static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const char *filename)

{

    int i, err;

    AVFormatContext *ic = avformat_alloc_context();





    ic->interrupt_callback = int_cb;

    err = avformat_open_input(&ic, filename, NULL, NULL);

    if (err < 0)

        return err;

    /* copy stream format */

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

        AVStream *st;

        OutputStream *ost;

        AVCodec *codec;

        const char *enc_config;



        codec = avcodec_find_encoder(ic->streams[i]->codecpar->codec_id);

        if (!codec) {

            av_log(s, AV_LOG_ERROR, "no encoder found for codec id %i\n", ic->streams[i]->codecpar->codec_id);

            return AVERROR(EINVAL);

        }

        if (codec->type == AVMEDIA_TYPE_AUDIO)

            opt_audio_codec(o, "c:a", codec->name);

        else if (codec->type == AVMEDIA_TYPE_VIDEO)

            opt_video_codec(o, "c:v", codec->name);

        ost   = new_output_stream(o, s, codec->type, -1);

        st    = ost->st;



        avcodec_get_context_defaults3(st->codec, codec);

        enc_config = av_stream_get_recommended_encoder_configuration(ic->streams[i]);

        if (enc_config) {

            AVDictionary *opts = NULL;

            av_dict_parse_string(&opts, enc_config, "=", ",", 0);

            av_opt_set_dict2(st->codec, &opts, AV_OPT_SEARCH_CHILDREN);

            av_dict_free(&opts);

        }



        if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy)

            choose_sample_fmt(st, codec);

        else if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy)

            choose_pixel_fmt(st, st->codec, codec, st->codecpar->format);

        avcodec_copy_context(ost->enc_ctx, st->codec);

        if (enc_config)

            av_dict_parse_string(&ost->encoder_opts, enc_config, "=", ",", 0);

    }



    avformat_close_input(&ic);

    return err;

}
static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const char *filename)

{

    int i, err;

    AVFormatContext *ic = avformat_alloc_context();





    ic->interrupt_callback = int_cb;

    err = avformat_open_input(&ic, filename, NULL, NULL);

    if (err < 0)

        return err;

    

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

        AVStream *st;

        OutputStream *ost;

        AVCodec *codec;

        const char *enc_config;



        codec = avcodec_find_encoder(ic->streams[i]->codecpar->codec_id);

        if (!codec) {

            av_log(s, AV_LOG_ERROR, "no encoder found for codec id %i\n", ic->streams[i]->codecpar->codec_id);

            return AVERROR(EINVAL);

        }

        if (codec->type == AVMEDIA_TYPE_AUDIO)

            opt_audio_codec(o, "c:a", codec->name);

        else if (codec->type == AVMEDIA_TYPE_VIDEO)

            opt_video_codec(o, "c:v", codec->name);

        ost   = new_output_stream(o, s, codec->type, -1);

        st    = ost->st;



        avcodec_get_context_defaults3(st->codec, codec);

        enc_config = av_stream_get_recommended_encoder_configuration(ic->streams[i]);

        if (enc_config) {

            AVDictionary *opts = NULL;

            av_dict_parse_string(&opts, enc_config, "=", ",", 0);

            av_opt_set_dict2(st->codec, &opts, AV_OPT_SEARCH_CHILDREN);

            av_dict_free(&opts);

        }



        if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy)

            choose_sample_fmt(st, codec);

        else if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy)

            choose_pixel_fmt(st, st->codec, codec, st->codecpar->format);

        avcodec_copy_context(ost->enc_ctx, st->codec);

        if (enc_config)

            av_dict_parse_string(&ost->encoder_opts, enc_config, "=", ",", 0);

    }



    avformat_close_input(&ic);

    return err;

}
static int FUNC_0(OptionsContext *VAR_0, AVFormatContext *VAR_1, const char *VAR_2)

