summaryrefslogtreecommitdiff
path: root/doc/examples
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 /doc/examples
parent874390e163427c1fe7682ab27924a7843780dbb3 (diff)
Use av_packet_rescale_ts() to simplify code.
Diffstat (limited to 'doc/examples')
-rw-r--r--doc/examples/output.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/doc/examples/output.c b/doc/examples/output.c
index dd0e6a224e..0239791e3d 100644
--- a/doc/examples/output.c
+++ b/doc/examples/output.c
@@ -362,14 +362,7 @@ static void write_video_frame(AVFormatContext *oc, AVStream *st)
ret = avcodec_encode_video2(c, &pkt, picture, &got_packet);
/* If size is zero, it means the image was buffered. */
if (!ret && got_packet && pkt.size) {
- if (pkt.pts != AV_NOPTS_VALUE) {
- pkt.pts = av_rescale_q(pkt.pts,
- c->time_base, st->time_base);
- }
- if (pkt.dts != AV_NOPTS_VALUE) {
- pkt.dts = av_rescale_q(pkt.dts,
- c->time_base, st->time_base);
- }
+ av_packet_rescale_ts(&pkt, c->time_base, st->time_base);
pkt.stream_index = st->index;
/* Write the compressed frame to the media file. */