shithub: aacdec

Download patch

ref: b4989014824433c9f048b0066a84b9f9e99611d2
parent: 4f9a9087f16b92662389be3dc0589629359ac8a4
author: menno <menno>
date: Sun Apr 14 12:31:02 EDT 2002

code update

--- a/aacDECdrop/Script.rc
+++ b/aacDECdrop/Script.rc
@@ -71,6 +71,7 @@
     POPUP "Menu"
     BEGIN
         MENUITEM "&Decoder Options",            IDM_VOLUME
+        MENUITEM "&Stop Decoding",              IDM_STOP_DEC
         MENUITEM SEPARATOR
         MENUITEM "&Errors to Log File",         IDM_LOGERR
         MENUITEM "&Always on Top",              IDM_ONTOP
@@ -97,48 +98,43 @@
 
 IDD_VOLUME DIALOG DISCARDABLE  0, 0, 255, 218
 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Decoder Options"
+CAPTION "Decoder Options V1.2"
 FONT 8, "MS Sans Serif"
 BEGIN
     GROUPBOX        "Decoding Settings",IDC_STATIC,7,7,241,23
-    CONTROL         "Playback",IDC_PLAYBACK,"Button", BS_AUTORADIOBUTTON | WS_GROUP,15,17,55,10
-    CONTROL         "Decode to File",IDC_DECODE,"Button", BS_AUTORADIOBUTTON,125,17,65,10
+    CONTROL         "Playback",IDC_PLAYBACK,"Button",BS_AUTORADIOBUTTON | 
+                    WS_GROUP,15,17,55,10
+    CONTROL         "Decode to File",IDC_DECODE,"Button",BS_AUTORADIOBUTTON,
+                    125,17,65,10
     GROUPBOX        "Output Format Settings",IDC_STATIC,7,31,241,50
-    CONTROL         "Microsoft WAV",IDC_WAV,"Button", BS_AUTORADIOBUTTON | WS_GROUP,15,45,65,10
-    CONTROL         "Apple/SGI AIFF",IDC_AIFF,"Button", BS_AUTORADIOBUTTON,125,45,65,10
-    CONTROL         "Sun/NeXT AU",IDC_SUNAU,"Button", BS_AUTORADIOBUTTON,15,60,65,10
-    CONTROL         "DEC AU",IDC_DECAU,"Button", BS_AUTORADIOBUTTON,125,60,65,10
+    CONTROL         "Microsoft WAV",IDC_WAV,"Button",BS_AUTORADIOBUTTON | 
+                    WS_GROUP,15,45,65,10
+    CONTROL         "Apple/SGI AIFF",IDC_AIFF,"Button",BS_AUTORADIOBUTTON,
+                    125,45,65,10
+    CONTROL         "Sun/NeXT AU",IDC_SUNAU,"Button",BS_AUTORADIOBUTTON,15,
+                    60,65,10
+    CONTROL         "DEC AU",IDC_DECAU,"Button",BS_AUTORADIOBUTTON,125,60,65,
+                    10
     GROUPBOX        "Output Sample Format Settings",IDC_STATIC,7,82,241,50
-    CONTROL         "16 bit PCM",IDC_16BIT,"Button", BS_AUTORADIOBUTTON | WS_GROUP,15,96,65,10
-    CONTROL         "24 bit PCM",IDC_24BIT,"Button", BS_AUTORADIOBUTTON,125,96,65,10
-    CONTROL         "32 bit PCM",IDC_32BIT,"Button", BS_AUTORADIOBUTTON,15,111,65,10
-    CONTROL         "32 bit floats",IDC_FLOATS,"Button", BS_AUTORADIOBUTTON,125,111,65,10
+    CONTROL         "16 bit PCM",IDC_16BIT,"Button",BS_AUTORADIOBUTTON | 
+                    WS_GROUP,15,96,65,10
+    CONTROL         "24 bit PCM",IDC_24BIT,"Button",BS_AUTORADIOBUTTON,125,
+                    96,65,10
+    CONTROL         "32 bit PCM",IDC_32BIT,"Button",BS_AUTORADIOBUTTON,15,
+                    111,65,10
+    CONTROL         "32 bit floats",IDC_FLOATS,"Button",BS_AUTORADIOBUTTON,
+                    125,111,65,10
     GROUPBOX        "Object Type Settings",IDC_STATIC,7,133,241,50
-    CONTROL         "Main",IDC_MAIN,"Button", BS_AUTORADIOBUTTON | WS_GROUP,15,147,65,10
-    CONTROL         "Low Complexity",IDC_LC,"Button", BS_AUTORADIOBUTTON,125,147,65,10
-    CONTROL         "Long Term Prediction",IDC_LTP,"Button", BS_AUTORADIOBUTTON,15,162,85,10
-    CONTROL         "Low Delay",IDC_LD,"Button", BS_AUTORADIOBUTTON,125,162,65,10
+    CONTROL         "Main",IDC_MAIN,"Button",BS_AUTORADIOBUTTON | WS_GROUP,
+                    15,147,65,10
+    CONTROL         "Low Complexity",IDC_LC,"Button",BS_AUTORADIOBUTTON,125,
+                    147,65,10
+    CONTROL         "Long Term Prediction",IDC_LTP,"Button",
+                    BS_AUTORADIOBUTTON,15,162,85,10
+    CONTROL         "Low Delay",IDC_LD,"Button",BS_AUTORADIOBUTTON,125,162,
+                    65,10
     DEFPUSHBUTTON   "Accept",IDC_BUTTON1,102,192,50,16