{

    int VAR_3, VAR_4;

    AVFormatContext *ic = avformat_alloc_context();





    ic->interrupt_callback = int_cb;

    VAR_4 = avformat_open_input(&ic, VAR_2, NULL, NULL);

    if (VAR_4 < 0)

        return VAR_4;

    

    for(VAR_3=0;VAR_3<ic->nb_streams;VAR_3++) {

        AVStream *st;

        OutputStream *ost;

        AVCodec *codec;

        const char *enc_config;



        codec = avcodec_find_encoder(ic->streams[VAR_3]->codecpar->codec_id);

        if (!codec) {

            av_log(VAR_1, AV_LOG_ERROR, "no encoder found for codec id %VAR_3\n", ic->streams[VAR_3]->codecpar->codec_id);

            return AVERROR(EINVAL);

        }

        if (codec->type == AVMEDIA_TYPE_AUDIO)

            opt_audio_codec(VAR_0, "c:a", codec->name);

        else if (codec->type == AVMEDIA_TYPE_VIDEO)

            opt_video_codec(VAR_0, "c:v", codec->name);

        ost   = new_output_stream(VAR_0, VAR_1, codec->type, -1);

        st    = ost->st;



        avcodec_get_context_defaults3(st->codec, codec);

        enc_config = av_stream_get_recommended_encoder_configuration(ic->streams[VAR_3]);

        if (enc_config) {

            AVDictionary *opts = NULL;

            av_dict_parse_string(&opts, enc_config, "=", ",", 0);

            av_opt_set_dict2(st->codec, &opts, AV_OPT_SEARCH_CHILDREN);

            av_dict_free(&opts);

        }



        if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy)

            choose_sample_fmt(st, codec);

        else if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy)

            choose_pixel_fmt(st, st->codec, codec, st->codecpar->format);

        avcodec_copy_context(ost->enc_ctx, st->codec);

        if (enc_config)

            av_dict_parse_string(&ost->encoder_opts, enc_config, "=", ",", 0);

    }



    avformat_close_input(&ic);

    return VAR_4;

}
static int FUNC_0(OptionsContext *VAR_0, AVFormatContext *VAR_1, const char *VAR_2)
{ int VAR_3, VAR_4; AVFormatContext *ic = avformat_alloc_context(); ic->interrupt_callback = int_cb; VAR_4 = avformat_open_input(&ic, VAR_2, NULL, NULL); if (VAR_4 < 0)
return VAR_4; for(VAR_3=0;VAR_3<ic->nb_streams;VAR_3++) { AVStream *st; OutputStream *ost; AVCodec *codec; const char *enc_config; codec = avcodec_find_encoder(ic->streams[VAR_3]->codecpar->codec_id); if (!codec) { av_log(VAR_1, AV_LOG_ERROR, "no encoder found for codec id %VAR_3\n", ic->streams[VAR_3]->codecpar->codec_id); return AVERROR(EINVAL); } if (codec->type == AVMEDIA_TYPE_AUDIO)
opt_audio_codec(VAR_0, "c:a", codec->name); else if (codec->type == AVMEDIA_TYPE_VIDEO)
opt_video_codec(VAR_0, "c:v", codec->name); ost   = new_output_stream(VAR_0, VAR_1, codec->type, -1); st    = ost->st; avcodec_get_context_defaults3(st->codec, codec); enc_config = av_stream_get_recommended_encoder_configuration(ic->streams[VAR_3]); if (enc_config) { AVDictionary *opts = NULL; av_dict_parse_string(&opts, enc_config, "=", ",", 0); av_opt_set_dict2(st->codec, &opts, AV_OPT_SEARCH_CHILDREN); av_dict_free(&opts); } if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy)
choose_sample_fmt(st, codec); else if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy)
choose_pixel_fmt(st, st->codec, codec, st->codecpar->format); avcodec_copy_context(ost->enc_ctx, st->codec); if (enc_config)
av_dict_parse_string(&ost->encoder_opts, enc_config, "=", ",", 0); } avformat_close_input(&ic); return VAR_4; }