aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2005-08-14 18:39:59 +0000
committerMike Melanson <mike@multimedia.cx>2005-08-14 18:39:59 +0000
commitaf9da83b0e1192ae6163633f66c420a332e2932c (patch)
tree3697b748cf1ac6155a6f5d6844aca7c1c2192f0c
parentf0ff20a197dd98d2c0ecef3d183185a5c45c7196 (diff)
downloadffmpeg-af9da83b0e1192ae6163633f66c420a332e2932c.tar.gz
automatically detect Cinepak data from Sega FILM/CPK files
Originally committed as revision 4525 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/cinepak.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c
index 3b00a1605d..d1e1f0ec16 100644
--- a/libavcodec/cinepak.c
+++ b/libavcodec/cinepak.c
@@ -316,13 +316,22 @@ static int cinepak_decode (CinepakContext *s)
uint8_t *eod = (s->data + s->size);
int i, result, strip_size, frame_flags, num_strips;
int y0 = 0;
+ int encoded_buf_size;
+ /* if true, Cinepak data is from a Sega FILM/CPK file */
+ int sega_film_data = 0;
if (s->size < 10)
return -1;
frame_flags = s->data[0];
num_strips = BE_16 (&s->data[8]);
- s->data += 10;
+ encoded_buf_size = BE_16 (&s->data[2]);
+ if (encoded_buf_size != s->size)
+ sega_film_data = 1;
+ if (sega_film_data)
+ s->data += 12;
+ else
+ s->data += 10;
if (num_strips > MAX_STRIPS)
num_strips = MAX_STRIPS;