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
33
41
43 {
44 /* Check file header */
47 else
48 return 0;
49 }
50
52 {
57 int fps, chunk_header;
58
59 /* Initialize the video codec... */
61 if (!vstream)
63
64 /* Initialize the audio codec... */
66 if (!astream)
68
69 /* Set the total number of frames. */
80
81 /*Load the palette to extradata */
89
91
92 /* Set up the video codec... */
99
100 /* Set up the audio codec now... */
108 avio_seek(pb, chunk_header - 3, SEEK_SET);
110 return 0;
111 }
112
113
115 {
118 int ret, audio_offset, video_offset, chunk_size, audio_size = 0;
121 }
122
123 /* If all previous chunks were completely read, then find a new one... */
126 while(state !=
MKTAG(
'S',
'A',
'V',
'I')){
129 state = 256*state +
avio_r8(pb);
130 }
131 /* Now that the chunk's location is confirmed, we proceed... */
137 audio_size = video_offset - audio_offset;
139 if (audio_size < 0 || bfi->video_size < 0) {
142 }
143
144 //Tossing an audio packet at the audio decoder.
146 if (ret < 0)
148
152
153 //Tossing a video packet at the video decoder.
155 if (ret < 0)
157
160
161 /* One less frame to read. A cursory decrement. */
163 } else {
164 /* Empty video packet */
166 }
167
171 }
172
180 };