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>
This commit is contained in:
Jörn Heusipp 2016-07-17 15:37:13 +02:00 committed by Josh de Kock
parent 4ed6edac76
commit 840df1f193
1 changed files with 4 additions and 3 deletions

View File

@ -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,8 +120,7 @@ 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)
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;