Mercurial > libavcodec.hg
comparison cinepak.c @ 2836:7bfea1374957 libavcodec
automatically detect Cinepak data from Sega FILM/CPK files
author | melanson |
---|---|
date | Sun, 14 Aug 2005 18:39:59 +0000 |
parents | af90d5dc83f0 |
children | c8fa6a50fca5 |
comparison
equal
deleted
inserted
replaced
2835:d4c4b84e0fac | 2836:7bfea1374957 |
---|---|
314 static int cinepak_decode (CinepakContext *s) | 314 static int cinepak_decode (CinepakContext *s) |
315 { | 315 { |
316 uint8_t *eod = (s->data + s->size); | 316 uint8_t *eod = (s->data + s->size); |
317 int i, result, strip_size, frame_flags, num_strips; | 317 int i, result, strip_size, frame_flags, num_strips; |
318 int y0 = 0; | 318 int y0 = 0; |
319 int encoded_buf_size; | |
320 /* if true, Cinepak data is from a Sega FILM/CPK file */ | |
321 int sega_film_data = 0; | |
319 | 322 |
320 if (s->size < 10) | 323 if (s->size < 10) |
321 return -1; | 324 return -1; |
322 | 325 |
323 frame_flags = s->data[0]; | 326 frame_flags = s->data[0]; |
324 num_strips = BE_16 (&s->data[8]); | 327 num_strips = BE_16 (&s->data[8]); |
325 s->data += 10; | 328 encoded_buf_size = BE_16 (&s->data[2]); |
329 if (encoded_buf_size != s->size) | |
330 sega_film_data = 1; | |
331 if (sega_film_data) | |
332 s->data += 12; | |
333 else | |
334 s->data += 10; | |
326 | 335 |
327 if (num_strips > MAX_STRIPS) | 336 if (num_strips > MAX_STRIPS) |
328 num_strips = MAX_STRIPS; | 337 num_strips = MAX_STRIPS; |
329 | 338 |
330 for (i=0; i < num_strips; i++) { | 339 for (i=0; i < num_strips; i++) { |