[FFmpeg-devel] [RFC] General design for subtitles demuxers

Clément Bœsch ubitux at gmail.com
Wed Jun 13 02:40:11 CEST 2012


Yet another subtitles thread, addressing this time several issues in a row.

All the text subtitles formats are small files where it is interesting to
consider them as such, and not as a stream. In practice I propose the
following:

1) Parse the whole file

   Just like lavf/assdec or lavf/jacosubdec, the whole file should be parsed on
   the read_header() callback.

   Why is it done like this? Because in "format" oriented ("ASS"), the events
   can be in any order, require looking ahead, or preprocessing the file; when
   they are muxed ("SSA") the timeline must makes sense, and it doesn't matter
   since this demuxing belongs to the video demuxer.

   JACOsub also has that issue, but SubRip as well (remember the event
   numbers?), and actually all the others (see below).

2) Set missing durations

   Since we now have the complete list of events in a list, it's easy to work
   on them, and we can just set the packets duration when missing that
   information: this actually solves in a very simple way the
   last-to-next-subtitle feature I mentioned several times.

3) Sort the events

   We should then export the sorting of all these subtitles (PTS based) raw
   events from lavf/assdec.c. This way, all the subtitles events will be
   sorted, whatever the format: it will fixe some files, and make things
   simpler to implement.

4) Make a generic read_seek

   We should take out read_seek2() from lavf/assdec.

5) Profit

Any comment?

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120613/d12053f1/attachment.asc>


More information about the ffmpeg-devel mailing list