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

Diego Biurrun diego
Mon Jul 27 12:55:00 CEST 2009


On Mon, Jul 27, 2009 at 11:47:39AM +0100, ogg.k.ogg.k at googlemail.com wrote:
> >> > the ASS/SSA subtitle stuff is unfinished, if you want to extend it
> >> > and actually use it thats welcome
> 
> Attached.
> I realized why I was wrong when thinking it'd break API, as client code
> still gets the packet, and call decode themselves.

The build system part is OK, but you are missing documentation and
changelog updates.

I would guesstimate that at least 5 out of 10 people forget
documentation and changelog updates.  Can you give me a hint how to fix
this situation.  Why did you forget?  Where did you miss the
information?

> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -3316,6 +3316,14 @@ attribute_deprecated int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtit
> +/**
> + * Frees memory used by a subtitle structure.
> + * Returns a negative value on error, otherwise non zero.

nonzero

> --- /dev/null
> +++ b/libavcodec/ssadec.c
> @@ -0,0 +1,88 @@
> +
> +// Return the decoded text through the standard api

API

> +    sub->format = 1; // TODO ?
> +    sub->start_display_time = avpkt->pts;
> +    sub->end_display_time = avpkt->pts + avpkt->duration;
> +    sub->num_rects = 1;
> +    sub->rects = av_mallocz(sizeof(*sub->rects));
> +    sub->rects[0] = av_mallocz(sizeof(*sub->rects[0]));
> +
> +    rect = sub->rects[0];
> +    rect->type = SUBTITLE_ASS;
> +    rect->ass = av_malloc(buf_size+1);
> +    memcpy(rect->ass, buf, buf_size);
> +    rect->ass[buf_size] = 0;

some of this could be aligned

> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -655,6 +655,32 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
>  
> +    for (n=0; n<sub->num_rects; n++) {

This would be more readable with some spaces around operators, same
below.

Diego



More information about the ffmpeg-devel mailing list