shithub: aacenc

Download patch

ref: 18bef504ab6ba3d72f498f688f5fe75bef3ae8b2
parent: a3af75643a20c1f66b84bde7a1d8bf9f45ec57cb
author: ca5e <ca5e>
date: Tue Oct 14 13:19:06 EDT 2003

Fixed AAC object type selection, some minor cleanups

--- a/plugins/foo_faac/foo_faac.cpp
+++ b/plugins/foo_faac/foo_faac.cpp
@@ -2,6 +2,7 @@
 // Copyright (C) 2003 Janne Hyv�rinen
 //
 // Changes:
+//  0.3.4 (2003-10-14): Fixed AAC object type selecting
 //  0.3.3 (2003-10-02): Removed gapless support for raw AAC files, it was hacky and recent libfaad changes broke it
 //  0.3.2 (2003-09-17): Last fix wasn't perfect and very small input chunks wouldn't have been encoded
 //  0.3.1 (2003-09-14): Fixed possible memory access problems
@@ -32,7 +33,7 @@
 #include <faac.h>
 #include <version.h>
 
-#define FOO_FAAC_VERSION     "0.3.3"
+#define FOO_FAAC_VERSION     "0.3.4"
 
 #define FF_AAC  0
 #define FF_MP4  1
@@ -364,7 +365,7 @@
             for ( int i = 0; i < info.meta_get_count(); i++ ) {
                 char *pName = (char *)info.meta_enum_name ( i );
                 const char *val = info.meta_enum_value ( i );
-                if ( !val ) continue;
+                if ( !val || (val && !(*val)) ) continue;
 
                 if ( !stricmp (pName, "TITLE") ) {
                     MP4SetMetadataName ( MP4hFile, val );
@@ -388,23 +389,19 @@
                     MP4SetMetadataGenre ( MP4hFile, val );
                 }
                 else if ( !stricmp (pName, "TRACKNUMBER") ) {
-                    unsigned __int16 trkn = 0, tot = 0;
-                    sscanf ( val, "%d", &trkn );
+                    unsigned __int16 trkn = atoi ( val ), tot = 0;
                     MP4SetMetadataTrack ( MP4hFile, trkn, tot );
                 }
                 else if ( !stricmp (pName, "DISKNUMBER") || !stricmp (pName, "DISC") ) {
-                    unsigned __int16 disk = 0, tot = 0;
-                    sscanf ( val, "%d", &disk );
+                    unsigned __int16 disk = atoi ( val ), tot = 0;
                     MP4SetMetadataDisk ( MP4hFile, disk, tot );
                 }
                 else if ( !stricmp (pName, "COMPILATION") ) {
-                    unsigned __int8 cpil = 0;
-                    sscanf ( val, "%d", &cpil );
+                    unsigned __int8 cpil = atoi ( val );
                     MP4SetMetadataCompilation ( MP4hFile, cpil );
                 }
                 else if ( !stricmp (pName, "TEMPO") ) {
-                    unsigned __int16 tempo = 0;
-                    sscanf ( val, "%d", &tempo );
+                    unsigned __int16 tempo = atoi ( val );
                     MP4SetMetadataTempo ( MP4hFile, tempo );
                 } else {
                     MP4SetMetadataFreeForm ( MP4hFile, pName, (unsigned __int8*)val, strlen(val) );
@@ -618,7 +615,7 @@
 
                 update ( wnd );
             }
-            return 1;
+            return TRUE;
 
         case WM_COMMAND:
             switch ( wp ) {
@@ -627,7 +624,7 @@
                     int t = (int)uSendMessage ( wnd_format, CB_GETCURSEL, 0, 0 );
                     if ( t >= 0 ) cfg_mp4container = format_list[t].mp4;
                 }
-                return 0;
+                break;
 
             case IDC_PROFILE | (CBN_SELCHANGE<<16):
                 {
@@ -634,7 +631,7 @@
                     int t = (int)uSendMessage ( wnd_profile, CB_GETCURSEL, 0, 0 );
                     if ( t >= 0 ) cfg_objecttype = profile_list[t].profile;
                 }
-                return 0;
+                break;
 
             case IDC_QUANTQUAL_EDIT | (EN_KILLFOCUS<<16):
                 {
@@ -649,7 +646,7 @@
                     }
                     uSendDlgItemMessage ( wnd, IDC_QUANTQUAL_SLIDER, TBM_SETPOS, 1, cfg_quantqual );
                 }
