static int sub2video_prepare(InputStream *ist)

{

    AVFormatContext *avf = input_files[ist->file_index]->ctx;

    int i, w, h;



    /* Compute the size of the canvas for the subtitles stream.

       If the subtitles codec has set a size, use it. Otherwise use the

       maximum dimensions of the video streams in the same file. */

    w = ist->dec_ctx->width;

    h = ist->dec_ctx->height;

    if (!(w && h)) {

        for (i = 0; i < avf->nb_streams; i++) {

            if (avf->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {

                w = FFMAX(w, avf->streams[i]->codec->width);

                h = FFMAX(h, avf->streams[i]->codec->height);

            }

        }

        if (!(w && h)) {

            w = FFMAX(w, 720);

            h = FFMAX(h, 576);

        }

        av_log(avf, AV_LOG_INFO, "sub2video: using %dx%d canvas\n", w, h);

    }

    ist->sub2video.w = ist->dec_ctx->width  = ist->resample_width  = w;

    ist->sub2video.h = ist->dec_ctx->height = ist->resample_height = h;



    /* rectangles are AV_PIX_FMT_PAL8, but we have no guarantee that the

       palettes for all rectangles are identical or compatible */

    ist->resample_pix_fmt = ist->dec_ctx->pix_fmt = AV_PIX_FMT_RGB32;



    ist->sub2video.frame = av_frame_alloc();

    if (!ist->sub2video.frame)

        return AVERROR(ENOMEM);

    ist->sub2video.last_pts = INT64_MIN;

    return 0;

}

static int sub2video_prepare(InputStream *ist)

{

    AVFormatContext *avf = input_files[ist->file_index]->ctx;

    int i, w, h;



    





    w = ist->dec_ctx->width;

    h = ist->dec_ctx->height;

    if (!(w && h)) {

        for (i = 0; i < avf->nb_streams; i++) {

            if (avf->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {

                w = FFMAX(w, avf->streams[i]->codec->width);

                h = FFMAX(h, avf->streams[i]->codec->height);

            }

        }

        if (!(w && h)) {

            w = FFMAX(w, 720);

            h = FFMAX(h, 576);

        }

        av_log(avf, AV_LOG_INFO, "sub2video: using %dx%d canvas\n", w, h);

    }

    ist->sub2video.w = ist->dec_ctx->width  = ist->resample_width  = w;

    ist->sub2video.h = ist->dec_ctx->height = ist->resample_height = h;



    



    ist->resample_pix_fmt = ist->dec_ctx->pix_fmt = AV_PIX_FMT_RGB32;



    ist->sub2video.frame = av_frame_alloc();

    if (!ist->sub2video.frame)

        return AVERROR(ENOMEM);

    ist->sub2video.last_pts = INT64_MIN;

    return 0;

}

static int FUNC_0(InputStream *VAR_0)

{

    AVFormatContext *avf = input_files[VAR_0->file_index]->ctx;

    int VAR_1, VAR_2, VAR_3;



    





    VAR_2 = VAR_0->dec_ctx->width;

    VAR_3 = VAR_0->dec_ctx->height;

    if (!(VAR_2 && VAR_3)) {

        for (VAR_1 = 0; VAR_1 < avf->nb_streams; VAR_1++) {

            if (avf->streams[VAR_1]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {

                VAR_2 = FFMAX(VAR_2, avf->streams[VAR_1]->codec->width);

                VAR_3 = FFMAX(VAR_3, avf->streams[VAR_1]->codec->height);

            }

        }

        if (!(VAR_2 && VAR_3)) {

            VAR_2 = FFMAX(VAR_2, 720);

            VAR_3 = FFMAX(VAR_3, 576);

        }

        av_log(avf, AV_LOG_INFO, "sub2video: using %dx%d canvas\n", VAR_2, VAR_3);

    }

    VAR_0->sub2video.VAR_2 = VAR_0->dec_ctx->width  = VAR_0->resample_width  = VAR_2;

    VAR_0->sub2video.VAR_3 = VAR_0->dec_ctx->height = VAR_0->resample_height = VAR_3;



    



    VAR_0->resample_pix_fmt = VAR_0->dec_ctx->pix_fmt = AV_PIX_FMT_RGB32;



    VAR_0->sub2video.frame = av_frame_alloc();

    if (!VAR_0->sub2video.frame)

        return AVERROR(ENOMEM);

    VAR_0->sub2video.last_pts = INT64_MIN;

    return 0;

}

static int FUNC_0(InputStream *VAR_0)
{ AVFormatContext *avf = input_files[VAR_0->file_index]->ctx; int VAR_1, VAR_2, VAR_3; VAR_2 = VAR_0->dec_ctx->width; VAR_3 = VAR_0->dec_ctx->height; if (!(VAR_2 && VAR_3)) { for (VAR_1 = 0; VAR_1 < avf->nb_streams; VAR_1++) { if (avf->streams[VAR_1]->codec->codec_type == AVMEDIA_TYPE_VIDEO) { VAR_2 = FFMAX(VAR_2, avf->streams[VAR_1]->codec->width); VAR_3 = FFMAX(VAR_3, avf->streams[VAR_1]->codec->height); } } if (!(VAR_2 && VAR_3)) { VAR_2 = FFMAX(VAR_2, 720); VAR_3 = FFMAX(VAR_3, 576); } av_log(avf, AV_LOG_INFO, "sub2video: using %dx%d canvas\n", VAR_2, VAR_3); } VAR_0->sub2video.VAR_2 = VAR_0->dec_ctx->width  = VAR_0->resample_width  = VAR_2; VAR_0->sub2video.VAR_3 = VAR_0->dec_ctx->height = VAR_0->resample_height = VAR_3; VAR_0->resample_pix_fmt = VAR_0->dec_ctx->pix_fmt = AV_PIX_FMT_RGB32; VAR_0->sub2video.frame = av_frame_alloc(); if (!VAR_0->sub2video.frame)
return AVERROR(ENOMEM); VAR_0->sub2video.last_pts = INT64_MIN; return 0; }