From 5ff2be1b878d481cbfcce5f41a5fb679c45824ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 3 Mar 2007 01:41:16 +0000 Subject: 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 --- src/demuxers/demux_mpgaudio.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/demuxers/demux_mpgaudio.c') 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"); -- cgit v1.2.3