[MPlayer-users] Closed Captions: advice needed

Arpi arpi at thot.banki.hu
Fri Jul 19 00:42:01 CEST 2002


Hi,

> I noticed that MPlayer lacks Closed Captions decoding capability (at 
Because we lack of DVD discs using it... don't you want to donate some? :)

> 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". 
yes. it's readed, but isn't decoded & displayed.

> 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.
great

> 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...
video.c is still the best place for it. the other possible place would be
the mpeg video decoder (libmpeg2 or libavcodec) but it's even worse.
and, as subs are in the stream, libmpdemux is the best place to handle.

> 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). 
Are they text (ascii) subs? (i've never seen any CC subtitle)

> 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. 
Hmm, tricky. And, how are sub hiding (no sub is visible) handled?

Anyway, ascii subs don't have duration in teh OSD layer, the find_sub.c code
just notices that it reached end time, so it chanegs text to next sub or
NULL, and send a change notify event to the OSD layer. You should do the
same (construct the sub in the bg, then swap buffers and send a notify
event) - or, you can implement another OSD type, for CC subs, and implement
the code to render it. If it's simple ascii, i suggest the former way.

> 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 
yes. where is the problem?

> user_data demuxed. Can someone give me a pointer (possibly one that is 
> not "RTFS"  :-)  )?
subsribe mplayer-dev-eng
ah, and RTFS, especially osd.c and sub.c :)

> Moreover, if MPlayer already supports CCs and I just didn't notice... 
no


A'rpi / Astral & ESP-team

--
Developer of MPlayer, the Movie Player for Linux - http://www.MPlayerHQ.hu




More information about the MPlayer-users mailing list