diff options
author | Bastien Nocera <hadess@users.sourceforge.net> | 2003-03-18 15:42:04 +0000 |
---|---|---|
committer | Bastien Nocera <hadess@users.sourceforge.net> | 2003-03-18 15:42:04 +0000 |
commit | 786f6b4832cb640bb205f390349dccf10fd82da7 (patch) | |
tree | 8a585d0ad82a668517801d38df4ea7c79c2d823d | |
parent | fda52e608dcd7c21a02ab3693d0e78fa993e47dc (diff) | |
download | xine-lib-786f6b4832cb640bb205f390349dccf10fd82da7.tar.gz xine-lib-786f6b4832cb640bb205f390349dccf10fd82da7.tar.bz2 |
- try going 2 bytes deep into the file before checking for the RIFF header
CVS patchset: 4442
CVS date: 2003/03/18 15:42:04
-rw-r--r-- | src/demuxers/demux_mpgaudio.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index ee3b348fb..4683daa96 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -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.96 2003/03/18 13:31:25 hadess Exp $ + * $Id: demux_mpgaudio.c,v 1.97 2003/03/18 15:42:04 hadess Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -463,7 +463,7 @@ static int demux_mpgaudio_get_status (demux_plugin_t *this_gen) { return this->status; } -static uint32_t demux_mpgaudio_read_head(input_plugin_t *input, uint8_t *buf) { +static uint32_t demux_mpgaudio_read_head(input_plugin_t *input, uint8_t *buf, int offset) { uint32_t head=0; int bs = 0; @@ -472,7 +472,7 @@ static uint32_t demux_mpgaudio_read_head(input_plugin_t *input, uint8_t *buf) { return 0; if((input->get_capabilities(input) & INPUT_CAP_SEEKABLE) != 0) { - input->seek(input, 0, SEEK_SET); + input->seek(input, offset, SEEK_SET); if (input->get_capabilities (input) & INPUT_CAP_BLOCK) bs = input->get_blocksize(input); @@ -494,10 +494,10 @@ static uint32_t demux_mpgaudio_read_head(input_plugin_t *input, uint8_t *buf) { #endif input->get_optional_data (input, buf, INPUT_OPTIONAL_DATA_PREVIEW); - head = (buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3]; + head = (buf[offset] << 24) + (buf[offset+1] << 16) + (buf[offset+2] << 8) + buf[offset+3]; #ifdef LOG printf ("demux_mpgaudio: got preview %02x %02x %02x %02x\n", - buf[0], buf[1], buf[2], buf[3]); + buf[offset], buf[offset+1], buf[offset+2], buf[offset+3]); #endif } else { #ifdef LOG @@ -527,7 +527,7 @@ static void demux_mpgaudio_send_headers (demux_plugin_t *this_gen) { if ((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) != 0) { uint32_t head; - head = demux_mpgaudio_read_head(this->input, buf); + head = demux_mpgaudio_read_head(this->input, buf, 0); if (mpg123_head_check(head)) mpg123_decode_header(this,head); @@ -619,15 +619,16 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str switch (stream->content_detection_method) { case METHOD_BY_CONTENT: { - uint32_t head; + uint32_t head, head2; - head = demux_mpgaudio_read_head (input, buf); + head = demux_mpgaudio_read_head (input, buf, 0); + head2 = demux_mpgaudio_read_head (input, buf, 2); #ifdef LOG - printf ("demux_mpgaudio: head is %x\n", head); + printf ("demux_mpgaudio: head is %x head2 is %x\n", head, head2); #endif - if (head == RIFF_TAG) { + if (head == RIFF_TAG || head2 == RIFF_TAG) { int ok; #ifdef LOG @@ -674,7 +675,8 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str #ifdef LOG printf ("demux_mpgaudio: **** mpg123: checking %08X\n", head); #endif - if (mpg123_head_check(head)) + if (mpg123_head_check(head) + || _sniff_buffer_looks_like_mp3(input)) ok = 1; } if (!ok) |