[FFmpeg-cvslog] avformat/mp3dec: replace SAME_HEADER_MASK with MP3_MASK

Limin Wang git at videolan.org
Mon Nov 11 21:18:40 EET 2019


ffmpeg | branch: master | Limin Wang <lance.lmwang at gmail.com> | Mon Nov 11 09:05:02 2019 +0800| [72915ca8ba66f96717838439ee13cb3f70f9863f] | committer: Michael Niedermayer

avformat/mp3dec: replace SAME_HEADER_MASK with MP3_MASK

mp3 header bitstream syntax:
header()
{
    syncword   12bits bslsf
    id         1bit    bslsf
    layer      2bit    bslsf
    protection_bit 1bit bslsf
    bitrate_index 4bits bslsf
    sampling_frequency 2bits bslsf
    padding_bit  1bit bslsf
    private_bit 1bit bslsf
    mode 2bits bslsf
    mode_extension 2bits bslsf
    copyright 1bit bslsf
    original/home 1bit bslsf
    emphasis 2bits bslsf
}

if the header is masking with MP3_MASK(0xFFFE0CCF), below fields will be cleared:
protection_bit, bitrate_index, sampling_freqency, mode

with SAME_HEADER_MASK(0xFFFE0C00), extra below fields will be cleared which didn't make
sense:
mode_extension, copyright, original/home, emphasis

As the MP3_MASK is good for same mp3 header masking and is defined in the
header, so it's preferable to remove SAME_HEADER_MASK to keep the masking same.

Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=72915ca8ba66f96717838439ee13cb3f70f9863f
---

 libavformat/mp3dec.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index dd14174e07..6888c88f83 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -42,8 +42,6 @@
 
 #define XING_TOC_COUNT 100
 
-#define SAME_HEADER_MASK \
-   (0xffe00000 | (3 << 17) | (3 << 10) | (3 << 19))
 
 typedef struct {
     AVClass *class;
@@ -398,7 +396,7 @@ static int mp3_read_header(AVFormatContext *s)
             ffio_ensure_seekback(s->pb, i + 1024 + frame_size + 4);
             ret = check(s->pb, off + i + frame_size, &header2);
             if (ret >= 0 &&
-                (header & SAME_HEADER_MASK) == (header2 & SAME_HEADER_MASK))
+                (header & MP3_MASK) == (header2 & MP3_MASK))
             {
                 av_log(s, i > 0 ? AV_LOG_INFO : AV_LOG_VERBOSE, "Skipping %d bytes of junk at %"PRId64".\n", i, off);
                 ret = avio_seek(s->pb, off + i, SEEK_SET);



More information about the ffmpeg-cvslog mailing list