shithub: aacdec

Download patch

ref: 95192f051ae87f4cee8ccc285893690446acd79c
parent: 87f85fdfb793a840ded7f3148276362c5e2e0430
author: knik <knik>
date: Sun Aug 3 04:57:32 EDT 2003

accurate palying position calculation

--- 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.36 2003/08/02 22:34:46 menno Exp $
+** $Id: in_mp4.c,v 1.37 2003/08/03 08:57:32 knik Exp $
 **/
 
 //#define DEBUG_OUTPUT
@@ -87,7 +87,7 @@
     faacDecHandle hDecoder;
     int samplerate;
     unsigned char channels;
-    int decode_pos_ms; // current decoding position, in milliseconds
+    double decode_pos_ms; // current decoding position, in milliseconds
     int paused; // are we paused?
     int seek_needed; // if != -1, it is the point that the decode thread should seek to, in ms.
     char filename[_MAX_PATH];
@@ -1278,7 +1278,7 @@
 
     void *sample_buffer;
     unsigned char *buffer;
-    int buffer_size, ms;
+    int buffer_size;
     faacDecFrameInfo frameInfo;
 
 #ifdef DEBUG_OUTPUT
@@ -1365,9 +1365,8 @@
                         mp4state.decode_pos_ms);
                     module.VSAAddPCMData(sample_buffer, (int)mp4state.channels, res_table[m_resolution],
                         mp4state.decode_pos_ms);
-                    ms = (int)floor(((float)frameInfo.samples*1000.0) /
-                        ((float)mp4state.samplerate*(float)frameInfo.channels));
-                    mp4state.decode_pos_ms += ms;
+		    mp4state.decode_pos_ms += (double)frameInfo.samples * 1000.0 /
+		      ((double)mp4state.samplerate * (double)frameInfo.channels);
 
                     l = frameInfo.samples * res_table[m_resolution] / 8;
 
@@ -1497,7 +1496,7 @@
 DWORD WINAPI AACPlayThread(void *b)
 {
     int done = 0;
-    int l, ms;
+    int l;
 
 #ifdef DEBUG_OUTPUT
     in_mp4_DebugOutput("AACPlayThread");
@@ -1565,9 +1564,8 @@
                     mp4state.decode_pos_ms);
                 module.VSAAddPCMData(sample_buffer, (int)mp4state.channels, res_table[m_resolution],
                     mp4state.decode_pos_ms);
-                ms = (int)floor(((float)frameInfo.samples*1000.0) /
-                    ((float)mp4state.samplerate*(float)frameInfo.channels));
-                mp4state.decode_pos_ms += ms;
+		mp4state.decode_pos_ms += (double)frameInfo.samples * 1000.0 /
+		  ((double)mp4state.samplerate* (double)frameInfo.channels);
 
                 l = frameInfo.samples * res_table[m_resolution] / 8;