Revision e63a3628 libavformat/bethsoftvid.c

View differences:

libavformat/bethsoftvid.c
68 68
    *    int16s: always_512, nframes, width, height, delay, always_14
69 69
    */
70 70
    url_fseek(pb, 5, SEEK_CUR);
71
    vid->nframes = get_le16(pb);
71
    vid->nframes = avio_rl16(pb);
72 72

  
73 73
    stream = av_new_stream(s, 0);
74 74
    if (!stream)
......
76 76
    av_set_pts_info(stream, 32, 1, 60);     // 16 ms increments, i.e. 60 fps
77 77
    stream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
78 78
    stream->codec->codec_id = CODEC_ID_BETHSOFTVID;
79
    stream->codec->width = get_le16(pb);
80
    stream->codec->height = get_le16(pb);
79
    stream->codec->width = avio_rl16(pb);
80
    stream->codec->height = avio_rl16(pb);
81 81
    stream->codec->pix_fmt = PIX_FMT_PAL8;
82
    vid->bethsoft_global_delay = get_le16(pb);
83
    get_le16(pb);
82
    vid->bethsoft_global_delay = avio_rl16(pb);
83
    avio_rl16(pb);
84 84

  
85 85
    // done with video codec, set up audio codec
86 86
    stream = av_new_stream(s, 0);
......
117 117
    vidbuf_start[vidbuf_nbytes++] = block_type;
118 118

  
119 119
    // get the video delay (next int16), and set the presentation time
120
    vid->video_pts += vid->bethsoft_global_delay + get_le16(pb);
120
    vid->video_pts += vid->bethsoft_global_delay + avio_rl16(pb);
121 121

  
122 122
    // set the y offset if it exists (decoder header data should be in data section)
123 123
    if(block_type == VIDEO_YOFF_P_FRAME){
124
        if(get_buffer(pb, &vidbuf_start[vidbuf_nbytes], 2) != 2)
124
        if(avio_read(pb, &vidbuf_start[vidbuf_nbytes], 2) != 2)
125 125
            goto fail;
126 126
        vidbuf_nbytes += 2;
127 127
    }
......
131 131
        if(!vidbuf_start)
132 132
            return AVERROR(ENOMEM);
133 133

  
134
        code = get_byte(pb);
134
        code = avio_r8(pb);
135 135
        vidbuf_start[vidbuf_nbytes++] = code;
136 136

  
137 137
        if(code >= 0x80){ // rle sequence
138 138
            if(block_type == VIDEO_I_FRAME)
139
                vidbuf_start[vidbuf_nbytes++] = get_byte(pb);
139
                vidbuf_start[vidbuf_nbytes++] = avio_r8(pb);
140 140
        } else if(code){ // plain sequence
141
            if(get_buffer(pb, &vidbuf_start[vidbuf_nbytes], code) != code)
141
            if(avio_read(pb, &vidbuf_start[vidbuf_nbytes], code) != code)
142 142
                goto fail;
143 143
            vidbuf_nbytes += code;
144 144
        }
145 145
        bytes_copied += code & 0x7F;
146 146
        if(bytes_copied == npixels){ // sometimes no stop character is given, need to keep track of bytes copied
147 147
            // may contain a 0 byte even if read all pixels
148
            if(get_byte(pb))
148
            if(avio_r8(pb))
149 149
                url_fseek(pb, -1, SEEK_CUR);
150 150
            break;
151 151
        }
......
182 182
    if(vid->is_finished || url_feof(pb))
183 183
        return AVERROR(EIO);
184 184

  
185
    block_type = get_byte(pb);
185
    block_type = avio_r8(pb);
186 186
    switch(block_type){
187 187
        case PALETTE_BLOCK:
188 188
            url_fseek(pb, -1, SEEK_CUR);     // include block type
......
195 195
            return ret_value;
196 196

  
197 197
        case FIRST_AUDIO_BLOCK:
198
            get_le16(pb);
198
            avio_rl16(pb);
199 199
            // soundblaster DAC used for sample rate, as on specification page (link above)
200
            s->streams[1]->codec->sample_rate = 1000000 / (256 - get_byte(pb));
200
            s->streams[1]->codec->sample_rate = 1000000 / (256 - avio_r8(pb));
201 201
            s->streams[1]->codec->bit_rate = s->streams[1]->codec->channels * s->streams[1]->codec->sample_rate * s->streams[1]->codec->bits_per_coded_sample;
202 202
        case AUDIO_BLOCK:
203
            audio_length = get_le16(pb);
203
            audio_length = avio_rl16(pb);
204 204
            ret_value = av_get_packet(pb, pkt, audio_length);
205 205
            pkt->stream_index = 1;
206 206
            return ret_value != audio_length ? AVERROR(EIO) : ret_value;

Also available in: Unified diff