Revision 01f4895c libavformat/nut.c

View differences:

libavformat/nut.c
155 155
    for(stream_id= 0; stream_id<s->nb_streams; stream_id++){
156 156
        int start2= start + (end-start)*stream_id / s->nb_streams;
157 157
        int end2  = start + (end-start)*(stream_id+1) / s->nb_streams;
158
        AVCodecContext *codec = &s->streams[stream_id]->codec;
158
        AVCodecContext *codec = s->streams[stream_id]->codec;
159 159
        int is_audio= codec->codec_type == CODEC_TYPE_AUDIO;
160 160
        int intra_only= /*codec->intra_only || */is_audio;
161 161
        int pred_count;
......
579 579
    {
580 580
	int nom, denom, ssize;
581 581

  
582
	codec = &s->streams[i]->codec;
582
	codec = s->streams[i]->codec;
583 583
	
584 584
	put_be64(bc, STREAM_STARTCODE);
585 585
	put_packetheader(nut, bc, 120 + codec->extradata_size, 1);
......
674 674
        put_str(bc, s->copyright);
675 675
    }
676 676
    /* encoder */
677
    if(!(s->streams[0]->codec.flags & CODEC_FLAG_BITEXACT)){
677
    if(!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)){
678 678
        put_v(bc, 13); /* type */
679 679
        put_str(bc, LIBAVFORMAT_IDENT);
680 680
    }
......
707 707
    int size= pkt->size;
708 708
    int stream_index= pkt->stream_index;
709 709

  
710
    enc = &s->streams[stream_index]->codec;
710
    enc = s->streams[stream_index]->codec;
711 711
    key_frame = !!(pkt->flags & PKT_FLAG_KEY);
712 712
    
713 713
    frame_type=0;
......
949 949

  
950 950
    class = get_v(bc);
951 951
    tmp = get_vb(bc);
952
    st->codec.codec_tag= tmp;
952
    st->codec->codec_tag= tmp;
953 953
    switch(class)
954 954
    {
955 955
        case 0:
956
            st->codec.codec_type = CODEC_TYPE_VIDEO;
957
            st->codec.codec_id = codec_get_bmp_id(tmp);
958
            if (st->codec.codec_id == CODEC_ID_NONE)
956
            st->codec->codec_type = CODEC_TYPE_VIDEO;
957
            st->codec->codec_id = codec_get_bmp_id(tmp);
958
            if (st->codec->codec_id == CODEC_ID_NONE)
959 959
                av_log(s, AV_LOG_ERROR, "Unknown codec?!\n");
960 960
            break;
961 961
        case 1:
962 962
        case 32: //compatibility
963
            st->codec.codec_type = CODEC_TYPE_AUDIO;
964
            st->codec.codec_id = codec_get_wav_id(tmp);
965
            if (st->codec.codec_id == CODEC_ID_NONE)
963
            st->codec->codec_type = CODEC_TYPE_AUDIO;
964
            st->codec->codec_id = codec_get_wav_id(tmp);
965
            if (st->codec->codec_id == CODEC_ID_NONE)
966 966
                av_log(s, AV_LOG_ERROR, "Unknown codec?!\n");
967 967
            break;
968 968
        case 2:
969
//            st->codec.codec_type = CODEC_TYPE_TEXT;
969
//            st->codec->codec_type = CODEC_TYPE_TEXT;
970 970
//            break;
971 971
        case 3:
972
            st->codec.codec_type = CODEC_TYPE_DATA;
972
            st->codec->codec_type = CODEC_TYPE_DATA;
973 973
            break;
974 974
        default:
975 975
            av_log(s, AV_LOG_ERROR, "Unknown stream class (%d)\n", class);
......
980 980
    nom = get_v(bc);
981 981
    denom = get_v(bc);
982 982
    nut->stream[stream_id].msb_timestamp_shift = get_v(bc);
983
    st->codec.has_b_frames=
983
    st->codec->has_b_frames=
984 984
    nut->stream[stream_id].decode_delay= get_v(bc);
985 985
    get_byte(bc); /* flags */
986 986

  
987 987
    /* codec specific data headers */
988 988
    while(get_v(bc) != 0){
989
        st->codec.extradata_size= get_v(bc);
990
        if((unsigned)st->codec.extradata_size > (1<<30))
989
        st->codec->extradata_size= get_v(bc);
990
        if((unsigned)st->codec->extradata_size > (1<<30))
991 991
            return -1;
992
        st->codec.extradata= av_mallocz(st->codec.extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
993
        get_buffer(bc, st->codec.extradata, st->codec.extradata_size);            
992
        st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
993
        get_buffer(bc, st->codec->extradata, st->codec->extradata_size);            
994 994
//	    url_fskip(bc, get_v(bc));
995 995
    }
996 996
    
997
    if (st->codec.codec_type == CODEC_TYPE_VIDEO) /* VIDEO */
997
    if (st->codec->codec_type == CODEC_TYPE_VIDEO) /* VIDEO */
998 998
    {
999
        st->codec.width = get_v(bc);
1000
        st->codec.height = get_v(bc);
1001
        st->codec.sample_aspect_ratio.num= get_v(bc);
1002
        st->codec.sample_aspect_ratio.den= get_v(bc);
999
        st->codec->width = get_v(bc);
1000
        st->codec->height = get_v(bc);
1001
        st->codec->sample_aspect_ratio.num= get_v(bc);
1002
        st->codec->sample_aspect_ratio.den= get_v(bc);
1003 1003
        get_v(bc); /* csp type */
1004 1004
    }
1005
    if (st->codec.codec_type == CODEC_TYPE_AUDIO) /* AUDIO */
1005
    if (st->codec->codec_type == CODEC_TYPE_AUDIO) /* AUDIO */
1006 1006
    {
1007
        st->codec.sample_rate = get_v(bc);
1007
        st->codec->sample_rate = get_v(bc);
1008 1008
        get_v(bc); // samplerate_den
1009
        st->codec.channels = get_v(bc);
1009
        st->codec->channels = get_v(bc);
1010 1010
    }
1011 1011
    if(check_checksum(bc)){
1012 1012
        av_log(s, AV_LOG_ERROR, "Stream header %d checksum mismatch\n", stream_id);
......
1407 1407
    int i;
1408 1408

  
1409 1409
    for(i=0;i<s->nb_streams;i++) {
1410
        av_freep(&s->streams[i]->codec.extradata);
1410
        av_freep(&s->streams[i]->codec->extradata);
1411 1411
    }
1412 1412
    av_freep(&nut->stream);
1413 1413

  

Also available in: Unified diff