1 /*
2 * American Laser Games MM Format Demuxer
3 * Copyright (c) 2006 Peter Ross
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 * American Laser Games MM Format Demuxer
25 * by Peter Ross (pross@xvid.org)
26 *
27 * The MM format was used by IBM-PC ports of ALG's "arcade shooter" games,
28 * including Mad Dog McCree and Crime Patrol.
29 *
30 * Technical details here:
31 * http://wiki.multimedia.cx/index.php?title=American_Laser_Games_MM
32 */
33
39
40 #define MM_PREAMBLE_SIZE 6
41
42 #define MM_TYPE_HEADER 0x0
43 #define MM_TYPE_INTER 0x5
44 #define MM_TYPE_INTRA 0x8
45 #define MM_TYPE_INTRA_HH 0xc
46 #define MM_TYPE_INTER_HH 0xd
47 #define MM_TYPE_INTRA_HHV 0xe
48 #define MM_TYPE_INTER_HHV 0xf
49 #define MM_TYPE_AUDIO 0x15
50 #define MM_TYPE_PALETTE 0x31
51
52 #define MM_HEADER_LEN_V 0x16 /* video only */
53 #define MM_HEADER_LEN_AV 0x18 /* video + audio */
54
55 #define MM_PALETTE_COUNT 128
56 #define MM_PALETTE_SIZE (MM_PALETTE_COUNT*3)
57
61
63 {
66 return 0;
67 /* the first chunk is always the header */
69 return 0;
72 return 0;
76 if (!fps || fps > 60 || !
w ||
w > 2048 || !
h ||
h > 2048)
77 return 0;
80 return 0;
81
82 /* only return half certainty since this check is a bit sketchy */
84 }
85
87 {
91
92 unsigned int type, length;
94
97
100
101 /* read header */
102 avio_rl16(pb);
/* total number of chunks */
104 avio_rl16(pb);
/* ibm-pc video bios mode */
107 avio_skip(pb, length - 10);
/* unknown data */
108
109 /* video stream */
111 if (!st)
119
120 /* audio stream */
123 if (!st)
131 }
132
135 return 0;
136 }
137
140 {
144 unsigned int type, length;
146
147 while(1) {
148
151 }
152
154 length =
AV_RL16(&preamble[2]);
155
164 /* output preamble + data */
175 return 0;
176
178 if (
s->nb_streams < 2)
184 return 0;
185
186 default :
189 }
190 }
191 }
192
200 };