[vlc-devel] Updated patch for ogg/theora seeking
Ilkka Ollakka
ileoo at videolan.org
Mon Jun 7 08:14:03 CEST 2010
On Sun, Jun 06, 2010 at 03:43:00PM -0300, salsaman wrote:
> Updated patch. Please let me know if it is OK now.
> Gabriel.
Hi,
Have to say, I don't know ogg that well, that I could really comment on
code content that much (but looks ok ). Still few indent issues here and
there, but nothing major.
Like here:
> @@ -323,15 +263,35 @@ static int Demux( demux_t * p_demux )
> /*
> * Demux an ogg page from the stream
> */
> - if( Ogg_ReadPage( p_demux, &oggpage ) != VLC_SUCCESS )
> + if( Ogg_ReadPage( p_demux ) != VLC_SUCCESS )
> return 0; /* EOF */
Here:
> + /* if any streams have b_ignore_packets, don't decode anything
> + * except headers */
> + for( i_stream = 0; i_stream < p_sys->i_streams; i_stream++ )
> + {
> + logical_stream_t *p_stream = p_sys->pp_stream[i_stream];
> +
> + if ( p_stream->b_ignore_packets )
> + {
> + b_ignore = true;
> + }
> +
> + /* check also if we are pre-rolling as the result of a search */
> + if ( p_stream->i_skip_frames > 0 )
> + {
> + b_skipping = true;
> + }
> +
> + }
Here:
> - if( ogg_stream_pagein( &p_stream->os, &oggpage ) != 0 )
> + if( ogg_stream_pagein( &p_stream->os, &p_sys->current_page ) != 0 )
> + {
> + msg_Warn ( p_demux, "Got incomplete page" );
> continue;
> + }
> +
> + if ( p_sys->i_total_length > 0 )
> + {
> + if ( p_stream->fmt.i_codec == VLC_CODEC_THEORA )
> + {
> + i_gpos = ogg_page_granulepos( &p_sys->current_page );
> + oggseek_theora_index_entry_add ( p_stream, i_gpos, p_sys->i_input_position );
> + }
> + }
> +
> }
Few comments still have those gf:-tags
> + /* gf: after a seek we only ignore all packets which end on the first page,
> + * unless we are seeking to the very first frame */
> +
> + p_stream->b_ignore_packets = false;
> +
Indent error
> @@ -673,7 +850,7 @@ static void Ogg_DecodePacket( demux_t *p_demux,
> p_stream->p_headers = realloc( p_stream->p_headers, p_stream->i_headers );
> if( p_stream->p_headers )
> {
> - memcpy( p_stream->p_headers + p_stream->i_headers - p_oggpacket->bytes,
> + memcpy( (unsigned char *)p_stream->p_headers + p_stream->i_headers - p_oggpacket->bytes,
> p_oggpacket->packet, p_stream->i_headers );
> }
> else
> @@ -791,6 +968,15 @@ static void Ogg_DecodePacket( demux_t *p_demux,
Here too
> + /* may need to preroll video frames after a seek */
> + if ( p_stream->i_skip_frames > 0 )
> + {
> + p_block->i_flags |= BLOCK_FLAG_PREROLL;
> + P_stream->i_skip_frames--;
> + }
and here
> + while( Ogg_ReadPage( p_demux ) == VLC_SUCCESS )
> + {
> + if( ogg_page_bos( &p_ogg->current_page ) )
> + {
> +
> +
> + /* All is wonderful in our fine fine little world.
> + * We found the beginning of our first logical stream. */
> + while( ogg_page_bos( &p_ogg->current_page ) )
> + {
> logical_stream_t *p_stream;
Seems like indent error here also, and forgotten gf-tag
> + /* gf: initialise kframe index */
> + p_stream->idx=NULL;
> + /* gf: end */
> +
> +
> /* Try first to reuse an old ES */
> if( p_old_stream &&
Indent error
> @@ -1417,6 +1621,29 @@ static int Ogg_BeginningOfStream( demux_t *p_demux )
> Ogg_LogicalStreamDelete( p_demux, p_ogg->p_old_stream );
> p_ogg->p_old_stream = NULL;
> }
> +
> +
> + /* get total frame count for video stream; we will need this for seeking */
> + p_ogg->i_total_frames = 0;
> +
> + if ( p_ogg->i_total_length > 0 )
> + {
> +
> + for( i_stream = 0 ; i_stream < p_ogg->i_streams; i_stream++ )
> + {
Similar indent issues still in few places, not sure if the extras emacs
stuff is out of date/broken in that sense or if you just forgot to
reindent those files.
--
Ilkka Ollakka
For a man to truly understand rejection, he must first be ignored by a
cat.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100607/4e747dbf/attachment.sig>
More information about the vlc-devel
mailing list