comparison idroq.c @ 482:0fdc96c2f2fe libavformat

sweeping change from -EIO -> AVERROR_IO
author melanson
date Sat, 19 Jun 2004 03:59:34 +0000
parents b69898ffc92a
children 253b5292946a
comparison
equal deleted inserted replaced
481:f1430abbbd8b 482:0fdc96c2f2fe
185 offset_t codebook_offset; 185 offset_t codebook_offset;
186 186
187 while (!packet_read) { 187 while (!packet_read) {
188 188
189 if (url_feof(&s->pb)) 189 if (url_feof(&s->pb))
190 return -EIO; 190 return AVERROR_IO;
191 191
192 /* get the next chunk preamble */ 192 /* get the next chunk preamble */
193 if ((ret = get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) != 193 if ((ret = get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) !=
194 RoQ_CHUNK_PREAMBLE_SIZE) 194 RoQ_CHUNK_PREAMBLE_SIZE)
195 return -EIO; 195 return AVERROR_IO;
196 196
197 chunk_type = LE_16(&preamble[0]); 197 chunk_type = LE_16(&preamble[0]);
198 chunk_size = LE_32(&preamble[2]); 198 chunk_size = LE_32(&preamble[2]);
199 199
200 switch (chunk_type) { 200 switch (chunk_type) {
209 codebook_offset = url_ftell(pb) - RoQ_CHUNK_PREAMBLE_SIZE; 209 codebook_offset = url_ftell(pb) - RoQ_CHUNK_PREAMBLE_SIZE;
210 codebook_size = chunk_size; 210 codebook_size = chunk_size;
211 url_fseek(pb, codebook_size, SEEK_CUR); 211 url_fseek(pb, codebook_size, SEEK_CUR);
212 if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != 212 if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
213 RoQ_CHUNK_PREAMBLE_SIZE) 213 RoQ_CHUNK_PREAMBLE_SIZE)
214 return -EIO; 214 return AVERROR_IO;
215 chunk_size = LE_32(&preamble[2]) + RoQ_CHUNK_PREAMBLE_SIZE * 2 + 215 chunk_size = LE_32(&preamble[2]) + RoQ_CHUNK_PREAMBLE_SIZE * 2 +
216 codebook_size; 216 codebook_size;
217 217
218 /* rewind */ 218 /* rewind */
219 url_fseek(pb, codebook_offset, SEEK_SET); 219 url_fseek(pb, codebook_offset, SEEK_SET);
220 220
221 /* load up the packet */ 221 /* load up the packet */
222 if (av_new_packet(pkt, chunk_size)) 222 if (av_new_packet(pkt, chunk_size))
223 return -EIO; 223 return AVERROR_IO;
224 pkt->stream_index = roq->video_stream_index; 224 pkt->stream_index = roq->video_stream_index;
225 pkt->pts = roq->video_pts; 225 pkt->pts = roq->video_pts;
226 ret = get_buffer(pb, pkt->data, chunk_size); 226 ret = get_buffer(pb, pkt->data, chunk_size);
227 if (ret != chunk_size) 227 if (ret != chunk_size)
228 ret = -EIO; 228 ret = AVERROR_IO;
229 229
230 roq->video_pts += roq->frame_pts_inc; 230 roq->video_pts += roq->frame_pts_inc;
231 packet_read = 1; 231 packet_read = 1;
232 break; 232 break;
233 233
234 case RoQ_SOUND_MONO: 234 case RoQ_SOUND_MONO:
235 case RoQ_SOUND_STEREO: 235 case RoQ_SOUND_STEREO:
236 case RoQ_QUAD_VQ: 236 case RoQ_QUAD_VQ:
237 /* load up the packet */ 237 /* load up the packet */
238 if (av_new_packet(pkt, chunk_size + RoQ_CHUNK_PREAMBLE_SIZE)) 238 if (av_new_packet(pkt, chunk_size + RoQ_CHUNK_PREAMBLE_SIZE))
239 return -EIO; 239 return AVERROR_IO;
240 /* copy over preamble */ 240 /* copy over preamble */
241 memcpy(pkt->data, preamble, RoQ_CHUNK_PREAMBLE_SIZE); 241 memcpy(pkt->data, preamble, RoQ_CHUNK_PREAMBLE_SIZE);
242 242
243 if (chunk_type == RoQ_QUAD_VQ) { 243 if (chunk_type == RoQ_QUAD_VQ) {
244 pkt->stream_index = roq->video_stream_index; 244 pkt->stream_index = roq->video_stream_index;
253 } 253 }
254 254
255 ret = get_buffer(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE, 255 ret = get_buffer(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE,
256 chunk_size); 256 chunk_size);
257 if (ret != chunk_size) 257 if (ret != chunk_size)
258 ret = -EIO; 258 ret = AVERROR_IO;
259 259
260 packet_read = 1; 260 packet_read = 1;
261 break; 261 break;
262 262
263 default: 263 default: