1 /*
2 * DXA demuxer
3 * Copyright (c) 2007 Konstantin Shishkov
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
26
27 #define DXA_EXTRA_SIZE 9
28
37
39 {
40 int w, h;
42 return 0;
45 /* check file header */
46 if (p->
buf[0] ==
'D' && p->
buf[1] ==
'E' &&
47 p->
buf[2] ==
'X' && p->
buf[3] ==
'A' &&
48 w && w <= 2048 && h && h <= 2048)
50 else
51 return 0;
52 }
53
55 {
61 int w, h;
62 int num, den;
65
67 if (tag !=
MKTAG(
'D',
'E',
'X',
'A'))
74 }
75
77 if(fps > 0){
78 den = 1000;
79 num = fps;
80 }else if (fps < 0){
81 den = 100000;
82 num = -fps;
83 }else{
84 den = 10;
85 num = 1;
86 }
90
92 if (!st)
94
95 // Parse WAV data header
103
105 if (!ast)
108 if (ret < 0)
112 // find 'data' chunk
116 if(tag ==
MKTAG(
'd',
'a',
't',
'a'))
break;
118 }
125 }
126
127 /* now we are ready: build format streams */
132 av_reduce(&den, &num, den, num, (1UL<<31)-1);
134 /* flags & 0x80 means that image is interlaced,
135 * flags & 0x40 means that image has double height
136 * either way set true height
137 */
138 if(flags & 0xC0){
140 }
146
147 return 0;
148 }
149
151 {
156 int pal_size = 0;
157
164 if(ret != size)
168 return 0;
169 }
174 case MKTAG(
'N',
'U',
'L',
'L'):
178 if(pal_size) memcpy(pkt->
data, pal, pal_size);
179 memcpy(pkt->
data + pal_size, buf, 4);
183 return 0;
184 case MKTAG(
'C',
'M',
'A',
'P'):
185 pal_size = 768+4;
186 memcpy(pal, buf, 4);
188 break;
189 case MKTAG(
'F',
'R',
'A',
'M'):
192 if(size > 0xFFFFFF){
195 }
200 if(ret != size){
203 }
204 if(pal_size) memcpy(pkt->
data, pal, pal_size);
209 return 0;
210 default:
213 }
214 }
216 }
217
225 };