X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fsegafilm.c;h=1225227138dc347f12fb97d4c696cdda57d5fcc4;hb=fcf7ef0a8128e73cd0b921732d309b0eb558e80e;hp=b0c6c419ced3fe7db6fdb0b9255a91eec9e1ad4f;hpb=c7488f746154b5dcd70f8a3bef9a9fa5c42ac595;p=ffmpeg diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c index b0c6c419ced..1225227138d 100644 --- a/libavformat/segafilm.c +++ b/libavformat/segafilm.c @@ -40,8 +40,8 @@ typedef struct film_sample { int stream; - int64_t sample_offset; unsigned int sample_size; + int64_t sample_offset; int64_t pts; int keyframe; } film_sample; @@ -64,7 +64,7 @@ typedef struct FilmDemuxContext { unsigned int version; } FilmDemuxContext; -static int film_probe(AVProbeData *p) +static int film_probe(const AVProbeData *p) { if (AV_RB32(&p->buf[0]) != FILM_TAG) return 0; @@ -144,8 +144,11 @@ static int film_read_header(AVFormatContext *s) film->video_type = AV_CODEC_ID_NONE; } + if (film->video_type == AV_CODEC_ID_NONE && film->audio_type == AV_CODEC_ID_NONE) + return AVERROR_INVALIDDATA; + /* initialize the decoder streams */ - if (film->video_type) { + if (film->video_type != AV_CODEC_ID_NONE) { st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); @@ -166,7 +169,7 @@ static int film_read_header(AVFormatContext *s) } } - if (film->audio_type) { + if (film->audio_type != AV_CODEC_ID_NONE) { st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); @@ -241,7 +244,7 @@ static int film_read_header(AVFormatContext *s) film->sample_table[i].pts = AV_RB32(&scratch[8]) & 0x7FFFFFFF; film->sample_table[i].keyframe = (scratch[8] & 0x80) ? 0 : AVINDEX_KEYFRAME; video_frame_counter++; - if (film->video_type) + if (film->video_type != AV_CODEC_ID_NONE) av_add_index_entry(s->streams[film->video_stream_index], film->sample_table[i].sample_offset, film->sample_table[i].pts, @@ -250,10 +253,10 @@ static int film_read_header(AVFormatContext *s) } } - if (film->audio_type) + if (film->audio_type != AV_CODEC_ID_NONE) s->streams[film->audio_stream_index]->duration = audio_frame_counter; - if (film->video_type) + if (film->video_type != AV_CODEC_ID_NONE) s->streams[film->video_stream_index]->duration = video_frame_counter; film->current_sample = 0; @@ -321,7 +324,7 @@ static int film_read_seek(AVFormatContext *s, int stream_index, int64_t timestam if (ret < 0) return ret; - pos = avio_seek(s->pb, st->index_entries[ret].pos, SEEK_SET); + pos = avio_seek(s->pb, st->internal->index_entries[ret].pos, SEEK_SET); if (pos < 0) return pos;