[FFmpeg-devel] [RFC] General design for subtitles demuxers
Clément Bœsch
ubitux at gmail.com
Wed Jun 13 09:02:36 CEST 2012
On Wed, Jun 13, 2012 at 08:53:27AM +0200, Nicolas George wrote:
> Le sextidi 26 prairial, an CCXX, Clément Bœsch a écrit :
> > 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
>
>
> Until now, I agree at 100%.
>
Great. I'll see what I can do on this ASAP then.
> > events from lavf/assdec.c.
>
> This part I am not sure I understand. Do you mean that the demuxer is
> supposed to translate into ASS?
>
I'm just refering here to:
static int event_cmp(uint8_t **a, uint8_t **b)
{
return get_pts(*a) - get_pts(*b);
}
[...]
qsort(ass->event, ass->event_count, sizeof(*ass->event), (void*)event_cmp);
> > We should take out read_seek2() from lavf/assdec.
>
> Looks reasonable.
>
We just need to find a better way of storing the events & pts; maybe to
something simple like
typedef struct {
int64_t pts;
uint8_t *data;
} FFSubtitle;
We will BTW be able to have a generic read_packet() as well, and greatly
simplify again all this stuff.
--
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/ed12c627/attachment.asc>
More information about the ffmpeg-devel
mailing list