From bcaf94e7f9a10925a86b8f7e03e5e184550ae9f5 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 24 Mar 2018 18:02:59 +0100 Subject: [PATCH] Simplify the timebase conversion in mux.cpp. --- mux.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mux.cpp b/mux.cpp index 5e9043e..e554ec5 100644 --- a/mux.cpp +++ b/mux.cpp @@ -154,13 +154,9 @@ void Mux::add_packet(const AVPacket &pkt, int64_t pts, int64_t dts, AVRational t exit(1); } if (pkt.stream_index == 0) { - pkt_copy.pts = av_rescale_q(pts, timebase, avstream_video->time_base); - pkt_copy.dts = av_rescale_q(dts, timebase, avstream_video->time_base); - pkt_copy.duration = av_rescale_q(pkt.duration, timebase, avstream_video->time_base); + av_packet_rescale_ts(&pkt_copy, timebase, avstream_video->time_base); } else if (pkt.stream_index == 1) { - pkt_copy.pts = av_rescale_q(pts, timebase, avstream_audio->time_base); - pkt_copy.dts = av_rescale_q(dts, timebase, avstream_audio->time_base); - pkt_copy.duration = av_rescale_q(pkt.duration, timebase, avstream_audio->time_base); + av_packet_rescale_ts(&pkt_copy, timebase, avstream_audio->time_base); } else { assert(false); } -- 2.39.2