1 /*
2 * Brute Force & Ignorance (BFI) demuxer
3 * Copyright (c) 2008 Sisir Koppaka
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 /**
23 * @file
24 * @brief Brute Force & Ignorance (.bfi) file demuxer
25 * @author Sisir Koppaka ( sisir.koppaka at gmail dot com )
26 * @see http://wiki.multimedia.cx/index.php?title=BFI
27 */
28
34
42
44 {
45 /* Check file header */
48 else
49 return 0;
50 }
51
53 {
58 int ret, fps, chunk_header;
59
60 /* Initialize the video codec... */
62 if (!vstream)
64
65 /* Initialize the audio codec... */
67 if (!astream)
69
70 /* Set the total number of frames. */
73 if (chunk_header < 3)
75
86
87 /*Load the palette to extradata */
92
97 }
98
99 /* Set up the video codec... */
106
107 /* Set up the audio codec now... */
114 avio_seek(pb, chunk_header - 3, SEEK_SET);
116 return 0;
117 }
118
119
121 {
124 int ret, audio_offset, video_offset, chunk_size, audio_size = 0;
127 }
128
129 /* If all previous chunks were completely read, then find a new one... */
136 }
137 /* Now that the chunk's location is confirmed, we proceed... */
143 if (audio_offset < 0 || video_offset < audio_offset || chunk_size < video_offset) {
146 }
147 audio_size = video_offset - audio_offset;
149
150 //Tossing an audio packet at the audio decoder.
154
158
159 //Tossing a video packet at the video decoder.
163
166
167 /* One less frame to read. A cursory decrement. */
169 } else {
170 /* Empty video packet */
172 }
173
177 }
178
186 };