shithub: aacdec

Download patch

ref: dd018ff492773b6be8bd786a026cbb1d5ca9c24e
parent: 4d4850f5de853099d2e2883057458ad48ccec477
author: menno <menno>
date: Mon Oct 18 15:25:00 EDT 2004

fixed some problems in winamp plugin

--- a/plugins/in_mp4/aacinfo.c
+++ b/plugins/in_mp4/aacinfo.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: aacinfo.c,v 1.5 2003/07/29 08:20:14 menno Exp $
+** $Id: aacinfo.c,v 1.6 2004/10/18 19:25:00 menno Exp $
 **/
 
 #define WIN32_LEAN_AND_MEAN
@@ -30,6 +30,7 @@
 #include <malloc.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <math.h>
 #include "aacinfo.h"
 #include "utils.h"
 
--- a/plugins/in_mp4/in_mp4.c
+++ b/plugins/in_mp4/in_mp4.c
@@ -22,7 +22,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: in_mp4.c,v 1.54 2004/09/04 14:56:30 menno Exp $
+** $Id: in_mp4.c,v 1.55 2004/10/18 19:25:00 menno Exp $
 **/
 
 //#define DEBUG_OUTPUT
@@ -318,7 +318,7 @@
 {
     char s[1024];
 
-    sprintf(s, "in_mp4: %s: %s", mp4state.filename, message);
+    sprintf(s, "in_mp4: %s", message);
     OutputDebugString(s);
 }
 #endif
@@ -1406,7 +1406,7 @@
         int bread = 0;
         double length = 0.;
         __int64 bitrate = 128;
-        NeAACDecFrameInfo frameInfo;
+//        NeAACDecFrameInfo frameInfo;
 
         module.is_seekable = 1;
 
@@ -1633,6 +1633,17 @@
         mp4state.numSamples = mp4ff_num_samples(mp4state.mp4file, mp4state.mp4track);
         mp4state.sampleId = 0;
 
+        {
+            double timescale_div = 1.0 / (double)mp4ff_time_scale(mp4state.mp4file, mp4state.mp4track);
+            int64_t duration = mp4ff_get_track_duration_use_offsets(mp4state.mp4file, mp4state.mp4track);
+            if (duration == -1)
+            {
+                mp4state.m_length = 0;
+            } else {
+                mp4state.m_length = (int)((double)duration * timescale_div * 1000.0);
+            }
+        }
+
         module.is_seekable = 1;
     }
 
@@ -1832,7 +1843,7 @@
 
         length = mp4ff_get_track_duration(file, track);
 
-        msDuration = (long)((float)length / (float)mp4ff_time_scale(file, track) + 0.5);
+        msDuration = (long)((float)length*1000.0 / (float)mp4ff_time_scale(file, track) + 0.5);
 
         mp4ff_close(file);
         fclose(mp4File);
--- a/plugins/in_mp4/utils.c
+++ b/plugins/in_mp4/utils.c
@@ -22,11 +22,12 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
 **
-** $Id: utils.c,v 1.8 2004/09/03 19:38:32 menno Exp $
+** $Id: utils.c,v 1.9 2004/10/18 19:25:00 menno Exp $
 **/
 
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
+#include <malloc.h>
 //#include <mp4.h>
 #include <mp4ff.h>
 #include <neaacdec.h>