X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Felectronicarts.c;h=a0007d2982265915c08c1f8cd0c77494f6d25d1a;hb=01fcbdf9cedcf14418b5886205261e532167f949;hp=0508a06cc4580ca05ce511843fc2fdf49dce8ba9;hpb=0b9a69f244e399565d67100a6862886201a594a4;p=ffmpeg diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index 0508a06cc45..a0007d29822 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -27,6 +27,7 @@ #include "libavutil/intreadwrite.h" #include "avformat.h" +#include "internal.h" #define SCHl_TAG MKTAG('S', 'C', 'H', 'l') #define SEAD_TAG MKTAG('S', 'E', 'A', 'D') /* Sxxx header */ @@ -403,7 +404,7 @@ static int ea_read_header(AVFormatContext *s, EaDemuxContext *ea = s->priv_data; AVStream *st; - if (!process_ea_header(s)) + if (process_ea_header(s)<=0) return AVERROR(EIO); if (ea->video_codec) { @@ -419,7 +420,7 @@ static int ea_read_header(AVFormatContext *s, st->need_parsing = AVSTREAM_PARSE_HEADERS; st->codec->codec_tag = 0; /* no fourcc */ if (ea->time_base.num) - av_set_pts_info(st, 64, ea->time_base.num, ea->time_base.den); + avpriv_set_pts_info(st, 64, ea->time_base.num, ea->time_base.den); st->codec->width = ea->width; st->codec->height = ea->height; } @@ -435,12 +436,17 @@ static int ea_read_header(AVFormatContext *s, ea->audio_codec = 0; return 1; } + if (ea->bytes <= 0) { + av_log(s, AV_LOG_ERROR, "Invalid number of bytes per sample: %d\n", ea->bytes); + ea->audio_codec = CODEC_ID_NONE; + return 1; + } /* initialize the audio decoder stream */ st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); - av_set_pts_info(st, 33, 1, ea->sample_rate); + avpriv_set_pts_info(st, 33, 1, ea->sample_rate); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = ea->audio_codec; st->codec->codec_tag = 0; /* no tag */