[vlc-devel] spu-channel vs spu-es and subtitle selection

R. Bernstein rocky at panix.com
Mon Mar 15 05:54:48 CET 2004

I was looking at how to improve selecting CVD and SVCD subtitles and
ran across a problem what looks a bit messy in vlc as it currently

vlc has two variables spu-es and spu-channel; both are used to select
a subtitle. For DVD's spu-es is I guess a language code.  spu-channel
I think is always a small number.

For VCDs the more natural thing to use is the small integer,
spu-channel, as there is no language name encoded anywhere. In one VCD
subtitle 0 might be one language and in another VCD, subtitle 0 might
be another language. The problem I have is how setting either of these
keeps the other in synch. In fact the problem I had was that the front
end was changing spu-es, but that change wasn't being reflected in the
spu-channel variable which is where the subtitle decoder is looking.

I added a little hack to have the VCD plugin register a callback so
that when spu-es is changed it changes spu-channel. And actually even
this was a bit messier than I had anticipated. It seems that I
couldn't register the callback in the subtitle decoder where it is
needed. For reasons I don't understand, doing that won't have the
callback triggered. And then there's the messiness that to have the
spu-channel variable of the access module found in the decoder, you
have to first look up the input module's object - a bit cumbersome and

Naively I thought the spu-channel/spu-es association would work like
say Unix id's usernames. Internally a uid is used, but you can call a
routine to get the name from the uid or vice versa. I'm guessing that
something like this doesn't already exist, right?

And at present, I'm not sure *how* to make the association between the
two for SVCD subtitles given just the spu-es as it currently is
stored. For SVCD subtitles The spu-es seems always to be 0x70 no
matter which subtitle is selected. (For CVD subtitles the ES id is
0xbd, 0x1bd, 0x2bd, etc).

And last there's the weirdness of how the Video/Subtitle Track decides
on its entries. For a CVD which has 4 subtitles that I think of as
numbered 0..3, the menu entries start at "Track 4" (which corresponds
to subtitle 0) and display down to "Track 1" (which corresponds to
subtitle 3). For my SVCD test which has two subtitles, there is only
one subtitle listed. No doubt this is a reflection of the fact that
all SVCD subtitles get a 0x70 ES id.

My guess is that there's a bug in this code that sets/stores ES ID's,
but where is this code? 

What steps vlc take to make sure spu-channel and spu-es are
consistent? Should they be consistent? 


This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html
If you are in trouble, please contact <postmaster at videolan.org>

More information about the vlc-devel mailing list