static int poll_filter(OutputStream *ost)

{

    OutputFile    *of = output_files[ost->file_index];

    AVFrame *filtered_frame = NULL;

    int frame_size, ret;



    if (!ost->filtered_frame && !(ost->filtered_frame = avcodec_alloc_frame())) {

        return AVERROR(ENOMEM);

    } else

        avcodec_get_frame_defaults(ost->filtered_frame);

    filtered_frame = ost->filtered_frame;



    if (ost->enc->type == AVMEDIA_TYPE_AUDIO &&

        !(ost->enc->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE))

        ret = av_buffersink_get_samples(ost->filter->filter, filtered_frame,

                                         ost->st->codec->frame_size);

    else

        ret = av_buffersink_get_frame(ost->filter->filter, filtered_frame);



    if (ret < 0)

        return ret;



    if (filtered_frame->pts != AV_NOPTS_VALUE) {

        filtered_frame->pts = av_rescale_q(filtered_frame->pts,

                                           ost->filter->filter->inputs[0]->time_base,

                                           ost->st->codec->time_base) -

                              av_rescale_q(of->start_time,

                                           AV_TIME_BASE_Q,

                                           ost->st->codec->time_base);

    }



    switch (ost->filter->filter->inputs[0]->type) {

    case AVMEDIA_TYPE_VIDEO:

        if (!ost->frame_aspect_ratio)

            ost->st->codec->sample_aspect_ratio = filtered_frame->sample_aspect_ratio;



        do_video_out(of->ctx, ost, filtered_frame, &frame_size);

        if (vstats_filename && frame_size)

            do_video_stats(ost, frame_size);

        break;

    case AVMEDIA_TYPE_AUDIO:

        do_audio_out(of->ctx, ost, filtered_frame);

        break;

    default:

        // TODO support subtitle filters

        av_assert0(0);

    }



    av_frame_unref(filtered_frame);



    return 0;

}

static int poll_filter(OutputStream *ost)

{

    OutputFile    *of = output_files[ost->file_index];

    AVFrame *filtered_frame = NULL;

    int frame_size, ret;



    if (!ost->filtered_frame && !(ost->filtered_frame = avcodec_alloc_frame())) {

        return AVERROR(ENOMEM);

    } else

        avcodec_get_frame_defaults(ost->filtered_frame);

    filtered_frame = ost->filtered_frame;



    if (ost->enc->type == AVMEDIA_TYPE_AUDIO &&

        !(ost->enc->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE))

        ret = av_buffersink_get_samples(ost->filter->filter, filtered_frame,

                                         ost->st->codec->frame_size);

    else

        ret = av_buffersink_get_frame(ost->filter->filter, filtered_frame);



    if (ret < 0)

        return ret;



    if (filtered_frame->pts != AV_NOPTS_VALUE) {

        filtered_frame->pts = av_rescale_q(filtered_frame->pts,

                                           ost->filter->filter->inputs[0]->time_base,

                                           ost->st->codec->time_base) -

                              av_rescale_q(of->start_time,

                                           AV_TIME_BASE_Q,

                                           ost->st->codec->time_base);

    }



    switch (ost->filter->filter->inputs[0]->type) {

    case AVMEDIA_TYPE_VIDEO:

        if (!ost->frame_aspect_ratio)

            ost->st->codec->sample_aspect_ratio = filtered_frame->sample_aspect_ratio;



        do_video_out(of->ctx, ost, filtered_frame, &frame_size);

        if (vstats_filename && frame_size)

            do_video_stats(ost, frame_size);

        break;

    case AVMEDIA_TYPE_AUDIO:

        do_audio_out(of->ctx, ost, filtered_frame);

        break;

    default:

        

        av_assert0(0);

    }



    av_frame_unref(filtered_frame);



    return 0;

}

static int FUNC_0(OutputStream *VAR_0)

