summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-27 03:18:09 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-27 04:01:31 +0200
commit1909dbf11da01f4493d9183622ef9feb3632257e (patch)
treebd0ed38590bf7c8046e099bba35e3db052c7bf54 /ffmpeg.c
parent2bcbdd84569037c3dd9011246691ccb50368fc18 (diff)
ffmpeg: use av_rescale_delta() for audio stream copy
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index f2d0b67c09..37b6311100 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1360,6 +1360,15 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, ost->st->time_base);
opkt.dts -= ost_tb_start_time;
+ if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && pkt->dts != AV_NOPTS_VALUE) {
+ int duration = av_get_audio_frame_duration(ist->st->codec, pkt->size);
+ if(!duration)
+ duration = ist->st->codec->frame_size;
+ opkt.dts = opkt.pts = av_rescale_delta(ist->st->time_base, pkt->dts,
+ (AVRational){1, ist->st->codec->sample_rate}, duration, &ist->filter_in_rescale_delta_last,
+ ost->st->time_base);
+ }
+
opkt.duration = av_rescale_q(pkt->duration, ist->st->time_base, ost->st->time_base);
opkt.flags = pkt->flags;