[FFmpeg-devel] [RFC] TS/DVB subtitle sub_id hack

Michael Niedermayer michaelni
Sun Jul 11 18:17:59 CEST 2010


On Sun, Jul 11, 2010 at 04:22:52PM +0200, Reimar D?ffinger wrote:
> Hello,
> currently the DVB subtitle handling is a mess that's basically not going
> to work for anyone not using ffmpeg or ffplay binaries, and even violates
> the documentation.
> First, the documentation of the AVCodecContext:sub_id field that is mostly involved
> here:
>      * - decoding: Set by libavcodec. (FIXME: Is this OK?)
>      */
>     int sub_id;
> 
> However in this case it is actually set by libavformat/mpegts.c:
> st->codec->sub_id = (anc_page << 16) | comp_page;
> 
> Worse, unless this is set correctly, the dvbsub decoder will not produce any output
> at all, even though most TS streams only have one single subid in the whole
> subtitle stream anyway.

i think what mpegts & dvbsub do with sub_id is not in line with what
the field is supposed to be used for.


> 
> I have two suggestions for quick fixes:
> 1) Identify invalid values for sub_id, and use them to make the decoder output everything
> 2) Have the dvbsub decoder always decode everything and only make it set the sub_id
>    according to the data it just decoded, thus matching the documentation.
>    Filtering by sub_id then has to be done elsewhere. For this, it would be good
>    to know how sub_id is used elsewhere, and also samples of TS streams where this
>    sub_id value is actually relevant would be useful.

neither alone will work, they also violate the specs. the spec says clearly
that the id values from the pmt should be used.

maybe something along the lines of:
put the 2 ids in extradata in mpegts.c (1-2 line change)
make dvbsub use the 2 ids from extradata (1-2 line change)
if dvbsub finds no extradata print a big warning that multiple languages
could be displayed on top of each other and display all.
if there are multiple pmt entries that refer to the same stream, create
multiple subtitle streams with differening extradata.

comments and other suggestions welcome but this seems the easiest way to fix
this. it does have a issue with subtitle stream duplication on stream copy
if this (rare) feature is used


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100711/1bc7ca3e/attachment.pgp>



More information about the ffmpeg-devel mailing list