} sh;
} stream_header_t;
-#define OGG_BLOCK_SIZE 4096
/* Some defines from OggDS */
#define PACKET_TYPE_HEADER 0x01
while( ogg_sync_pageout( &p_ogg->oy, p_oggpage ) != 1 )
{
- p_buffer = ogg_sync_buffer( &p_ogg->oy, OGG_BLOCK_SIZE );
+ p_buffer = ogg_sync_buffer( &p_ogg->oy, OGGSEEK_BYTES_TO_READ );
- i_read = stream_Read( p_demux->s, p_buffer, OGG_BLOCK_SIZE );
+ i_read = stream_Read( p_demux->s, p_buffer, OGGSEEK_BYTES_TO_READ );
if( i_read <= 0 )
return VLC_EGENERIC;
( iframe << p_stream->i_granule_shift );
p_stream->i_pcr = ( iframe + pframe - p_stream->i_keyframe_offset )
- * INT64_C(1000000) / p_stream->f_rate;
+ * INT64_C(1000000) / p_stream->f_rate;
}
else if( p_stream->fmt.i_codec == VLC_CODEC_DIRAC )
{
}
else
{
+#warning Memory leak
p_stream->i_headers = 0;
p_stream->p_headers = NULL;
free( p_org );
}
/* Check for Dirac header */
else if( ( oggpacket.bytes >= 5 &&
- ! memcmp( oggpacket.packet, "BBCD\x00", 5 ) ) ||
- ( oggpacket.bytes >= 9 &&
- ! memcmp( oggpacket.packet, "KW-DIRAC\x00", 9 ) ) )
- {
- if( Ogg_ReadDiracHeader( p_stream, &oggpacket ) )
- msg_Dbg( p_demux, "found dirac header" );
+ ! memcmp( oggpacket.packet, "BBCD\x00", 5 ) ) ||
+ ( oggpacket.bytes >= 9 &&
+ ! memcmp( oggpacket.packet, "KW-DIRAC\x00", 9 ) ) )
+ {
+ if( Ogg_ReadDiracHeader( p_stream, &oggpacket ) )
+ msg_Dbg( p_demux, "found dirac header" );
else
{
msg_Warn( p_demux, "found dirac header isn't decodable" );
}
}
else if( (*oggpacket.packet & PACKET_TYPE_BITS ) == PACKET_TYPE_HEADER &&
- oggpacket.bytes >= 56+1 )
+ oggpacket.bytes >= 44+1 )
{
stream_header_t tmp;
stream_header_t *st = &tmp;
st->bits_per_sample = GetWLE( &oggpacket.packet[1+40] ); // (padding 2)
/* Check for video header (new format) */
- if( !strncmp( st->streamtype, "video", 5 ) )
+ if( !strncmp( st->streamtype, "video", 5 ) &&
+ oggpacket.bytes >= 52+1 )
{
st->sh.video.width = GetDWLE( &oggpacket.packet[1+44] );
st->sh.video.height = GetDWLE( &oggpacket.packet[1+48] );
p_stream->fmt.video.i_bits_per_pixel );
}
/* Check for audio header (new format) */
- else if( !strncmp( st->streamtype, "audio", 5 ) )
+ else if( !strncmp( st->streamtype, "audio", 5 ) &&
+ oggpacket.bytes >= 56+1 )
{
char p_buffer[5];
int i_extra_size;
p_stream->b_force_backup = 1;
}
- else if( !strncmp(content_type_string, "audio/x-speex", 14) )
+ else if( !strncmp(content_type_string, "audio/x-speex", 13) )
{
p_stream->fmt.i_cat = AUDIO_ES;
p_stream->fmt.i_codec = VLC_CODEC_SPEEX;
p_stream->b_force_backup = 1;
}
- else if( !strncmp(content_type_string, "video/x-xvid", 14) )
+ else if( !strncmp(content_type_string, "video/x-xvid", 12) )
{
p_stream->fmt.i_cat = VIDEO_ES;
p_stream->fmt.i_codec = VLC_FOURCC( 'x','v','i','d' );
p_stream->b_force_backup = 1;
}
- else if( !strncmp(content_type_string, "video/mpeg", 14) )
+ else if( !strncmp(content_type_string, "video/mpeg", 10) )
{
/* n.b. MPEG streams are unsupported right now */
p_stream->fmt.i_cat = VIDEO_ES;