diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-03-03 00:58:52 +0000 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-03-03 00:58:52 +0000 |
commit | 6a16b385d3c32e412e23f9f5d44140d7afd9af79 (patch) | |
tree | 32e1451dd03c41b60ca8e5ccf68610a87a35c1b5 /src/demuxers/id3.c | |
parent | 834fb11173a04fb9febc30e8c0e6c08722114f80 (diff) | |
download | xine-lib-6a16b385d3c32e412e23f9f5d44140d7afd9af79.tar.gz xine-lib-6a16b385d3c32e412e23f9f5d44140d7afd9af79.tar.bz2 |
Add a function to parse a generic ID3v2 tag, and make both demux_aac and demux_mpgaudio use it without repeating the same code.
CVS patchset: 8636
CVS date: 2007/03/03 00:58:52
Diffstat (limited to 'src/demuxers/id3.c')
-rw-r--r-- | src/demuxers/id3.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index ffa022a59..b707166b6 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -29,7 +29,7 @@ * * ID3v2 specs: http://www.id3.org/ * - * $Id: id3.c,v 1.12 2006/04/05 22:12:18 valtri Exp $ + * $Id: id3.c,v 1.13 2007/03/03 00:58:52 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -878,3 +878,33 @@ int id3v24_parse_tag(input_plugin_t *input, return 0; } } + +int id3v2_parse_tag(input_plugin_t *input, + xine_stream_t *stream, + int8_t *mp3_frame_header) { + _x_assert(mp3_frame_header[0] == 'I' && mp3_frame_header[1] == 'D' && mp3_frame_header[2] == '3'); + + int result = 0; + + switch(mp3_frame_header[3]) { + case 2: + xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.2 tag\n"); + result = id3v22_parse_tag(input, stream, mp3_frame_header); + break; + + case 3: + xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.3 tag\n"); + result = id3v23_parse_tag(input, stream, mp3_frame_header); + break; + + case 4: + xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.3 tag\n"); + result = id3v24_parse_tag(input, stream, mp3_frame_header); + break; + + default: + xprintf(stream->xine, XINE_VERBOSITY_LOG, "Unknown ID3v2 version: 0x%02x.\n", mp3_frame_header[3]); + } + + return result; +} |