shithub: aacdec

Download patch

ref: 9681f24773d7db5456b2ee91fd2902970faef5ba
parent: 1022473b1236454b7f11f005331a447938863eb8
author: menno <menno>
date: Tue Sep 3 17:22:53 EDT 2002

Filename can now be chosen when converting to mp4

--- a/plugins/in_mp4/aac2mp4.c
+++ b/plugins/in_mp4/aac2mp4.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: aac2mp4.c,v 1.1 2002/08/30 20:52:42 menno Exp $
+** $Id: aac2mp4.c,v 1.2 2002/09/03 21:22:53 menno Exp $
 **/
 
 #include <mpeg4ip.h>
@@ -25,19 +25,14 @@
 
 #include "aac2mp4.h"
 
-int covert_aac_to_mp4(char *inputFileName)
+int covert_aac_to_mp4(char *inputFileName, char *mp4FileName)
 {
     int Mp4TimeScale = 90000;
     int allMpeg4Streams = 0;
     MP4FileHandle mp4File;
     FILE* inFile;
-    char mp4FileName[256];
-    char* extension, *type;
+    char *type;
     MP4TrackId createdTrackId = MP4_INVALID_TRACK_ID;
-
-    lstrcpy(mp4FileName, inputFileName);
-    extension = strrchr(mp4FileName, '.');
-    lstrcpy(extension, ".mp4");
 
     mp4File = MP4Create(mp4FileName, 0, 0, 0);
     if (mp4File)
--- a/plugins/in_mp4/aac2mp4.h
+++ b/plugins/in_mp4/aac2mp4.h
@@ -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: aac2mp4.h,v 1.1 2002/08/30 20:52:43 menno Exp $
+** $Id: aac2mp4.h,v 1.2 2002/09/03 21:22:53 menno Exp $
 **/
 
 #ifndef AAC2MP4_H__
@@ -26,7 +26,7 @@
 extern "C" {
 #endif /* __cplusplus */
 
-int covert_aac_to_mp4(char *inputFileName);
+int covert_aac_to_mp4(char *inputFileName, char *mp4FileName);
 MP4TrackId AacCreator(MP4FileHandle mp4File, FILE* inFile);
 
 #ifdef __cplusplus
--- a/plugins/in_mp4/in_mp4.c
+++ b/plugins/in_mp4/in_mp4.c
@@ -16,12 +16,13 @@
 ** 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.18 2002/08/30 20:52:43 menno Exp $
+** $Id: in_mp4.c,v 1.19 2002/09/03 21:22:53 menno Exp $
 **/
 
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <commctrl.h>
+#include <commdlg.h>
 #include <stdlib.h>
 #include <math.h>
 #include <faad.h>
@@ -279,11 +280,33 @@
         {
         case IDC_CONVERT:
             {
-                int ret = covert_aac_to_mp4(info_fn);
-                if (ret)
+                char mp4FileName[256];
+                char *extension;
+                OPENFILENAME ofn;
+
+                lstrcpy(mp4FileName, info_fn);
+                extension = strrchr(mp4FileName, '.');
+                lstrcpy(extension, ".mp4");
+
+                memset(&ofn, 0, sizeof(OPENFILENAME));
+                ofn.lStructSize = sizeof(OPENFILENAME);
+                ofn.hwndOwner = hwndDlg;
+                ofn.hInstance = module.hDllInstance;
+                ofn.nMaxFileTitle = 31;
+                ofn.lpstrFile = (LPSTR)mp4FileName;
+                ofn.nMaxFile = _MAX_PATH;
+                ofn.lpstrFilter = "MP4 Files (*.mp4)\0*.mp4\0";
+                ofn.lpstrDefExt = "mp4";
+                ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
+                ofn.lpstrTitle = "Select Output File";
+
+                if (GetSaveFileName(&ofn))
                 {
-                    MessageBox(hwndDlg, "An error occured!", "An error occured!", MB_OK);
-                    return FALSE;
+                    if (covert_aac_to_mp4(info_fn, mp4FileName))
+                    {
+                        MessageBox(hwndDlg, "An error occured while converting AAC to MP4!", "An error occured!", MB_OK);
+                        return FALSE;
+                    }
                 }
                 return TRUE;
             }
--- a/plugins/in_mp4/in_mp4.rc
+++ b/plugins/in_mp4/in_mp4.rc
@@ -62,10 +62,10 @@
     LTEXT           "Static",IDC_INFOTEXT,14,17,275,47,0,WS_EX_CLIENTEDGE
     GROUPBOX        "Track info",IDC_STATIC,7,7,289,64
     GROUPBOX        "User data",IDC_USERDATA,7,76,289,104
-    PUSHBUTTON      "Convert Now!",IDC_CONVERT,111,150,81,14
+    PUSHBUTTON      "Convert Now!",IDC_CONVERT,111,151,81,14
     GROUPBOX        "Convert to MP4",IDC_CONVERT2,7,81,289,99
     CTEXT           "You can convert this file to MP4 if you like. This does not involve re-encoding, only the container format is changed. Advantages of MP4 files are that they are playable by a lot more players and they will have a lot of support in the future.",
-                    IDC_CONVERT1,24,102,255,27
+                    IDC_CONVERT1,24,98,255,27
 END
 
 IDD_CONFIG DIALOGEX 0, 0, 151, 108