[FFmpeg-devel] [RFC] Support multiple frames in a singe AVPacket in avcodec_decode_subtitle2
u at pkh.me
Tue Oct 15 07:30:14 CEST 2013
On Tue, Oct 01, 2013 at 11:16:01PM +0200, Marton Balint wrote:
> When I implemented the DVB teletext decoder, I faced a problem: If
> multiple teletext pages are in a single teletext packet, the decoder
> has no way to return multiple AVSubtitles. So the current decoder
> only return one AVSubtitle in that case, an AVSubtitle containing
> the first decoded page from the packet.
> This is not a problem if the user wants to decode only a single
> teletext page (subtitle page), because the same page is not sent
> twice in a single packet. However, if somebody wants to decode all
> pages, he probably won't be able to do so without losing a page here
> or there.
> I could have split the teletext PES packets (usually around 1472
> bytes) at the demuxer level to 46-byte packets to overcome this, but
> I thought it would be much better to extend the API the same way it
> is used now for audio decoding, where a single packet can contain
> multiple frames.
> If I combine this with CODEC_CAP_DELAY, the teletext decoder can
> store the remaining pages of a teletext packet (unfortunately
> libzvbi parses all pages in the packet in a single pass), and return
> them to the user on the next call to avcodec_decode_subtitle2. In
> that case the decoder obviously would not consume anything from the
> next packet until its buffer containing teletext pages from the
> previous packet is not empty.
> If we do this, we will have to make sure that the current subtitle
> decoders will always return the full buffer size as the number of
> consumed bytes. I've checked, and it seems that only 3 decoders are
> problematic, but they only need a one-line patch to fix them.
> Movtext (patch is already on the mailing list), srtdec and dvbsub
> are the three.
> So, what do you think?
I think that's a good thing; and we might actually require something like
this for DVB subtitles (see the hack in ffmpeg.c).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 490 bytes
Desc: not available
More information about the ffmpeg-devel