]> git.sesse.net Git - ffmpeg/commitdiff
libopenmpt: set stream duration and fix time base
authorJörn Heusipp <osmanx@problemloesungsmaschine.de>
Sun, 17 Jul 2016 13:37:13 +0000 (15:37 +0200)
committerJosh de Kock <josh@itanimul.li>
Thu, 21 Jul 2016 01:47:35 +0000 (02:47 +0100)
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>
libavformat/libopenmpt.c

index a87283b77be114f8aa86aef95cdfae077296e952..bad34b958a2555a23aab8b876d8fc2b370e7aa9d 100644 (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,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);