mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
avformat/vivo: set packet duration
Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
parent
b4305d60f6
commit
a07b19d9af
@ -36,6 +36,7 @@ typedef struct VivoContext {
|
|||||||
int type;
|
int type;
|
||||||
int sequence;
|
int sequence;
|
||||||
int length;
|
int length;
|
||||||
|
int duration;
|
||||||
|
|
||||||
uint8_t text[1024 + 1];
|
uint8_t text[1024 + 1];
|
||||||
} VivoContext;
|
} VivoContext;
|
||||||
@ -237,6 +238,7 @@ static int vivo_read_header(AVFormatContext *s)
|
|||||||
ast->codecpar->bits_per_coded_sample = 16;
|
ast->codecpar->bits_per_coded_sample = 16;
|
||||||
ast->codecpar->block_align = 40;
|
ast->codecpar->block_align = 40;
|
||||||
ast->codecpar->bit_rate = 6400;
|
ast->codecpar->bit_rate = 6400;
|
||||||
|
vivo->duration = 320;
|
||||||
}
|
}
|
||||||
|
|
||||||
ast->start_time = 0;
|
ast->start_time = 0;
|
||||||
@ -252,7 +254,7 @@ static int vivo_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
VivoContext *vivo = s->priv_data;
|
VivoContext *vivo = s->priv_data;
|
||||||
AVIOContext *pb = s->pb;
|
AVIOContext *pb = s->pb;
|
||||||
unsigned old_sequence = vivo->sequence, old_type = vivo->type;
|
unsigned old_sequence = vivo->sequence, old_type = vivo->type;
|
||||||
int stream_index, ret = 0;
|
int stream_index, duration, ret = 0;
|
||||||
|
|
||||||
restart:
|
restart:
|
||||||
|
|
||||||
@ -268,10 +270,12 @@ restart:
|
|||||||
case 1:
|
case 1:
|
||||||
case 2: // video
|
case 2: // video
|
||||||
stream_index = 0;
|
stream_index = 0;
|
||||||
|
duration = 1;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
case 4: // audio
|
case 4: // audio
|
||||||
stream_index = 1;
|
stream_index = 1;
|
||||||
|
duration = vivo->duration;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
av_log(s, AV_LOG_ERROR, "unknown packet type %d\n", vivo->type);
|
av_log(s, AV_LOG_ERROR, "unknown packet type %d\n", vivo->type);
|
||||||
@ -300,6 +304,7 @@ restart:
|
|||||||
}
|
}
|
||||||
|
|
||||||
pkt->stream_index = stream_index;
|
pkt->stream_index = stream_index;
|
||||||
|
pkt->duration = duration;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user