[FFmpeg-cvslog] fftools/ffmpeg: move ts_scale to DemuxStream

Anton Khirnov git at videolan.org
Mon Feb 20 20:28:54 EET 2023


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Feb 11 08:17:55 2023 +0100| [156ca865697fcad6332ea75f4d97f12135975ac5] | committer: Anton Khirnov

fftools/ffmpeg: move ts_scale to DemuxStream

It is not needed outside of ffmpeg_demux.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=156ca865697fcad6332ea75f4d97f12135975ac5
---

 fftools/ffmpeg.h       |  1 -
 fftools/ffmpeg_demux.c | 10 ++++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 401f424f79..4d4433f5ba 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -385,7 +385,6 @@ typedef struct InputStream {
 
     int64_t nb_samples; /* number of samples in the last decoded audio frame before looping */
 
-    double ts_scale;
     int saw_first_ts;
     AVDictionary *decoder_opts;
     AVRational framerate;               /* framerate forced with -r */
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c
index f2a1391a29..2033c1de54 100644
--- a/fftools/ffmpeg_demux.c
+++ b/fftools/ffmpeg_demux.c
@@ -58,6 +58,8 @@ typedef struct DemuxStream {
     // name used for logging
     char log_name[32];
 
+    double ts_scale;
+
     int64_t min_pts; /* pts with the smallest value in a current stream */
     int64_t max_pts; /* pts with the higher value in a current stream */
 } DemuxStream;
@@ -225,9 +227,9 @@ static void ts_fixup(Demuxer *d, AVPacket *pkt, int *repeat_pict)
         pkt->pts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
 
     if (pkt->pts != AV_NOPTS_VALUE)
-        pkt->pts *= ist->ts_scale;
+        pkt->pts *= ds->ts_scale;
     if (pkt->dts != AV_NOPTS_VALUE)
-        pkt->dts *= ist->ts_scale;
+        pkt->dts *= ds->ts_scale;
 
     duration = av_rescale_q(d->duration, d->time_base, ist->st->time_base);
     if (pkt->pts != AV_NOPTS_VALUE) {
@@ -670,8 +672,8 @@ static void add_input_streams(const OptionsContext *o, Demuxer *d)
         ds->min_pts = INT64_MAX;
         ds->max_pts = INT64_MIN;
 
-        ist->ts_scale = 1.0;
-        MATCH_PER_STREAM_OPT(ts_scale, dbl, ist->ts_scale, ic, st);
+        ds->ts_scale = 1.0;
+        MATCH_PER_STREAM_OPT(ts_scale, dbl, ds->ts_scale, ic, st);
 
         ist->autorotate = 1;
         MATCH_PER_STREAM_OPT(autorotate, i, ist->autorotate, ic, st);



More information about the ffmpeg-cvslog mailing list