-//    PUSHBUTTON      "Stop",IDC_BUTTON2,172,192,50,16
 END
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO DISCARDABLE 
-BEGIN
-    IDD_QUALITY, DIALOG
-    BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 217
-        TOPMARGIN, 7
-        BOTTOMMARGIN, 101
-    END
-END
-#endif    // APSTUDIO_INVOKED
 
 #endif    // English (U.S.) resources
 /////////////////////////////////////////////////////////////////////////////
--- a/aacDECdrop/decode.c
+++ b/aacDECdrop/decode.c
@@ -16,8 +16,8 @@
 ** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
-** $Id: decode.c,v 1.1 2002/03/16 19:18:10 menno Exp $
-** $Id: decode.c,v 1.1 2002/03/16 19:18:10 menno Exp $
+** $Id: decode.c,v 1.2 2002/04/14 16:31:02 menno Exp $
+** $Id: decode.c,v 1.2 2002/04/14 16:31:02 menno Exp $
 **/
 
 #ifdef _WIN32
@@ -92,6 +92,7 @@
 
 /* globals */
 char *progName;
+extern int stop_decoding;
 
 int id3v2_tag(unsigned char *buffer)
 {
@@ -240,6 +241,9 @@
 		if (buffer_index >= fileread)
 			sample_buffer = NULL; /* to make sure it stops now */
 
+		if(stop_decoding)
+			break;
+
 	} while (sample_buffer != NULL);
 
 	faacDecClose(hDecoder);
@@ -421,6 +425,8 @@
 			faacDecGetErrorMessage(frameInfo.error));
 			break;
 		}
+		if(stop_decoding)
+			break;
 	}
 
 
--- a/aacDECdrop/decthread.c
+++ b/aacDECdrop/decthread.c
@@ -27,6 +27,7 @@
 int fileType;
 int object_type;
 extern char* fileName;
+int stop_decoding;
 
 typedef struct enclist_tag {
 	char *filename;
@@ -152,6 +153,10 @@
 			aac_dec_opt      dec_opts;
 			animate = 1;
 
+			if(stop_decoding){
+				numfiles--;
+				break;
+			}
 			set_filename(in_file);
 
 			dec_opts.progress_update = _update;
--- a/aacDECdrop/main.c
+++ b/aacDECdrop/main.c
@@ -40,6 +40,7 @@
 HBITMAP hbm[12], temp;
 HMENU menu;
 int decoding_done = 0;
+int stop_decoding = 0;
 double file_complete;
 int totalfiles;
 int numfiles;
@@ -266,6 +267,7 @@
 			{
 				flag = 1;
 				decthread_addfile(szFile);
+				stop_decoding = 0;
 			}
 		}
 	}
@@ -447,6 +449,13 @@
 				case IDM_LOGERR:
 					set_logerr(hwnd, ~GetMenuState(menu, LOWORD(wParam), MF_BYCOMMAND) & MF_CHECKED);
 					break;
+				case IDM_STOP_DEC:
+				{
+					int v = ~GetMenuState(menu, LOWORD(wParam), MF_BYCOMMAND) & MF_CHECKED;
+					if(v == 8)
+						stop_decoding = 1;
+					break;
+				}
 				case IDM_VOLUME:
 				{
 					int value = 
@@ -457,6 +466,7 @@
 
 					if (value == -2)
 						break;
+					break;
 				}
 
 			} // LOWORD(wParam)
@@ -634,12 +644,9 @@
 					else if (IsDlgButtonChecked(hwndDlg, IDC_LD) == BST_CHECKED)
 						set_object_type(23);            // Low Delay
 
-					decoding_done = 0;
 					EndDialog(hwndDlg, -2);
 					return TRUE;
 				}
-//				case IDC_BUTTON2:
-//					break;
 				case IDC_PLAYBACK:
 					CheckDlgButton(hwndDlg,IDC_DECODE,FALSE);
 					CheckDlgButton(hwndDlg,IDC_WAV,TRUE);
--- a/aacDECdrop/misc.c
+++ b/aacDECdrop/misc.c
@@ -20,7 +20,7 @@
  * Set the current input file name.
  */
 
-void set_filename(const char *filename)
+void set_filename(char *filename)
 {
 	_filename = filename;
 }
--- a/aacDECdrop/misc.h
+++ b/aacDECdrop/misc.h
@@ -13,7 +13,7 @@
 #include "decode.h"
 #include <stdio.h>
 
-void set_filename(const char *filename);
+void set_filename(char *filename);
 
 extern void error_dialog(const char *fmt, ...);
 extern void log_error(const char *fmt, ...);
--- a/aacDECdrop/resource.h
+++ b/aacDECdrop/resource.h
@@ -14,7 +14,6 @@
 #define IDR_MENU1                       124
 #define IDI_ICON1                       130
 #define IDC_BUTTON1                     1001
-#define IDC_BUTTON2                     1003
 #define IDC_PLAYBACK                    1005
 #define IDC_DECODE                      1008
 #define IDC_WAV                         1014
@@ -30,6 +29,7 @@
 #define IDC_LTP                         1025
 #define IDC_LD                          1026
 #define IDM_VOLUME                      40005
+#define IDM_STOP_DEC                    40006
 #define IDM_LOGERR                      40008
 #define IDM_ONTOP                       40015
 #define IDM_QUIT                        40019