Revision 72415b2a ffmpeg.c

View differences:

ffmpeg.c
452 452
    powerpc_display_perf_report();
453 453
#endif /* CONFIG_POWERPC_PERF */
454 454

  
455
    for (i=0;i<CODEC_TYPE_NB;i++)
455
    for (i=0;i<AVMEDIA_TYPE_NB;i++)
456 456
        av_free(avcodec_opts[i]);
457 457
    av_free(avformat_opts);
458 458
    av_free(sws_opts);
......
527 527
        memcpy(st->codec, ic->streams[i]->codec, sizeof(AVCodecContext));
528 528
        s->streams[i] = st;
529 529

  
530
        if (st->codec->codec_type == CODEC_TYPE_AUDIO && audio_stream_copy)
530
        if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && audio_stream_copy)
531 531
            st->stream_copy = 1;
532
        else if (st->codec->codec_type == CODEC_TYPE_VIDEO && video_stream_copy)
532
        else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && video_stream_copy)
533 533
            st->stream_copy = 1;
534 534

  
535 535
        if(!st->codec->thread_count)
......
967 967
    }else
968 968
        ost->sync_opts= lrintf(sync_ipts);
969 969

  
970
    nb_frames= FFMIN(nb_frames, max_frames[CODEC_TYPE_VIDEO] - ost->frame_number);
970
    nb_frames= FFMIN(nb_frames, max_frames[AVMEDIA_TYPE_VIDEO] - ost->frame_number);
971 971
    if (nb_frames <= 0)
972 972
        return;
973 973

  
......
1088 1088
            /* better than nothing: use input picture interlaced
1089 1089
               settings */
1090 1090
            big_picture.interlaced_frame = in_picture->interlaced_frame;
1091
            if(avcodec_opts[CODEC_TYPE_VIDEO]->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)){
1091
            if(avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)){
1092 1092
                if(top_field_first == -1)
1093 1093
                    big_picture.top_field_first = in_picture->top_field_first;
1094 1094
                else
......
1163 1163
    }
1164 1164

  
1165 1165
    enc = ost->st->codec;
1166
    if (enc->codec_type == CODEC_TYPE_VIDEO) {
1166
    if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
1167 1167
        frame_number = ost->frame_number;
1168 1168
        fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA);
1169 1169
        if (enc->flags&CODEC_FLAG_PSNR)
......
1223 1223
    for(i=0;i<nb_ostreams;i++) {
1224 1224
        ost = ost_table[i];
1225 1225
        enc = ost->st->codec;
1226
        if (vid && enc->codec_type == CODEC_TYPE_VIDEO) {
1226
        if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
1227 1227
            snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ",
1228 1228
                     !ost->st->stream_copy ?
1229 1229
                     enc->coded_frame->quality/(float)FF_QP2LAMBDA : -1);
1230 1230
        }
