[Ffmpeg-devel] Subtitle patches

Michael Niedermayer michaelni
Sun Aug 14 02:36:42 CEST 2005


On Wed, Jul 27, 2005 at 06:33:22PM +0100, Ian Caulfield wrote:
> Hi,
> I've attache a couple of subtitle decoder patches - subs.diff fixes a 
> couple of minor bugs in my DVB subtitle decoder, and also fixes a few 
> problems in the DVD decoder (the palette entries were being read 
> back-to-front, and the timing conversions were slighly off). I've also 
> added an extra field to the AVSubtitleRect structure to pass the DVD clut 
> mappings out, so that an application with access to the IFO files can 
> display the correct colours.

thats not good at all, the way AVSubtitleRect is stored we cannot add
anything to it without breaking binary compatibility, please change it to
a linked list (or anything else if you have an idea), so we break 
compatibility just once instead of every time a field is added, also
please increase the version number in avcodec.h if compatibility is broken

> ffplay.diff patches ffplay to be able to display subtitles.
> When testing these, I found a couple of issues that I'm not sure how to 
> resolve:
>  - On the Lord of The Rings extended DVDs, the subtitles for the 
> director's commentary tracks fade in and out by giving several SET_CONTR 
> commands. The dvdsub decoder just takes the last alpha values, so the 
> subtitles are invisible. To properly decode these subtitles, 
> av_decode_subtitle needs to be able to return multiple AVSubtitles for one 
> call. I think the best way to implement this is probably to change the API 
> so that instead of passing an AVSubtitle* to the function, pass an 
> AVSubtitle** and let the decoder allocate an array of AVSubtitles and 
> return the number of pages in got_subtitles

forget arrays of structures which are vissible outside libav*, as already 
described above its very problematic if we add a field and the user 
application was compiled against a version of libav* prior to that
maybe merging AVSubtitle & AVSubtitleRect would simplify things if we
output multiple AVSubtitles anyway?

>  - Different formats use different coordinate systems - DVB subtitles are 
> based on a 720x576 frame regardless of video resolution, while DVD 
> subtitles are given (I think) in video coordinates (does anyone have a 
> sub-D1 DVD to test this on?). Also DVD subtitles for letterboxed display 
> are formatted to put the text into the black bars - they're meant to be 
> scaled separately to the video. Currently there's no way to support this 
> in the AVSubtitle struct. What would be the best way to represent this?

well either convert to the video width/height or set the width/height
of the used coordinate system in AVCodecContext, i think the later is
better in the long run as there might be multiple video streams with
different resolution but the same subtitles



More information about the ffmpeg-devel mailing list