+ oggpack_adv( &opb, 88 );
+ oggpack_adv( &opb, 104 );
+ p_stream->fmt.i_bitrate = oggpack_read( &opb, 32 );
+ p_stream->f_rate = 2; /* FIXME */
+ msg_Dbg( p_demux,
+ "found tarkin header, bitrate: %i, rate: %f",
+ p_stream->fmt.i_bitrate, p_stream->f_rate );
+ }
+ /* Check for Annodex header */
+ else if( oggpacket.bytes >= 7 &&
+ ! memcmp( &oggpacket.packet[0], "Annodex", 7 ) )
+ {
+ Ogg_ReadAnnodexHeader( VLC_OBJECT(p_demux), p_stream,
+ &oggpacket );
+ /* kill annodex track */
+ free( p_stream );
+ p_ogg->i_streams--;
+ }
+ /* Check for Annodex header */
+ else if( oggpacket.bytes >= 7 &&
+ ! memcmp( &oggpacket.packet[0], "AnxData", 7 ) )
+ {
+ Ogg_ReadAnnodexHeader( VLC_OBJECT(p_demux), p_stream,
+ &oggpacket );
+ }
+ else if( oggpacket.bytes >= 142 &&
+ !memcmp( &oggpacket.packet[1],
+ "Direct Show Samples embedded in Ogg", 35 ))
+ {
+ /* Old header type */
+
+ /* Check for video header (old format) */
+ if( GetDWLE((oggpacket.packet+96)) == 0x05589f80 &&
+ oggpacket.bytes >= 184 )
+ {
+ p_stream->fmt.i_cat = VIDEO_ES;
+ p_stream->fmt.i_codec =
+ VLC_FOURCC( oggpacket.packet[68],
+ oggpacket.packet[69],
+ oggpacket.packet[70],
+ oggpacket.packet[71] );
+ msg_Dbg( p_demux, "found video header of type: %.4s",
+ (char *)&p_stream->fmt.i_codec );
+
+ p_stream->fmt.video.i_frame_rate = 10000000;
+ p_stream->fmt.video.i_frame_rate_base =
+ GetQWLE((oggpacket.packet+164));
+ p_stream->f_rate = 10000000.0 /
+ GetQWLE((oggpacket.packet+164));
+ p_stream->fmt.video.i_bits_per_pixel =
+ GetWLE((oggpacket.packet+182));
+ if( !p_stream->fmt.video.i_bits_per_pixel )
+ /* hack, FIXME */
+ p_stream->fmt.video.i_bits_per_pixel = 24;
+ p_stream->fmt.video.i_width =
+ GetDWLE((oggpacket.packet+176));
+ p_stream->fmt.video.i_height =
+ GetDWLE((oggpacket.packet+180));
+
+ msg_Dbg( p_demux,
+ "fps: %f, width:%i; height:%i, bitcount:%i",
+ p_stream->f_rate,
+ p_stream->fmt.video.i_width,
+ p_stream->fmt.video.i_height,
+ p_stream->fmt.video.i_bits_per_pixel);
+
+ }
+ /* Check for audio header (old format) */
+ else if( GetDWLE((oggpacket.packet+96)) == 0x05589F81 )
+ {
+ unsigned int i_extra_size;
+ unsigned int i_format_tag;
+
+ p_stream->fmt.i_cat = AUDIO_ES;
+
+ i_extra_size = GetWLE((oggpacket.packet+140));
+ if( i_extra_size )
+ {
+ p_stream->fmt.i_extra = i_extra_size;
+ p_stream->fmt.p_extra = malloc( i_extra_size );
+ memcpy( p_stream->fmt.p_extra,
+ oggpacket.packet + 142, i_extra_size );
+ }
+
+ i_format_tag = GetWLE((oggpacket.packet+124));
+ p_stream->fmt.audio.i_channels =
+ GetWLE((oggpacket.packet+126));
+ p_stream->f_rate = p_stream->fmt.audio.i_rate =
+ GetDWLE((oggpacket.packet+128));
+ p_stream->fmt.i_bitrate =
+ GetDWLE((oggpacket.packet+132)) * 8;
+ p_stream->fmt.audio.i_blockalign =
+ GetWLE((oggpacket.packet+136));
+ p_stream->fmt.audio.i_bitspersample =
+ GetWLE((oggpacket.packet+138));
+
+ wf_tag_to_fourcc( i_format_tag,
+ &p_stream->fmt.i_codec, 0 );
+
+ if( p_stream->fmt.i_codec ==
+ VLC_FOURCC('u','n','d','f') )
+ {
+ p_stream->fmt.i_codec = VLC_FOURCC( 'm', 's',
+ ( i_format_tag >> 8 ) & 0xff,
+ i_format_tag & 0xff );
+ }
+
+ msg_Dbg( p_demux, "found audio header of type: %.4s",
+ (char *)&p_stream->fmt.i_codec );
+ msg_Dbg( p_demux, "audio:0x%4.4x channels:%d %dHz "
+ "%dbits/sample %dkb/s",
+ i_format_tag,
+ p_stream->fmt.audio.i_channels,
+ p_stream->fmt.audio.i_rate,
+ p_stream->fmt.audio.i_bitspersample,
+ p_stream->fmt.i_bitrate / 1024 );
+
+ }
+ else
+ {
+ msg_Dbg( p_demux, "stream %d has an old header "
+ "but is of an unknown type", p_ogg->i_streams-1 );
+ free( p_stream );
+ p_ogg->i_streams--;
+ }