| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * ID3v2 header parser | 2  * ID3v2 header parser | 
| 3  * Copyright (c) 2003 Fabrice Bellard | 3  * Copyright (c) 2003 Fabrice Bellard | 
| 4  * | 4  * | 
| 5  * This file is part of FFmpeg. | 5  * This file is part of FFmpeg. | 
| 6  * | 6  * | 
| 7  * FFmpeg is free software; you can redistribute it and/or | 7  * FFmpeg is free software; you can redistribute it and/or | 
| 8  * modify it under the terms of the GNU Lesser General Public | 8  * modify it under the terms of the GNU Lesser General Public | 
| 9  * License as published by the Free Software Foundation; either | 9  * License as published by the Free Software Foundation; either | 
| 10  * version 2.1 of the License, or (at your option) any later version. | 10  * version 2.1 of the License, or (at your option) any later version. | 
| 11  * | 11  * | 
| 12  * FFmpeg is distributed in the hope that it will be useful, | 12  * FFmpeg is distributed in the hope that it will be useful, | 
| 13  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
| 15  * Lesser General Public License for more details. | 15  * Lesser General Public License for more details. | 
| 16  * | 16  * | 
| 17  * You should have received a copy of the GNU Lesser General Public | 17  * You should have received a copy of the GNU Lesser General Public | 
| 18  * License along with FFmpeg; if not, write to the Free Software | 18  * License along with FFmpeg; if not, write to the Free Software | 
| 19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 
| 20  */ | 20  */ | 
| 21 | 21 | 
| 22 #include "id3v2.h" | 22 #include "id3v2.h" | 
| 23 #include "id3v1.h" | 23 #include "id3v1.h" | 
| 24 #include "libavutil/avstring.h" | 24 #include "libavutil/avstring.h" | 
| 25 #include "libavutil/intreadwrite.h" | 25 #include "libavutil/intreadwrite.h" | 
|  | 26 #include "metadata.h" | 
| 26 | 27 | 
| 27 int ff_id3v2_match(const uint8_t *buf, const char * magic) | 28 int ff_id3v2_match(const uint8_t *buf, const char * magic) | 
| 28 { | 29 { | 
| 29     return  buf[0]         == magic[0] && | 30     return  buf[0]         == magic[0] && | 
| 30             buf[1]         == magic[1] && | 31             buf[1]         == magic[1] && | 
| 31             buf[2]         == magic[2] && | 32             buf[2]         == magic[2] && | 
| 32             buf[3]         != 0xff && | 33             buf[3]         != 0xff && | 
| 33             buf[4]         != 0xff && | 34             buf[4]         != 0xff && | 
| 34            (buf[6] & 0x80) ==    0 && | 35            (buf[6] & 0x80) ==    0 && | 
| 35            (buf[7] & 0x80) ==    0 && | 36            (buf[7] & 0x80) ==    0 && | 
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 242         } | 243         } | 
| 243         else if (!tag[0]) { | 244         else if (!tag[0]) { | 
| 244             if (tag[1]) | 245             if (tag[1]) | 
| 245                 av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding"); | 246                 av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding"); | 
| 246             url_fskip(s->pb, tlen); | 247             url_fskip(s->pb, tlen); | 
| 247             break; | 248             break; | 
| 248         } | 249         } | 
| 249         /* Skip to end of tag */ | 250         /* Skip to end of tag */ | 
| 250         url_fseek(s->pb, next, SEEK_SET); | 251         url_fseek(s->pb, next, SEEK_SET); | 
| 251     } | 252     } | 
|  | 253     ff_metadata_conv(&s->metadata, NULL, ff_id3v2_metadata_conv); | 
| 252 | 254 | 
| 253     if (len > 0) { | 255     if (len > 0) { | 
| 254         /* Skip padding */ | 256         /* Skip padding */ | 
| 255         url_fskip(s->pb, len); | 257         url_fskip(s->pb, len); | 
| 256     } | 258     } | 
| 257     if (version == 4 && flags & 0x10) /* Footer preset, always 10 bytes, skip ov
     er it */ | 259     if (version == 4 && flags & 0x10) /* Footer preset, always 10 bytes, skip ov
     er it */ | 
| 258         url_fskip(s->pb, 10); | 260         url_fskip(s->pb, 10); | 
| 259 | 261 | 
| 260     av_free(buffer); | 262     av_free(buffer); | 
| 261     return; | 263     return; | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 298 }; | 300 }; | 
| 299 | 301 | 
| 300 const char ff_id3v2_tags[][4] = { | 302 const char ff_id3v2_tags[][4] = { | 
| 301    "TALB", "TBPM", "TCOM", "TCON", "TCOP", "TDEN", "TDLY", "TDOR", "TDRC", | 303    "TALB", "TBPM", "TCOM", "TCON", "TCOP", "TDEN", "TDLY", "TDOR", "TDRC", | 
| 302    "TDRL", "TDTG", "TENC", "TEXT", "TFLT", "TIPL", "TIT1", "TIT2", "TIT3", | 304    "TDRL", "TDTG", "TENC", "TEXT", "TFLT", "TIPL", "TIT1", "TIT2", "TIT3", | 
| 303    "TKEY", "TLAN", "TLEN", "TMCL", "TMED", "TMOO", "TOAL", "TOFN", "TOLY", | 305    "TKEY", "TLAN", "TLEN", "TMCL", "TMED", "TMOO", "TOAL", "TOFN", "TOLY", | 
| 304    "TOPE", "TOWN", "TPE1", "TPE2", "TPE3", "TPE4", "TPOS", "TPRO", "TPUB", | 306    "TOPE", "TOWN", "TPE1", "TPE2", "TPE3", "TPE4", "TPOS", "TPRO", "TPUB", | 
| 305    "TRCK", "TRSN", "TRSO", "TSOA", "TSOP", "TSOT", "TSRC", "TSSE", "TSST", | 307    "TRCK", "TRSN", "TRSO", "TSOA", "TSOP", "TSOT", "TSRC", "TSSE", "TSST", | 
| 306    { 0 }, | 308    { 0 }, | 
| 307 }; | 309 }; | 
| OLD | NEW | 
|---|