int ff_ass_add_rect(AVSubtitle *sub, const char *dialog,

                    int ts_start, int duration, int raw)

{

    AVBPrint buf;

    int ret, dlen;

    AVSubtitleRect **rects;



    av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);

    if ((ret = ff_ass_bprint_dialog(&buf, dialog, ts_start, duration, raw)) < 0)

        goto err;

    dlen = ret;

    if (!av_bprint_is_complete(&buf))




    rects = av_realloc_array(sub->rects, (sub->num_rects+1), sizeof(*sub->rects));

    if (!rects)


    sub->rects = rects;

    sub->end_display_time = FFMAX(sub->end_display_time, 10 * duration);

    rects[sub->num_rects]       = av_mallocz(sizeof(*rects[0]));



    rects[sub->num_rects]->type = SUBTITLE_ASS;

    ret = av_bprint_finalize(&buf, &rects[sub->num_rects]->ass);

    if (ret < 0)

        goto err;

    sub->num_rects++;

    return dlen;



errnomem:

    ret = AVERROR(ENOMEM);

err:

    av_bprint_finalize(&buf, NULL);

    return ret;

}
int ff_ass_add_rect(AVSubtitle *sub, const char *dialog,

                    int ts_start, int duration, int raw)

{

    AVBPrint buf;

    int ret, dlen;

    AVSubtitleRect **rects;



    av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);

    if ((ret = ff_ass_bprint_dialog(&buf, dialog, ts_start, duration, raw)) < 0)

        goto err;

    dlen = ret;

    if (!av_bprint_is_complete(&buf))




    rects = av_realloc_array(sub->rects, (sub->num_rects+1), sizeof(*sub->rects));

    if (!rects)


    sub->rects = rects;

    sub->end_display_time = FFMAX(sub->end_display_time, 10 * duration);

    rects[sub->num_rects]       = av_mallocz(sizeof(*rects[0]));



    rects[sub->num_rects]->type = SUBTITLE_ASS;

    ret = av_bprint_finalize(&buf, &rects[sub->num_rects]->ass);

    if (ret < 0)

        goto err;

    sub->num_rects++;

    return dlen;



errnomem:

    ret = AVERROR(ENOMEM);

err:

    av_bprint_finalize(&buf, NULL);

    return ret;

}
int FUNC_0(AVSubtitle *VAR_0, const char *VAR_1,

                    int VAR_2, int VAR_3, int VAR_4)

{

    AVBPrint buf;

    int VAR_5, VAR_6;

    AVSubtitleRect **rects;



    av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);

    if ((VAR_5 = ff_ass_bprint_dialog(&buf, VAR_1, VAR_2, VAR_3, VAR_4)) < 0)

        goto err;

    VAR_6 = VAR_5;

    if (!av_bprint_is_complete(&buf))




    rects = av_realloc_array(VAR_0->rects, (VAR_0->num_rects+1), sizeof(*VAR_0->rects));

    if (!rects)


    VAR_0->rects = rects;

    VAR_0->end_display_time = FFMAX(VAR_0->end_display_time, 10 * VAR_3);

    rects[VAR_0->num_rects]       = av_mallocz(sizeof(*rects[0]));



    rects[VAR_0->num_rects]->type = SUBTITLE_ASS;

    VAR_5 = av_bprint_finalize(&buf, &rects[VAR_0->num_rects]->ass);

    if (VAR_5 < 0)

        goto err;

    VAR_0->num_rects++;

    return VAR_6;



errnomem:

    VAR_5 = AVERROR(ENOMEM);

err:

    av_bprint_finalize(&buf, NULL);

    return VAR_5;

}
int FUNC_0(AVSubtitle *VAR_0, const char *VAR_1,
int VAR_2, int VAR_3, int VAR_4)
{ AVBPrint buf; int VAR_5, VAR_6; AVSubtitleRect **rects; av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED); if ((VAR_5 = ff_ass_bprint_dialog(&buf, VAR_1, VAR_2, VAR_3, VAR_4)) < 0)
goto err; VAR_6 = VAR_5; if (!av_bprint_is_complete(&buf))
rects = av_realloc_array(VAR_0->rects, (VAR_0->num_rects+1), sizeof(*VAR_0->rects)); if (!rects)
VAR_0->rects = rects; VAR_0->end_display_time = FFMAX(VAR_0->end_display_time, 10 * VAR_3); rects[VAR_0->num_rects]       = av_mallocz(sizeof(*rects[0])); rects[VAR_0->num_rects]->type = SUBTITLE_ASS; VAR_5 = av_bprint_finalize(&buf, &rects[VAR_0->num_rects]->ass); if (VAR_5 < 0)
goto err; VAR_0->num_rects++; return VAR_6; errnomem:
VAR_5 = AVERROR(ENOMEM); err:
av_bprint_finalize(&buf, NULL); return VAR_5; }