Revision 636f1c4c ffmpeg.c

View differences:

ffmpeg.c
946 946
            /* better than nothing: use input picture interlaced
947 947
               settings */
948 948
            big_picture.interlaced_frame = in_picture->interlaced_frame;
949
            if(avctx_opts[CODEC_TYPE_VIDEO]->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)){
949
            if(avcodec_opts[CODEC_TYPE_VIDEO]->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)){
950 950
                if(top_field_first == -1)
951 951
                    big_picture.top_field_first = in_picture->top_field_first;
952 952
                else
......
2328 2328

  
2329 2329
    opt_default(opt, arg);
2330 2330

  
2331
    if (av_get_int(avctx_opts[codec_type], "b", NULL) < 1000)
2331
    if (av_get_int(avcodec_opts[codec_type], "b", NULL) < 1000)
2332 2332
        fprintf(stderr, "WARNING: The bitrate parameter is set too low. It takes bits/s as argument, not kbits/s\n");
2333 2333

  
2334 2334
    return 0;
......
2854 2854
        enc->thread_count= thread_count;
2855 2855
        switch(enc->codec_type) {
2856 2856
        case CODEC_TYPE_AUDIO:
2857
            set_context_opts(enc, avctx_opts[CODEC_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM);
2857
            set_context_opts(enc, avcodec_opts[CODEC_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM);
2858 2858
            //fprintf(stderr, "\nInput Audio channels: %d", enc->channels);
2859 2859
            channel_layout = enc->channel_layout;
2860 2860
            audio_channels = enc->channels;
......
2865 2865
                ic->streams[i]->discard= AVDISCARD_ALL;
2866 2866
            break;
2867 2867
        case CODEC_TYPE_VIDEO:
2868
            set_context_opts(enc, avctx_opts[CODEC_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM);
2868
            set_context_opts(enc, avcodec_opts[CODEC_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM);
2869 2869
            frame_height = enc->height;
2870 2870
            frame_width = enc->width;
2871 2871
            if(ic->streams[i]->sample_aspect_ratio.num)
......
2994 2994
    if(   (video_global_header&1)
2995 2995
       || (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))){
2996 2996
        video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
2997
        avctx_opts[CODEC_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER;
2997
        avcodec_opts[CODEC_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER;
2998 2998
    }
2999 2999
    if(video_global_header&2){
3000 3000
        video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER;
3001
        avctx_opts[CODEC_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER;
3001
        avcodec_opts[CODEC_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER;
3002 3002
    }
3003 3003

  
3004 3004
    if (video_stream_copy) {
......
3023 3023

  
3024 3024
        video_enc->codec_id = codec_id;
3025 3025

  
3026
        set_context_opts(video_enc, avctx_opts[CODEC_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
3026
        set_context_opts(video_enc, avcodec_opts[CODEC_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
3027 3027

  
3028 3028
        if (codec && codec->supported_framerates && !force_fps)
3029 3029
            fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)];
......
3137 3137

  
3138 3138
    if (oc->oformat->flags & AVFMT_GLOBALHEADER) {
3139 3139
        audio_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
3140
        avctx_opts[CODEC_TYPE_AUDIO]->flags|= CODEC_FLAG_GLOBAL_HEADER;
3140
        avcodec_opts[CODEC_TYPE_AUDIO]->flags|= CODEC_FLAG_GLOBAL_HEADER;
3141 3141
    }
3142 3142
    if (audio_stream_copy) {
3143 3143
        st->stream_copy = 1;
......
3145 3145
    } else {
3146 3146
        AVCodec *codec;
3147 3147

  
3148
        set_context_opts(audio_enc, avctx_opts[CODEC_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
3148
        set_context_opts(audio_enc, avcodec_opts[CODEC_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
3149 3149

  
3150 3150
        if (audio_codec_name) {
3151 3151
            codec_id = find_codec_or_die(audio_codec_name, CODEC_TYPE_AUDIO, 1);
......
3211 3211
    if (subtitle_stream_copy) {
3212 3212
        st->stream_copy = 1;
3213 3213
    } else {
3214
        set_context_opts(avctx_opts[CODEC_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
3214
        set_context_opts(avcodec_opts[CODEC_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
3215 3215
        subtitle_enc->codec_id = find_codec_or_die(subtitle_codec_name, CODEC_TYPE_SUBTITLE, 1);
3216 3216
        output_codecs[nb_ocodecs] = avcodec_find_encoder_by_name(subtitle_codec_name);
3217 3217
    }
......
3503 3503
                      OPT_GRAB,
3504 3504
                      OPT_GRAB);
3505 3505
    printf("\n");
3506
    av_opt_show(avctx_opts[0], NULL);
3506
    av_opt_show(avcodec_opts[0], NULL);
3507 3507
    printf("\n");
3508 3508
    av_opt_show(avformat_opts, NULL);
3509 3509
    printf("\n");
......
3888 3888
        url_set_interrupt_cb(decode_interrupt_cb);
3889 3889

  
3890 3890
    for(i=0; i<CODEC_TYPE_NB; i++){
3891
        avctx_opts[i]= avcodec_alloc_context2(i);
3891
        avcodec_opts[i]= avcodec_alloc_context2(i);
3892 3892
    }
3893 3893
    avformat_opts = avformat_alloc_context();
3894 3894
    sws_opts = sws_getContext(16,16,0, 16,16,0, sws_flags, NULL,NULL,NULL);

Also available in: Unified diff