+ /* Read info from any secondary header packets, if there are any */
+ if( p_stream->secondary_header_packets > 0 )
+ {
+ if( p_stream->fmt.i_codec == VLC_FOURCC('t','h','e','o') &&
+ oggpacket.bytes >= 7 &&
+ ! memcmp( &oggpacket.packet[1], "theora", 6 ) )
+ {
+ Ogg_ReadTheoraHeader( p_stream, &oggpacket );
+ p_stream->secondary_header_packets = 0;
+ }
+ else if( p_stream->fmt.i_codec == VLC_FOURCC('v','o','r','b') &&
+ oggpacket.bytes >= 7 &&
+ ! memcmp( &oggpacket.packet[1], "vorbis", 6 ) )
+ {
+ Ogg_ReadVorbisHeader( p_stream, &oggpacket );
+ p_stream->secondary_header_packets = 0;
+ }
+ else if ( p_stream->fmt.i_codec == VLC_FOURCC('c','m','m','l') )
+ {
+ p_stream->secondary_header_packets = 0;
+ }
+ }
+
+ if( p_stream->b_reinit )
+ {
+ /* If synchro is re-initialized we need to drop all the packets
+ * until we find a new dated one. */
+ Ogg_UpdatePCR( p_stream, &oggpacket );
+
+ if( p_stream->i_pcr >= 0 )
+ {
+ p_stream->b_reinit = 0;
+ }
+ else
+ {
+ p_stream->i_interpolated_pcr = -1;
+ continue;
+ }
+
+ /* An Ogg/vorbis packet contains an end date granulepos */
+ if( p_stream->fmt.i_codec == VLC_FOURCC( 'v','o','r','b' ) ||
+ p_stream->fmt.i_codec == VLC_FOURCC( 's','p','x',' ' ) ||
+ p_stream->fmt.i_codec == VLC_FOURCC( 'f','l','a','c' ) )
+ {
+ if( ogg_stream_packetout( &p_stream->os, &oggpacket ) > 0 )
+ {
+ Ogg_DecodePacket( p_demux, p_stream, &oggpacket );
+ }
+ else
+ {
+ es_out_Control( p_demux->out, ES_OUT_SET_PCR,
+ p_stream->i_pcr );
+ }
+ continue;
+ }
+ }
+
+ Ogg_DecodePacket( p_demux, p_stream, &oggpacket );