[MPlayer-users] Closed Captions: advice needed

DarkAveng darkaveng at darkaveng.cjb.net
Fri Jul 19 00:17:01 CEST 2002


I noticed that MPlayer lacks Closed Captions decoding capability (at 
least I didnt't find it...), so I started looking at xine's source about 
how it supports them. I had also noticed that, on some DVDs of mine, 
mplayer -v printed out some "user_data" lines which started with "CC". 
So, off I went to "port" the CC decoding stuff from xine to MPlayer 
(quite a big word, actually I did little more than some cut&paste :-)).
Anyway, it basically works (for the time being I just cared about the 
correct decoding of the subtitle text), meaning that it correctly 
displays sub text in a console.
The main points about which I need advice are:
1) Can someone tell me a "clean" way (and place...) to do the decoding? 
I'll explain better: CC data is retrieved by the video demuxer, since 
it's encapsulated in the MPEG stream as user data. I  thus had to modify 
libmpdemux/video.c to extract the needed data, but I definitely think 
video.c is an ugly place to do subtitle related stuff, so...
2) Most important: I do not know MPlayer's OSD architecture well enough, 
and I'd definitely like to use it to display my neat (:-)) CC subtitles. 
Yes, I know CCs have control codes for color, background, font change 
and so on. I just don't care about them (as of now... I'll see later). 
The problem is: as far as I understand, the OSD-displayed subtitles (I 
mean, not vobsub ones) need to know *before* being displayed the 
duration they will have. I _CANNOT_ do that for CCs, since they use  a 
"doublebuffer-like" approach: a CC decoder has a displayed memory and a 
non-displayed one. The data coming from the stream "constructs" the 
non-displayed memory and then a control code asks to "swap" the buffers. 
So, you see, I cannot know how long the currently displayed subtitle is 
going to last, let alone the ones yet to display. So, if my 
understanding of how CCs work is correct, I definitely need a way to use 
MPlayer's OSD like "Display these lines of text NOW" and "Erase the text 
you were displaying NOW", according to the control codes from the 
user_data demuxed. Can someone give me a pointer (possibly one that is 
not "RTFS"  :-)  )?

Of course, I will accept corrections on what I wrote, which almost 
surely contains something wrong, especially about MPlayer's OSD, which I 
have not looked at in depth.
Moreover, if MPlayer already supports CCs and I just didn't notice... 
just flame me... :-))

Thanks in advance for your help.
DarkAveng





More information about the MPlayer-users mailing list