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

Karl Ostmo kostmo at gmail.com
Wed Sep 15 14:16:23 CEST 2010


I've been looking into writing a patch for this bug:
http://trac.videolan.org/vlc/ticket/4175

It looks like the problem has to do with vlc/modules/demux/ogg.c and
vlc/src/input/es_out.c.  In es_out.c's EsOutAdd(), a stream's
es->psz_language_code variable is set from es->fmt.psz_language, then
in EsOutSelect(), the correct audio track is selected by comparing
this to a preference setting stored in the variable
p_sys->p_es_audio->psz_language_code.

The problem is that unlike with .mkv files, with .ogm files the
es->fmt.psz_language variable is not set by the time that EsOutAdd()
is called.  In fact, currently the variable is never set for Vorbis
audio streams.  Ideally, the variable would be set in
Ogg_ReadVorbisHeader() of ogg.c.  However, it looks like the header
data is not fully extracted until up to 3 packets have been read in
Ogg_DecodePacket().

At that point the function Ogg_ExtractMeta() is called, which itself
makes a call to vorbis_ParseComment() where the stream's language
attribute could be extracted.  Unfortunately, this finally happens
well after Ogg_BeginningOfStream() had been called (which is where
EsOutAdd() happens).

I was wondering if someone familiar with this code could give me some
pointers or suggestions about how to proceed.  Would there be a way to
"read ahead" a few packets
from within Ogg_ReadVorbisHeader() so that the header info can be
fully populated and parsed?

Thanks,
Karl



More information about the vlc-devel mailing list