{

    OutputFile    *of = output_files[VAR_0->file_index];

    AVFrame *filtered_frame = NULL;

    int VAR_1, VAR_2;



    if (!VAR_0->filtered_frame && !(VAR_0->filtered_frame = avcodec_alloc_frame())) {

        return AVERROR(ENOMEM);

    } else

        avcodec_get_frame_defaults(VAR_0->filtered_frame);

    filtered_frame = VAR_0->filtered_frame;



    if (VAR_0->enc->type == AVMEDIA_TYPE_AUDIO &&

        !(VAR_0->enc->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE))

        VAR_2 = av_buffersink_get_samples(VAR_0->filter->filter, filtered_frame,

                                         VAR_0->st->codec->VAR_1);

    else

        VAR_2 = av_buffersink_get_frame(VAR_0->filter->filter, filtered_frame);



    if (VAR_2 < 0)

        return VAR_2;



    if (filtered_frame->pts != AV_NOPTS_VALUE) {

        filtered_frame->pts = av_rescale_q(filtered_frame->pts,

                                           VAR_0->filter->filter->inputs[0]->time_base,

                                           VAR_0->st->codec->time_base) -

                              av_rescale_q(of->start_time,

                                           AV_TIME_BASE_Q,

                                           VAR_0->st->codec->time_base);

    }



    switch (VAR_0->filter->filter->inputs[0]->type) {

    case AVMEDIA_TYPE_VIDEO:

        if (!VAR_0->frame_aspect_ratio)

            VAR_0->st->codec->sample_aspect_ratio = filtered_frame->sample_aspect_ratio;



        do_video_out(of->ctx, VAR_0, filtered_frame, &VAR_1);

        if (vstats_filename && VAR_1)

            do_video_stats(VAR_0, VAR_1);

        break;

    case AVMEDIA_TYPE_AUDIO:

        do_audio_out(of->ctx, VAR_0, filtered_frame);

        break;

    default:

        

        av_assert0(0);

    }



    av_frame_unref(filtered_frame);



    return 0;

}

static int FUNC_0(OutputStream *VAR_0)
{ OutputFile    *of = output_files[VAR_0->file_index]; AVFrame *filtered_frame = NULL; int VAR_1, VAR_2; if (!VAR_0->filtered_frame && !(VAR_0->filtered_frame = avcodec_alloc_frame())) { return AVERROR(ENOMEM); } else avcodec_get_frame_defaults(VAR_0->filtered_frame); filtered_frame = VAR_0->filtered_frame; if (VAR_0->enc->type == AVMEDIA_TYPE_AUDIO &&
!(VAR_0->enc->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE))
VAR_2 = av_buffersink_get_samples(VAR_0->filter->filter, filtered_frame,
VAR_0->st->codec->VAR_1); else
VAR_2 = av_buffersink_get_frame(VAR_0->filter->filter, filtered_frame); if (VAR_2 < 0)
return VAR_2; if (filtered_frame->pts != AV_NOPTS_VALUE) { filtered_frame->pts = av_rescale_q(filtered_frame->pts,
VAR_0->filter->filter->inputs[0]->time_base,
VAR_0->st->codec->time_base) -
av_rescale_q(of->start_time,
AV_TIME_BASE_Q,
VAR_0->st->codec->time_base); } switch (VAR_0->filter->filter->inputs[0]->type) { case AVMEDIA_TYPE_VIDEO:
if (!VAR_0->frame_aspect_ratio)
VAR_0->st->codec->sample_aspect_ratio = filtered_frame->sample_aspect_ratio; do_video_out(of->ctx, VAR_0, filtered_frame, &VAR_1); if (vstats_filename && VAR_1)
do_video_stats(VAR_0, VAR_1); break; case AVMEDIA_TYPE_AUDIO:
do_audio_out(of->ctx, VAR_0, filtered_frame); break; default:
av_assert0(0); } av_frame_unref(filtered_frame); return 0; }