[FFmpeg-devel] [PATCH 1/8] lavf: add internal demuxer helpers for subtitles.

Clément Bœsch ubitux at gmail.com
Thu Jun 21 20:17:13 CEST 2012

On Tue, Jun 19, 2012 at 10:31:13PM +0200, Nicolas George wrote:
> Le primidi 1er messidor, an CCXX, Clément Bœsch a écrit :
> > That's not the only reasons: event will always be a null terminated string
> > (yes I fixed the doxy-comment), and len is the length, not the size (it
> > doesn't count the zero, and is used to avoid some calls to strlen).
> Do you actually need that, except for the merge part?

Sane strings, mainly to simplify debug purpose ("did I insert the string
correctly in the queue? let's print it.").

> Also, note that currently, the text subtitles packets do not include the
> terminating NUL character, while your ff_subtitles_queue_read_packet
> includes it.

It greatly simplifies the decoders to do so... I think if I actually
drop the explicit NUL insert, it would work exactly the same because of
the FF_INPUT_BUFFER_PADDING_SIZE filled with zeros.

> > But they are, in the sense that it only works with strings and they're
> > meant to be a full list of "text events" ordered by time (and pos).
> I do not see what makes them only work for strings.

Mmh indeed, re-thinking of this it should indeed works with binary too. It
was designed for text purpose in mind though. I could add some debug
function call printing the event in it for instance.

Of course, all of this could be part of lavf/utils.c, as a generic way of
making a list of AVPackets. But I find these helpers useful and explicit
for this specific case (text sub), so I don't think it hurts.

OTOH, I'm not that blind and I realize a few persons here believe it would
be better to make them generic, using AVPacket, changing naming to work
with any abstract packet data etc. If you guys think the memory usage and
the other arguments are not worth creating that interface, I may take the
time this week end to rework the patchset.

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/20120621/036fa48d/attachment.asc>

More information about the ffmpeg-devel mailing list