[FFmpeg-devel] [PATCH] avformat/demux: Use av_opt_set_int() where appropriate

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Fri Sep 17 18:44:56 EEST 2021


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
I find it odd that the previous values are not restored, but
rather overwritten with the default value of said option.

 libavformat/demux.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index 714146039f..d7393d5b46 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -1733,7 +1733,7 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
         goto skip_duration_calc;
     }
 
-    av_opt_set(ic, "skip_changes", "1", AV_OPT_SEARCH_CHILDREN);
+    av_opt_set_int(ic, "skip_changes", 1, AV_OPT_SEARCH_CHILDREN);
     /* estimate the end time (duration) */
     /* XXX: may need to support wrapping */
     filesize = ic->pb ? avio_size(ic->pb) : 0;
@@ -1804,7 +1804,7 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
              offset &&
              ++retry <= DURATION_MAX_RETRY);
 
-    av_opt_set(ic, "skip_changes", "0", AV_OPT_SEARCH_CHILDREN);
+    av_opt_set_int(ic, "skip_changes", 0, AV_OPT_SEARCH_CHILDREN);
 
     /* warn about audio/video streams which duration could not be estimated */
     for (unsigned i = 0; i < ic->nb_streams; i++) {
@@ -2412,7 +2412,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
 
     flush_codecs = probesize > 0;
 
-    av_opt_set(ic, "skip_clear", "1", AV_OPT_SEARCH_CHILDREN);
+    av_opt_set_int(ic, "skip_clear", 1, AV_OPT_SEARCH_CHILDREN);
 
     max_stream_analyze_duration = max_analyze_duration;
     max_subtitle_analyze_duration = max_analyze_duration;
@@ -2884,7 +2884,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
     if (probesize)
         estimate_timings(ic, old_offset);
 
-    av_opt_set(ic, "skip_clear", "0", AV_OPT_SEARCH_CHILDREN);
+    av_opt_set_int(ic, "skip_clear", 0, AV_OPT_SEARCH_CHILDREN);
 
     if (ret >= 0 && ic->nb_streams)
         /* We could not have all the codec parameters before EOF. */
-- 
2.30.2



More information about the ffmpeg-devel mailing list