1 /*
2 * Wing Commander III Movie (.mve) File Demuxer
3 * Copyright (c) 2003 The FFmpeg project
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 * Wing Commander III Movie file demuxer
25 * by Mike Melanson (melanson@pcisys.net)
26 * for more information on the WC3 .mve file format, visit:
27 * http://www.pcisys.net/~melanson/codecs/
28 */
29
38
39 #define FORM_TAG MKTAG('F', 'O', 'R', 'M')
40 #define MOVE_TAG MKTAG('M', 'O', 'V', 'E')
41 #define PC__TAG MKTAG('_', 'P', 'C', '_')
42 #define SOND_TAG MKTAG('S', 'O', 'N', 'D')
43 #define BNAM_TAG MKTAG('B', 'N', 'A', 'M')
44 #define SIZE_TAG MKTAG('S', 'I', 'Z', 'E')
45 #define PALT_TAG MKTAG('P', 'A', 'L', 'T')
46 #define INDX_TAG MKTAG('I', 'N', 'D', 'X')
47 #define BRCH_TAG MKTAG('B', 'R', 'C', 'H')
48 #define SHOT_TAG MKTAG('S', 'H', 'O', 'T')
49 #define VGA__TAG MKTAG('V', 'G', 'A', ' ')
50 #define TEXT_TAG MKTAG('T', 'E', 'X', 'T')
51 #define AUDI_TAG MKTAG('A', 'U', 'D', 'I')
52
53 /* video resolution unless otherwise specified */
54 #define WC3_DEFAULT_WIDTH 320
55 #define WC3_DEFAULT_HEIGHT 165
56
57 /* always use the same PCM audio parameters */
58 #define WC3_SAMPLE_RATE 22050
59 #define WC3_AUDIO_BITS 16
60
61 /* nice, constant framerate */
62 #define WC3_FRAME_FPS 15
63
64 #define PALETTE_SIZE (256 * 3)
65
72
74
76
78 {
80
82
83 return 0;
84 }
85
87 {
89 return 0;
90
93 return 0;
94
96 }
97
99 {
102 unsigned int fourcc_tag;
107
108 /* default context members */
116
117 /* skip the first 3 32-bit numbers */
119
120 /* traverse through the chunks and load the header information before
121 * the first BRCH tag */
124
125 do {
126 switch (fourcc_tag) {
127
130 /* SOND unknown, INDX unnecessary; ignore both */
132 break;
133
135 /* number of palettes, unneeded */
137 break;
138
140 /* load up the name */
147 }
151 break;
152
154 /* video resolution override */
157 break;
158
160 /* one of several palettes */
163 break;
164
165 default:
169 }
170
172 /* chunk sizes are 16-bit aligned */
176
178
179 /* initialize the decoder streams */
181 if (!st)
190
192 if (!st)
205
206 return 0;
207 }
208
211 {
214 unsigned int fourcc_tag;
216 int packet_read = 0;
218 unsigned char text[1024];
219
220 while (!packet_read) {
221
223 /* chunk sizes are 16-bit aligned */
227
228 switch (fourcc_tag) {
229
231 /* no-op */
232 break;
233
235 /* load up new palette */
238 break;
239
241 /* send out video chunk */
244 // ignore error if we have some data
250 packet_read = 1;
251 break;
252
254 /* subtitle chunk */
257 else {
271 }
272 break;
273
275 /* send out audio chunk */
279
280 /* time to advance pts */
282
283 packet_read = 1;
284 break;
285
286 default:
290 packet_read = 1;
291 break;
292 }
293 }
294
296 }
297
299 .
p.
name =
"wc3movie",
307 };