summaryrefslogtreecommitdiff
path: root/libavformat/libopenmpt.c
diff options
context:
space:
mode:
authorJörn Heusipp <osmanx@problemloesungsmaschine.de>2016-07-17 15:37:13 +0200
committerJosh de Kock <josh@itanimul.li>2016-07-21 02:47:35 +0100
commit840df1f1931499ba7a8b388115cff37f0b82ee48 (patch)
treec48abcf432f2dbdfa3b0e8c17432e9ca66a94618 /libavformat/libopenmpt.c
parent4ed6edac762721ce128ccf2423b5902d5d79d171 (diff)
downloadffmpeg-840df1f1931499ba7a8b388115cff37f0b82ee48.tar.gz
libopenmpt: set stream duration and fix time base
Fix the confusion around the used time base. Check size returned from avio_size() Signed-off-by: Jörn Heusipp <osmanx@problemloesungsmaschine.de> Signed-off-by: Josh de Kock <josh@itanimul.li>
Diffstat (limited to 'libavformat/libopenmpt.c')
-rw-r--r--libavformat/libopenmpt.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavformat/libopenmpt.c b/libavformat/libopenmpt.c
index a87283b77b..bad34b958a 100644
--- a/libavformat/libopenmpt.c
+++ b/libavformat/libopenmpt.c
@@ -73,6 +73,8 @@ static int read_header_openmpt(AVFormatContext *s)
AVStream *st;
OpenMPTContext *openmpt = s->priv_data;
int64_t size = avio_size(s->pb);
+ if (!size)
+ return AVERROR_INVALIDDATA;
char *buf = av_malloc(size);
int ret;
@@ -118,9 +120,8 @@ static int read_header_openmpt(AVFormatContext *s)
openmpt->module = NULL;
return AVERROR(ENOMEM);
}
- avpriv_set_pts_info(st, 64, 1, 1000);
- if (st->duration > 0)
- st->duration = llrint(openmpt->duration*AV_TIME_BASE);
+ avpriv_set_pts_info(st, 64, 1, AV_TIME_BASE);
+ st->duration = llrint(openmpt->duration*AV_TIME_BASE);
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
st->codecpar->codec_id = AV_NE(AV_CODEC_ID_PCM_F32BE, AV_CODEC_ID_PCM_F32LE);