OLD | NEW |
1 /* | 1 /* |
2 * id Quake II CIN File Demuxer | 2 * id Quake II CIN File Demuxer |
3 * Copyright (c) 2003 The ffmpeg Project | 3 * Copyright (c) 2003 The ffmpeg Project |
4 * | 4 * |
5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
6 * | 6 * |
7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 b = palette_buffer[i * 3 + 2] << palette_scale; | 253 b = palette_buffer[i * 3 + 2] << palette_scale; |
254 idcin->palctrl.palette[i] = (r << 16) | (g << 8) | (b); | 254 idcin->palctrl.palette[i] = (r << 16) | (g << 8) | (b); |
255 } | 255 } |
256 } | 256 } |
257 | 257 |
258 chunk_size = get_le32(pb); | 258 chunk_size = get_le32(pb); |
259 /* skip the number of decoded bytes (always equal to width * height) */ | 259 /* skip the number of decoded bytes (always equal to width * height) */ |
260 url_fseek(pb, 4, SEEK_CUR); | 260 url_fseek(pb, 4, SEEK_CUR); |
261 chunk_size -= 4; | 261 chunk_size -= 4; |
262 ret= av_get_packet(pb, pkt, chunk_size); | 262 ret= av_get_packet(pb, pkt, chunk_size); |
263 if (ret != chunk_size) | 263 if (ret < 0) |
264 return AVERROR(EIO); | 264 return ret; |
265 pkt->stream_index = idcin->video_stream_index; | 265 pkt->stream_index = idcin->video_stream_index; |
266 pkt->pts = idcin->pts; | 266 pkt->pts = idcin->pts; |
267 } else { | 267 } else { |
268 /* send out the audio chunk */ | 268 /* send out the audio chunk */ |
269 if (idcin->current_audio_chunk) | 269 if (idcin->current_audio_chunk) |
270 chunk_size = idcin->audio_chunk_size2; | 270 chunk_size = idcin->audio_chunk_size2; |
271 else | 271 else |
272 chunk_size = idcin->audio_chunk_size1; | 272 chunk_size = idcin->audio_chunk_size1; |
273 ret= av_get_packet(pb, pkt, chunk_size); | 273 ret= av_get_packet(pb, pkt, chunk_size); |
274 if (ret != chunk_size) | 274 if (ret < 0) |
275 return AVERROR(EIO); | 275 return ret; |
276 pkt->stream_index = idcin->audio_stream_index; | 276 pkt->stream_index = idcin->audio_stream_index; |
277 pkt->pts = idcin->pts; | 277 pkt->pts = idcin->pts; |
278 | 278 |
279 idcin->current_audio_chunk ^= 1; | 279 idcin->current_audio_chunk ^= 1; |
280 idcin->pts++; | 280 idcin->pts++; |
281 } | 281 } |
282 | 282 |
283 if (idcin->audio_present) | 283 if (idcin->audio_present) |
284 idcin->next_chunk_is_video ^= 1; | 284 idcin->next_chunk_is_video ^= 1; |
285 | 285 |
286 return ret; | 286 return ret; |
287 } | 287 } |
288 | 288 |
289 AVInputFormat idcin_demuxer = { | 289 AVInputFormat idcin_demuxer = { |
290 "idcin", | 290 "idcin", |
291 NULL_IF_CONFIG_SMALL("id Cinematic format"), | 291 NULL_IF_CONFIG_SMALL("id Cinematic format"), |
292 sizeof(IdcinDemuxContext), | 292 sizeof(IdcinDemuxContext), |
293 idcin_probe, | 293 idcin_probe, |
294 idcin_read_header, | 294 idcin_read_header, |
295 idcin_read_packet, | 295 idcin_read_packet, |
296 }; | 296 }; |
OLD | NEW |