Mercurial > libavformat.hg
comparison mov.c @ 2027:f42fec0331d5 libavformat
remove broken ctab code
author | bcoudurier |
---|---|
date | Sat, 21 Apr 2007 18:03:53 +0000 |
parents | 2e2c2dbb511d |
children | 319147157f29 |
comparison
equal
deleted
inserted
replaced
2026:2e2c2dbb511d | 2027:f42fec0331d5 |
---|---|
81 uint32_t type; | 81 uint32_t type; |
82 int64_t offset; | 82 int64_t offset; |
83 int64_t size; /* total size (excluding the size and type fields) */ | 83 int64_t size; /* total size (excluding the size and type fields) */ |
84 } MOV_atom_t; | 84 } MOV_atom_t; |
85 | 85 |
86 typedef struct { | |
87 int seed; | |
88 int flags; | |
89 int size; | |
90 void* clrs; | |
91 } MOV_ctab_t; | |
92 | |
93 typedef struct MOV_mdat_atom_s { | 86 typedef struct MOV_mdat_atom_s { |
94 offset_t offset; | 87 offset_t offset; |
95 int64_t size; | 88 int64_t size; |
96 } MOV_mdat_atom_t; | 89 } MOV_mdat_atom_t; |
97 | 90 |
181 int found_mdat; /* we suppose we have enough data to read the file */ | 174 int found_mdat; /* we suppose we have enough data to read the file */ |
182 int64_t mdat_offset; | 175 int64_t mdat_offset; |
183 int total_streams; | 176 int total_streams; |
184 MOVStreamContext *streams[MAX_STREAMS]; | 177 MOVStreamContext *streams[MAX_STREAMS]; |
185 | 178 |
186 int ctab_size; | |
187 MOV_ctab_t **ctab; /* color tables */ | |
188 const struct MOVParseTableEntry *parse_table; /* could be eventually used to change the table */ | 179 const struct MOVParseTableEntry *parse_table; /* could be eventually used to change the table */ |
189 /* NOTE: for recursion save to/ restore from local variable! */ | 180 /* NOTE: for recursion save to/ restore from local variable! */ |
190 | 181 |
191 AVPaletteControl palette_control; | 182 AVPaletteControl palette_control; |
192 MOV_mdat_atom_t *mdat_list; | 183 MOV_mdat_atom_t *mdat_list; |
270 if (!err && total_size < atom.size && atom.size < 0x7ffff) { | 261 if (!err && total_size < atom.size && atom.size < 0x7ffff) { |
271 url_fskip(pb, atom.size - total_size); | 262 url_fskip(pb, atom.size - total_size); |
272 } | 263 } |
273 | 264 |
274 return err; | 265 return err; |
275 } | |
276 | |
277 static int mov_read_ctab(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) | |
278 { | |
279 #if 1 | |
280 url_fskip(pb, atom.size); // for now | |
281 #else | |
282 VERY VERY BROKEN, NEVER execute this, needs rewrite | |
283 unsigned int len; | |
284 MOV_ctab_t *t; | |
285 c->ctab = av_realloc(c->ctab, ++c->ctab_size); | |
286 t = c->ctab[c->ctab_size]; | |
287 t->seed = get_be32(pb); | |
288 t->flags = get_be16(pb); | |
289 t->size = get_be16(pb) + 1; | |
290 len = 2 * t->size * 4; | |
291 if (len > 0) { | |
292 t->clrs = av_malloc(len); // 16bit A R G B | |
293 if (t->clrs) | |
294 get_buffer(pb, t->clrs, len); | |
295 } | |
296 #endif | |
297 | |
298 return 0; | |
299 } | 266 } |
300 | 267 |
301 static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) | 268 static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) |
302 { | 269 { |
303 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; | 270 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; |
1295 { MKTAG( 's', 't', 's', 'z' ), mov_read_stsz }, /* sample size */ | 1262 { MKTAG( 's', 't', 's', 'z' ), mov_read_stsz }, /* sample size */ |
1296 { MKTAG( 's', 't', 't', 's' ), mov_read_stts }, | 1263 { MKTAG( 's', 't', 't', 's' ), mov_read_stts }, |
1297 { MKTAG( 't', 'k', 'h', 'd' ), mov_read_tkhd }, /* track header */ | 1264 { MKTAG( 't', 'k', 'h', 'd' ), mov_read_tkhd }, /* track header */ |
1298 { MKTAG( 't', 'r', 'a', 'k' ), mov_read_trak }, | 1265 { MKTAG( 't', 'r', 'a', 'k' ), mov_read_trak }, |
1299 { MKTAG( 'w', 'a', 'v', 'e' ), mov_read_wave }, | 1266 { MKTAG( 'w', 'a', 'v', 'e' ), mov_read_wave }, |
1300 { MKTAG( 'c', 't', 'a', 'b' ), mov_read_ctab }, | |
1301 { MKTAG( 'e', 's', 'd', 's' ), mov_read_esds }, | 1267 { MKTAG( 'e', 's', 'd', 's' ), mov_read_esds }, |
1302 { MKTAG( 'w', 'i', 'd', 'e' ), mov_read_wide }, /* place holder */ | 1268 { MKTAG( 'w', 'i', 'd', 'e' ), mov_read_wide }, /* place holder */ |
1303 { MKTAG( 'c', 'm', 'o', 'v' ), mov_read_cmov }, | 1269 { MKTAG( 'c', 'm', 'o', 'v' ), mov_read_cmov }, |
1304 { 0L, NULL } | 1270 { 0L, NULL } |
1305 }; | 1271 }; |
1665 { | 1631 { |
1666 int i; | 1632 int i; |
1667 MOVContext *mov = s->priv_data; | 1633 MOVContext *mov = s->priv_data; |
1668 for(i=0; i<mov->total_streams; i++) | 1634 for(i=0; i<mov->total_streams; i++) |
1669 mov_free_stream_context(mov->streams[i]); | 1635 mov_free_stream_context(mov->streams[i]); |
1670 /* free color tabs */ | |
1671 for(i=0; i<mov->ctab_size; i++) | |
1672 av_freep(&mov->ctab[i]); | |
1673 if(mov->dv_demux){ | 1636 if(mov->dv_demux){ |
1674 for(i=0; i<mov->dv_fctx->nb_streams; i++){ | 1637 for(i=0; i<mov->dv_fctx->nb_streams; i++){ |
1675 av_freep(&mov->dv_fctx->streams[i]->codec); | 1638 av_freep(&mov->dv_fctx->streams[i]->codec); |
1676 av_freep(&mov->dv_fctx->streams[i]); | 1639 av_freep(&mov->dv_fctx->streams[i]); |
1677 } | 1640 } |
1678 av_freep(&mov->dv_fctx); | 1641 av_freep(&mov->dv_fctx); |
1679 av_freep(&mov->dv_demux); | 1642 av_freep(&mov->dv_demux); |
1680 } | 1643 } |
1681 av_freep(&mov->ctab); | |
1682 return 0; | 1644 return 0; |
1683 } | 1645 } |
1684 | 1646 |
1685 AVInputFormat mov_demuxer = { | 1647 AVInputFormat mov_demuxer = { |
1686 "mov,mp4,m4a,3gp,3g2,mj2", | 1648 "mov,mp4,m4a,3gp,3g2,mj2", |