diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2012-03-22 20:17:42 +0100 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2012-03-22 20:36:16 +0100 |
commit | ffa28da180113b53bcb32ed38e913ad27c0cde24 (patch) | |
tree | b00f8480d8bacccb99ce1c1495f1496a3ca40e6b | |
parent | 179a592094b070e2069a2c194c2c659b0516a9f5 (diff) | |
download | ffmpeg-ffa28da180113b53bcb32ed38e913ad27c0cde24.tar.gz |
Support dropping audio dts/pts via -async -1.
Allows working around issue #605.
Note: as a side effect this fixes that -vsync drop
as far as I could tell would not drop pts/dts values
when duplicating frames or when flushing encoder delay.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
-rw-r--r-- | ffmpeg.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -999,6 +999,10 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) AVCodecContext *avctx = ost->st->codec; int ret; + if ((avctx->codec_type == AVMEDIA_TYPE_VIDEO && video_sync_method == VSYNC_DROP) || + (avctx->codec_type == AVMEDIA_TYPE_AUDIO && audio_sync_method < 0)) + pkt->pts = pkt->dts = AV_NOPTS_VALUE; + /* * Audio encoders may split the packets -- #frames in != #packets out. * But there is no reordering, so we can limit the number of output packets @@ -1227,7 +1231,7 @@ need_realloc: av_assert0(ost->audio_resample || dec->sample_fmt==enc->sample_fmt); - if (audio_sync_method) { + if (audio_sync_method > 0) { double delta = get_sync_ipts(ost, ist->pts) * enc->sample_rate - ost->sync_opts - av_fifo_size(ost->fifo) / (enc->channels * osize); int idelta = delta * dec->sample_rate / enc->sample_rate; @@ -1652,9 +1656,6 @@ static void do_video_out(AVFormatContext *s, OutputStream *ost, av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ost->st->time_base)); } - if (format_video_sync == VSYNC_DROP) - pkt.pts = pkt.dts = AV_NOPTS_VALUE; - write_frame(s, &pkt, ost); frame_size = pkt.size; video_size += pkt.size; |