summaryrefslogtreecommitdiff
path: root/avconv.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2014-06-18 09:43:27 +0200
committerAnton Khirnov <anton@khirnov.net>2014-06-20 14:14:48 +0200
commit452860d7e056f9a894cac2fe52cdedeae4c38251 (patch)
treea994d3978e73b4ce695ac85304e9d0a895dd5412 /avconv.c
parent874390e163427c1fe7682ab27924a7843780dbb3 (diff)
Use av_packet_rescale_ts() to simplify code.
Diffstat (limited to 'avconv.c')
-rw-r--r--avconv.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/avconv.c b/avconv.c
index b29f2006a7..13968da4f9 100644
--- a/avconv.c
+++ b/avconv.c
@@ -428,13 +428,7 @@ static void do_audio_out(AVFormatContext *s, OutputStream *ost,
}
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);
write_frame(s, &pkt, ost);
}
}
@@ -587,11 +581,7 @@ static void do_video_out(AVFormatContext *s,
}
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);
-
+ av_packet_rescale_ts(&pkt, enc->time_base, ost->st->time_base);
write_frame(s, &pkt, ost);
*frame_size = pkt.size;
@@ -1044,12 +1034,7 @@ static void flush_encoders(void)
stop_encoding = 1;
break;
}
- 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);
write_frame(os, &pkt, ost);
}