[FFmpeg-devel] [PATCH 5/6] libzvbi-teletextdec: support multiple teletext pages in a single packet
Michael Niedermayer
michaelni at gmx.at
Tue Oct 15 08:39:36 CEST 2013
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
[...]
also I see no one listed in MAINTAINERS for libzvbi-teletextdec
maybe you want to add yourself as maintainer to it?
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131015/b8cc9dee/attachment.asc>
More information about the ffmpeg-devel
mailing list