Commit b6dd43d5 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: ogg: add preparsing of headers (fix #6691)

parent 4572f451
...@@ -194,6 +194,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -194,6 +194,7 @@ static int Open( vlc_object_t * p_this )
return VLC_ENOMEM; return VLC_ENOMEM;
p_sys->i_length = -1; p_sys->i_length = -1;
p_sys->b_preparsing_done = false;
/* Set exported functions */ /* Set exported functions */
p_demux->pf_demux = Demux; p_demux->pf_demux = Demux;
...@@ -205,6 +206,10 @@ static int Open( vlc_object_t * p_this ) ...@@ -205,6 +206,10 @@ static int Open( vlc_object_t * p_this )
/* */ /* */
TAB_INIT( p_sys->i_seekpoints, p_sys->pp_seekpoints ); TAB_INIT( p_sys->i_seekpoints, p_sys->pp_seekpoints );
while ( !p_sys->b_preparsing_done && p_demux->pf_demux( p_demux ) > 0 )
{}
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -265,6 +270,9 @@ static int Demux( demux_t * p_demux ) ...@@ -265,6 +270,9 @@ static int Demux( demux_t * p_demux )
if( Ogg_BeginningOfStream( p_demux ) != VLC_SUCCESS ) if( Ogg_BeginningOfStream( p_demux ) != VLC_SUCCESS )
return 0; return 0;
if ( ! p_sys->skeleton.major )
p_sys->b_preparsing_done = true;
/* Find the real duration */ /* Find the real duration */
stream_Control( p_demux->s, STREAM_CAN_SEEK, &b_canseek ); stream_Control( p_demux->s, STREAM_CAN_SEEK, &b_canseek );
if ( b_canseek ) if ( b_canseek )
...@@ -300,9 +308,12 @@ static int Demux( demux_t * p_demux ) ...@@ -300,9 +308,12 @@ static int Demux( demux_t * p_demux )
{ {
/* If we delayed restarting encoders/SET_ES_FMT for more /* If we delayed restarting encoders/SET_ES_FMT for more
* skeleton provided configuration */ * skeleton provided configuration */
if ( p_sys->p_skelstream && p_sys->p_skelstream->i_serial_no == ogg_page_serialno(&p_sys->current_page) ) if ( p_sys->p_skelstream )
{
if ( p_sys->p_skelstream->i_serial_no == ogg_page_serialno(&p_sys->current_page) )
{ {
msg_Dbg( p_demux, "End of Skeleton" ); msg_Dbg( p_demux, "End of Skeleton" );
p_sys->b_preparsing_done = true;
for( i_stream = 0; i_stream < p_sys->i_streams; i_stream++ ) for( i_stream = 0; i_stream < p_sys->i_streams; i_stream++ )
{ {
logical_stream_t *p_stream = p_sys->pp_stream[i_stream]; logical_stream_t *p_stream = p_sys->pp_stream[i_stream];
...@@ -316,6 +327,8 @@ static int Demux( demux_t * p_demux ) ...@@ -316,6 +327,8 @@ static int Demux( demux_t * p_demux )
} }
} }
} }
}
for( i_stream = 0; i_stream < p_sys->i_streams; i_stream++ ) for( i_stream = 0; i_stream < p_sys->i_streams; i_stream++ )
{ {
...@@ -510,6 +523,8 @@ static int Demux( demux_t * p_demux ) ...@@ -510,6 +523,8 @@ static int Demux( demux_t * p_demux )
/* if a page was waiting, it's now processed */ /* if a page was waiting, it's now processed */
p_sys->b_page_waiting = false; p_sys->b_page_waiting = false;
p_sys->b_preparsing_done = true;
p_sys->i_pcr = -1; p_sys->i_pcr = -1;
for( i_stream = 0; i_stream < p_sys->i_streams; i_stream++ ) for( i_stream = 0; i_stream < p_sys->i_streams; i_stream++ )
{ {
...@@ -1264,6 +1279,7 @@ static void Ogg_DecodePacket( demux_t *p_demux, ...@@ -1264,6 +1279,7 @@ static void Ogg_DecodePacket( demux_t *p_demux,
memcpy( p_block->p_buffer, p_oggpacket->packet + i_header_len, memcpy( p_block->p_buffer, p_oggpacket->packet + i_header_len,
p_oggpacket->bytes - i_header_len ); p_oggpacket->bytes - i_header_len );
assert( p_ogg->b_preparsing_done );
es_out_Send( p_demux->out, p_stream->p_es, p_block ); es_out_Send( p_demux->out, p_stream->p_es, p_block );
} }
......
...@@ -167,6 +167,9 @@ struct demux_sys_t ...@@ -167,6 +167,9 @@ struct demux_sys_t
int i_attachments; int i_attachments;
input_attachment_t **attachments; input_attachment_t **attachments;
/* preparsing info */
bool b_preparsing_done;
/* Length, if available. */ /* Length, if available. */
int64_t i_length; int64_t i_length;
......
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