Revision b7effd4e libavformat/nutdec.c

View differences:

libavformat/nutdec.c
39 39
    unsigned int len= ff_get_v(bc);
40 40

  
41 41
    if(len && maxlen)
42
        get_buffer(bc, string, FFMIN(len, maxlen));
42
        avio_read(bc, string, FFMIN(len, maxlen));
43 43
    while(len > maxlen){
44
        get_byte(bc);
44
        avio_r8(bc);
45 45
        len--;
46 46
    }
47 47

  
......
64 64
static uint64_t get_fourcc(AVIOContext *bc){
65 65
    unsigned int len= ff_get_v(bc);
66 66

  
67
    if     (len==2) return get_le16(bc);
68
    else if(len==4) return get_le32(bc);
67
    if     (len==2) return avio_rl16(bc);
68
    else if(len==4) return avio_rl32(bc);
69 69
    else            return -1;
70 70
}
71 71

  
......
106 106
    init_checksum(bc, ff_crc04C11DB7_update, startcode);
107 107
    size= ff_get_v(bc);
108 108
    if(size > 4096)
109
        get_be32(bc);
109
        avio_rb32(bc);
110 110
    if(get_checksum(bc) && size > 4096)
111 111
        return -1;
112 112

  
......
122 122
        url_fseek(bc, pos, SEEK_SET); //note, this may fail if the stream is not seekable, but that should not matter, as in this case we simply start where we currently are
123 123

  
124 124
    while(!url_feof(bc)){
125
        state= (state<<8) | get_byte(bc);
125
        state= (state<<8) | avio_r8(bc);
126 126
        if((state>>56) != 'N')
127 127
            continue;
128 128
        switch(state){
......
182 182
        return -1;
183 183
    }else{
184 184
        while(pos--)
185
            get_byte(bc);
185
            avio_r8(bc);
186 186
        return 0;
187 187
    }
188 188
}
......
279 279
                return AVERROR_INVALIDDATA;
280 280
            }
281 281
            nut->header[i]= av_malloc(nut->header_len[i]);
282
            get_buffer(bc, nut->header[i], nut->header_len[i]);
282
            avio_read(bc, nut->header[i], nut->header_len[i]);
283 283
        }
284 284
        assert(nut->header_len[0]==0);
285 285
    }
......
355 355
    GET_V(st->codec->extradata_size, tmp < (1<<30));
356 356
    if(st->codec->extradata_size){
357 357
        st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
358
        get_buffer(bc, st->codec->extradata, st->codec->extradata_size);
358
        avio_read(bc, st->codec->extradata, st->codec->extradata_size);
359 359
    }
360 360

  
361 361
    if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
......
514 514
    int ret= -1;
515 515

  
516 516
    url_fseek(bc, filesize-12, SEEK_SET);
517
    url_fseek(bc, filesize-get_be64(bc), SEEK_SET);
518
    if(get_be64(bc) != INDEX_STARTCODE){
517
    url_fseek(bc, filesize-avio_rb64(bc), SEEK_SET);
518
    if(avio_rb64(bc) != INDEX_STARTCODE){
519 519
        av_log(s, AV_LOG_ERROR, "no index at the end\n");
520 520
        return -1;
521 521
    }
......
722 722
    size -= nut->header_len[*header_idx];
723 723

  
724 724
    if(flags&FLAG_CHECKSUM){
725
        get_be32(bc); //FIXME check this
725
        avio_rb32(bc); //FIXME check this
726 726
    }else if(size > 2*nut->max_distance || FFABS(stc->last_pts - *pts) > stc->max_pts_distance){
727 727
        av_log(s, AV_LOG_ERROR, "frame size > 2max_distance and no checksum\n");
728 728
        return AVERROR_INVALIDDATA;
......
764 764
    av_new_packet(pkt, size + nut->header_len[header_idx]);
765 765
    memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]);
766 766
    pkt->pos= url_ftell(bc); //FIXME
767
    get_buffer(bc, pkt->data + nut->header_len[header_idx], size);
767
    avio_read(bc, pkt->data + nut->header_len[header_idx], size);
768 768

  
769 769
    pkt->stream_index = stream_id;
770 770
    if (stc->last_flags & FLAG_KEY)
......
789 789
        if(tmp){
790 790
            pos-=8;
791 791
        }else{
792
            frame_code = get_byte(bc);
792
            frame_code = avio_r8(bc);
793 793
            if(url_feof(bc))
794 794
                return -1;
795 795
            if(frame_code == 'N'){
796 796
                tmp= frame_code;
797 797
                for(i=1; i<8; i++)
798
                    tmp = (tmp<<8) + get_byte(bc);
798
                    tmp = (tmp<<8) + avio_r8(bc);
799 799
            }
800 800
        }
801 801
        switch(tmp){
......
812 812
        case SYNCPOINT_STARTCODE:
813 813
            if(decode_syncpoint(nut, &ts, &back_ptr)<0)
814 814
                goto resync;
815
            frame_code = get_byte(bc);
815
            frame_code = avio_r8(bc);
816 816
        case 0:
817 817
            ret= decode_frame(nut, pkt, frame_code);
818 818
            if(ret==0)

Also available in: Unified diff