]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/libopenmpt.c
movenc: Add support for writing language codes into ISML manifests
[ffmpeg] / libavformat / libopenmpt.c
index a87283b77be114f8aa86aef95cdfae077296e952..e7091ef9fc5f748463ebb1553108fbfe31902423 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;
 
@@ -93,6 +95,7 @@ static int read_header_openmpt(AVFormatContext *s)
     add_meta(s, "title",   openmpt_module_get_metadata(openmpt->module, "title"));
     add_meta(s, "encoder", openmpt_module_get_metadata(openmpt->module, "tracker"));
     add_meta(s, "comment", openmpt_module_get_metadata(openmpt->module, "message"));
+    add_meta(s, "date",    openmpt_module_get_metadata(openmpt->module, "date"));
 
     if (openmpt->subsong >= openmpt_module_get_num_subsongs(openmpt->module)) {
         openmpt_module_destroy(openmpt->module);
@@ -118,9 +121,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);