Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avformat/avformat: Make AVFMT_FLAG_ID3V2_AUTO private (PR #20419)
@ 2025-09-03 18:51 mkver via ffmpeg-devel
  0 siblings, 0 replies; only message in thread
From: mkver via ffmpeg-devel @ 2025-09-03 18:51 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: mkver

PR #20419 opened by mkver
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20419
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20419.patch

It has been pushed just now (without version bump and APIchanges entry...), so it can be made private without deprecation.


>From f5cc1af53ab04c3ccf8786983c7b5ab69398b742 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Wed, 3 Sep 2025 20:38:48 +0200
Subject: [PATCH 1/3] avformat/avformat: Make AVFMT_FLAG_ID3V2_AUTO private

This flag governs whether avformat_open_input() reads
ID3v2 tags generically; some demuxers without this flag
read these tags themselves in a non-generic way,
e.g. oma. This makes this flag an implementation detail
that should not be exposed to the user, i.e. an internal flag.

Given that 9d037c54f209958d47ac376d2a9561608f98dfae
did not bump version and added no APIchanges entry
I deemded it inappropriate to bump version or add
an APIchanges entry for the removal of AVFMT_FLAG_ID3V2_AUTO.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/aacdec.c   | 3 ++-
 libavformat/avformat.h | 1 -
 libavformat/demux.c    | 2 +-
 libavformat/demux.h    | 5 +++++
 libavformat/mp3dec.c   | 3 ++-
 libavformat/tta.c      | 2 +-
 libavformat/wavdec.c   | 3 ++-
 7 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c
index 21d63ce189..38ac9dcbe7 100644
--- a/libavformat/aacdec.c
+++ b/libavformat/aacdec.c
@@ -208,9 +208,10 @@ retry:
 const FFInputFormat ff_aac_demuxer = {
     .p.name       = "aac",
     .p.long_name  = NULL_IF_CONFIG_SMALL("raw ADTS AAC (Advanced Audio Coding)"),
-    .p.flags      = AVFMT_GENERIC_INDEX | AVFMT_FLAG_ID3V2_AUTO,
+    .p.flags      = AVFMT_GENERIC_INDEX,
     .p.extensions = "aac",
     .p.mime_type  = "audio/aac,audio/aacp,audio/x-aac",
+    .flags_internal = FF_INFMT_FLAG_ID3V2_AUTO,
     .read_probe   = adts_aac_probe,
     .read_header  = adts_aac_read_header,
     .read_packet  = adts_aac_read_packet,
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 75c8a4703b..be6e532387 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1435,7 +1435,6 @@ typedef struct AVFormatContext {
 #define AVFMT_FLAG_SORT_DTS    0x10000 ///< try to interleave outputted packets by dts (using this flag can slow demuxing down)
 #define AVFMT_FLAG_FAST_SEEK   0x80000 ///< Enable fast, but inaccurate seeks for some formats
 #define AVFMT_FLAG_AUTO_BSF   0x200000 ///< Add bitstream filters as requested by the muxer
-#define AVFMT_FLAG_ID3V2_AUTO 0x400000 ///< Automatically parse ID3v2 metadata
 
     /**
      * Maximum number of bytes read from input in order to determine stream
diff --git a/libavformat/demux.c b/libavformat/demux.c
index dfc146d9c4..14776bc02f 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -215,7 +215,7 @@ static int update_stream_avctx(AVFormatContext *s)
 }
 
 static av_always_inline int is_id3v2_format(const AVInputFormat *fmt) {
-    return fmt->flags & AVFMT_FLAG_ID3V2_AUTO;
+    return ffifmt(fmt)->flags_internal & FF_INFMT_FLAG_ID3V2_AUTO;
 }
 
 int avformat_open_input(AVFormatContext **ps, const char *filename,
diff --git a/libavformat/demux.h b/libavformat/demux.h
index 7c22c870e2..ab1c001c9f 100644
--- a/libavformat/demux.h
+++ b/libavformat/demux.h
@@ -39,6 +39,11 @@ struct AVDeviceInfoList;
  */
 #define FF_INFMT_FLAG_PREFER_CODEC_FRAMERATE                   (1 << 1)
 
+/**
+ * Automatically parse ID3v2 metadata
+ */
+#define FF_INFMT_FLAG_ID3V2_AUTO                               (1 << 2)
+
 typedef struct FFInputFormat {
     /**
      * The public AVInputFormat. See avformat.h for it.
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 9cfc711493..5b153c7c9e 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -618,10 +618,11 @@ static const AVClass demuxer_class = {
 const FFInputFormat ff_mp3_demuxer = {
     .p.name         = "mp3",
     .p.long_name    = NULL_IF_CONFIG_SMALL("MP2/3 (MPEG audio layer 2/3)"),
-    .p.flags        = AVFMT_GENERIC_INDEX | AVFMT_FLAG_ID3V2_AUTO,
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .p.extensions   = "mp2,mp3,m2a,mpa", /* XXX: use probe */
     .p.priv_class   = &demuxer_class,
     .p.mime_type    = "audio/mpeg",
+    .flags_internal = FF_INFMT_FLAG_ID3V2_AUTO,
     .read_probe     = mp3_read_probe,
     .read_header    = mp3_read_header,
     .read_packet    = mp3_read_packet,
diff --git a/libavformat/tta.c b/libavformat/tta.c
index 26335202c7..70642324af 100644
--- a/libavformat/tta.c
+++ b/libavformat/tta.c
@@ -191,9 +191,9 @@ static int tta_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
 const FFInputFormat ff_tta_demuxer = {
     .p.name         = "tta",
     .p.long_name    = NULL_IF_CONFIG_SMALL("TTA (True Audio)"),
-    .p.flags        = AVFMT_FLAG_ID3V2_AUTO,
     .p.extensions   = "tta",
     .priv_data_size = sizeof(TTAContext),
+    .flags_internal = FF_INFMT_FLAG_ID3V2_AUTO,
     .read_probe     = tta_probe,
     .read_header    = tta_read_header,
     .read_packet    = tta_read_packet,
diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 4c47a5f05c..7d701c517a 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -1011,10 +1011,11 @@ static const AVClass w64_demuxer_class = {
 const FFInputFormat ff_w64_demuxer = {
     .p.name         = "w64",
     .p.long_name    = NULL_IF_CONFIG_SMALL("Sony Wave64"),
-    .p.flags        = AVFMT_GENERIC_INDEX | AVFMT_FLAG_ID3V2_AUTO,
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .p.codec_tag    = ff_wav_codec_tags_list,
     .p.priv_class   = &w64_demuxer_class,
     .priv_data_size = sizeof(WAVDemuxContext),
+    .flags_internal = FF_INFMT_FLAG_ID3V2_AUTO,
     .read_probe     = w64_probe,
     .read_header    = w64_read_header,
     .read_packet    = wav_read_packet,
-- 
2.49.1


>From 86903255e83678d3c8bb4ad0a61d5599d3f0b9a7 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Wed, 3 Sep 2025 20:46:28 +0200
Subject: [PATCH 2/3] avformat/demux: Avoid always-true branch

Since 9d037c54f209958d47ac376d2a9561608f98dfae id3v2_extra_meta
can only be != NULL if the input format wants ID3v2 tags to be
read generically.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/demux.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index 14776bc02f..6ced69a99b 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -325,15 +325,12 @@ int avformat_open_input(AVFormatContext **ps, const char *filename,
     }
 
     if (id3v2_extra_meta) {
-        if (is_id3v2_format(s->iformat)) {
             if ((ret = ff_id3v2_parse_apic(s, id3v2_extra_meta)) < 0)
                 goto close;
             if ((ret = ff_id3v2_parse_chapters(s, id3v2_extra_meta)) < 0)
                 goto close;
             if ((ret = ff_id3v2_parse_priv(s, id3v2_extra_meta)) < 0)
                 goto close;
-        } else
-            av_log(s, AV_LOG_DEBUG, "demuxer does not support additional id3 data, skipping\n");
         ff_id3v2_free_extra_meta(&id3v2_extra_meta);
     }
 
-- 
2.49.1


>From beb71bb71d6fc2ea10bcba26f969683cd9ab5990 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Wed, 3 Sep 2025 20:48:07 +0200
Subject: [PATCH 3/3] avformat/demux: Reindent after the previous commit

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/demux.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index 6ced69a99b..cc0d57ae97 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -325,12 +325,12 @@ int avformat_open_input(AVFormatContext **ps, const char *filename,
     }
 
     if (id3v2_extra_meta) {
-            if ((ret = ff_id3v2_parse_apic(s, id3v2_extra_meta)) < 0)
-                goto close;
-            if ((ret = ff_id3v2_parse_chapters(s, id3v2_extra_meta)) < 0)
-                goto close;
-            if ((ret = ff_id3v2_parse_priv(s, id3v2_extra_meta)) < 0)
-                goto close;
+        if ((ret = ff_id3v2_parse_apic(s, id3v2_extra_meta)) < 0)
+            goto close;
+        if ((ret = ff_id3v2_parse_chapters(s, id3v2_extra_meta)) < 0)
+            goto close;
+        if ((ret = ff_id3v2_parse_priv(s, id3v2_extra_meta)) < 0)
+            goto close;
         ff_id3v2_free_extra_meta(&id3v2_extra_meta);
     }
 
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-09-03 18:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-03 18:51 [FFmpeg-devel] [PATCH] avformat/avformat: Make AVFMT_FLAG_ID3V2_AUTO private (PR #20419) mkver via ffmpeg-devel

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