On Fri, 13 Jun 2014 07:56:23 -0700, John Stebbins <[email protected]> 
wrote:
> Add ability to handle multiple palettes and objects simultaneously.
> Each simultaneous object is given its own AVSubtitleRect.
> Note that there can be up to 64 currently valid objects, but only
> 2 at any one time can be "presented".
> ---
> @@ -369,43 +489,72 @@ static int display_end_segment(AVCodecContext *avctx, 
> void *data,
>      memset(sub, 0, sizeof(*sub));
>      sub->pts = ctx->presentation.pts;
>  
> -    // Blank if last object_number was 0.
> +    // Blank if last object_count was 0.
>      // Note that this may be wrong for more complex subtitles.
> -    if (!ctx->presentation.object_number)
> +    if (!ctx->presentation.object_count)
>          return 1;
>      sub->start_display_time = 0;
>      sub->end_display_time   = 20000;
>      sub->format             = 0;
>  
> -    sub->rects     = av_mallocz(sizeof(*sub->rects));
> -    sub->rects[0]  = av_mallocz(sizeof(*sub->rects[0]));
> -    sub->num_rects = 1;
> -
> -    if (ctx->presentation.composition_flag & 0x40)
> -        sub->rects[0]->flags |= AV_SUBTITLE_FLAG_FORCED;
> +    sub->num_rects = ctx->presentation.object_count;
> +    sub->rects     = av_mallocz(sizeof(*sub->rects) * sub->num_rects);
> +    if (!sub->rects) {
> +        return -1;

>From looking at the code, it seems that returning negative numbers from this
function won't work as expected.
Also, shouldn't you free sub->rects on failure here?

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to