diff mbox series

[FFmpeg-devel,12/20] fftools/ffmpeg_mux_init: avoid modifying OptionsContext.chapters_input_file

Message ID 20221018123701.25002-12-anton@khirnov.net
State Accepted
Commit aa0ce91f57358ec94f3b0150f8033b882fca90d2
Headers show
Series [FFmpeg-devel,01/20] fftools/ffmpeg_opt: move opening input files to ffmpeg_demux.c | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Oct. 18, 2022, 12:36 p.m. UTC
Use a local variable instead. This will allow making OptionsContext
const in future commits.
---
 fftools/ffmpeg_mux_init.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index cd46f441cf..f608376cf0 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -1537,6 +1537,7 @@  static void copy_meta(Muxer *mux, OptionsContext *o)
 {
     OutputFile      *of = &mux->of;
     AVFormatContext *oc = mux->fc;
+    int chapters_input_file = o->chapters_input_file;
 
     /* copy metadata */
     for (int i = 0; i < o->nb_metadata_map; i++) {
@@ -1553,23 +1554,23 @@  static void copy_meta(Muxer *mux, OptionsContext *o)
     }
 
     /* copy chapters */
-    if (o->chapters_input_file >= nb_input_files) {
-        if (o->chapters_input_file == INT_MAX) {
+    if (chapters_input_file >= nb_input_files) {
+        if (chapters_input_file == INT_MAX) {
             /* copy chapters from the first input file that has them*/
-            o->chapters_input_file = -1;
+            chapters_input_file = -1;
             for (int i = 0; i < nb_input_files; i++)
                 if (input_files[i]->ctx->nb_chapters) {
-                    o->chapters_input_file = i;
+                    chapters_input_file = i;
                     break;
                 }
         } else {
             av_log(NULL, AV_LOG_FATAL, "Invalid input file index %d in chapter mapping.\n",
-                   o->chapters_input_file);
+                   chapters_input_file);
             exit_program(1);
         }
     }
-    if (o->chapters_input_file >= 0)
-        copy_chapters(input_files[o->chapters_input_file], of, oc,
+    if (chapters_input_file >= 0)
+        copy_chapters(input_files[chapters_input_file], of, oc,
                       !o->metadata_chapters_manual);
 
     /* copy global metadata by default */