You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
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. Originally committed as revision 7214 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
@@ -58,8 +58,6 @@ typedef struct FilmDemuxContext {
|
|||||||
|
|
||||||
unsigned int base_clock;
|
unsigned int base_clock;
|
||||||
unsigned int version;
|
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 */
|
/* buffer used for interleaving stereo PCM data */
|
||||||
unsigned char *stereo_buffer;
|
unsigned char *stereo_buffer;
|
||||||
@@ -126,13 +124,8 @@ static int film_read_header(AVFormatContext *s,
|
|||||||
if (BE_32(&scratch[0]) != FDSC_TAG)
|
if (BE_32(&scratch[0]) != FDSC_TAG)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
film->cvid_extra_bytes = 0;
|
|
||||||
if (BE_32(&scratch[8]) == CVID_TAG) {
|
if (BE_32(&scratch[8]) == CVID_TAG) {
|
||||||
film->video_type = CODEC_ID_CINEPAK;
|
film->video_type = CODEC_ID_CINEPAK;
|
||||||
if (film->version)
|
|
||||||
film->cvid_extra_bytes = 2;
|
|
||||||
else
|
|
||||||
film->cvid_extra_bytes = 6; /* Lemmings 3DO case */
|
|
||||||
} else
|
} else
|
||||||
film->video_type = 0;
|
film->video_type = 0;
|
||||||
|
|
||||||
@@ -231,18 +224,10 @@ static int film_read_packet(AVFormatContext *s,
|
|||||||
/* do a special song and dance when loading FILM Cinepak chunks */
|
/* do a special song and dance when loading FILM Cinepak chunks */
|
||||||
if ((sample->stream == film->video_stream_index) &&
|
if ((sample->stream == film->video_stream_index) &&
|
||||||
(film->video_type == CODEC_ID_CINEPAK)) {
|
(film->video_type == CODEC_ID_CINEPAK)) {
|
||||||
if (av_new_packet(pkt, sample->sample_size - film->cvid_extra_bytes))
|
|
||||||
return AVERROR_NOMEM;
|
|
||||||
if(pkt->size < 10)
|
|
||||||
return -1;
|
|
||||||
pkt->pos= url_ftell(pb);
|
pkt->pos= url_ftell(pb);
|
||||||
ret = get_buffer(pb, pkt->data, 10);
|
if (av_new_packet(pkt, sample->sample_size))
|
||||||
/* skip the non-spec CVID bytes */
|
return AVERROR_NOMEM;
|
||||||
url_fseek(pb, film->cvid_extra_bytes, SEEK_CUR);
|
get_buffer(pb, pkt->data, sample->sample_size);
|
||||||
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;
|
|
||||||
} else if ((sample->stream == film->audio_stream_index) &&
|
} else if ((sample->stream == film->audio_stream_index) &&
|
||||||
(film->audio_channels == 2)) {
|
(film->audio_channels == 2)) {
|
||||||
/* stereo PCM needs to be interleaved */
|
/* stereo PCM needs to be interleaved */
|
||||||
|
Reference in New Issue
Block a user