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

Clément Bœsch u at pkh.me
Sun Nov 10 19:00:18 CET 2013


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.

> 
> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131110/8c986039/attachment.asc>


More information about the ffmpeg-devel mailing list