[vlc-devel] [PATCH] Factor the ogg paging code

Laurent Aimar fenrir at via.ecp.fr
Fri Jul 31 00:33:08 CEST 2009


Hi,

On Thu, Jul 30, 2009, ogg.k.ogg.k at googlemail.com wrote:
> as they're the same modulo the libogg routine used.

> ---
>  modules/mux/ogg.c |   36 ++++++++++++------------------------
>  1 files changed, 12 insertions(+), 24 deletions(-)
> 
> diff --git a/modules/mux/ogg.c b/modules/mux/ogg.c
> index 8b3c024..5314c68 100644
> --- a/modules/mux/ogg.c
> +++ b/modules/mux/ogg.c
> @@ -557,14 +557,16 @@ static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input )
>  /*****************************************************************************
>   * Ogg bitstream manipulation routines
>   *****************************************************************************/
> -static block_t *OggStreamFlush( sout_mux_t *p_mux,
> -                                ogg_stream_state *p_os, mtime_t i_pts )
> +static block_t *OggStreamGetPage( sout_mux_t *p_mux,
> +                                  ogg_stream_state *p_os, mtime_t i_pts,
> +                                  bool flush )
>  {
>      (void)p_mux;
>      block_t *p_og, *p_og_first = NULL;
>      ogg_page og;
> +    int (*pager)( ogg_stream_state*, ogg_page* ) = flush ? ogg_stream_flush : ogg_stream_pageout;
> 
> -    while( ogg_stream_flush( p_os, &og ) )
> +    while( (*pager)( p_os, &og ) )
I think that simply using
 while( pager( p_os, &og ) )
would be cleaner/easier to read.

-- 
fenrir



More information about the vlc-devel mailing list