annotate dxa.c @ 5044:2ef633b32f7a libavformat

Add support for muxing XSUB subtitles to AVI muxer.
author reimar
date Fri, 19 Jun 2009 13:26:10 +0000
parents 77e0c7511d41
children 33a244b7ca65
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1918
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
1 /*
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
2 * DXA demuxer
4251
77e0c7511d41 cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents: 4201
diff changeset
3 * Copyright (c) 2007 Konstantin Shishkov
1918
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
4 *
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
5 * This file is part of FFmpeg.
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
6 *
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
11 *
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
15 * Lesser General Public License for more details.
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
16 *
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
20 */
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
21
4201
7d2f3f1b68d8 Fix build: Add intreadwrite.h and bswap.h #includes where necessary.
diego
parents: 3424
diff changeset
22 #include "libavutil/intreadwrite.h"
1918
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
23 #include "avformat.h"
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
24 #include "riff.h"
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
25
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
26 #define DXA_EXTRA_SIZE 9
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
27
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
28 typedef struct{
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
29 int frames;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
30 int has_sound;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
31 int bpc;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
32 uint32_t bytes_left;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
33 int64_t wavpos, vidpos;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
34 int readvid;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
35 }DXAContext;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
36
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
37 static int dxa_probe(AVProbeData *p)
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
38 {
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
39 /* check file header */
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
40 if (p->buf[0] == 'D' && p->buf[1] == 'E' &&
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
41 p->buf[2] == 'X' && p->buf[3] == 'A')
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
42 return AVPROBE_SCORE_MAX;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
43 else
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
44 return 0;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
45 }
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
46
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
47 static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
48 {
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2274
diff changeset
49 ByteIOContext *pb = s->pb;
1918
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
50 DXAContext *c = s->priv_data;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
51 AVStream *st, *ast;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
52 uint32_t tag;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
53 int32_t fps;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
54 int w, h;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
55 int num, den;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
56 int flags;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
57
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
58 tag = get_le32(pb);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
59 if (tag != MKTAG('D', 'E', 'X', 'A'))
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
60 return -1;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
61 flags = get_byte(pb);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
62 c->frames = get_be16(pb);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
63 if(!c->frames){
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
64 av_log(s, AV_LOG_ERROR, "File contains no frames ???\n");
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
65 return -1;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
66 }
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
67
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
68 fps = get_be32(pb);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
69 if(fps > 0){
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
70 den = 1000;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
71 num = fps;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
72 }else if (fps < 0){
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
73 den = 100000;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
74 num = -fps;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
75 }else{
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
76 den = 10;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
77 num = 1;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
78 }
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
79 w = get_be16(pb);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
80 h = get_be16(pb);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
81 c->has_sound = 0;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
82
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
83 st = av_new_stream(s, 0);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
84 if (!st)
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
85 return -1;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
86
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
87 // Parse WAV data header
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
88 if(get_le32(pb) == MKTAG('W', 'A', 'V', 'E')){
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
89 uint32_t size, fsize;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
90 c->has_sound = 1;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
91 size = get_be32(pb);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
92 c->vidpos = url_ftell(pb) + size;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
93 url_fskip(pb, 16);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
94 fsize = get_le32(pb);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
95
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
96 ast = av_new_stream(s, 0);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
97 if (!ast)
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
98 return -1;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
99 get_wav_header(pb, ast->codec, fsize);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
100 // find 'data' chunk
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
101 while(url_ftell(pb) < c->vidpos && !url_feof(pb)){
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
102 tag = get_le32(pb);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
103 fsize = get_le32(pb);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
104 if(tag == MKTAG('d', 'a', 't', 'a')) break;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
105 url_fskip(pb, fsize);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
106 }
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
107 c->bpc = (fsize + c->frames - 1) / c->frames;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
108 if(ast->codec->block_align)
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
109 c->bpc = ((c->bpc + ast->codec->block_align - 1) / ast->codec->block_align) * ast->codec->block_align;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
110 c->bytes_left = fsize;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
111 c->wavpos = url_ftell(pb);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
112 url_fseek(pb, c->vidpos, SEEK_SET);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
113 }
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
114
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
115 /* now we are ready: build format streams */
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
116 st->codec->codec_type = CODEC_TYPE_VIDEO;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
117 st->codec->codec_id = CODEC_ID_DXA;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
118 st->codec->width = w;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
119 st->codec->height = h;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
120 av_reduce(&den, &num, den, num, (1UL<<31)-1);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
121 av_set_pts_info(st, 33, num, den);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
122 /* flags & 0x80 means that image is interlaced,
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
123 * flags & 0x40 means that image has double height
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
124 * either way set true height
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
125 */
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
126 if(flags & 0xC0){
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
127 st->codec->height >>= 1;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
128 }
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
129 c->readvid = !c->has_sound;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
130 c->vidpos = url_ftell(pb);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
131 s->start_time = 0;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
132 s->duration = (int64_t)c->frames * AV_TIME_BASE * num / den;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
133 av_log(s, AV_LOG_DEBUG, "%d frame(s)\n",c->frames);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
134
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
135 return 0;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
136 }
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
137
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
138 static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
139 {
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
140 DXAContext *c = s->priv_data;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
141 int ret;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
142 uint32_t size;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
143 uint8_t buf[DXA_EXTRA_SIZE], pal[768+4];
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
144 int pal_size = 0;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
145
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
146 if(!c->readvid && c->has_sound && c->bytes_left){
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
147 c->readvid = 1;
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2274
diff changeset
148 url_fseek(s->pb, c->wavpos, SEEK_SET);
1918
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
149 size = FFMIN(c->bytes_left, c->bpc);
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2274
diff changeset
150 ret = av_get_packet(s->pb, pkt, size);
1918
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
151 pkt->stream_index = 1;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
152 if(ret != size)
2274
b21c2af60bc9 Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents: 2273
diff changeset
153 return AVERROR(EIO);
1918
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
154 c->bytes_left -= size;
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2274
diff changeset
155 c->wavpos = url_ftell(s->pb);
1918
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
156 return 0;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
157 }
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2274
diff changeset
158 url_fseek(s->pb, c->vidpos, SEEK_SET);
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2274
diff changeset
159 while(!url_feof(s->pb) && c->frames){
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2274
diff changeset
160 get_buffer(s->pb, buf, 4);
1918
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
161 switch(AV_RL32(buf)){
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
162 case MKTAG('N', 'U', 'L', 'L'):
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
163 if(av_new_packet(pkt, 4 + pal_size) < 0)
2273
7eb456c4ed8a Replace all occurrences of AVERROR_NOMEM with AVERROR(ENOMEM).
takis
parents: 2001
diff changeset
164 return AVERROR(ENOMEM);
1918
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
165 pkt->stream_index = 0;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
166 if(pal_size) memcpy(pkt->data, pal, pal_size);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
167 memcpy(pkt->data + pal_size, buf, 4);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
168 c->frames--;
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2274
diff changeset
169 c->vidpos = url_ftell(s->pb);
1918
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
170 c->readvid = 0;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
171 return 0;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
172 case MKTAG('C', 'M', 'A', 'P'):
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
173 pal_size = 768+4;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
174 memcpy(pal, buf, 4);
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2274
diff changeset
175 get_buffer(s->pb, pal + 4, 768);
1918
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
176 break;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
177 case MKTAG('F', 'R', 'A', 'M'):
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2274
diff changeset
178 get_buffer(s->pb, buf + 4, DXA_EXTRA_SIZE - 4);
1918
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
179 size = AV_RB32(buf + 5);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
180 if(size > 0xFFFFFF){
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
181 av_log(s, AV_LOG_ERROR, "Frame size is too big: %d\n", size);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
182 return -1;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
183 }
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
184 if(av_new_packet(pkt, size + DXA_EXTRA_SIZE + pal_size) < 0)
2273
7eb456c4ed8a Replace all occurrences of AVERROR_NOMEM with AVERROR(ENOMEM).
takis
parents: 2001
diff changeset
185 return AVERROR(ENOMEM);
1918
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
186 memcpy(pkt->data + pal_size, buf, DXA_EXTRA_SIZE);
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2274
diff changeset
187 ret = get_buffer(s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size);
1918
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
188 if(ret != size){
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
189 av_free_packet(pkt);
2274
b21c2af60bc9 Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents: 2273
diff changeset
190 return AVERROR(EIO);
1918
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
191 }
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
192 if(pal_size) memcpy(pkt->data, pal, pal_size);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
193 pkt->stream_index = 0;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
194 c->frames--;
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2274
diff changeset
195 c->vidpos = url_ftell(s->pb);
1918
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
196 c->readvid = 0;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
197 return 0;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
198 default:
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
199 av_log(s, AV_LOG_ERROR, "Unknown tag %c%c%c%c\n", buf[0], buf[1], buf[2], buf[3]);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
200 return -1;
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
201 }
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
202 }
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
203 return AVERROR(EIO);
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
204 }
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
205
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
206 AVInputFormat dxa_demuxer = {
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
207 "dxa",
3424
7a0230981402 Make long_names in lavf/lavdev optional depending on CONFIG_SMALL.
diego
parents: 2771
diff changeset
208 NULL_IF_CONFIG_SMALL("DXA"),
1918
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
209 sizeof(DXAContext),
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
210 dxa_probe,
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
211 dxa_read_header,
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
212 dxa_read_packet,
7ccf23e42481 DXA demuxer and decoder
kostya
parents:
diff changeset
213 };