From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 4EA8043E81 for ; Tue, 18 Oct 2022 12:39:16 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 77BE968BD7A; Tue, 18 Oct 2022 15:38:28 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D488E68BD18 for ; Tue, 18 Oct 2022 15:38:20 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 340822406CD for ; Tue, 18 Oct 2022 14:38:19 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id aq41cAAMRAG5 for ; Tue, 18 Oct 2022 14:38:18 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id B64C72406CC for ; Tue, 18 Oct 2022 14:38:13 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id D31213A1A7C for ; Tue, 18 Oct 2022 14:38:13 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 18 Oct 2022 14:36:56 +0200 Message-Id: <20221018123701.25002-15-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221018123701.25002-1-anton@khirnov.net> References: <20221018123701.25002-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 15/20] fftools/ffmpeg_mux_init: stop using OptionsContext as storage in copy_metadata() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: It should be input-only to this code. Will allow making it const in future commits. --- fftools/ffmpeg.h | 3 --- fftools/ffmpeg_mux_init.c | 24 ++++++++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index a124b1b045..8a50cd8d4b 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -148,9 +148,6 @@ typedef struct OptionsContext { AudioChannelMap *audio_channel_maps; /* one info entry per -map_channel */ int nb_audio_channel_maps; /* number of (valid) -map_channel settings */ #endif - int metadata_global_manual; - int metadata_streams_manual; - int metadata_chapters_manual; const char **attachments; int nb_attachments; diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c index 9e0164ba19..96584e960b 100644 --- a/fftools/ffmpeg_mux_init.c +++ b/fftools/ffmpeg_mux_init.c @@ -1443,7 +1443,10 @@ static int copy_chapters(InputFile *ifile, OutputFile *ofile, AVFormatContext *o return 0; } -static int copy_metadata(const char *outspec, const char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o) +static int copy_metadata(const char *outspec, const char *inspec, + AVFormatContext *oc, AVFormatContext *ic, + int *metadata_global_manual, int *metadata_streams_manual, + int *metadata_chapters_manual, OptionsContext *o) { AVDictionary **meta_in = NULL; AVDictionary **meta_out = NULL; @@ -1456,11 +1459,11 @@ static int copy_metadata(const char *outspec, const char *inspec, AVFormatContex parse_meta_type(outspec, &type_out, &idx_out, &ostream_spec); if (type_in == 'g' || type_out == 'g') - o->metadata_global_manual = 1; + *metadata_global_manual = 1; if (type_in == 's' || type_out == 's') - o->metadata_streams_manual = 1; + *metadata_streams_manual = 1; if (type_in == 'c' || type_out == 'c') - o->metadata_chapters_manual = 1; + *metadata_chapters_manual = 1; /* ic is NULL when just disabling automatic mappings */ if (!ic) @@ -1528,6 +1531,9 @@ static void copy_meta(Muxer *mux, OptionsContext *o) OutputFile *of = &mux->of; AVFormatContext *oc = mux->fc; int chapters_input_file = o->chapters_input_file; + int metadata_global_manual = 0; + int metadata_streams_manual = 0; + int metadata_chapters_manual = 0; /* copy metadata */ for (int i = 0; i < o->nb_metadata_map; i++) { @@ -1540,7 +1546,9 @@ static void copy_meta(Muxer *mux, OptionsContext *o) } copy_metadata(o->metadata_map[i].specifier, *p ? p + 1 : p, oc, in_file_index >= 0 ? - input_files[in_file_index]->ctx : NULL, o); + input_files[in_file_index]->ctx : NULL, + &metadata_global_manual, &metadata_streams_manual, + &metadata_chapters_manual, o); } /* copy chapters */ @@ -1561,10 +1569,10 @@ static void copy_meta(Muxer *mux, OptionsContext *o) } if (chapters_input_file >= 0) copy_chapters(input_files[chapters_input_file], of, oc, - !o->metadata_chapters_manual); + !metadata_chapters_manual); /* copy global metadata by default */ - if (!o->metadata_global_manual && nb_input_files){ + if (!metadata_global_manual && nb_input_files){ av_dict_copy(&oc->metadata, input_files[0]->ctx->metadata, AV_DICT_DONT_OVERWRITE); if(o->recording_time != INT64_MAX) @@ -1574,7 +1582,7 @@ static void copy_meta(Muxer *mux, OptionsContext *o) av_dict_set(&oc->metadata, "product_name", NULL, 0); av_dict_set(&oc->metadata, "product_version", NULL, 0); } - if (!o->metadata_streams_manual) + if (!metadata_streams_manual) for (int i = 0; i < of->nb_streams; i++) { OutputStream *ost = of->streams[i]; InputStream *ist; -- 2.35.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".