diff mbox series

[FFmpeg-devel,01/13] avformat/mp3enc: Improve query_codec

Message ID AS8P250MB07447D5624C9B5EA91D18ED18F332@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit eb3ee7f141d33e2133697919ee91352cfad388b0
Headers show
Series [FFmpeg-devel,01/13] avformat/mp3enc: Improve query_codec | 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

Andreas Rheinhardt March 20, 2024, 2:07 a.m. UTC
Signal that anything except MP3 and the ID3V2 attached pic types
are forbidden.

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

Comments

Andreas Rheinhardt March 22, 2024, 12:13 p.m. UTC | #1
Andreas Rheinhardt:
> Signal that anything except MP3 and the ID3V2 attached pic types
> are forbidden.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavformat/mp3enc.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
> index cb250a46ca..4a02a45069 100644
> --- a/libavformat/mp3enc.c
> +++ b/libavformat/mp3enc.c
> @@ -495,12 +495,16 @@ static int mp3_write_trailer(struct AVFormatContext *s)
>  static int query_codec(enum AVCodecID id, int std_compliance)
>  {
>      const CodecMime *cm= ff_id3v2_mime_tags;
> +
> +    if (id == AV_CODEC_ID_MP3)
> +        return 1;
> +
>      while(cm->id != AV_CODEC_ID_NONE) {
>          if(id == cm->id)
>              return MKTAG('A', 'P', 'I', 'C');
>          cm++;
>      }
> -    return -1;
> +    return 0;
>  }
>  
>  static const AVOption options[] = {

Will apply this patchset tomorrow unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index cb250a46ca..4a02a45069 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -495,12 +495,16 @@  static int mp3_write_trailer(struct AVFormatContext *s)
 static int query_codec(enum AVCodecID id, int std_compliance)
 {
     const CodecMime *cm= ff_id3v2_mime_tags;
+
+    if (id == AV_CODEC_ID_MP3)
+        return 1;
+
     while(cm->id != AV_CODEC_ID_NONE) {
         if(id == cm->id)
             return MKTAG('A', 'P', 'I', 'C');
         cm++;
     }
-    return -1;
+    return 0;
 }
 
 static const AVOption options[] = {