[FFmpeg-devel] [PATCH 5/6] libzvbi-teletextdec: support multiple teletext pages in a single packet
Marton Balint
cus at passwd.hu
Wed Oct 16 02:18:26 CEST 2013
On Tue, 15 Oct 2013, Michael Niedermayer wrote:
> On Sat, Oct 05, 2013 at 07:34:57PM +0200, Marton Balint wrote:
>> After this patch, if a packet contains multiple teletext pages, the teletext
>> decoder can return the fist page and store the remaining pages in memory, and
>> return them to the user on the next calls to avcodec_decode_subtitle2.
>>
>> So on the next call, the decoder obviously will not consume anything from the
>> next packet until its buffer containing teletext pages from the previous packet
>> is not empty.
>>
>> Unfortunately libzvbi waits for all lines of a frame before returning any
>> pages, so consuming only partial data from the packet which contained the first
>> page could not be done.
>>
>> Signed-off-by: Marton Balint <cus at passwd.hu>
>> ---
>> libavcodec/libzvbi-teletextdec.c | 91 +++++++++++++++++++++++++++++-----------
>> 1 file changed, 66 insertions(+), 25 deletions(-)
>>
>> diff --git a/libavcodec/libzvbi-teletextdec.c b/libavcodec/libzvbi-teletextdec.c
>> index 2f6714c..b9356cd 100644
>> --- a/libavcodec/libzvbi-teletextdec.c
>> +++ b/libavcodec/libzvbi-teletextdec.c
>> @@ -32,6 +32,14 @@
>> #define VBI_B(rgba) (((rgba) >> 16) & 0xFF)
>> #define VBI_A(rgba) (((rgba) >> 24) & 0xFF)
>>
>> +typedef struct TeletextPage
>> +{
>> + AVSubtitleRect *sub_rect;
>> + int pgno;
>> + int subno;
>> + int64_t pts;
>> +} TeletextPage;
>> +
>> /* main data structure */
>> typedef struct TeletextContext
>> {
>> @@ -47,7 +55,9 @@ typedef struct TeletextContext
>> int chop_spaces;
>>
>> int lines_processed;
>> - AVSubtitleRect *sub_rect;
>> + TeletextPage *pages;
>> + int nb_pages;
>> + int64_t pts;
>>
>> vbi_decoder * vbi;
>> vbi_dvb_demux * dx;
>
>> @@ -72,11 +82,19 @@ chop_spaces_utf8(const unsigned char* t, int len)
>> return len;
>> }
>>
>> +static void
>> +subtitle_rect_free(AVSubtitleRect *sub_rect)
>> +{
>> + av_free(sub_rect->pict.data[0]);
>> + av_free(sub_rect->pict.data[1]);
>> + av_free(sub_rect->text);
>> + av_free(sub_rect);
>> +}
>
> av_freep() would ensure no freed pointers remain
> similarly **sub_rect could be used as argument to NULL that too
Okay, will do.
>
> [...]
>
> also I see no one listed in MAINTAINERS for libzvbi-teletextdec
> maybe you want to add yourself as maintainer to it?
Okay, will do that too, and I will set up a new branch on github for my
teletext patches.
Regards,
Marton
More information about the ffmpeg-devel
mailing list