Commit 25c03394 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* rewind the stream to 0 if we found an id3 tag, but the flac demuxer ISNT the...

* rewind the stream to 0 if we found an id3 tag, but the flac demuxer ISNT the correct one. Same should be done for mp3 demuxer and any other demux that launches id3 module. But not today :D
parent 30581898
...@@ -86,16 +86,14 @@ static int Open( vlc_object_t * p_this ) ...@@ -86,16 +86,14 @@ static int Open( vlc_object_t * p_this )
/* Have a peep at the show. */ /* Have a peep at the show. */
if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 ) if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 )
{ {
if( p_meta ) vlc_meta_Delete( p_meta ); goto error;
return VLC_EGENERIC;
} }
if( p_peek[0]!='f' || p_peek[1]!='L' || p_peek[2]!='a' || p_peek[3]!='C' ) if( p_peek[0]!='f' || p_peek[1]!='L' || p_peek[2]!='a' || p_peek[3]!='C' )
{ {
if( strncmp( p_demux->psz_demux, "flac", 4 ) ) if( strncmp( p_demux->psz_demux, "flac", 4 ) )
{ {
if( p_meta ) vlc_meta_Delete( p_meta ); goto error;
return VLC_EGENERIC;
} }
/* User forced */ /* User forced */
msg_Err( p_demux, "this doesn't look like a flac stream, " msg_Err( p_demux, "this doesn't look like a flac stream, "
...@@ -114,15 +112,13 @@ static int Open( vlc_object_t * p_this ) ...@@ -114,15 +112,13 @@ static int Open( vlc_object_t * p_this )
if( p_peek[4] & 0x7F ) if( p_peek[4] & 0x7F )
{ {
msg_Err( p_demux, "this isn't a STREAMINFO metadata block" ); msg_Err( p_demux, "this isn't a STREAMINFO metadata block" );
if( p_meta ) vlc_meta_Delete( p_meta ); goto error;
return VLC_EGENERIC;
} }
if( ((p_peek[5]<<16)+(p_peek[6]<<8)+p_peek[7]) != (STREAMINFO_SIZE - 4) ) if( ((p_peek[5]<<16)+(p_peek[6]<<8)+p_peek[7]) != (STREAMINFO_SIZE - 4) )
{ {
msg_Err( p_demux, "invalid size for a STREAMINFO metadata block" ); msg_Err( p_demux, "invalid size for a STREAMINFO metadata block" );
if( p_meta ) vlc_meta_Delete( p_meta ); goto error;
return VLC_EGENERIC;
} }
/* /*
...@@ -154,18 +150,29 @@ static int Open( vlc_object_t * p_this ) ...@@ -154,18 +150,29 @@ static int Open( vlc_object_t * p_this )
module_Need( p_sys->p_packetizer, "packetizer", NULL, 0 ); module_Need( p_sys->p_packetizer, "packetizer", NULL, 0 );
if( !p_sys->p_packetizer->p_module ) if( !p_sys->p_packetizer->p_module )
{ {
if( p_sys->p_packetizer->fmt_in.p_extra )
free( p_sys->p_packetizer->fmt_in.p_extra );
vlc_object_destroy( p_sys->p_packetizer );
msg_Err( p_demux, "cannot find flac packetizer" ); msg_Err( p_demux, "cannot find flac packetizer" );
if( p_meta ) vlc_meta_Delete( p_meta ); goto error;
return VLC_EGENERIC;
} }
p_sys->p_es = es_out_Add( p_demux->out, &fmt ); p_sys->p_es = es_out_Add( p_demux->out, &fmt );
return VLC_SUCCESS; return VLC_SUCCESS;
error:
if( p_sys != NULL && p_sys->p_packetizer )
{
if( p_sys->p_packetizer->fmt_in.p_extra )
free( p_sys->p_packetizer->fmt_in.p_extra );
vlc_object_destroy( p_sys->p_packetizer );
}
if( p_meta )
{
int b_seekable;
vlc_meta_Delete( p_meta );
stream_Control( p_demux->s, STREAM_CAN_FASTSEEK, &b_seekable );
if( b_seekable ) stream_Seek( p_demux->s, 0 );
}
return VLC_EGENERIC;
} }
/***************************************************************************** /*****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment