|
|
|
@ -501,10 +501,14 @@ static const char signature[] = "Interplay MVE File\x1A\0\x1A"; |
|
|
|
|
|
|
|
|
|
static int ipmovie_probe(AVProbeData *p) |
|
|
|
|
{ |
|
|
|
|
if (memcmp(p->buf, signature, sizeof(signature)) != 0) |
|
|
|
|
return 0; |
|
|
|
|
uint8_t *b = p->buf; |
|
|
|
|
uint8_t *b_end = p->buf + p->buf_size - sizeof(signature); |
|
|
|
|
do { |
|
|
|
|
if (memcmp(b++, signature, sizeof(signature)) == 0) |
|
|
|
|
return AVPROBE_SCORE_MAX; |
|
|
|
|
} while (b < b_end); |
|
|
|
|
|
|
|
|
|
return AVPROBE_SCORE_MAX; |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int ipmovie_read_header(AVFormatContext *s, |
|
|
|
@ -516,14 +520,22 @@ static int ipmovie_read_header(AVFormatContext *s, |
|
|
|
|
AVStream *st; |
|
|
|
|
unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE]; |
|
|
|
|
int chunk_type; |
|
|
|
|
|
|
|
|
|
uint8_t signature_buffer[sizeof(signature)]; |
|
|
|
|
|
|
|
|
|
get_buffer(pb, signature_buffer, sizeof(signature_buffer)); |
|
|
|
|
while (memcmp(signature_buffer, signature, sizeof(signature))) { |
|
|
|
|
memmove(signature_buffer, signature_buffer + 1, sizeof(signature_buffer) - 1); |
|
|
|
|
signature_buffer[sizeof(signature_buffer) - 1] = get_byte(pb); |
|
|
|
|
if (url_feof(pb)) |
|
|
|
|
return AVERROR_EOF; |
|
|
|
|
} |
|
|
|
|
/* initialize private context members */ |
|
|
|
|
ipmovie->video_pts = ipmovie->audio_frame_count = 0; |
|
|
|
|
ipmovie->audio_chunk_offset = ipmovie->video_chunk_offset = |
|
|
|
|
ipmovie->decode_map_chunk_offset = 0; |
|
|
|
|
|
|
|
|
|
/* on the first read, this will position the stream at the first chunk */ |
|
|
|
|
ipmovie->next_chunk_offset = sizeof(signature) + 4; |
|
|
|
|
ipmovie->next_chunk_offset = url_ftell(pb) + 4; |
|
|
|
|
|
|
|
|
|
/* process the first chunk which should be CHUNK_INIT_VIDEO */ |
|
|
|
|
if (process_ipmovie_chunk(ipmovie, pb, &pkt) != CHUNK_INIT_VIDEO) |
|
|
|
|