Mercurial > libavformat.hg
annotate 4xm.c @ 4296:42a9dba93e69 libavformat
Fix memleak of header in error returns.
author | michael |
---|---|
date | Tue, 27 Jan 2009 21:06:19 +0000 |
parents | 36a6d25e95ea |
children | 85aa6639649a |
rev | line source |
---|---|
137 | 1 /* |
2 * 4X Technologies .4xm File Demuxer (no muxer) | |
3 * Copyright (c) 2003 The ffmpeg Project | |
4 * | |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1169
diff
changeset
|
5 * This file is part of FFmpeg. |
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1169
diff
changeset
|
6 * |
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1169
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
137 | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1169
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
137 | 11 * |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1169
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
137 | 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 | |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1169
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
896
edbe5c3717f9
Update licensing information: The FSF changed postal address.
diego
parents:
885
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
137 | 20 */ |
21 | |
22 /** | |
23 * @file 4xm.c | |
24 * 4X Technologies file demuxer | |
25 * by Mike Melanson (melanson@pcisys.net) | |
26 * for more information on the .4xm file format, visit: | |
27 * http://www.pcisys.net/~melanson/codecs/ | |
28 */ | |
29 | |
4201
7d2f3f1b68d8
Fix build: Add intreadwrite.h and bswap.h #includes where necessary.
diego
parents:
4199
diff
changeset
|
30 #include "libavutil/intreadwrite.h" |
137 | 31 #include "avformat.h" |
32 | |
4199 | 33 #define RIFF_TAG MKTAG('R', 'I', 'F', 'F') |
4198 | 34 #define FOURXMV_TAG MKTAG('4', 'X', 'M', 'V') |
4199 | 35 #define LIST_TAG MKTAG('L', 'I', 'S', 'T') |
36 #define HEAD_TAG MKTAG('H', 'E', 'A', 'D') | |
37 #define TRK__TAG MKTAG('T', 'R', 'K', '_') | |
38 #define MOVI_TAG MKTAG('M', 'O', 'V', 'I') | |
39 #define VTRK_TAG MKTAG('V', 'T', 'R', 'K') | |
40 #define STRK_TAG MKTAG('S', 'T', 'R', 'K') | |
41 #define std__TAG MKTAG('s', 't', 'd', '_') | |
42 #define name_TAG MKTAG('n', 'a', 'm', 'e') | |
43 #define vtrk_TAG MKTAG('v', 't', 'r', 'k') | |
44 #define strk_TAG MKTAG('s', 't', 'r', 'k') | |
45 #define ifrm_TAG MKTAG('i', 'f', 'r', 'm') | |
46 #define pfrm_TAG MKTAG('p', 'f', 'r', 'm') | |
47 #define cfrm_TAG MKTAG('c', 'f', 'r', 'm') | |
48 #define ifr2_TAG MKTAG('i', 'f', 'r', '2') | |
49 #define pfr2_TAG MKTAG('p', 'f', 'r', '2') | |
50 #define cfr2_TAG MKTAG('c', 'f', 'r', '2') | |
51 #define snd__TAG MKTAG('s', 'n', 'd', '_') | |
137 | 52 |
53 #define vtrk_SIZE 0x44 | |
54 #define strk_SIZE 0x28 | |
55 | |
56 #define GET_LIST_HEADER() \ | |
143 | 57 fourcc_tag = get_le32(pb); \ |
137 | 58 size = get_le32(pb); \ |
59 if (fourcc_tag != LIST_TAG) \ | |
60 return AVERROR_INVALIDDATA; \ | |
143 | 61 fourcc_tag = get_le32(pb); |
137 | 62 |
63 typedef struct AudioTrack { | |
64 int sample_rate; | |
65 int bits; | |
66 int channels; | |
143 | 67 int stream_index; |
145 | 68 int adpcm; |
137 | 69 } AudioTrack; |
70 | |
71 typedef struct FourxmDemuxContext { | |
72 int width; | |
73 int height; | |
143 | 74 int video_stream_index; |
137 | 75 int track_count; |
76 AudioTrack *tracks; | |
77 int selected_track; | |
143 | 78 |
316
9aa23c6d396e
use the proper file framerate (specified by a float); account the pts
melanson
parents:
254
diff
changeset
|
79 int64_t audio_pts; |
9aa23c6d396e
use the proper file framerate (specified by a float); account the pts
melanson
parents:
254
diff
changeset
|
80 int64_t video_pts; |
317 | 81 float fps; |
137 | 82 } FourxmDemuxContext; |
83 | |
84 static int fourxm_probe(AVProbeData *p) | |
85 { | |
1673 | 86 if ((AV_RL32(&p->buf[0]) != RIFF_TAG) || |
4198 | 87 (AV_RL32(&p->buf[8]) != FOURXMV_TAG)) |
137 | 88 return 0; |
89 | |
90 return AVPROBE_SCORE_MAX; | |
91 } | |
92 | |
93 static int fourxm_read_header(AVFormatContext *s, | |
143 | 94 AVFormatParameters *ap) |
137 | 95 { |
2771
d52c718e83f9
Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents:
2410
diff
changeset
|
96 ByteIOContext *pb = s->pb; |
137 | 97 unsigned int fourcc_tag; |
98 unsigned int size; | |
99 int header_size; | |
2006 | 100 FourxmDemuxContext *fourxm = s->priv_data; |
137 | 101 unsigned char *header; |
102 int i; | |
103 int current_track = -1; | |
104 AVStream *st; | |
105 | |
106 fourxm->track_count = 0; | |
107 fourxm->tracks = NULL; | |
108 fourxm->selected_track = 0; | |
317 | 109 fourxm->fps = 1.0; |
137 | 110 |
111 /* skip the first 3 32-bit numbers */ | |
112 url_fseek(pb, 12, SEEK_CUR); | |
113 | |
114 /* check for LIST-HEAD */ | |
115 GET_LIST_HEADER(); | |
116 header_size = size - 4; | |
4295 | 117 if (fourcc_tag != HEAD_TAG || header_size < 0) |
137 | 118 return AVERROR_INVALIDDATA; |
119 | |
120 /* allocate space for the header and load the whole thing */ | |
121 header = av_malloc(header_size); | |
122 if (!header) | |
2273
7eb456c4ed8a
Replace all occurrences of AVERROR_NOMEM with AVERROR(ENOMEM).
takis
parents:
2006
diff
changeset
|
123 return AVERROR(ENOMEM); |
4296 | 124 if (get_buffer(pb, header, header_size) != header_size){ |
125 av_free(header); | |
2274
b21c2af60bc9
Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents:
2273
diff
changeset
|
126 return AVERROR(EIO); |
4296 | 127 } |
137 | 128 |
129 /* take the lazy approach and search for any and all vtrk and strk chunks */ | |
130 for (i = 0; i < header_size - 8; i++) { | |
1673 | 131 fourcc_tag = AV_RL32(&header[i]); |
132 size = AV_RL32(&header[i + 4]); | |
137 | 133 |
316
9aa23c6d396e
use the proper file framerate (specified by a float); account the pts
melanson
parents:
254
diff
changeset
|
134 if (fourcc_tag == std__TAG) { |
1673 | 135 fourxm->fps = av_int2flt(AV_RL32(&header[i + 12])); |
316
9aa23c6d396e
use the proper file framerate (specified by a float); account the pts
melanson
parents:
254
diff
changeset
|
136 } else if (fourcc_tag == vtrk_TAG) { |
137 | 137 /* check that there is enough data */ |
138 if (size != vtrk_SIZE) { | |
139 av_free(header); | |
140 return AVERROR_INVALIDDATA; | |
141 } | |
1673 | 142 fourxm->width = AV_RL32(&header[i + 36]); |
143 fourxm->height = AV_RL32(&header[i + 40]); | |
143 | 144 |
145 /* allocate a new AVStream */ | |
146 st = av_new_stream(s, 0); | |
4296 | 147 if (!st){ |
148 av_free(header); | |
2273
7eb456c4ed8a
Replace all occurrences of AVERROR_NOMEM with AVERROR(ENOMEM).
takis
parents:
2006
diff
changeset
|
149 return AVERROR(ENOMEM); |
4296 | 150 } |
740 | 151 av_set_pts_info(st, 60, 1, fourxm->fps); |
143 | 152 |
153 fourxm->video_stream_index = st->index; | |
154 | |
820
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
155 st->codec->codec_type = CODEC_TYPE_VIDEO; |
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
156 st->codec->codec_id = CODEC_ID_4XM; |
2410
9b58a031620e
Change 4xm demuxer and video decoder to pass the video format version in
rtogni
parents:
2379
diff
changeset
|
157 st->codec->extradata_size = 4; |
9b58a031620e
Change 4xm demuxer and video decoder to pass the video format version in
rtogni
parents:
2379
diff
changeset
|
158 st->codec->extradata = av_malloc(4); |
9b58a031620e
Change 4xm demuxer and video decoder to pass the video format version in
rtogni
parents:
2379
diff
changeset
|
159 AV_WL32(st->codec->extradata, AV_RL32(&header[i + 16])); |
820
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
160 st->codec->width = fourxm->width; |
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
161 st->codec->height = fourxm->height; |
143 | 162 |
2379 | 163 i += 8 + size; |
137 | 164 } else if (fourcc_tag == strk_TAG) { |
165 /* check that there is enough data */ | |
166 if (size != strk_SIZE) { | |
167 av_free(header); | |
168 return AVERROR_INVALIDDATA; | |
169 } | |
1673 | 170 current_track = AV_RL32(&header[i + 8]); |
137 | 171 if (current_track + 1 > fourxm->track_count) { |
141 | 172 fourxm->track_count = current_track + 1; |
4296 | 173 if((unsigned)fourxm->track_count >= UINT_MAX / sizeof(AudioTrack)){ |
174 av_free(header); | |
639 | 175 return -1; |
4296 | 176 } |
885 | 177 fourxm->tracks = av_realloc(fourxm->tracks, |
141 | 178 fourxm->track_count * sizeof(AudioTrack)); |
137 | 179 if (!fourxm->tracks) { |
180 av_free(header); | |
2273
7eb456c4ed8a
Replace all occurrences of AVERROR_NOMEM with AVERROR(ENOMEM).
takis
parents:
2006
diff
changeset
|
181 return AVERROR(ENOMEM); |
137 | 182 } |
183 } | |
1673 | 184 fourxm->tracks[current_track].adpcm = AV_RL32(&header[i + 12]); |
185 fourxm->tracks[current_track].channels = AV_RL32(&header[i + 36]); | |
186 fourxm->tracks[current_track].sample_rate = AV_RL32(&header[i + 40]); | |
187 fourxm->tracks[current_track].bits = AV_RL32(&header[i + 44]); | |
137 | 188 i += 8 + size; |
143 | 189 |
190 /* allocate a new AVStream */ | |
191 st = av_new_stream(s, current_track); | |
4296 | 192 if (!st){ |
193 av_free(header); | |
2273
7eb456c4ed8a
Replace all occurrences of AVERROR_NOMEM with AVERROR(ENOMEM).
takis
parents:
2006
diff
changeset
|
194 return AVERROR(ENOMEM); |
4296 | 195 } |
143 | 196 |
740 | 197 av_set_pts_info(st, 60, 1, fourxm->tracks[current_track].sample_rate); |
462
b69898ffc92a
move time_base (pts_num/pts_den) from AVFormatContext -> AVStream
michael
parents:
386
diff
changeset
|
198 |
143 | 199 fourxm->tracks[current_track].stream_index = st->index; |
200 | |
820
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
201 st->codec->codec_type = CODEC_TYPE_AUDIO; |
1450
1580c48ba4b9
Do not set audio codec_tag to 1, that would be PCM audio.
diego
parents:
1358
diff
changeset
|
202 st->codec->codec_tag = 0; |
820
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
203 st->codec->channels = fourxm->tracks[current_track].channels; |
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
204 st->codec->sample_rate = fourxm->tracks[current_track].sample_rate; |
3908
1d3d17de20ba
Bump Major version, this commit is almost just renaming bits_per_sample to
michael
parents:
3424
diff
changeset
|
205 st->codec->bits_per_coded_sample = fourxm->tracks[current_track].bits; |
820
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
206 st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * |
3908
1d3d17de20ba
Bump Major version, this commit is almost just renaming bits_per_sample to
michael
parents:
3424
diff
changeset
|
207 st->codec->bits_per_coded_sample; |
1d3d17de20ba
Bump Major version, this commit is almost just renaming bits_per_sample to
michael
parents:
3424
diff
changeset
|
208 st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample; |
145 | 209 if (fourxm->tracks[current_track].adpcm) |
820
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
210 st->codec->codec_id = CODEC_ID_ADPCM_4XM; |
3908
1d3d17de20ba
Bump Major version, this commit is almost just renaming bits_per_sample to
michael
parents:
3424
diff
changeset
|
211 else if (st->codec->bits_per_coded_sample == 8) |
820
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
212 st->codec->codec_id = CODEC_ID_PCM_U8; |
143 | 213 else |
820
feca73904e67
changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents:
775
diff
changeset
|
214 st->codec->codec_id = CODEC_ID_PCM_S16LE; |
137 | 215 } |
216 } | |
217 | |
218 av_free(header); | |
219 | |
220 /* skip over the LIST-MOVI chunk (which is where the stream should be */ | |
221 GET_LIST_HEADER(); | |
222 if (fourcc_tag != MOVI_TAG) | |
223 return AVERROR_INVALIDDATA; | |
224 | |
143 | 225 /* initialize context members */ |
740 | 226 fourxm->video_pts = -1; /* first frame will push to 0 */ |
316
9aa23c6d396e
use the proper file framerate (specified by a float); account the pts
melanson
parents:
254
diff
changeset
|
227 fourxm->audio_pts = 0; |
137 | 228 |
229 return 0; | |
230 } | |
231 | |
232 static int fourxm_read_packet(AVFormatContext *s, | |
143 | 233 AVPacket *pkt) |
137 | 234 { |
235 FourxmDemuxContext *fourxm = s->priv_data; | |
2771
d52c718e83f9
Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents:
2410
diff
changeset
|
236 ByteIOContext *pb = s->pb; |
137 | 237 unsigned int fourcc_tag; |
145 | 238 unsigned int size, out_size; |
137 | 239 int ret = 0; |
240 int track_number; | |
241 int packet_read = 0; | |
143 | 242 unsigned char header[8]; |
316
9aa23c6d396e
use the proper file framerate (specified by a float); account the pts
melanson
parents:
254
diff
changeset
|
243 int audio_frame_count; |
137 | 244 |
245 while (!packet_read) { | |
246 | |
2771
d52c718e83f9
Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents:
2410
diff
changeset
|
247 if ((ret = get_buffer(s->pb, header, 8)) < 0) |
143 | 248 return ret; |
1673 | 249 fourcc_tag = AV_RL32(&header[0]); |
250 size = AV_RL32(&header[4]); | |
137 | 251 if (url_feof(pb)) |
2274
b21c2af60bc9
Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents:
2273
diff
changeset
|
252 return AVERROR(EIO); |
137 | 253 switch (fourcc_tag) { |
254 | |
144 | 255 case LIST_TAG: |
316
9aa23c6d396e
use the proper file framerate (specified by a float); account the pts
melanson
parents:
254
diff
changeset
|
256 /* this is a good time to bump the video pts */ |
740 | 257 fourxm->video_pts ++; |
316
9aa23c6d396e
use the proper file framerate (specified by a float); account the pts
melanson
parents:
254
diff
changeset
|
258 |
144 | 259 /* skip the LIST-* tag and move on to the next fourcc */ |
260 get_le32(pb); | |
261 break; | |
262 | |
137 | 263 case ifrm_TAG: |
264 case pfrm_TAG: | |
2377
2a44e9c75bf3
pass *fr2 chunks to decoder (Toy-Story2_better-image-quality.4xa contains them)
michael
parents:
2274
diff
changeset
|
265 case cfrm_TAG: |
2a44e9c75bf3
pass *fr2 chunks to decoder (Toy-Story2_better-image-quality.4xa contains them)
michael
parents:
2274
diff
changeset
|
266 case ifr2_TAG: |
2a44e9c75bf3
pass *fr2 chunks to decoder (Toy-Story2_better-image-quality.4xa contains them)
michael
parents:
2274
diff
changeset
|
267 case pfr2_TAG: |
2a44e9c75bf3
pass *fr2 chunks to decoder (Toy-Story2_better-image-quality.4xa contains them)
michael
parents:
2274
diff
changeset
|
268 case cfr2_TAG: |
2a44e9c75bf3
pass *fr2 chunks to decoder (Toy-Story2_better-image-quality.4xa contains them)
michael
parents:
2274
diff
changeset
|
269 { |
143 | 270 |
271 /* allocate 8 more bytes than 'size' to account for fourcc | |
272 * and size */ | |
643 | 273 if (size + 8 < size || av_new_packet(pkt, size + 8)) |
2274
b21c2af60bc9
Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents:
2273
diff
changeset
|
274 return AVERROR(EIO); |
143 | 275 pkt->stream_index = fourxm->video_stream_index; |
316
9aa23c6d396e
use the proper file framerate (specified by a float); account the pts
melanson
parents:
254
diff
changeset
|
276 pkt->pts = fourxm->video_pts; |
2771
d52c718e83f9
Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents:
2410
diff
changeset
|
277 pkt->pos = url_ftell(s->pb); |
143 | 278 memcpy(pkt->data, header, 8); |
2771
d52c718e83f9
Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents:
2410
diff
changeset
|
279 ret = get_buffer(s->pb, &pkt->data[8], size); |
143 | 280 |
281 if (ret < 0) | |
282 av_free_packet(pkt); | |
283 else | |
284 packet_read = 1; | |
139 | 285 break; |
286 } | |
143 | 287 |
137 | 288 case snd__TAG: |
289 track_number = get_le32(pb); | |
145 | 290 out_size= get_le32(pb); |
291 size-=8; | |
292 | |
137 | 293 if (track_number == fourxm->selected_track) { |
2771
d52c718e83f9
Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents:
2410
diff
changeset
|
294 ret= av_get_packet(s->pb, pkt, size); |
775 | 295 if(ret<0) |
2274
b21c2af60bc9
Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents:
2273
diff
changeset
|
296 return AVERROR(EIO); |
885 | 297 pkt->stream_index = |
143 | 298 fourxm->tracks[fourxm->selected_track].stream_index; |
316
9aa23c6d396e
use the proper file framerate (specified by a float); account the pts
melanson
parents:
254
diff
changeset
|
299 pkt->pts = fourxm->audio_pts; |
775 | 300 packet_read = 1; |
143 | 301 |
316
9aa23c6d396e
use the proper file framerate (specified by a float); account the pts
melanson
parents:
254
diff
changeset
|
302 /* pts accounting */ |
9aa23c6d396e
use the proper file framerate (specified by a float); account the pts
melanson
parents:
254
diff
changeset
|
303 audio_frame_count = size; |
9aa23c6d396e
use the proper file framerate (specified by a float); account the pts
melanson
parents:
254
diff
changeset
|
304 if (fourxm->tracks[fourxm->selected_track].adpcm) |
885 | 305 audio_frame_count -= |
316
9aa23c6d396e
use the proper file framerate (specified by a float); account the pts
melanson
parents:
254
diff
changeset
|
306 2 * (fourxm->tracks[fourxm->selected_track].channels); |
9aa23c6d396e
use the proper file framerate (specified by a float); account the pts
melanson
parents:
254
diff
changeset
|
307 audio_frame_count /= |
9aa23c6d396e
use the proper file framerate (specified by a float); account the pts
melanson
parents:
254
diff
changeset
|
308 fourxm->tracks[fourxm->selected_track].channels; |
9aa23c6d396e
use the proper file framerate (specified by a float); account the pts
melanson
parents:
254
diff
changeset
|
309 if (fourxm->tracks[fourxm->selected_track].adpcm) |
9aa23c6d396e
use the proper file framerate (specified by a float); account the pts
melanson
parents:
254
diff
changeset
|
310 audio_frame_count *= 2; |
885 | 311 else |
316
9aa23c6d396e
use the proper file framerate (specified by a float); account the pts
melanson
parents:
254
diff
changeset
|
312 audio_frame_count /= |
9aa23c6d396e
use the proper file framerate (specified by a float); account the pts
melanson
parents:
254
diff
changeset
|
313 (fourxm->tracks[fourxm->selected_track].bits / 8); |
740 | 314 fourxm->audio_pts += audio_frame_count; |
143 | 315 |
137 | 316 } else { |
317 url_fseek(pb, size, SEEK_CUR); | |
318 } | |
319 break; | |
320 | |
321 default: | |
322 url_fseek(pb, size, SEEK_CUR); | |
323 break; | |
324 } | |
325 } | |
326 return ret; | |
327 } | |
328 | |
329 static int fourxm_read_close(AVFormatContext *s) | |
330 { | |
2006 | 331 FourxmDemuxContext *fourxm = s->priv_data; |
137 | 332 |
333 av_free(fourxm->tracks); | |
334 | |
335 return 0; | |
336 } | |
337 | |
1169 | 338 AVInputFormat fourxm_demuxer = { |
137 | 339 "4xm", |
3424
7a0230981402
Make long_names in lavf/lavdev optional depending on CONFIG_SMALL.
diego
parents:
2771
diff
changeset
|
340 NULL_IF_CONFIG_SMALL("4X Technologies format"), |
137 | 341 sizeof(FourxmDemuxContext), |
342 fourxm_probe, | |
343 fourxm_read_header, | |
344 fourxm_read_packet, | |
345 fourxm_read_close, | |
346 }; |