[FFmpeg-devel] [PATCH 09/11] libzvbi-teletextdec: output ass subtitles instead of plain text

Marton Balint cus at passwd.hu
Sun Nov 10 20:05:41 CET 2013



On Sun, 10 Nov 2013, Clément Bœsch wrote:

> On Sat, Nov 09, 2013 at 01:06:38PM +0100, Marton Balint wrote:
> [...]
>>>> +{
>>>> +    int ret;
>>>> +    AVBPrint buf, buf2;
>>>> +    const int ts_start    = av_rescale_q(ctx->pts,          AV_TIME_BASE_Q,        (AVRational){1, 100});
>>>> +    const int ts_duration = av_rescale_q(ctx->sub_duration, (AVRational){1, 1000}, (AVRational){1, 100});
>>>> +
>>>
>>>> +    av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
>>>> +    ff_ass_bprint_text_event(&buf, text, strlen(text), "", 0);
>>>> +
>>>> +    if (!av_bprint_is_complete(&buf)) {
>>>> +        av_bprint_finalize(&buf, NULL);
>>>> +        return AVERROR(ENOMEM);
>>>> +    }
>>>
>>> Sorry but what is this buf indirection for?
>>>
>
> I was just wondering about the double ff_ass_* but didn't realized one
> block was for the markup only and second one of ASS dialogs. You might
> want to add a comment above each of the blocks.

Okay, will do, thanks.

Marton

>
>>
>> What do you mean? ff_ass_bprint_text_event returns the escaped text in buf.
>> Am I missing something?
>>
>>>> +
>>>> +    av_bprint_init(&buf2, 0, AV_BPRINT_SIZE_UNLIMITED);
>>>> +    ff_ass_bprint_dialog(&buf2, buf.str, ts_start, ts_duration, 0);
>>>> +    av_bprint_finalize(&buf, NULL);
>>>> +
>>>> +    if (!av_bprint_is_complete(&buf2)) {
>>>> +        av_bprint_finalize(&buf2, NULL);
>>>> +        return AVERROR(ENOMEM);
>>>> +    }
>>>> +
>>>> +    if ((ret = av_bprint_finalize(&buf2, ass)) < 0)
>>>> +        return ret;
>>>> +
>>>> +    return 0;
>>>> +}
>>>> +
>>> [...]
>>>
>>> Should be OK otherwise
>>>
>
> -- 
> Clément B.
>


More information about the ffmpeg-devel mailing list