[vlc-devel] fixing a bug: preferred audio language select for .ogg

Karl Ostmo kostmo at gmail.com
Thu Sep 16 11:48:07 CEST 2010


> Reading the code, I think it might be as simple as delaying calling
> Ogg_ExtraMeta
> until all headers are read, eg:
> - if( p_stream->i_headers > 0 )
> + if( p_stream->i_headers > 2 )
>
> 2 being hardcoded for Vorbis/Theora (3 headers) in this example, other
> stream types can be different.

In Ogg_DecodePacket(), there is a counter p_stream->i_packets_backup
and conditional
 if( p_stream->i_packets_backup == 3 )
that sets p_stream->b_force_backup to false.  Only after that variable
is false does Ogg_ExtractMeta() get called.  However, audio stream
selection based on language (EsOutSelect(), via EsOutAdd(), called via
es_out_Add() in ogg.c) is triggered on the first packet, in
Ogg_BeginningOfStream().  It might work to delay calling es_out_Add()
until the third packet, but I don't know what other things that would
disrupt.

Alternatively, it might work if there was a way to change the active
audio stream (with EsOutSelect()) from within Demux() on some packet
after the first.  I actually tried this, by exposing es_out_Select()
through the es_out_t struct in include/vlc_es_out.h, but got "Bus
error" when I used the function.

Karl



More information about the vlc-devel mailing list