summaryrefslogtreecommitdiff
path: root/src/demuxers/demux_mpgaudio.c
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-03-03 01:41:16 +0000
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-03-03 01:41:16 +0000
commit5ff2be1b878d481cbfcce5f41a5fb679c45824ec (patch)
treeee605aafbdf130b5b7bfe8d7891a6632ff3969dc /src/demuxers/demux_mpgaudio.c
parent6a16b385d3c32e412e23f9f5d44140d7afd9af79 (diff)
downloadxine-lib-5ff2be1b878d481cbfcce5f41a5fb679c45824ec.tar.gz
xine-lib-5ff2be1b878d481cbfcce5f41a5fb679c45824ec.tar.bz2
Add two extra functions (inline as they are just a return statement) that checks if a preamble is of an ID3v2 tag, and that calculate the size of the tag (to avoid repeating the same code over and over and over; the size of the shared object is reduced. Also make demux_flac use the id3.c functions to parse the eventual ID3 header.
CVS patchset: 8637 CVS date: 2007/03/03 01:41:16
Diffstat (limited to 'src/demuxers/demux_mpgaudio.c')
-rw-r--r--src/demuxers/demux_mpgaudio.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c
index b9f35c17d..6c0b6031c 100644
--- a/src/demuxers/demux_mpgaudio.c
+++ b/src/demuxers/demux_mpgaudio.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2003 the xine project
+ * Copyright (C) 2000-2007 the xine project
*
* This file is part of xine, a free video player.
*
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_mpgaudio.c,v 1.150 2007/03/03 00:58:52 dgp85 Exp $
+ * $Id: demux_mpgaudio.c,v 1.151 2007/03/03 01:41:16 dgp85 Exp $
*
* demultiplexer for mpeg audio (i.e. mp3) streams
*
@@ -606,7 +606,7 @@ static int demux_mpgaudio_next (demux_mpgaudio_t *this, int decoder_flags, int s
return parse_frame_payload(this, header_buf, decoder_flags);
- } else if ( header_buf[0] == 'I' && header_buf[1] == 'D' && header_buf[2] == '3' ) {
+ } else if ( id3v2_istag(header_buf) ) {
if (!id3v2_parse_tag(this->input, this->stream, header_buf)) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
LOG_MODULE ": ID3V2 tag parsing error\n");
@@ -693,10 +693,7 @@ static int detect_mpgaudio_file(input_plugin_t *input) {
* flac files can contain id3v2 tags
*/
uint8_t *ptr = &buf[6];
- uint32_t tag_size = ((uint32_t)ptr[0] << 21) +
- ((uint32_t)ptr[1] << 14) +
- ((uint32_t)ptr[2] << 7) +
- (uint32_t)ptr[3];
+ uint32_t tag_size = id3v2_tagsize(ptr);
lprintf("try to skip id3v2 tag (%d bytes)\n", tag_size);
if ((10 + tag_size) >= preview_len) {
lprintf("cannot skip id3v2 tag\n");