diff mbox

[FFmpeg-devel] avformat: fix ID3v2 parser for v2.2 comment frames

Message ID 20170127212031.9580-2-kode54@gmail.com
State Accepted
Commit ecd360041ea7f206e42736f046a3ecb9984e0763
Headers show

Commit Message

kode54@gmail.com Jan. 27, 2017, 9:20 p.m. UTC
From: Chris Moeller <kode54@gmail.com>

---
 libavformat/id3v2.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer Jan. 28, 2017, 12:34 p.m. UTC | #1
On Fri, Jan 27, 2017 at 01:20:31PM -0800, Christopher Snowhill wrote:
> From: Chris Moeller <kode54@gmail.com>
> 
> ---
>  libavformat/id3v2.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)

applied

thanks

[...]
diff mbox

Patch

diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 9969d7a..f7fa3ef 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -823,6 +823,7 @@  static void id3v2_parse(AVIOContext *pb, AVDictionary **metadata,
     const ID3v2EMFunc *extra_func = NULL;
     unsigned char *uncompressed_buffer = NULL;
     av_unused int uncompressed_buffer_size = 0;
+    const char *comm_frame;
 
     av_log(s, AV_LOG_DEBUG, "id3v2 ver:%d flags:%02X len:%d\n", version, flags, len);
 
@@ -834,12 +835,14 @@  static void id3v2_parse(AVIOContext *pb, AVDictionary **metadata,
         }
         isv34     = 0;
         taghdrlen = 6;
+        comm_frame = "COM";
         break;
 
     case 3:
     case 4:
         isv34     = 1;
         taghdrlen = 10;
+        comm_frame = "COMM";
         break;
 
     default:
@@ -950,7 +953,7 @@  static void id3v2_parse(AVIOContext *pb, AVDictionary **metadata,
         /* check for text tag or supported special meta tag */
         } else if (tag[0] == 'T' ||
                    !memcmp(tag, "USLT", 4) ||
-                   !memcmp(tag, "COMM", 4) ||
+                   !strcmp(tag, comm_frame) ||
                    (extra_meta &&
                     (extra_func = get_extra_meta_func(tag, isv34)))) {
             pbx = pb;
@@ -1018,7 +1021,7 @@  static void id3v2_parse(AVIOContext *pb, AVDictionary **metadata,
                 read_ttag(s, pbx, tlen, metadata, tag);
             else if (!memcmp(tag, "USLT", 4))
                 read_uslt(s, pbx, tlen, metadata);
-            else if (!memcmp(tag, "COMM", 4))
+            else if (!strcmp(tag, comm_frame))
                 read_comment(s, pbx, tlen, metadata);
             else
                 /* parse special meta tag */