shithub: aacdec

Download patch

ref: 2750dae23aa7753b3e9cd9a54813fb9b59057b1c
parent: 57f4d33729c77675019237604ed04b8af70f67f0
author: menno <menno>
date: Sat May 31 09:18:05 EDT 2003

fixed some stuff in winamp plugin

--- a/plugins/in_mp4/aacinfo.c
+++ b/plugins/in_mp4/aacinfo.c
@@ -16,7 +16,7 @@
 ** along with this program; if not, write to the Free Software 
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
-** $Id: aacinfo.c,v 1.3 2002/08/30 20:52:43 menno Exp $
+** $Id: aacinfo.c,v 1.4 2003/05/31 13:18:05 menno Exp $
 **/
 
 #define WIN32_LEAN_AND_MEAN
@@ -108,13 +108,11 @@
         if (ID == 0)
         {
             info->version = 4;
-            frame_length = (((unsigned int)buffer[4]) << 5) |
-                ((unsigned int)buffer[5] >> 3);
         } else { /* MPEG-2 */
             info->version = 2;
-            frame_length = ((((unsigned int)buffer[3] & 0x3)) << 11)
-                | (((unsigned int)buffer[4]) << 3) | (buffer[5] >> 5);
         }
+        frame_length = ((((unsigned int)buffer[3] & 0x3)) << 11)
+            | (((unsigned int)buffer[4]) << 3) | (buffer[5] >> 5);
 
         t_framelength += frame_length;
 
--- a/plugins/in_mp4/in_mp4.c
+++ b/plugins/in_mp4/in_mp4.c
@@ -16,7 +16,7 @@
 ** along with this program; if not, write to the Free Software 
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
-** $Id: in_mp4.c,v 1.29 2003/05/29 19:56:50 menno Exp $
+** $Id: in_mp4.c,v 1.30 2003/05/31 13:18:05 menno Exp $
 **/
 
 //#define DEBUG_OUTPUT
@@ -302,7 +302,7 @@
         switch (aacInfo.headertype)
         {
         case 0: /* RAW */
-            header_string = "";
+            header_string = " RAW";
             break;
         case 1: /* ADIF */
             header_string = " ADIF";
@@ -654,7 +654,7 @@
         mp4state.m_header_type = 0;
         if ((mp4state.m_aac_buffer[0] == 0xFF) && ((mp4state.m_aac_buffer[1] & 0xF6) == 0xF0))
         {
-            if (1) //(m_reader->can_seek())
+            if (1) //(can_seek)
             {
                 adts_parse(&mp4state, &bitrate, &length);
                 fseek(mp4state.aacfile, tagsize, SEEK_SET);
@@ -687,7 +687,10 @@
 
             mp4state.m_header_type = 2;
         } else {
-            module.is_seekable = 0;
+            length = (double)file_length(mp4state.aacfile);
+            length = ((double)length*8.)/((double)bitrate*1000.) + 0.5;
+
+            module.is_seekable = 1;
         }
 
         mp4state.m_length = (int)(length*1000.);
@@ -1011,9 +1014,12 @@
             else
                 length = ((double)length*8.)/((double)bitrate) + 0.5;
 
-            bitrate = (__int64)((double)bitrate/1000.0 + 0.5);
-
             len_state.m_header_type = 2;
+        } else {
+            length = (double)file_length(len_state.aacfile);
+            length = ((double)length*8.)/((double)bitrate*1000.) + 0.5;
+
+            len_state.m_header_type = 0;
         }
 
         if (len_state.m_aac_buffer)
@@ -1272,7 +1278,7 @@
     int bread;
     struct seek_list *target = st->m_head;
 
-    if (1 /*m_reader->can_seek()*/ && ((st->m_header_type == 1) || (seconds < st->cur_pos_sec)))
+    if (1 /*can_seek*/ && ((st->m_header_type == 1) || (seconds < st->cur_pos_sec)))
     {
         frames = (int)(seconds*((double)st->samplerate/1024.0) + 0.5);
 
@@ -1348,10 +1354,10 @@
         {
             double ms;
 
-            /* Round off to a second */
             ms = mp4state.seek_needed/1000;
             module.outMod->Flush(mp4state.decode_pos_ms);
             aac_seek(&mp4state, ms);
+            mp4state.cur_pos_sec = ms;
             mp4state.decode_pos_ms = mp4state.seek_needed;
             mp4state.seek_needed = -1;
         }