changeset 1548:5bb34e659b1c libavformat

Simplify the Sega FILM/CPK demuxer to not modify the bastardized Cinepak stream. I changes the lavc Cinepak decoder some time ago to be able to handle the deviant data, but never updated this demuxer.
author melanson
date Sat, 02 Dec 2006 21:28:05 +0000
parents e48e3a714f24
children 3b4019c023a3
files segafilm.c
diffstat 1 files changed, 3 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/segafilm.c	Fri Dec 01 10:26:54 2006 +0000
+++ b/segafilm.c	Sat Dec 02 21:28:05 2006 +0000
@@ -58,8 +58,6 @@
 
     unsigned int base_clock;
     unsigned int version;
-    int cvid_extra_bytes;  /* the number of bytes thrown into the Cinepak
-                            * chunk header to throw off decoders */
 
     /* buffer used for interleaving stereo PCM data */
     unsigned char *stereo_buffer;
@@ -126,13 +124,8 @@
     if (BE_32(&scratch[0]) != FDSC_TAG)
         return AVERROR_INVALIDDATA;
 
-    film->cvid_extra_bytes = 0;
     if (BE_32(&scratch[8]) == CVID_TAG) {
         film->video_type = CODEC_ID_CINEPAK;
-        if (film->version)
-            film->cvid_extra_bytes = 2;
-        else
-            film->cvid_extra_bytes = 6;  /* Lemmings 3DO case */
     } else
         film->video_type = 0;
 
@@ -231,18 +224,10 @@
     /* do a special song and dance when loading FILM Cinepak chunks */
     if ((sample->stream == film->video_stream_index) &&
         (film->video_type == CODEC_ID_CINEPAK)) {
-        if (av_new_packet(pkt, sample->sample_size - film->cvid_extra_bytes))
+        pkt->pos= url_ftell(pb);
+        if (av_new_packet(pkt, sample->sample_size))
             return AVERROR_NOMEM;
-        if(pkt->size < 10)
-            return -1;
-        pkt->pos= url_ftell(pb);
-        ret = get_buffer(pb, pkt->data, 10);
-        /* skip the non-spec CVID bytes */
-        url_fseek(pb, film->cvid_extra_bytes, SEEK_CUR);
-        ret += get_buffer(pb, pkt->data + 10,
-            sample->sample_size - 10 - film->cvid_extra_bytes);
-        if (ret != sample->sample_size - film->cvid_extra_bytes)
-            ret = AVERROR_IO;
+        get_buffer(pb, pkt->data, sample->sample_size);
     } else if ((sample->stream == film->audio_stream_index) &&
         (film->audio_channels == 2)) {
         /* stereo PCM needs to be interleaved */