comparison mov.c @ 5991:b65ecf9c2a26 libavformat

mov: Read nero chapters
author conrad
date Wed, 05 May 2010 08:41:01 +0000
parents f74198942337
children 2bab410094e0
comparison
equal deleted inserted replaced
5990:d52b769af700 5991:b65ecf9c2a26
214 av_log(c->fc, AV_LOG_DEBUG, "lang \"%3s\" ", language); 214 av_log(c->fc, AV_LOG_DEBUG, "lang \"%3s\" ", language);
215 av_log(c->fc, AV_LOG_DEBUG, "tag \"%s\" value \"%s\" atom \"%.4s\" %d %lld\n", 215 av_log(c->fc, AV_LOG_DEBUG, "tag \"%s\" value \"%s\" atom \"%.4s\" %d %lld\n",
216 key, str, (char*)&atom.type, str_size, atom.size); 216 key, str, (char*)&atom.type, str_size, atom.size);
217 #endif 217 #endif
218 218
219 return 0;
220 }
221
222 static int mov_read_chpl(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
223 {
224 int64_t start;
225 int i, nb_chapters, str_len;
226 char str[256+1];
227
228 if ((atom.size -= 5) < 0)
229 return 0;
230
231 get_be32(pb); // version + flags
232 get_be32(pb); // ???
233 nb_chapters = get_byte(pb);
234
235 for (i = 0; i < nb_chapters; i++) {
236 if (atom.size < 9)
237 return 0;
238
239 start = get_be64(pb);
240 str_len = get_byte(pb);
241
242 if ((atom.size -= 9+str_len) < 0)
243 return 0;
244
245 get_buffer(pb, str, str_len);
246 str[str_len] = 0;
247 ff_new_chapter(c->fc, i, (AVRational){1,10000000}, start, AV_NOPTS_VALUE, str);
248 }
219 return 0; 249 return 0;
220 } 250 }
221 251
222 static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom) 252 static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
223 { 253 {
2164 return 0; 2194 return 0;
2165 } 2195 }
2166 2196
2167 static const MOVParseTableEntry mov_default_parse_table[] = { 2197 static const MOVParseTableEntry mov_default_parse_table[] = {
2168 { MKTAG('a','v','s','s'), mov_read_extradata }, 2198 { MKTAG('a','v','s','s'), mov_read_extradata },
2199 { MKTAG('c','h','p','l'), mov_read_chpl },
2169 { MKTAG('c','o','6','4'), mov_read_stco }, 2200 { MKTAG('c','o','6','4'), mov_read_stco },
2170 { MKTAG('c','t','t','s'), mov_read_ctts }, /* composition time to sample */ 2201 { MKTAG('c','t','t','s'), mov_read_ctts }, /* composition time to sample */
2171 { MKTAG('d','i','n','f'), mov_read_default }, 2202 { MKTAG('d','i','n','f'), mov_read_default },
2172 { MKTAG('d','r','e','f'), mov_read_dref }, 2203 { MKTAG('d','r','e','f'), mov_read_dref },
2173 { MKTAG('e','d','t','s'), mov_read_default }, 2204 { MKTAG('e','d','t','s'), mov_read_default },