From: Anton Khirnov <anton@khirnov.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 15/20] fftools/ffmpeg_mux_init: stop using OptionsContext as storage in copy_metadata()
Date: Tue, 18 Oct 2022 14:36:56 +0200
Message-ID: <20221018123701.25002-15-anton@khirnov.net> (raw)
In-Reply-To: <20221018123701.25002-1-anton@khirnov.net>
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".
next prev parent reply other threads:[~2022-10-18 12:39 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-18 12:36 [FFmpeg-devel] [PATCH 01/20] fftools/ffmpeg_opt: move opening input files to ffmpeg_demux.c Anton Khirnov
2022-10-18 12:36 ` [FFmpeg-devel] [PATCH 02/20] fftools/ffmpeg_demux: add demuxer private data Anton Khirnov
2022-10-18 12:36 ` [FFmpeg-devel] [PATCH 03/20] fftools/ffmpeg: drop init_input_threads() Anton Khirnov
2022-10-18 12:36 ` [FFmpeg-devel] [PATCH 04/20] fftools/ffmpeg: move closing the input file into a separate function Anton Khirnov
2022-10-18 12:36 ` [FFmpeg-devel] [PATCH 05/20] fftools/ffmpeg: drop free_input_threads() Anton Khirnov
2022-10-18 12:36 ` [FFmpeg-devel] [PATCH 06/20] fftools/ffmpeg: move threading fields from InputFile to Demuxer Anton Khirnov
2022-10-18 12:36 ` [FFmpeg-devel] [PATCH 07/20] fftools/ffmpeg: move duration/time_base " Anton Khirnov
2022-10-18 12:36 ` [FFmpeg-devel] [PATCH 08/20] fftools/ffmpeg_demux: do not log to the demuxer context Anton Khirnov
2022-10-18 12:36 ` [FFmpeg-devel] [PATCH 09/20] fftools/ffmpeg: move nb_streams_warn from InputFile to Demuxer Anton Khirnov
2022-10-18 12:36 ` [FFmpeg-devel] [PATCH 10/20] fftools/ffmpeg_demux: log when the demuxer thread terminates Anton Khirnov
2022-10-18 12:36 ` [FFmpeg-devel] [PATCH 11/20] fftools/ffmpeg: factor out copying metadata/chapters from of_open() Anton Khirnov
2022-10-18 12:36 ` [FFmpeg-devel] [PATCH 12/20] fftools/ffmpeg_mux_init: avoid modifying OptionsContext.chapters_input_file Anton Khirnov
2022-10-18 12:36 ` [FFmpeg-devel] [PATCH 13/20] fftools/ffmpeg_mux_init: constify metadata specifier arguments Anton Khirnov
2022-10-18 12:36 ` [FFmpeg-devel] [PATCH 14/20] fftools/ffmpeg_mux_init: drop a duplicated block in copy_metadata() Anton Khirnov
2022-10-18 21:51 ` Michael Niedermayer
2022-11-08 12:46 ` Anton Khirnov
2022-11-14 9:24 ` Anton Khirnov
2022-11-14 22:21 ` Michael Niedermayer
2022-10-18 12:36 ` Anton Khirnov [this message]
2022-10-18 12:36 ` [FFmpeg-devel] [PATCH 16/20] fftools/ffmpeg_mux_init: stop modifying some OptionsContext fields Anton Khirnov
2022-10-18 12:36 ` [FFmpeg-devel] [PATCH 17/20] fftools/ffmpeg_mux_init: move code creating streams into a new function Anton Khirnov
2022-10-18 12:36 ` [FFmpeg-devel] [PATCH 18/20] fftools/ffmpeg_mux_init: stop modifying OptionsContext.*_disable Anton Khirnov
2022-10-18 12:37 ` [FFmpeg-devel] [PATCH 19/20] fftools/ffmpeg_demux: stop modifying OptionsContext Anton Khirnov
2022-10-18 12:37 ` [FFmpeg-devel] [PATCH 20/20] fftools/ffmpeg_[de]mux: constify all uses of OptionsContext Anton Khirnov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221018123701.25002-15-anton@khirnov.net \
--to=anton@khirnov.net \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git