-                return 0;
+                break;
 
             case IDC_CUTOFF | (CBN_SELCHANGE<<16):
                 {
@@ -656,6 +653,7 @@
                     int t = (int)uSendMessage ( wnd_cutoff, CB_GETCURSEL, 0, 0 );
                     if ( t >= 0 ) cfg_cutoff = cutoff_list[t].cutoff;
                 }
+                break;
 
             case IDC_CUTOFF | (CBN_KILLFOCUS<<16):
                 {
@@ -672,19 +670,19 @@
                         }
                     }
                 }
-                return 0;
+                break;
 
             case IDC_MIDSIDE:
                 {
                     cfg_midside = !cfg_midside;
                 }
-                return 0;
+                break;
 
             case IDC_TNS:
                 {
                     cfg_tns = !cfg_tns;
                 }
-                return 0;
+                break;
 
             case IDC_DEFAULTS:
                 {
@@ -696,7 +694,7 @@
                     cfg_cutoff = FF_DEFAULT_CUTOFF;
                     update ( wnd );
                 }
-                return 0;
+                break;
             }
             break;
 
@@ -705,10 +703,10 @@
                 cfg_quantqual = uSendDlgItemMessage ( wnd, IDC_QUANTQUAL_SLIDER, TBM_GETPOS, 0, 0 );
                 uSetDlgItemText ( wnd, IDC_QUANTQUAL_EDIT, string_printf ("%i", (int)cfg_quantqual) );
             }
-            return 0;
+            break;
         }
 
-        return 0;
+        return FALSE;
     }
 
     virtual HWND create ( HWND parent ) {
--- a/plugins/foo_faac/foo_faac.rc
+++ b/plugins/foo_faac/foo_faac.rc
@@ -79,8 +79,8 @@
     COMBOBOX        IDC_FORMAT,68,14,53,50,CBS_DROPDOWNLIST | WS_VSCROLL | 
                     WS_TABSTOP
     LTEXT           "AAC profile:",IDC_STATIC,21,60,42,8
-    COMBOBOX        IDC_PROFILE,81,58,60,50,CBS_DROPDOWNLIST | CBS_SORT | 
-                    WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_PROFILE,81,58,60,50,CBS_DROPDOWNLIST | WS_VSCROLL | 
+                    WS_TABSTOP
     LTEXT           "Quantizer quality:",IDC_STATIC,21,44,60,8
     EDITTEXT        IDC_QUANTQUAL_EDIT,220,42,32,12,ES_CENTER | 
                     ES_AUTOHSCROLL | ES_NUMBER
--- a/plugins/foo_faac/resource.h
+++ b/plugins/foo_faac/resource.h
@@ -4,15 +4,15 @@
 //
 #define IDD_CONFIG                      116
 #define IDC_COMPRESSION                 1000
-#define IDC_FORMAT                      1002
-#define IDC_BPS                         1003
-#define IDC_PROFILE                     1004
-#define IDC_QUANTQUAL_EDIT              1006
-#define IDC_CUTOFF                      1007
-#define IDC_MIDSIDE                     1008
-#define IDC_TNS                         1009
-#define IDC_QUANTQUAL_SLIDER            1014
-#define IDC_DEFAULTS                    1015
+#define IDC_FORMAT                      1001
+#define IDC_BPS                         1002
+#define IDC_PROFILE                     1003
+#define IDC_QUANTQUAL_EDIT              1004
+#define IDC_CUTOFF                      1005
+#define IDC_MIDSIDE                     1006
+#define IDC_TNS                         1007
+#define IDC_QUANTQUAL_SLIDER            1008
+#define IDC_DEFAULTS                    1009
 
 // Next default values for new objects
 //