[FFmpeg-devel] [RFC] General design for subtitles demuxers
ubitux at gmail.com
Wed Jun 13 19:59:39 CEST 2012
On Wed, Jun 13, 2012 at 05:34:26PM +0200, Wolfram Gloger wrote:
> Clément Bœsch <ubitux at gmail.com> writes:
> > It might be a possibility, though, from a demuxer point of view, this list
> > will be used to create AVPacket (in the read_packet() callback). Which
> > will then be used by the main application to create an AVPacket. So the
> > situation will looks like:
> > AVSubtitles (demux/read_header) -> AVPacket (demux/read_packet) -> AVSubtitles (decode)
> > Sure we can do that (AVSubtitles stores the start & end, and we can put
> > some text in it), but it looks very confusing.
> > OTOH, we could use AVPacket directly: read_header() constructs a list of
> > read-to-use AVPacket (pts, duration and data are in it), and we can raise
> > them directly. It should also works for bitmap-based subtitles demuxer.
> Maybe I misunderstood you, but as I see it all you want is that
> read_header() for pure subtitle formats reads all packets in one go and
> queues them up. Sounds fine, but please use the existing infrastructure
> libavformat/utils.c:add_to_pktbuf() (something like
> ff_add_to_pktbuf(AVFormatContext *s, AVPacket *p) would need to be newly
> exported) and for the computation of the durations
> update_initial_durations() would probably best be extended.
Thanks for the hint, that could do the trick, but unfortunately sorting
the entries will be more complex: AVPacketList, as the name suggests, is a
list, and not an array, so you need something more complicated than just
using qsort() to sort the events.
I though about adding a insert_sort flag add_to_pktbuf(), but that won't
work because the durations must be set on the unsorted list.
IMO it's simpler to create an array, set a simple loop to set the
durations, and then qsort() the array.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 490 bytes
Desc: not available
More information about the ffmpeg-devel