[FFmpeg-devel] [PATCH] Decoding of raw UTF-8 text from Ogg streams

Michael Niedermayer michaelni
Tue Jul 28 11:10:44 CEST 2009


On Mon, Jul 27, 2009 at 03:18:06PM +0100, ogg.k.ogg.k at googlemail.com wrote:
> > 2 remarks I forgot last time:
> 
> Done.

>  Changelog              |    1 
>  doc/APIchanges         |    3 +
>  doc/general.texi       |    2 -
>  libavcodec/Makefile    |    1 
>  libavcodec/allcodecs.c |    1 
>  libavcodec/avcodec.h   |   10 +++++
>  libavcodec/ssadec.c    |   84 +++++++++++++++++++++++++++++++++++++++++++++++++
>  libavcodec/utils.c     |   25 ++++++++++++++
>  8 files changed, 125 insertions(+), 2 deletions(-)
> 24b474f88a7e42470d6479eece6a065224f47261  0001-Add-a-simple-ASS-SSA-decoder.patch
> From 4449414a3ba9b13f37b697f337ae8b81e836b9a9 Mon Sep 17 00:00:00 2001
> From: ogg.k.ogg.k <ogg.k.ogg.k at googlemail.com>
> Date: Sun, 26 Jul 2009 21:27:22 +0100
> Subject: [PATCH] Add a simple ASS/SSA decoder
>  Add avcodec_free_subtitle
> 
[...]
> +    sub->start_display_time = avpkt->pts;
> +    sub->end_display_time   = avpkt->pts + avpkt->duration;

this doesnt look correct


[...]
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -655,6 +655,31 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
>      return ret;
>  }
>  
> +int avcodec_free_subtitle(AVCodecContext *avctx, AVSubtitle *sub)
> +{
> +    unsigned int n;
> +
> +    if (!sub || !sub->num_rects)
> +        return 0;
> +
> +    for (n = 0; n < sub->num_rects; n++) {
> +        AVSubtitleRect *r = sub->rects[n];
> +        AVPicture *pic;
> +        if (r) {
> +            unsigned int d;
> +
> +            av_free(r->text);
> +            av_free(r->ass);
> +            pic = &r->pict;
> +            for (d = 0; d < FF_ARRAY_ELEMS(pic->data); d++) {
> +                av_free(pic->data[n]);
> +            }
> +        }
> +    }

i think av_freep() is better as its safer against mistaken use

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090728/0637bff1/attachment.pgp>



More information about the ffmpeg-devel mailing list