1231
        if (!vid && enc->codec_type == CODEC_TYPE_VIDEO) {
1231
        if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
1232 1232
            float t = (av_gettime()-timer_start) / 1000000.0;
1233 1233

  
1234 1234
            frame_number = ost->frame_number;
......
1360 1360
        subtitle_to_free = NULL;
1361 1361
        if (ist->decoding_needed) {
1362 1362
            switch(ist->st->codec->codec_type) {
1363
            case CODEC_TYPE_AUDIO:{
1363
            case AVMEDIA_TYPE_AUDIO:{
1364 1364
                if(pkt && samples_size < FFMAX(pkt->size*sizeof(*samples), AVCODEC_MAX_AUDIO_FRAME_SIZE)) {
1365 1365
                    samples_size = FFMAX(pkt->size*sizeof(*samples), AVCODEC_MAX_AUDIO_FRAME_SIZE);
1366 1366
                    av_free(samples);
......
1386 1386
                ist->next_pts += ((int64_t)AV_TIME_BASE/bps * decoded_data_size) /
1387 1387
                    (ist->st->codec->sample_rate * ist->st->codec->channels);
1388 1388
                break;}
1389
            case CODEC_TYPE_VIDEO:
1389
            case AVMEDIA_TYPE_VIDEO:
1390 1390
                    decoded_data_size = (ist->st->codec->width * ist->st->codec->height * 3) / 2;
1391 1391
                    /* XXX: allocate picture correctly */
1392 1392
                    avcodec_get_frame_defaults(&picture);
......
1408 1408
                    }
1409 1409
                    avpkt.size = 0;
1410 1410
                    break;
1411
            case CODEC_TYPE_SUBTITLE:
1411
            case AVMEDIA_TYPE_SUBTITLE:
1412 1412
                ret = avcodec_decode_subtitle2(ist->st->codec,
1413 1413
                                               &subtitle, &got_subtitle, &avpkt);
1414 1414
                if (ret < 0)
......
1424 1424
            }
1425 1425
        } else {
1426 1426
            switch(ist->st->codec->codec_type) {
1427
            case CODEC_TYPE_AUDIO:
1427
            case AVMEDIA_TYPE_AUDIO:
1428 1428
                ist->next_pts += ((int64_t)AV_TIME_BASE * ist->st->codec->frame_size) /
1429 1429
                    ist->st->codec->sample_rate;
1430 1430
                break;
1431
            case CODEC_TYPE_VIDEO:
1431
            case AVMEDIA_TYPE_VIDEO:
1432 1432
                if (ist->st->codec->time_base.num != 0) {
1433 1433
                    int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame;
1434 1434
                    ist->next_pts += ((int64_t)AV_TIME_BASE *
......
1442 1442
        }
1443 1443

  
1444 1444
        buffer_to_free = NULL;
1445
        if (ist->st->codec->codec_type == CODEC_TYPE_VIDEO) {
1445
        if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
1446 1446
            pre_process_video_frame(ist, (AVPicture *)&picture,
1447 1447
                                    &buffer_to_free);
1448 1448
        }
1449 1449

  
1450 1450
        // preprocess audio (volume)
1451
        if (ist->st->codec->codec_type == CODEC_TYPE_AUDIO) {
1451
        if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
1452 1452
            if (audio_volume != 256) {
1453 1453
                short *volp;
1454 1454
                volp = samples;
......
1485 1485
                    if (ost->encoding_needed) {
1486 1486
                        assert(ist->decoding_needed);
1487 1487
                        switch(ost->st->codec->codec_type) {
1488
                        case CODEC_TYPE_AUDIO:
1488
                        case AVMEDIA_TYPE_AUDIO:
1489 1489
                            do_audio_out(os, ost, ist, decoded_data_buf, decoded_data_size);
1490 1490
                            break;
1491
                        case CODEC_TYPE_VIDEO:
1491
                        case AVMEDIA_TYPE_VIDEO:
1492 1492
                            do_video_out(os, ost, ist, &picture, &frame_size);
1493 1493
                            if (vstats_filename && frame_size)
1494 1494
                                do_video_stats(os, ost, frame_size);
1495 1495
                            break;
1496
                        case CODEC_TYPE_SUBTITLE:
1496
                        case AVMEDIA_TYPE_SUBTITLE:
1497 1497
                            do_subtitle_out(os, ost, ist, &subtitle,
1498 1498
                                            pkt->pts);
1499 1499
                            break;
......
1517 1517
                        ost->st->codec->coded_frame= &avframe;
1518 1518
                        avframe.key_frame = pkt->flags & PKT_FLAG_KEY;
1519 1519

  
1520
                        if(ost->st->codec->codec_type == CODEC_TYPE_AUDIO)
1520
                        if(ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
1521 1521
                            audio_size += data_size;
1522
                        else if (ost->st->codec->codec_type == CODEC_TYPE_VIDEO) {
1522
                        else if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
1523 1523
                            video_size += data_size;
1524 1524
                            ost->sync_opts++;
1525 1525
                        }
......
1583 1583
                AVCodecContext *enc= ost->st->codec;
1584 1584
                os = output_files[ost->file_index];
1585 1585

  
1586
                if(ost->st->codec->codec_type == CODEC_TYPE_AUDIO && enc->frame_size <=1)
1586
                if(ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <=1)
1587 1587
                    continue;
1588
                if(ost->st->codec->codec_type == CODEC_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE))
1588
                if(ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE))
1589 1589
                    continue;
1590 1590

  
1591 1591
                if (ost->encoding_needed) {
......
1596 1596
                        pkt.stream_index= ost->index;
1597 1597

  
1598 1598
                        switch(ost->st->codec->codec_type) {
1599
                        case CODEC_TYPE_AUDIO:
1599
                        case AVMEDIA_TYPE_AUDIO:
1600 1600
                            fifo_bytes = av_fifo_size(ost->fifo);
1601 1601
                            ret = 0;
1602 1602
                            /* encode any samples remaining in fifo */
......
1629 1629
                            audio_size += ret;
1630 1630
                            pkt.flags |= PKT_FLAG_KEY;
1631 1631
                            break;
1632
                        case CODEC_TYPE_VIDEO:
1632
                        case AVMEDIA_TYPE_VIDEO:
1633 1633
                            ret = avcodec_encode_video(enc, bit_buffer, bit_buffer_size, NULL);
1634 1634
                            if (ret < 0) {
1635 1635
                                fprintf(stderr, "Video encoding failed\n");
......
1946 1946
            }else
1947 1947
                codec->time_base = ist->st->time_base;
1948 1948
            switch(codec->codec_type) {
1949
            case CODEC_TYPE_AUDIO:
1949
            case AVMEDIA_TYPE_AUDIO:
1950 1950
                if(audio_volume != 256) {
1951 1951
                    fprintf(stderr,"-acodec copy and -vol are incompatible (frames are not decoded)\n");
1952 1952
                    av_exit(1);
......
1961 1961
                if(codec->codec_id == CODEC_ID_AC3)
1962 1962
                    codec->block_align= 0;
1963 1963
                break;
1964
            case CODEC_TYPE_VIDEO:
1964
            case AVMEDIA_TYPE_VIDEO:
1965 1965
                codec->pix_fmt = icodec->pix_fmt;
1966 1966
                codec->width = icodec->width;
1967 1967
                codec->height = icodec->height;
1968 1968
                codec->has_b_frames = icodec->has_b_frames;
1969 1969
                break;
1970
            case CODEC_TYPE_SUBTITLE:
1970
            case AVMEDIA_TYPE_SUBTITLE:
1971 1971
                codec->width = icodec->width;
1972 1972
                codec->height = icodec->height;
1973 1973
                break;
......
1976 1976
            }
1977 1977
        } else {
1978 1978
            switch(codec->codec_type) {
1979
            case CODEC_TYPE_AUDIO:
1979
            case AVMEDIA_TYPE_AUDIO:
1980 1980
                ost->fifo= av_fifo_alloc(1024);
1981 1981
                if(!ost->fifo)
1982 1982
                    goto fail;
......
1986 1986
                ist->decoding_needed = 1;
1987 1987
                ost->encoding_needed = 1;
1988 1988
                break;
1989
            case CODEC_TYPE_VIDEO:
1989
            case AVMEDIA_TYPE_VIDEO:
1990 1990
                if (ost->st->codec->pix_fmt == PIX_FMT_NONE) {
1991 1991
                    fprintf(stderr, "Video pixel format is unknown, stream cannot be encoded\n");
1992 1992
                    av_exit(1);
......
2050 2050
                ost->encoding_needed = 1;
2051 2051
                ist->decoding_needed = 1;
2052 2052
                break;
2053
            case CODEC_TYPE_SUBTITLE:
2053
            case AVMEDIA_TYPE_SUBTITLE:
2054 2054
                ost->encoding_needed = 1;
2055 2055
                ist->decoding_needed = 1;
2056 2056
                break;
......
2098 2098
                }
2099 2099
            }
2100 2100
        }
2101
        if(codec->codec_type == CODEC_TYPE_VIDEO){
2101
        if(codec->codec_type == AVMEDIA_TYPE_VIDEO){
2102 2102
            int size= codec->width * codec->height;
2103 2103
            bit_buffer_size= FFMAX(bit_buffer_size, 6*size + 200);
2104 2104
        }
......
2155 2155
                ret = AVERROR(EINVAL);
2156 2156
                goto dump_format;
2157 2157
            }
2158
            //if (ist->st->codec->codec_type == CODEC_TYPE_VIDEO)
2158
            //if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
2159 2159
            //    ist->st->codec->flags |= CODEC_FLAG_REPEAT_FIELD;
2160 2160
        }
2161 2161
    }
......
2528 2528

  
2529 2529
static int opt_bitrate(const char *opt, const char *arg)
2530 2530
{
2531
    int codec_type = opt[0]=='a' ? CODEC_TYPE_AUDIO : CODEC_TYPE_VIDEO;
2531
    int codec_type = opt[0]=='a' ? AVMEDIA_TYPE_AUDIO : AVMEDIA_TYPE_VIDEO;
2532 2532

  
2533 2533
    opt_default(opt, arg);
2534 2534

  
......
2781 2781

  
2782 2782
static void opt_audio_codec(const char *arg)
2783 2783
{
2784
    opt_codec(&audio_stream_copy, &audio_codec_name, CODEC_TYPE_AUDIO, arg);
2784
    opt_codec(&audio_stream_copy, &audio_codec_name, AVMEDIA_TYPE_AUDIO, arg);
2785 2785
}
2786 2786

  
2787 2787
static void opt_audio_tag(const char *arg)
......
2804 2804

  
2805 2805
static void opt_video_codec(const char *arg)
2806 2806
{
2807
    opt_codec(&video_stream_copy, &video_codec_name, CODEC_TYPE_VIDEO, arg);
2807
    opt_codec(&video_stream_copy, &video_codec_name, AVMEDIA_TYPE_VIDEO, arg);
2808 2808
}
2809 2809

  
2810 2810
static void opt_subtitle_codec(const char *arg)
2811 2811
{
2812
    opt_codec(&subtitle_stream_copy, &subtitle_codec_name, CODEC_TYPE_SUBTITLE, arg);
2812
    opt_codec(&subtitle_stream_copy, &subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, arg);
2813 2813
}
2814 2814

  
2815 2815
static void opt_subtitle_tag(const char *arg)
......
2965 2965

  
2966 2966
    set_context_opts(ic, avformat_opts, AV_OPT_FLAG_DECODING_PARAM);
2967 2967

  
2968
    ic->video_codec_id   = find_codec_or_die(video_codec_name   , CODEC_TYPE_VIDEO   , 0);
2969
    ic->audio_codec_id   = find_codec_or_die(audio_codec_name   , CODEC_TYPE_AUDIO   , 0);
2970
    ic->subtitle_codec_id= find_codec_or_die(subtitle_codec_name, CODEC_TYPE_SUBTITLE, 0);
2968
    ic->video_codec_id   = find_codec_or_die(video_codec_name   , AVMEDIA_TYPE_VIDEO   , 0);
2969
    ic->audio_codec_id   = find_codec_or_die(audio_codec_name   , AVMEDIA_TYPE_AUDIO   , 0);
2970
    ic->subtitle_codec_id= find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 0);
2971 2971
    ic->flags |= AVFMT_FLAG_NONBLOCK;
2972 2972

  
2973 2973
    if(pgmyuv_compatibility_hack)
......
3035 3035
        AVCodecContext *enc = st->codec;
3036 3036
        avcodec_thread_init(enc, thread_count);
3037 3037
        switch(enc->codec_type) {
3038
        case CODEC_TYPE_AUDIO:
3039
            set_context_opts(enc, avcodec_opts[CODEC_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM);
3038
        case AVMEDIA_TYPE_AUDIO:
3039
            set_context_opts(enc, avcodec_opts[AVMEDIA_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM);
3040 3040
            //fprintf(stderr, "\nInput Audio channels: %d", enc->channels);
3041 3041
            channel_layout = enc->channel_layout;
3042 3042
            audio_channels = enc->channels;
......
3046 3046
            if(audio_disable)
3047 3047
                st->discard= AVDISCARD_ALL;
3048 3048
            break;
3049
        case CODEC_TYPE_VIDEO:
3050
            set_context_opts(enc, avcodec_opts[CODEC_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM);
3049
        case AVMEDIA_TYPE_VIDEO:
3050
            set_context_opts(enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM);
3051 3051
            frame_height = enc->height;
3052 3052
            frame_width = enc->width;
3053 3053
            if(ic->streams[i]->sample_aspect_ratio.num)
......
3084 3084
            else if(video_discard)
3085 3085
                st->discard= video_discard;
3086 3086
            break;
3087
        case CODEC_TYPE_DATA:
3087
        case AVMEDIA_TYPE_DATA:
3088 3088
            break;
3089
        case CODEC_TYPE_SUBTITLE:
3089
        case AVMEDIA_TYPE_SUBTITLE:
3090 3090
            input_codecs[nb_icodecs++] = avcodec_find_decoder_by_name(subtitle_codec_name);
3091 3091
            if(subtitle_disable)
3092 3092
                st->discard = AVDISCARD_ALL;
3093 3093
            break;
3094
        case CODEC_TYPE_ATTACHMENT:
3095
        case CODEC_TYPE_UNKNOWN:
3094
        case AVMEDIA_TYPE_ATTACHMENT:
3095
        case AVMEDIA_TYPE_UNKNOWN:
3096 3096
            nb_icodecs++;
3097 3097
            break;
3098 3098
        default:
......
3129 3129
        for(i=0;i<ic->nb_streams;i++) {
3130 3130
            AVCodecContext *enc = ic->streams[i]->codec;
3131 3131
            switch(enc->codec_type) {
3132
            case CODEC_TYPE_AUDIO:
3132
            case AVMEDIA_TYPE_AUDIO:
3133 3133
                has_audio = 1;
3134 3134
                break;
3135
            case CODEC_TYPE_VIDEO:
3135
            case AVMEDIA_TYPE_VIDEO:
3136 3136
                has_video = 1;
3137 3137
                break;
3138
            case CODEC_TYPE_SUBTITLE:
3138
            case AVMEDIA_TYPE_SUBTITLE:
3139 3139
                has_subtitle = 1;
3140 3140
                break;
3141
            case CODEC_TYPE_DATA:
3142
            case CODEC_TYPE_ATTACHMENT:
3143
            case CODEC_TYPE_UNKNOWN:
3141
            case AVMEDIA_TYPE_DATA:
3142
            case AVMEDIA_TYPE_ATTACHMENT:
3143
            case AVMEDIA_TYPE_UNKNOWN:
3144 3144
                break;
3145 3145
            default:
3146 3146
                abort();
......
3163 3163
        fprintf(stderr, "Could not alloc stream\n");
3164 3164
        av_exit(1);
3165 3165
    }
3166
    avcodec_get_context_defaults2(st->codec, CODEC_TYPE_VIDEO);
3166
    avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_VIDEO);
3167 3167
    bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters;
3168 3168
    video_bitstream_filters= NULL;
3169 3169

  
......
3177 3177
    if(   (video_global_header&1)
3178 3178
       || (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))){
3179 3179
        video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
3180
        avcodec_opts[CODEC_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER;
3180
        avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER;
3181 3181
    }
3182 3182
    if(video_global_header&2){
3183 3183
        video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER;
3184
        avcodec_opts[CODEC_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER;
3184
        avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER;
3185 3185
    }
3186 3186

  
3187 3187
    if (video_stream_copy) {
3188 3188
        st->stream_copy = 1;
3189
        video_enc->codec_type = CODEC_TYPE_VIDEO;
3189
        video_enc->codec_type = AVMEDIA_TYPE_VIDEO;
3190 3190
        video_enc->sample_aspect_ratio =
3191 3191
        st->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255);
3192 3192
    } else {
......
3196 3196
        AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1};
3197 3197

  
3198 3198
        if (video_codec_name) {
3199
            codec_id = find_codec_or_die(video_codec_name, CODEC_TYPE_VIDEO, 1);
3199
            codec_id = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1);
3200 3200
            codec = avcodec_find_encoder_by_name(video_codec_name);
3201 3201
            output_codecs[nb_ocodecs] = codec;
3202 3202
        } else {
3203
            codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, CODEC_TYPE_VIDEO);
3203
            codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO);
3204 3204
            codec = avcodec_find_encoder(codec_id);
3205 3205
        }
3206 3206

  
3207 3207
        video_enc->codec_id = codec_id;
3208 3208

  
3209
        set_context_opts(video_enc, avcodec_opts[CODEC_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
3209
        set_context_opts(video_enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
3210 3210

  
3211 3211
        if (codec && codec->supported_framerates && !force_fps)
3212 3212
            fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)];
......
3300 3300
        fprintf(stderr, "Could not alloc stream\n");
3301 3301
        av_exit(1);
3302 3302
    }
3303
    avcodec_get_context_defaults2(st->codec, CODEC_TYPE_AUDIO);
3303
    avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_AUDIO);
3304 3304

  
3305 3305
    bitstream_filters[nb_output_files][oc->nb_streams - 1]= audio_bitstream_filters;
3306 3306
    audio_bitstream_filters= NULL;
......
3308 3308
    avcodec_thread_init(st->codec, thread_count);
3309 3309

  
3310 3310
    audio_enc = st->codec;
3311
    audio_enc->codec_type = CODEC_TYPE_AUDIO;
3311
    audio_enc->codec_type = AVMEDIA_TYPE_AUDIO;
3312 3312

  
3313 3313
    if(audio_codec_tag)
3314 3314
        audio_enc->codec_tag= audio_codec_tag;
3315 3315

  
3316 3316
    if (oc->oformat->flags & AVFMT_GLOBALHEADER) {
3317 3317
        audio_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
3318
        avcodec_opts[CODEC_TYPE_AUDIO]->flags|= CODEC_FLAG_GLOBAL_HEADER;
3318
        avcodec_opts[AVMEDIA_TYPE_AUDIO]->flags|= CODEC_FLAG_GLOBAL_HEADER;
3319 3319
    }
3320 3320
    if (audio_stream_copy) {
3321 3321
        st->stream_copy = 1;
......
3323 3323
    } else {
3324 3324
        AVCodec *codec;
3325 3325

  
3326
        set_context_opts(audio_enc, avcodec_opts[CODEC_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
3326
        set_context_opts(audio_enc, avcodec_opts[AVMEDIA_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
3327 3327

  
3328 3328
        if (audio_codec_name) {
3329
            codec_id = find_codec_or_die(audio_codec_name, CODEC_TYPE_AUDIO, 1);
3329
            codec_id = find_codec_or_die(audio_codec_name, AVMEDIA_TYPE_AUDIO, 1);
3330 3330
            codec = avcodec_find_encoder_by_name(audio_codec_name);
3331 3331
            output_codecs[nb_ocodecs] = codec;
3332 3332
        } else {
3333
            codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, CODEC_TYPE_AUDIO);
3333
            codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_AUDIO);
3334 3334
            codec = avcodec_find_encoder(codec_id);
3335 3335
        }
3336 3336
        audio_enc->codec_id = codec_id;
......
3370 3370
        fprintf(stderr, "Could not alloc stream\n");
3371 3371
        av_exit(1);
3372 3372
    }
3373
    avcodec_get_context_defaults2(st->codec, CODEC_TYPE_SUBTITLE);
3373
    avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_SUBTITLE);
3374 3374

  
3375 3375
    bitstream_filters[nb_output_files][oc->nb_streams - 1]= subtitle_bitstream_filters;
3376 3376
    subtitle_bitstream_filters= NULL;
3377 3377

  
3378 3378
    subtitle_enc = st->codec;
3379
    subtitle_enc->codec_type = CODEC_TYPE_SUBTITLE;
3379
    subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
3380 3380

  
3381 3381
    if(subtitle_codec_tag)
3382 3382
        subtitle_enc->codec_tag= subtitle_codec_tag;
......
3384 3384
    if (subtitle_stream_copy) {
3385 3385
        st->stream_copy = 1;
3386 3386
    } else {
3387
        set_context_opts(avcodec_opts[CODEC_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
3388
        subtitle_enc->codec_id = find_codec_or_die(subtitle_codec_name, CODEC_TYPE_SUBTITLE, 1);
3387
        set_context_opts(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
3388
        subtitle_enc->codec_id = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1);
3389 3389
        output_codecs[nb_ocodecs] = avcodec_find_encoder_by_name(subtitle_codec_name);
3390 3390
    }
3391 3391
    nb_ocodecs++;
......
3739 3739
                for(j = 0; j < nb_input_files; j++) {
3740 3740
                    for(i = 0; i < input_files[j]->nb_streams; i++) {
3741 3741
                        AVCodecContext *c = input_files[j]->streams[i]->codec;
3742
                        if(c->codec_type != CODEC_TYPE_VIDEO)
3742
                        if(c->codec_type != AVMEDIA_TYPE_VIDEO)
3743 3743
                            continue;
3744 3744
                        fr = c->time_base.den * 1000 / c->time_base.num;
3745 3745
                        if(fr == 25000) {
......
3965 3965
    { "itsscale", HAS_ARG, {(void*)opt_input_ts_scale}, "set the input ts scale", "stream:scale" },
3966 3966
    { "timestamp", OPT_FUNC2 | HAS_ARG, {(void*)opt_rec_timestamp}, "set the timestamp ('now' to set the current time)", "time" },
3967 3967
    { "metadata", OPT_FUNC2 | HAS_ARG, {(void*)opt_metadata}, "add metadata", "string=string" },
3968
    { "dframes", OPT_INT | HAS_ARG, {(void*)&max_frames[CODEC_TYPE_DATA]}, "set the number of data frames to record", "number" },
3968
    { "dframes", OPT_INT | HAS_ARG, {(void*)&max_frames[AVMEDIA_TYPE_DATA]}, "set the number of data frames to record", "number" },
3969 3969
    { "benchmark", OPT_BOOL | OPT_EXPERT, {(void*)&do_benchmark},
3970 3970
      "add timings for benchmarking" },
3971 3971
    { "timelimit", OPT_FUNC2 | HAS_ARG, {(void*)opt_timelimit}, "set max runtime in seconds", "limit" },
......
3993 3993
    /* video options */
3994 3994
    { "b", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_bitrate}, "set bitrate (in bits/s)", "bitrate" },
3995 3995
    { "vb", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_bitrate}, "set bitrate (in bits/s)", "bitrate" },
3996
    { "vframes", OPT_INT | HAS_ARG | OPT_VIDEO, {(void*)&max_frames[CODEC_TYPE_VIDEO]}, "set the number of video frames to record", "number" },
3996
    { "vframes", OPT_INT | HAS_ARG | OPT_VIDEO, {(void*)&max_frames[AVMEDIA_TYPE_VIDEO]}, "set the number of video frames to record", "number" },
3997 3997
    { "r", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_frame_rate}, "set frame rate (Hz value, fraction or abbreviation)", "rate" },
3998 3998
    { "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" },
3999 3999
    { "aspect", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_aspect_ratio}, "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" },
......
4035 4035

  
4036 4036
    /* audio options */
4037 4037
    { "ab", OPT_FUNC2 | HAS_ARG | OPT_AUDIO, {(void*)opt_bitrate}, "set bitrate (in bits/s)", "bitrate" },
4038
    { "aframes", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&max_frames[CODEC_TYPE_AUDIO]}, "set the number of audio frames to record", "number" },
4038
    { "aframes", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&max_frames[AVMEDIA_TYPE_AUDIO]}, "set the number of audio frames to record", "number" },
4039 4039
    { "aq", OPT_FLOAT | HAS_ARG | OPT_AUDIO, {(void*)&audio_qscale}, "set audio quality (codec-specific)", "quality", },
4040 4040
    { "ar", HAS_ARG | OPT_FUNC2 | OPT_AUDIO, {(void*)opt_audio_rate}, "set audio sampling rate (in Hz)", "rate" },
4041 4041
    { "ac", HAS_ARG | OPT_FUNC2 | OPT_AUDIO, {(void*)opt_audio_channels}, "set number of audio channels", "channels" },
......
4090 4090
        url_set_interrupt_cb(decode_interrupt_cb);
4091 4091
#endif
4092 4092

  
4093
    for(i=0; i<CODEC_TYPE_NB; i++){
4093
    for(i=0; i<AVMEDIA_TYPE_NB; i++){
4094 4094
        avcodec_opts[i]= avcodec_alloc_context2(i);
4095 4095
    }
4096 4096
    avformat_opts = avformat_alloc_context();

Also available in: Unified diff