Commit e806ceaa authored by Michael Niedermayer's avatar Michael Niedermayer

ffmpeg: Use the correct (dts) variables for stream copy.

Strongly based on Anton Khirnovs code.
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent f070bf08
...@@ -2297,18 +2297,18 @@ static int output_packet(InputStream *ist, ...@@ -2297,18 +2297,18 @@ static int output_packet(InputStream *ist,
/* handle stream copy */ /* handle stream copy */
if (!ist->decoding_needed) { if (!ist->decoding_needed) {
rate_emu_sleep(ist); rate_emu_sleep(ist);
ist->pts = ist->next_pts; ist->dts = ist->next_dts;
switch (ist->st->codec->codec_type) { switch (ist->st->codec->codec_type) {
case AVMEDIA_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
ist->next_pts += ((int64_t)AV_TIME_BASE * ist->st->codec->frame_size) / ist->next_dts += ((int64_t)AV_TIME_BASE * ist->st->codec->frame_size) /
ist->st->codec->sample_rate; ist->st->codec->sample_rate;
break; break;
case AVMEDIA_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
if (pkt->duration) { if (pkt->duration) {
ist->next_pts += av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q); ist->next_dts += av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q);
} else if(ist->st->codec->time_base.num != 0) { } else if(ist->st->codec->time_base.num != 0) {
int ticks= ist->st->parser ? ist->st->parser->repeat_pict + 1 : ist->st->codec->ticks_per_frame; int ticks= ist->st->parser ? ist->st->parser->repeat_pict + 1 : ist->st->codec->ticks_per_frame;
ist->next_pts += ((int64_t)AV_TIME_BASE * ist->next_dts += ((int64_t)AV_TIME_BASE *
ist->st->codec->time_base.num * ticks) / ist->st->codec->time_base.num * ticks) /
ist->st->codec->time_base.den; ist->st->codec->time_base.den;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment