aboutsummaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer2014-06-20 17:03:58 +0200
committerMichael Niedermayer2014-06-20 17:03:58 +0200
commitafa7ab557a801d54a4c3dbab38350f858efbbd5f (patch)
treed9bb2f47c96a4caecd7beb862c7eac92a2ccfff5 /ffmpeg.c
parent4a993335812f7e9b2088145c7d043c01019c5d04 (diff)
parent452860d7e056f9a894cac2fe52cdedeae4c38251 (diff)
Merge commit '452860d7e056f9a894cac2fe52cdedeae4c38251'
* commit '452860d7e056f9a894cac2fe52cdedeae4c38251': Use av_packet_rescale_ts() to simplify code. Conflicts: doc/examples/muxing.c ffmpeg.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 099620baba..1af3e0e5f9 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -755,12 +755,7 @@ static void do_audio_out(AVFormatContext *s, OutputStream *ost,
update_benchmark("encode_audio %d.%d", ost->file_index, ost->index);
if (got_packet) {
- if (pkt.pts != AV_NOPTS_VALUE)
- pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base);
- if (pkt.dts != AV_NOPTS_VALUE)
- pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base);
- if (pkt.duration > 0)
- pkt.duration = av_rescale_q(pkt.duration, enc->time_base, ost->st->time_base);
+ av_packet_rescale_ts(&pkt, enc->time_base, ost->st->time_base);
if (debug_ts) {
av_log(NULL, AV_LOG_INFO, "encoder -> type:audio "
@@ -1052,10 +1047,7 @@ static void do_video_out(AVFormatContext *s,
if (pkt.pts == AV_NOPTS_VALUE && !(enc->codec->capabilities & CODEC_CAP_DELAY))
pkt.pts = ost->sync_opts;
- if (pkt.pts != AV_NOPTS_VALUE)
- pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base);
- if (pkt.dts != AV_NOPTS_VALUE)
- pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base);
+ av_packet_rescale_ts(&pkt, enc->time_base, ost->st->time_base);
if (debug_ts) {
av_log(NULL, AV_LOG_INFO, "encoder -> type:video "
@@ -1564,12 +1556,7 @@ static void flush_encoders(void)
av_free_packet(&pkt);
continue;
}
- if (pkt.pts != AV_NOPTS_VALUE)
- pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base);
- if (pkt.dts != AV_NOPTS_VALUE)
- pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base);
- if (pkt.duration > 0)
- pkt.duration = av_rescale_q(pkt.duration, enc->time_base, ost->st->time_base);
+ av_packet_rescale_ts(&pkt, enc->time_base, ost->st->time_base);
pkt_size = pkt.size;
write_frame(os, &pkt, ost);
if (ost->enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO && vstats_filename) {