static void sub2video_update(InputStream *ist, AVSubtitle *sub)

{

    AVFrame *frame = ist->sub2video.frame;

    int8_t *dst;

    int     dst_linesize;

    int num_rects, i;

    int64_t pts, end_pts;



    if (!frame)

        return;

    if (sub) {

        pts       = av_rescale_q(sub->pts + sub->start_display_time * 1000LL,

                                 AV_TIME_BASE_Q, ist->st->time_base);

        end_pts   = av_rescale_q(sub->pts + sub->end_display_time   * 1000LL,

                                 AV_TIME_BASE_Q, ist->st->time_base);

        num_rects = sub->num_rects;

    } else {

        pts       = ist->sub2video.end_pts;

        end_pts   = INT64_MAX;

        num_rects = 0;

    }

    if (sub2video_get_blank_frame(ist) < 0) {

        av_log(ist->dec_ctx, AV_LOG_ERROR,

               "Impossible to get a blank canvas.\n");

        return;

    }

    dst          = frame->data    [0];

    dst_linesize = frame->linesize[0];

    for (i = 0; i < num_rects; i++)

        sub2video_copy_rect(dst, dst_linesize, frame->width, frame->height, sub->rects[i]);

    sub2video_push_ref(ist, pts);

    ist->sub2video.end_pts = end_pts;

}

static void sub2video_update(InputStream *ist, AVSubtitle *sub)

{

    AVFrame *frame = ist->sub2video.frame;

    int8_t *dst;

    int     dst_linesize;

    int num_rects, i;

    int64_t pts, end_pts;



    if (!frame)

        return;

    if (sub) {

        pts       = av_rescale_q(sub->pts + sub->start_display_time * 1000LL,

                                 AV_TIME_BASE_Q, ist->st->time_base);

        end_pts   = av_rescale_q(sub->pts + sub->end_display_time   * 1000LL,

                                 AV_TIME_BASE_Q, ist->st->time_base);

        num_rects = sub->num_rects;

    } else {

        pts       = ist->sub2video.end_pts;

        end_pts   = INT64_MAX;

        num_rects = 0;

    }

    if (sub2video_get_blank_frame(ist) < 0) {

        av_log(ist->dec_ctx, AV_LOG_ERROR,

               "Impossible to get a blank canvas.\n");

        return;

    }

    dst          = frame->data    [0];

    dst_linesize = frame->linesize[0];

    for (i = 0; i < num_rects; i++)

        sub2video_copy_rect(dst, dst_linesize, frame->width, frame->height, sub->rects[i]);

    sub2video_push_ref(ist, pts);

    ist->sub2video.end_pts = end_pts;

}

static void FUNC_0(InputStream *VAR_0, AVSubtitle *VAR_1)

{

    AVFrame *frame = VAR_0->sub2video.frame;

    int8_t *dst;

    int     VAR_2;

    int VAR_3, VAR_4;

    int64_t pts, end_pts;



    if (!frame)

        return;

    if (VAR_1) {

        pts       = av_rescale_q(VAR_1->pts + VAR_1->start_display_time * 1000LL,

                                 AV_TIME_BASE_Q, VAR_0->st->time_base);

        end_pts   = av_rescale_q(VAR_1->pts + VAR_1->end_display_time   * 1000LL,

                                 AV_TIME_BASE_Q, VAR_0->st->time_base);

        VAR_3 = VAR_1->VAR_3;

    } else {

        pts       = VAR_0->sub2video.end_pts;

        end_pts   = INT64_MAX;

        VAR_3 = 0;

    }

    if (sub2video_get_blank_frame(VAR_0) < 0) {

        av_log(VAR_0->dec_ctx, AV_LOG_ERROR,

               "Impossible to get a blank canvas.\n");

        return;

    }

    dst          = frame->data    [0];

    VAR_2 = frame->linesize[0];

    for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++)

        sub2video_copy_rect(dst, VAR_2, frame->width, frame->height, VAR_1->rects[VAR_4]);

    sub2video_push_ref(VAR_0, pts);

    VAR_0->sub2video.end_pts = end_pts;

}

static void FUNC_0(InputStream *VAR_0, AVSubtitle *VAR_1)
{ AVFrame *frame = VAR_0->sub2video.frame; int8_t *dst; int     VAR_2; int VAR_3, VAR_4; int64_t pts, end_pts; if (!frame)
return; if (VAR_1) { pts       = av_rescale_q(VAR_1->pts + VAR_1->start_display_time * 1000LL,
AV_TIME_BASE_Q, VAR_0->st->time_base); end_pts   = av_rescale_q(VAR_1->pts + VAR_1->end_display_time   * 1000LL,
AV_TIME_BASE_Q, VAR_0->st->time_base); VAR_3 = VAR_1->VAR_3; } else { pts       = VAR_0->sub2video.end_pts; end_pts   = INT64_MAX; VAR_3 = 0; } if (sub2video_get_blank_frame(VAR_0) < 0) { av_log(VAR_0->dec_ctx, AV_LOG_ERROR,
"Impossible to get a blank canvas.\n"); return; } dst          = frame->data    [0]; VAR_2 = frame->linesize[0]; for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) sub2video_copy_rect(dst, VAR_2, frame->width, frame->height, VAR_1->rects[VAR_4]); sub2video_push_ref(VAR_0, pts); VAR_0->sub2video.end_pts = end_pts; }