|
Packit |
47f805 |
/**
|
|
Packit |
47f805 |
*
|
|
Packit |
47f805 |
* Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows
|
|
Packit |
47f805 |
*
|
|
Packit |
47f805 |
* Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr>
|
|
Packit |
47f805 |
*
|
|
Packit |
47f805 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
47f805 |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
47f805 |
* License as published by the Free Software Foundation; either
|
|
Packit |
47f805 |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
47f805 |
*
|
|
Packit |
47f805 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
47f805 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
47f805 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
47f805 |
* Lesser General Public License for more details.
|
|
Packit |
47f805 |
*
|
|
Packit |
47f805 |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
47f805 |
* License along with this library; if not, write to the Free Software
|
|
Packit |
47f805 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
Packit |
47f805 |
*
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
/*!
|
|
Packit |
47f805 |
\author Steve Lhomme
|
|
Packit |
47f805 |
\version \$Id: AEncodeProperties.cpp,v 1.9 2006/12/25 21:37:34 robert Exp $
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
#if !defined(STRICT)
|
|
Packit |
47f805 |
#define STRICT
|
|
Packit |
47f805 |
#endif // !defined(STRICT)
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
#include <windows.h>
|
|
Packit |
47f805 |
#include <windowsx.h>
|
|
Packit |
47f805 |
#include <shlobj.h>
|
|
Packit |
47f805 |
#include <assert.h>
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
#ifdef _MSC_VER
|
|
Packit |
47f805 |
// no problem with unknown pragmas
|
|
Packit |
47f805 |
#pragma warning(disable: 4068)
|
|
Packit |
47f805 |
#endif
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
#include "resource.h"
|
|
Packit |
47f805 |
#include <lame.h>
|
|
Packit |
47f805 |
#include "adebug.h"
|
|
Packit |
47f805 |
#include "AEncodeProperties.h"
|
|
Packit |
47f805 |
#include "ACM.h"
|
|
Packit |
47f805 |
//#include "AParameters/AParameters.h"
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
#ifndef TTS_BALLOON
|
|
Packit |
47f805 |
#define TTS_BALLOON 0x40
|
|
Packit |
47f805 |
#endif // TTS_BALLOON
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
const unsigned int AEncodeProperties::the_Bitrates[18] = {320, 256, 224, 192, 160, 144, 128, 112, 96, 80, 64, 56, 48, 40, 32, 24, 16, 8 };
|
|
Packit |
47f805 |
const unsigned int AEncodeProperties::the_MPEG1_Bitrates[14] = {320, 256, 224, 192, 160, 128, 112, 96, 80, 64, 56, 48, 40, 32 };
|
|
Packit |
47f805 |
const unsigned int AEncodeProperties::the_MPEG2_Bitrates[14] = {160, 144, 128, 112, 96, 80, 64, 56, 48, 40, 32, 24, 16, 8};
|
|
Packit |
47f805 |
const unsigned int AEncodeProperties::the_ChannelModes[3] = { STEREO, JOINT_STEREO, DUAL_CHANNEL };
|
|
Packit |
47f805 |
//const char AEncodeProperties::the_Presets[][13] = {"None", "CD", "Studio", "Hi-Fi", "Phone", "Voice", "Radio", "Tape", "FM", "AM", "SW"};
|
|
Packit |
47f805 |
//const LAME_QUALTIY_PRESET AEncodeProperties::the_Presets[] = {LQP_NOPRESET, LQP_R3MIX_QUALITY, LQP_NORMAL_QUALITY, LQP_LOW_QUALITY, LQP_HIGH_QUALITY, LQP_VERYHIGH_QUALITY, LQP_VOICE_QUALITY, LQP_PHONE, LQP_SW, LQP_AM, LQP_FM, LQP_VOICE, LQP_RADIO, LQP_TAPE, LQP_HIFI, LQP_CD, LQP_STUDIO};
|
|
Packit |
47f805 |
//const unsigned int AEncodeProperties::the_SamplingFreqs[9] = { 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000 };
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
ToolTipItem AEncodeProperties::Tooltips[13]={
|
|
Packit |
47f805 |
{ IDC_CHECK_ENC_ABR, "Allow encoding with an average bitrate\r\ninstead of a constant one.\r\n\r\nIt can improve the quality for the same bitrate." },
|
|
Packit |
47f805 |
{ IDC_CHECK_COPYRIGHT, "Mark the encoded data as copyrighted." },
|
|
Packit |
47f805 |
{ IDC_CHECK_CHECKSUM, "Put a checksum in the encoded data.\r\n\r\nThis can make the file less sensitive to data loss." },
|
|
Packit |
47f805 |
{ IDC_CHECK_ORIGINAL, "Mark the encoded data as an original file." },
|
|
Packit |
47f805 |
{ IDC_CHECK_PRIVATE, "Mark the encoded data as private." },
|
|
Packit |
47f805 |
{ IDC_COMBO_ENC_STEREO, "Select the type of stereo mode used for encoding:\r\n\r\n- Stereo : the usual one\r\n- Joint-Stereo : mix both channel to achieve better compression\r\n- Dual Channel : treat both channel as separate" },
|
|
Packit |
47f805 |
{ IDC_STATIC_DECODING, "Decoding not supported for the moment by the codec." },
|
|
Packit |
47f805 |
{ IDC_CHECK_ENC_SMART, "Disable bitrate when there is too much compression.\r\n(default 1:15 ratio)" },
|
|
Packit |
47f805 |
{ IDC_STATIC_CONFIG_VERSION, "Version of this codec.\r\n\r\nvX.X.X is the version of the codec interface.\r\nX.XX is the version of the encoding engine." },
|
|
Packit |
47f805 |
{ IDC_SLIDER_AVERAGE_MIN, "Select the minimum Average Bitrate allowed." },
|
|
Packit |
47f805 |
{ IDC_SLIDER_AVERAGE_MAX, "Select the maximum Average Bitrate allowed." },
|
|
Packit |
47f805 |
{ IDC_SLIDER_AVERAGE_STEP, "Select the step of Average Bitrate between the min and max.\r\n\r\nA step of 5 between 152 and 165 means you have :\r\n165, 160 and 155" },
|
|
Packit |
47f805 |
{ IDC_SLIDER_AVERAGE_SAMPLE, "Check the resulting values of the (min,max,step) combination.\r\n\r\nUse the keyboard to navigate (right -> left)." },
|
|
Packit |
47f805 |
};
|
|
Packit |
47f805 |
//int AEncodeProperties::tst = 0;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
/*
|
|
Packit |
47f805 |
#pragma argsused
|
|
Packit |
47f805 |
static UINT CALLBACK DLLFindCallback(
|
|
Packit |
47f805 |
HWND hdlg, // handle to child dialog box
|
|
Packit |
47f805 |
UINT uiMsg, // message identifier
|
|
Packit |
47f805 |
WPARAM wParam, // message parameter
|
|
Packit |
47f805 |
LPARAM lParam // message parameter
|
|
Packit |
47f805 |
)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
UINT result = 0;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
switch (uiMsg)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
case WM_NOTIFY:
|
|
Packit |
47f805 |
OFNOTIFY * info = (OFNOTIFY *)lParam;
|
|
Packit |
47f805 |
if (info->hdr.code == CDN_FILEOK)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
result = 1; // by default we don't accept the file
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Check if the selected file is a valid DLL with all the required functions
|
|
Packit |
47f805 |
ALameDLL * tstFile = new ALameDLL;
|
|
Packit |
47f805 |
if (tstFile != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
if (tstFile->Load(info->lpOFN->lpstrFile))
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
result = 0;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
delete tstFile;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (result == 1)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
TCHAR output[250];
|
|
Packit |
47f805 |
::LoadString(AOut::GetInstance(),IDS_STRING_DLL_UNRECOGNIZED,output,250);
|
|
Packit |
47f805 |
AOut::MyMessageBox( output, MB_OK|MB_ICONEXCLAMATION, hdlg);
|
|
Packit |
47f805 |
SetWindowLong(hdlg, DWL_MSGRESULT , -100);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
return result;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
#pragma argsused
|
|
Packit |
47f805 |
static int CALLBACK BrowseFolderCallbackroc(
|
|
Packit |
47f805 |
HWND hwnd,
|
|
Packit |
47f805 |
UINT uMsg,
|
|
Packit |
47f805 |
LPARAM lParam,
|
|
Packit |
47f805 |
LPARAM lpData
|
|
Packit |
47f805 |
)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
AEncodeProperties * the_prop;
|
|
Packit |
47f805 |
the_prop = (AEncodeProperties *) lpData;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (uMsg == BFFM_INITIALIZED)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// char FolderName[MAX_PATH];
|
|
Packit |
47f805 |
// SHGetPathFromIDList((LPITEMIDLIST) lParam,FolderName);
|
|
Packit |
47f805 |
//ADbg tst;
|
|
Packit |
47f805 |
//tst.OutPut("init folder to %s ",the_prop->GetOutputDirectory());
|
|
Packit |
47f805 |
// CreateFile();
|
|
Packit |
47f805 |
::SendMessage(hwnd, BFFM_SETSELECTION, (WPARAM)TRUE, (LPARAM)the_prop->GetOutputDirectory());
|
|
Packit |
47f805 |
}/* else if (uMsg == BFFM_SELCHANGED)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// verify that the folder is writable
|
|
Packit |
47f805 |
// ::SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM)0); // disable
|
|
Packit |
47f805 |
char FolderName[MAX_PATH];
|
|
Packit |
47f805 |
SHGetPathFromIDList((LPITEMIDLIST) lParam, FolderName);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// if (CreateFile(FolderName,STANDARD_RIGHTS_WRITE,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL) == INVALID_HANDLE_VALUE)
|
|
Packit |
47f805 |
if ((GetFileAttributes(FolderName) & FILE_ATTRIBUTE_DIRECTORY) != 0)
|
|
Packit |
47f805 |
::SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM)1); // enable
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
::SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM)0); // disable
|
|
Packit |
47f805 |
//ADbg tst;
|
|
Packit |
47f805 |
//tst.OutPut("change folder to %s ",FolderName);
|
|
Packit |
47f805 |
}* /
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
return 0;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
#pragma argsused
|
|
Packit |
47f805 |
static BOOL CALLBACK ConfigProc(
|
|
Packit |
47f805 |
HWND hwndDlg, // handle to dialog box
|
|
Packit |
47f805 |
UINT uMsg, // message
|
|
Packit |
47f805 |
WPARAM wParam, // first message parameter
|
|
Packit |
47f805 |
LPARAM lParam // second message parameter
|
|
Packit |
47f805 |
)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
BOOL bResult;
|
|
Packit |
47f805 |
AEncodeProperties * the_prop;
|
|
Packit |
47f805 |
the_prop = (AEncodeProperties *) GetProp(hwndDlg, "AEncodeProperties-Config");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
switch (uMsg) {
|
|
Packit |
47f805 |
case WM_COMMAND:
|
|
Packit |
47f805 |
if (the_prop != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
bResult = the_prop->HandleDialogCommand( hwndDlg, wParam, lParam);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
case WM_INITDIALOG:
|
|
Packit |
47f805 |
assert(the_prop == NULL);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
the_prop = (AEncodeProperties *) lParam;
|
|
Packit |
47f805 |
the_prop->my_debug.OutPut("there hwnd = 0x%08X",hwndDlg);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
assert(the_prop != NULL);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
SetProp(hwndDlg, "AEncodeProperties-Config", the_prop);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
the_prop->InitConfigDlg(hwndDlg);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
bResult = TRUE;
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
case WM_HSCROLL:
|
|
Packit |
47f805 |
// check if it's the ABR sliders
|
|
Packit |
47f805 |
if ((HWND)lParam == GetDlgItem(hwndDlg,IDC_SLIDER_AVERAGE_MIN))
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
the_prop->UpdateDlgFromSlides(hwndDlg);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else if ((HWND)lParam == GetDlgItem(hwndDlg,IDC_SLIDER_AVERAGE_MAX))
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
the_prop->UpdateDlgFromSlides(hwndDlg);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else if ((HWND)lParam == GetDlgItem(hwndDlg,IDC_SLIDER_AVERAGE_STEP))
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
the_prop->UpdateDlgFromSlides(hwndDlg);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else if ((HWND)lParam == GetDlgItem(hwndDlg,IDC_SLIDER_AVERAGE_SAMPLE))
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
the_prop->UpdateDlgFromSlides(hwndDlg);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
case WM_NOTIFY:
|
|
Packit |
47f805 |
if (TTN_GETDISPINFO == ((LPNMHDR)lParam)->code) {
|
|
Packit |
47f805 |
NMTTDISPINFO *lphdr = (NMTTDISPINFO *)lParam;
|
|
Packit |
47f805 |
UINT id = (lphdr->uFlags & TTF_IDISHWND) ? GetWindowLong((HWND)lphdr->hdr.idFrom, GWL_ID) : lphdr->hdr.idFrom;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
*lphdr->lpszText = 0;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
SendMessage(lphdr->hdr.hwndFrom, TTM_SETMAXTIPWIDTH, 0, 5000);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
for(int i=0; i
|
|
Packit |
47f805 |
if (id == AEncodeProperties::Tooltips[i].id)
|
|
Packit |
47f805 |
lphdr->lpszText = const_cast<char *>(AEncodeProperties::Tooltips[i].tip);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
return TRUE;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
default:
|
|
Packit |
47f805 |
bResult = FALSE; // will be treated by DefWindowProc
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
return bResult;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
//////////////////////////////////////////////////////////////////////
|
|
Packit |
47f805 |
// Construction/Destruction
|
|
Packit |
47f805 |
//////////////////////////////////////////////////////////////////////
|
|
Packit |
47f805 |
/**
|
|
Packit |
47f805 |
\class AEncodeProperties
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
const char * AEncodeProperties::GetChannelModeString(int a_channelID) const
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
assert(a_channelID < sizeof(the_ChannelModes));
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
switch (a_channelID) {
|
|
Packit |
47f805 |
case 0:
|
|
Packit |
47f805 |
return "Stereo";
|
|
Packit |
47f805 |
case 1:
|
|
Packit |
47f805 |
return "Joint-stereo";
|
|
Packit |
47f805 |
case 2:
|
|
Packit |
47f805 |
return "Dual Channel";
|
|
Packit |
47f805 |
default:
|
|
Packit |
47f805 |
assert(a_channelID);
|
|
Packit |
47f805 |
return NULL;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
const int AEncodeProperties::GetBitrateString(char * string, int string_size, int a_bitrateID) const
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
assert(a_bitrateID < sizeof(the_Bitrates));
|
|
Packit |
47f805 |
assert(string != NULL);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (string_size >= 4)
|
|
Packit |
47f805 |
return wsprintf(string,"%d",the_Bitrates[a_bitrateID]);
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
return -1;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
const unsigned int AEncodeProperties::GetChannelModeValue() const
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
assert(nChannelIndex < sizeof(the_ChannelModes));
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
return the_ChannelModes[nChannelIndex];
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
const unsigned int AEncodeProperties::GetBitrateValue() const
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
assert(nMinBitrateIndex < sizeof(the_Bitrates));
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
return the_Bitrates[nMinBitrateIndex];
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
inline const int AEncodeProperties::GetBitrateValueMPEG2(DWORD & bitrate) const
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
int i;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
for (i=0;i
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
if (the_MPEG2_Bitrates[i] == the_Bitrates[nMinBitrateIndex])
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
bitrate = the_MPEG2_Bitrates[i];
|
|
Packit |
47f805 |
return 0;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else if (the_MPEG2_Bitrates[i] < the_Bitrates[nMinBitrateIndex])
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
bitrate = the_MPEG2_Bitrates[i];
|
|
Packit |
47f805 |
return -1;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
bitrate = 160;
|
|
Packit |
47f805 |
return -1;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
inline const int AEncodeProperties::GetBitrateValueMPEG1(DWORD & bitrate) const
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
int i;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
for (i=sizeof(the_MPEG1_Bitrates)/sizeof(unsigned int)-1;i>=0;i--)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
if (the_MPEG1_Bitrates[i] == the_Bitrates[nMinBitrateIndex])
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
bitrate = the_MPEG1_Bitrates[i];
|
|
Packit |
47f805 |
return 0;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else if (the_MPEG1_Bitrates[i] > the_Bitrates[nMinBitrateIndex])
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
bitrate = the_MPEG1_Bitrates[i];
|
|
Packit |
47f805 |
return 1;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
bitrate = 32;
|
|
Packit |
47f805 |
return 1;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
/*
|
|
Packit |
47f805 |
const int AEncodeProperties::GetBitrateValue(DWORD & bitrate, const DWORD MPEG_Version) const
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
assert((MPEG_Version == MPEG1) || (MPEG_Version == MPEG2));
|
|
Packit |
47f805 |
assert(nMinBitrateIndex < sizeof(the_Bitrates));
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (MPEG_Version == MPEG2)
|
|
Packit |
47f805 |
return GetBitrateValueMPEG2(bitrate);
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
return GetBitrateValueMPEG1(bitrate);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
/*
|
|
Packit |
47f805 |
const char * AEncodeProperties::GetPresetModeString(const int a_presetID) const
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
assert(a_presetID < sizeof(the_Presets));
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
switch (a_presetID) {
|
|
Packit |
47f805 |
case 1:
|
|
Packit |
47f805 |
return "r3mix";
|
|
Packit |
47f805 |
case 2:
|
|
Packit |
47f805 |
return "Normal";
|
|
Packit |
47f805 |
case 3:
|
|
Packit |
47f805 |
return "Low";
|
|
Packit |
47f805 |
case 4:
|
|
Packit |
47f805 |
return "High";
|
|
Packit |
47f805 |
case 5:
|
|
Packit |
47f805 |
return "Very High";
|
|
Packit |
47f805 |
case 6:
|
|
Packit |
47f805 |
return "Voice";
|
|
Packit |
47f805 |
case 7:
|
|
Packit |
47f805 |
return "Phone";
|
|
Packit |
47f805 |
case 8:
|
|
Packit |
47f805 |
return "SW";
|
|
Packit |
47f805 |
case 9:
|
|
Packit |
47f805 |
return "AM";
|
|
Packit |
47f805 |
case 10:
|
|
Packit |
47f805 |
return "FM";
|
|
Packit |
47f805 |
case 11:
|
|
Packit |
47f805 |
return "Voice";
|
|
Packit |
47f805 |
case 12:
|
|
Packit |
47f805 |
return "Radio";
|
|
Packit |
47f805 |
case 13:
|
|
Packit |
47f805 |
return "Tape";
|
|
Packit |
47f805 |
case 14:
|
|
Packit |
47f805 |
return "Hi-Fi";
|
|
Packit |
47f805 |
case 15:
|
|
Packit |
47f805 |
return "CD";
|
|
Packit |
47f805 |
case 16:
|
|
Packit |
47f805 |
return "Studio";
|
|
Packit |
47f805 |
default:
|
|
Packit |
47f805 |
return "None";
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
const LAME_QUALTIY_PRESET AEncodeProperties::GetPresetModeValue() const
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
assert(nPresetIndex < sizeof(the_Presets));
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
return the_Presets[nPresetIndex];
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
bool AEncodeProperties::Config(const HINSTANCE Hinstance, const HWND HwndParent)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
//WM_INITDIALOG ?
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// remember the instance to retreive strings
|
|
Packit |
47f805 |
// hDllInstance = Hinstance;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
my_debug.OutPut("here");
|
|
Packit |
47f805 |
int ret = ::DialogBoxParam(Hinstance, MAKEINTRESOURCE(IDD_CONFIG), HwndParent, ::ConfigProc, (LPARAM) this);
|
|
Packit |
47f805 |
/* if (ret == -1)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
LPVOID lpMsgBuf;
|
|
Packit |
47f805 |
FormatMessage(
|
|
Packit |
47f805 |
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
|
Packit |
47f805 |
FORMAT_MESSAGE_FROM_SYSTEM |
|
|
Packit |
47f805 |
FORMAT_MESSAGE_IGNORE_INSERTS,
|
|
Packit |
47f805 |
NULL,
|
|
Packit |
47f805 |
GetLastError(),
|
|
Packit |
47f805 |
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
|
Packit |
47f805 |
(LPTSTR) &lpMsgBuf,
|
|
Packit |
47f805 |
0,
|
|
Packit |
47f805 |
NULL
|
|
Packit |
47f805 |
);
|
|
Packit |
47f805 |
// Process any inserts in lpMsgBuf.
|
|
Packit |
47f805 |
// ...
|
|
Packit |
47f805 |
// Display the string.
|
|
Packit |
47f805 |
AOut::MyMessageBox( (LPCTSTR)lpMsgBuf, MB_OK | MB_ICONINFORMATION );
|
|
Packit |
47f805 |
// Free the buffer.
|
|
Packit |
47f805 |
LocalFree( lpMsgBuf );
|
|
Packit |
47f805 |
return false;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
return true;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
bool AEncodeProperties::InitConfigDlg(HWND HwndDlg)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// get all the required strings
|
|
Packit |
47f805 |
// TCHAR Version[5];
|
|
Packit |
47f805 |
// LoadString(hDllInstance, IDS_STRING_VERSION, Version, 5);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
int i;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Add required channel modes
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_ENC_STEREO), CB_RESETCONTENT , NULL, NULL);
|
|
Packit |
47f805 |
for (i=0;i
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_ENC_STEREO), CB_ADDSTRING, NULL, (LPARAM) GetChannelModeString(i));
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
char tmp[20];
|
|
Packit |
47f805 |
wsprintf(tmp, "v%s",ACM::GetVersionString());
|
|
Packit |
47f805 |
SetWindowText( GetDlgItem( HwndDlg, IDC_STATIC_CONFIG_VERSION), tmp);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Add all possible re-sampling freq
|
|
Packit |
47f805 |
/* SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_SAMPLEFREQ), CB_RESETCONTENT , NULL, NULL);
|
|
Packit |
47f805 |
char tmp[10];
|
|
Packit |
47f805 |
for (i=0;i
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
wsprintf(tmp, "%d", the_SamplingFreqs[i]);
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_SAMPLEFREQ), CB_ADDSTRING, NULL, (LPARAM) tmp );
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Add required bitrates
|
|
Packit |
47f805 |
/* SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_BITRATE), CB_RESETCONTENT , NULL, NULL);
|
|
Packit |
47f805 |
for (i=0;i
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
GetBitrateString(tmp, 5, i);
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_BITRATE), CB_ADDSTRING, NULL, (LPARAM) tmp );
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Add bitrates to the VBR combo box too
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_MAXBITRATE), CB_RESETCONTENT , NULL, NULL);
|
|
Packit |
47f805 |
for (i=0;i
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
GetBitrateString(tmp, 5, i);
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_MAXBITRATE), CB_ADDSTRING, NULL, (LPARAM) tmp );
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Add VBR Quality Slider
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_QUALITY), TBM_SETRANGE, TRUE, MAKELONG(0,9));
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Add presets
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_PRESET), CB_RESETCONTENT , NULL, NULL);
|
|
Packit |
47f805 |
for (i=0;i
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_PRESET), CB_ADDSTRING, NULL, (LPARAM) GetPresetModeString(i));
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Add ABR Sliders
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_AVERAGE_MIN), TBM_SETRANGE, TRUE, MAKELONG(8,320));
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_AVERAGE_MAX), TBM_SETRANGE, TRUE, MAKELONG(8,320));
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_AVERAGE_STEP), TBM_SETRANGE, TRUE, MAKELONG(1,16));
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Tool-Tip initialiasiation
|
|
Packit |
47f805 |
TOOLINFO ti;
|
|
Packit |
47f805 |
HWND ToolTipWnd;
|
|
Packit |
47f805 |
char DisplayStr[30] = "test tooltip";
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
ToolTipWnd = CreateWindowEx(WS_EX_TOPMOST,
|
|
Packit |
47f805 |
TOOLTIPS_CLASS,
|
|
Packit |
47f805 |
NULL,
|
|
Packit |
47f805 |
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP|TTS_BALLOON ,
|
|
Packit |
47f805 |
CW_USEDEFAULT,
|
|
Packit |
47f805 |
CW_USEDEFAULT,
|
|
Packit |
47f805 |
CW_USEDEFAULT,
|
|
Packit |
47f805 |
CW_USEDEFAULT,
|
|
Packit |
47f805 |
HwndDlg,
|
|
Packit |
47f805 |
NULL,
|
|
Packit |
47f805 |
NULL,
|
|
Packit |
47f805 |
NULL
|
|
Packit |
47f805 |
);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
SetWindowPos(ToolTipWnd,
|
|
Packit |
47f805 |
HWND_TOPMOST,
|
|
Packit |
47f805 |
0,
|
|
Packit |
47f805 |
0,
|
|
Packit |
47f805 |
0,
|
|
Packit |
47f805 |
0,
|
|
Packit |
47f805 |
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
/* INITIALIZE MEMBERS OF THE TOOLINFO STRUCTURE */
|
|
Packit |
47f805 |
ti.cbSize = sizeof(TOOLINFO);
|
|
Packit |
47f805 |
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
|
|
Packit |
47f805 |
ti.hwnd = HwndDlg;
|
|
Packit |
47f805 |
ti.lpszText = LPSTR_TEXTCALLBACK;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
/* SEND AN ADDTOOL MESSAGE TO THE TOOLTIP CONTROL WINDOW */
|
|
Packit |
47f805 |
for(i=0; i
|
|
Packit |
47f805 |
ti.uId = (WPARAM)GetDlgItem(HwndDlg, Tooltips[i].id);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (ti.uId)
|
|
Packit |
47f805 |
SendMessage(ToolTipWnd, TTM_ADDTOOL, 0, (LPARAM)&ti);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
my_debug.OutPut("call UpdateConfigs");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
UpdateConfigs(HwndDlg);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
my_debug.OutPut("call UpdateDlgFromValue");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
UpdateDlgFromValue(HwndDlg);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
my_debug.OutPut("finished InitConfigDlg");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
return true;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
bool AEncodeProperties::UpdateDlgFromValue(HWND HwndDlg)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// get all the required strings
|
|
Packit |
47f805 |
// TCHAR Version[5];
|
|
Packit |
47f805 |
// LoadString(hDllInstance, IDS_STRING_VERSION, Version, 5);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
int i;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Check boxes if required
|
|
Packit |
47f805 |
::CheckDlgButton( HwndDlg, IDC_CHECK_CHECKSUM, GetCRCMode() ?BST_CHECKED:BST_UNCHECKED );
|
|
Packit |
47f805 |
::CheckDlgButton( HwndDlg, IDC_CHECK_ORIGINAL, GetOriginalMode() ?BST_CHECKED:BST_UNCHECKED );
|
|
Packit |
47f805 |
::CheckDlgButton( HwndDlg, IDC_CHECK_PRIVATE, GetPrivateMode() ?BST_CHECKED:BST_UNCHECKED );
|
|
Packit |
47f805 |
::CheckDlgButton( HwndDlg, IDC_CHECK_COPYRIGHT, GetCopyrightMode() ?BST_CHECKED:BST_UNCHECKED );
|
|
Packit |
47f805 |
::CheckDlgButton( HwndDlg, IDC_CHECK_ENC_SMART, GetSmartOutputMode()?BST_CHECKED:BST_UNCHECKED );
|
|
Packit |
47f805 |
::CheckDlgButton( HwndDlg, IDC_CHECK_ENC_ABR, GetAbrOutputMode() ?BST_CHECKED:BST_UNCHECKED );
|
|
Packit |
47f805 |
// ::CheckDlgButton( HwndDlg, IDC_CHECK_RESERVOIR, !GetNoBiResMode() ?BST_CHECKED:BST_UNCHECKED );
|
|
Packit |
47f805 |
// ::CheckDlgButton( HwndDlg, IDC_CHECK_XINGVBR, GetXingFrameMode()?BST_CHECKED:BST_UNCHECKED );
|
|
Packit |
47f805 |
// ::CheckDlgButton( HwndDlg, IDC_CHECK_RESAMPLE, GetResampleMode() ?BST_CHECKED:BST_UNCHECKED );
|
|
Packit |
47f805 |
// ::CheckDlgButton( HwndDlg, IDC_CHECK_CHANNELFORCE, bForceChannel ?BST_CHECKED:BST_UNCHECKED );
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Add required channel modes
|
|
Packit |
47f805 |
for (i=0;i
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
if (i == nChannelIndex)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_ENC_STEREO), CB_SETCURSEL, i, NULL);
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Add VBR Quality
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_AVERAGE_MIN), TBM_SETPOS, TRUE, AverageBitrate_Min);
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_AVERAGE_MAX), TBM_SETPOS, TRUE, AverageBitrate_Max);
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_AVERAGE_STEP), TBM_SETPOS, TRUE, AverageBitrate_Step);
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_AVERAGE_SAMPLE), TBM_SETPOS, TRUE, AverageBitrate_Max);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
UpdateDlgFromSlides(HwndDlg);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
EnableAbrOptions(HwndDlg, GetAbrOutputMode());
|
|
Packit |
47f805 |
// UpdateAbrSteps(AverageBitrate_Min, AverageBitrate_Max, AverageBitrate_Step);
|
|
Packit |
47f805 |
// Add all possible re-sampling freq
|
|
Packit |
47f805 |
/* SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_SAMPLEFREQ), CB_SETCURSEL, nSamplingFreqIndex, NULL);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Add required bitrates
|
|
Packit |
47f805 |
for (i=0;i
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
if (i == nMinBitrateIndex)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_BITRATE), CB_SETCURSEL, i, NULL);
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Add bitrates to the VBR combo box too
|
|
Packit |
47f805 |
for (i=0;i
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
if (i == nMaxBitrateIndex)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_MAXBITRATE), CB_SETCURSEL, i, NULL);
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_QUALITY), TBM_SETRANGE, TRUE, MAKELONG(0,9));
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
char tmp[3];
|
|
Packit |
47f805 |
wsprintf(tmp,"%d",VbrQuality);
|
|
Packit |
47f805 |
SetWindowText(GetDlgItem( HwndDlg, IDC_CONFIG_QUALITY), tmp);
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_QUALITY), TBM_SETPOS, TRUE, VbrQuality);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
wsprintf(tmp,"%d",AverageBitrate);
|
|
Packit |
47f805 |
SetWindowText(GetDlgItem( HwndDlg, IDC_EDIT_AVERAGE), tmp);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Display VBR settings if needed
|
|
Packit |
47f805 |
AEncodeProperties::DisplayVbrOptions(HwndDlg, mBRmode);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Display Resample settings if needed
|
|
Packit |
47f805 |
if (GetResampleMode())
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem(HwndDlg,IDC_COMBO_SAMPLEFREQ), TRUE);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem(HwndDlg,IDC_COMBO_SAMPLEFREQ), FALSE);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Add presets
|
|
Packit |
47f805 |
for (i=0;i
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
if (i == nPresetIndex)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_PRESET), CB_SETCURSEL, i, NULL);
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Add User configs
|
|
Packit |
47f805 |
// SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_SETTINGS), CB_RESETCONTENT , NULL, NULL);
|
|
Packit |
47f805 |
::SetWindowText(::GetDlgItem( HwndDlg, IDC_EDIT_OUTPUTDIR), OutputDir.c_str());
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
/**
|
|
Packit |
47f805 |
\todo Select the right saved config
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
return true;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
bool AEncodeProperties::UpdateValueFromDlg(HWND HwndDlg)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
nChannelIndex = SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_ENC_STEREO), CB_GETCURSEL, NULL, NULL);
|
|
Packit |
47f805 |
// nMinBitrateIndex = SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_BITRATE), CB_GETCURSEL, NULL, NULL);
|
|
Packit |
47f805 |
// nMaxBitrateIndex = SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_MAXBITRATE), CB_GETCURSEL, NULL, NULL);
|
|
Packit |
47f805 |
// nPresetIndex = SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_PRESET), CB_GETCURSEL, NULL, NULL);
|
|
Packit |
47f805 |
// VbrQuality = SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_QUALITY), TBM_GETPOS , NULL, NULL);
|
|
Packit |
47f805 |
// nSamplingFreqIndex = SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_SAMPLEFREQ), CB_GETCURSEL, NULL, NULL);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
bCRC = (::IsDlgButtonChecked( HwndDlg, IDC_CHECK_CHECKSUM) == BST_CHECKED);
|
|
Packit |
47f805 |
bCopyright = (::IsDlgButtonChecked( HwndDlg, IDC_CHECK_COPYRIGHT) == BST_CHECKED);
|
|
Packit |
47f805 |
bOriginal = (::IsDlgButtonChecked( HwndDlg, IDC_CHECK_ORIGINAL) == BST_CHECKED);
|
|
Packit |
47f805 |
bPrivate = (::IsDlgButtonChecked( HwndDlg, IDC_CHECK_PRIVATE) == BST_CHECKED);
|
|
Packit |
47f805 |
bSmartOutput = (::IsDlgButtonChecked( HwndDlg, IDC_CHECK_ENC_SMART) == BST_CHECKED);
|
|
Packit |
47f805 |
bAbrOutput = (::IsDlgButtonChecked( HwndDlg, IDC_CHECK_ENC_ABR) == BST_CHECKED);
|
|
Packit |
47f805 |
// bNoBitRes =!(::IsDlgButtonChecked( HwndDlg, IDC_CHECK_RESERVOIR) == BST_CHECKED);
|
|
Packit |
47f805 |
// bXingFrame = (::IsDlgButtonChecked( HwndDlg, IDC_CHECK_XINGVBR) == BST_CHECKED);
|
|
Packit |
47f805 |
// bResample = (::IsDlgButtonChecked( HwndDlg, IDC_CHECK_RESAMPLE) == BST_CHECKED);
|
|
Packit |
47f805 |
// bForceChannel = (::IsDlgButtonChecked( HwndDlg, IDC_CHECK_CHANNELFORCE) == BST_CHECKED);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
AverageBitrate_Min = SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_AVERAGE_MIN), TBM_GETPOS , NULL, NULL);
|
|
Packit |
47f805 |
AverageBitrate_Max = SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_AVERAGE_MAX), TBM_GETPOS , NULL, NULL);
|
|
Packit |
47f805 |
AverageBitrate_Step = SendMessage(GetDlgItem( HwndDlg, IDC_SLIDER_AVERAGE_STEP), TBM_GETPOS , NULL, NULL);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
EnableAbrOptions(HwndDlg, bAbrOutput);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
my_debug.OutPut("nChannelIndex %d, bCRC %d, bCopyright %d, bOriginal %d, bPrivate %d",nChannelIndex, bCRC, bCopyright, bOriginal, bPrivate);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
/* char tmpPath[MAX_PATH];
|
|
Packit |
47f805 |
::GetWindowText( ::GetDlgItem( HwndDlg, IDC_EDIT_OUTPUTDIR), tmpPath, MAX_PATH);
|
|
Packit |
47f805 |
OutputDir = tmpPath;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (::IsDlgButtonChecked(HwndDlg, IDC_RADIO_BITRATE_CBR) == BST_CHECKED)
|
|
Packit |
47f805 |
mBRmode = BR_CBR;
|
|
Packit |
47f805 |
else if (::IsDlgButtonChecked(HwndDlg, IDC_RADIO_BITRATE_VBR) == BST_CHECKED)
|
|
Packit |
47f805 |
mBRmode = BR_VBR;
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
mBRmode = BR_ABR;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
::GetWindowText( ::GetDlgItem( HwndDlg, IDC_EDIT_AVERAGE), tmpPath, MAX_PATH);
|
|
Packit |
47f805 |
AverageBitrate = atoi(tmpPath);
|
|
Packit |
47f805 |
if (AverageBitrate < 8)
|
|
Packit |
47f805 |
AverageBitrate = 8;
|
|
Packit |
47f805 |
if (AverageBitrate > 320)
|
|
Packit |
47f805 |
AverageBitrate = 320;
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
return true;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
/*
|
|
Packit |
47f805 |
VBRMETHOD AEncodeProperties::GetVBRValue(DWORD & MaxBitrate, int & Quality, DWORD & AbrBitrate, BOOL & VBRHeader, const DWORD MPEG_Version) const
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
assert((MPEG_Version == MPEG1) || (MPEG_Version == MPEG2));
|
|
Packit |
47f805 |
assert(nMaxBitrateIndex < sizeof(the_Bitrates));
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (mBRmode == BR_VBR)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
MaxBitrate = the_Bitrates[nMaxBitrateIndex];
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (MPEG_Version == MPEG1)
|
|
Packit |
47f805 |
MaxBitrate = MaxBitrate>the_MPEG1_Bitrates[sizeof(the_MPEG1_Bitrates)/sizeof(unsigned int)-1]?MaxBitrate:the_MPEG1_Bitrates[sizeof(the_MPEG1_Bitrates)/sizeof(unsigned int)-1];
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
MaxBitrate = MaxBitrate
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
VBRHeader = bXingFrame;
|
|
Packit |
47f805 |
Quality = VbrQuality;
|
|
Packit |
47f805 |
AbrBitrate = 0;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
return VBR_METHOD_DEFAULT; // for the moment
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else if (mBRmode == BR_ABR)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
MaxBitrate = the_Bitrates[nMaxBitrateIndex];
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (MPEG_Version == MPEG1)
|
|
Packit |
47f805 |
MaxBitrate = MaxBitrate>the_MPEG1_Bitrates[sizeof(the_MPEG1_Bitrates)/sizeof(unsigned int)-1]?MaxBitrate:the_MPEG1_Bitrates[sizeof(the_MPEG1_Bitrates)/sizeof(unsigned int)-1];
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
MaxBitrate = MaxBitrate
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
VBRHeader = bXingFrame;
|
|
Packit |
47f805 |
Quality = 0;
|
|
Packit |
47f805 |
AbrBitrate = AverageBitrate*1000;
|
|
Packit |
47f805 |
return VBR_METHOD_ABR;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
return VBR_METHOD_NONE;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
void AEncodeProperties::ParamsRestore()
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// use these default parameters in case one is not found
|
|
Packit |
47f805 |
bCopyright = true;
|
|
Packit |
47f805 |
bCRC = true;
|
|
Packit |
47f805 |
bOriginal = true;
|
|
Packit |
47f805 |
bPrivate = true;
|
|
Packit |
47f805 |
bNoBitRes = false; // enable bit reservoir
|
|
Packit |
47f805 |
bXingFrame = true;
|
|
Packit |
47f805 |
bResample = false;
|
|
Packit |
47f805 |
bForceChannel = false;
|
|
Packit |
47f805 |
bSmartOutput = true;
|
|
Packit |
47f805 |
bAbrOutput = true;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
AverageBitrate_Min = 80; // a bit lame
|
|
Packit |
47f805 |
AverageBitrate_Max = 160; // a bit lame
|
|
Packit |
47f805 |
AverageBitrate_Step = 8; // a bit lame
|
|
Packit |
47f805 |
SmartRatioMax = 15.0;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
nChannelIndex = 2; // joint-stereo
|
|
Packit |
47f805 |
mBRmode = BR_CBR;
|
|
Packit |
47f805 |
nMinBitrateIndex = 6; // 128 kbps (works for both MPEGI and II)
|
|
Packit |
47f805 |
nMaxBitrateIndex = 4; // 160 kbps (works for both MPEGI and II)
|
|
Packit |
47f805 |
nPresetIndex = 0; // None
|
|
Packit |
47f805 |
VbrQuality = 1; // Quite High
|
|
Packit |
47f805 |
// AverageBitrate = 128; // a bit lame
|
|
Packit |
47f805 |
nSamplingFreqIndex = 1; // 44100
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// OutputDir = "c:\\";
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// DllLocation = "plugins\\lame_enc.dll";
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// get the values from the saved file if possible
|
|
Packit |
47f805 |
if (my_stored_data.LoadFile(my_store_location))
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
TiXmlNode* node;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
node = my_stored_data.FirstChild("lame_acm");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
TiXmlElement* CurrentNode = node->FirstChildElement("encodings");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
std::string CurrentConfig = "";
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (CurrentNode->Attribute("default") != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
CurrentConfig = *CurrentNode->Attribute("default");
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
/* // output parameters
|
|
Packit |
47f805 |
TiXmlElement* iterateElmt = node->FirstChildElement("DLL");
|
|
Packit |
47f805 |
if (iterateElmt != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
const std::string * tmpname = iterateElmt->Attribute("location");
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
DllLocation = *tmpname;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
GetValuesFromKey(CurrentConfig, *CurrentNode);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
/**
|
|
Packit |
47f805 |
\todo save the data in the file !
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
void AEncodeProperties::ParamsSave()
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
/*
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
save the current parameters in the corresponding subkey
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
HKEY OssKey;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (RegCreateKeyEx ( HKEY_LOCAL_MACHINE, "SOFTWARE\\MUKOLI\\out_lame", 0, "", REG_OPTION_NON_VOLATILE, KEY_WRITE , NULL, &OssKey, NULL ) == ERROR_SUCCESS) {
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (RegSetValueEx(OssKey, "DLL Location", 0, REG_EXPAND_SZ, (CONST BYTE *)DllLocation, strlen(DllLocation)+1 ) != ERROR_SUCCESS)
|
|
Packit |
47f805 |
return;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
RegCloseKey(OssKey);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
/*
|
|
Packit |
47f805 |
void AEncodeProperties::DisplayVbrOptions(const HWND hDialog, const BRMode the_mode)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
bool bVBR = false;
|
|
Packit |
47f805 |
bool bABR = false;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
switch ( the_mode )
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
case BR_CBR:
|
|
Packit |
47f805 |
::CheckRadioButton(hDialog, IDC_RADIO_BITRATE_CBR, IDC_RADIO_BITRATE_ABR, IDC_RADIO_BITRATE_CBR);
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
case BR_VBR:
|
|
Packit |
47f805 |
::CheckRadioButton(hDialog, IDC_RADIO_BITRATE_CBR, IDC_RADIO_BITRATE_ABR, IDC_RADIO_BITRATE_VBR);
|
|
Packit |
47f805 |
bVBR = true;
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
case BR_ABR:
|
|
Packit |
47f805 |
::CheckRadioButton(hDialog, IDC_RADIO_BITRATE_CBR, IDC_RADIO_BITRATE_ABR, IDC_RADIO_BITRATE_ABR);
|
|
Packit |
47f805 |
bABR = true;
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if(bVBR|bABR)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
::SetWindowText(::GetDlgItem(hDialog,IDC_STATIC_MINBITRATE), "Min Bitrate");
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
::SetWindowText(::GetDlgItem(hDialog,IDC_STATIC_MINBITRATE), "Bitrate");
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_CHECK_XINGVBR), bVBR|bABR);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_COMBO_MAXBITRATE), bVBR|bABR);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_MAXBITRATE), bVBR|bABR);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_SLIDER_QUALITY), bVBR);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_CONFIG_QUALITY), bVBR);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_VBRQUALITY), bVBR);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_VBRQUALITY_LOW), bVBR);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_VBRQUALITY_HIGH), bVBR);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_ABR), bABR);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_EDIT_AVERAGE), bABR);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
AEncodeProperties::AEncodeProperties(HMODULE hModule)
|
|
Packit |
47f805 |
:my_debug(ADbg(DEBUG_LEVEL_CREATION)),
|
|
Packit |
47f805 |
my_hModule(hModule)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
std::string path = "";
|
|
Packit |
47f805 |
// HMODULE htmp = LoadLibrary("out_lame.dll");
|
|
Packit |
47f805 |
if (hModule != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
char output[MAX_PATH];
|
|
Packit |
47f805 |
::GetModuleFileName(hModule, output, MAX_PATH);
|
|
Packit |
47f805 |
// ::FreeLibrary(htmp);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
path = output;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
my_store_location = path.substr(0,path.find_last_of('\\')+1);
|
|
Packit |
47f805 |
my_store_location += "lame_acm.xml";
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
my_debug.OutPut("store path = %s",my_store_location.c_str());
|
|
Packit |
47f805 |
//#ifdef OLD
|
|
Packit |
47f805 |
// ::OutputDebugString(my_store_location.c_str());
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// make sure the XML file is present
|
|
Packit |
47f805 |
HANDLE hFile = ::CreateFile(my_store_location.c_str(), 0, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_ARCHIVE, NULL );
|
|
Packit |
47f805 |
::CloseHandle(hFile);
|
|
Packit |
47f805 |
//#endif // OLD
|
|
Packit |
47f805 |
my_debug.OutPut("AEncodeProperties creation completed (0x%08X)",this);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Save the values to the right XML saved config
|
|
Packit |
47f805 |
void AEncodeProperties::SaveValuesToStringKey(const std::string & config_name)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// get the current data in the file to keep them
|
|
Packit |
47f805 |
if (my_stored_data.LoadFile(my_store_location))
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// check if the Node corresponding to the config_name already exist.
|
|
Packit |
47f805 |
TiXmlNode* node = my_stored_data.FirstChild("lame_acm");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (node != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
TiXmlElement* ConfigNode = node->FirstChildElement("encodings");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (ConfigNode != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// look all the <config> tags
|
|
Packit |
47f805 |
TiXmlElement* tmpNode = ConfigNode->FirstChildElement("config");
|
|
Packit |
47f805 |
while (tmpNode != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
const std::string * tmpname = tmpNode->Attribute("name");
|
|
Packit |
47f805 |
if (tmpname->compare(config_name) == 0)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
tmpNode = tmpNode->NextSiblingElement("config");
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (tmpNode == NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// Create the node
|
|
Packit |
47f805 |
tmpNode = new TiXmlElement("config");
|
|
Packit |
47f805 |
tmpNode->SetAttribute("name",config_name);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// save data in the node
|
|
Packit |
47f805 |
SaveValuesToElement(tmpNode);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
ConfigNode->InsertEndChild(*tmpNode);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// save data in the node
|
|
Packit |
47f805 |
SaveValuesToElement(tmpNode);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// and save the file
|
|
Packit |
47f805 |
my_stored_data.SaveFile(my_store_location);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
void AEncodeProperties::GetValuesFromKey(const std::string & config_name, const TiXmlNode & parentNode)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
TiXmlElement* tmpElt;
|
|
Packit |
47f805 |
TiXmlElement* iterateElmt;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// find the config that correspond to CurrentConfig
|
|
Packit |
47f805 |
iterateElmt = parentNode.FirstChildElement("config");
|
|
Packit |
47f805 |
while (iterateElmt != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
const std::string * tmpname = iterateElmt->Attribute("name");
|
|
Packit |
47f805 |
if ((tmpname != NULL) && (tmpname->compare(config_name) == 0))
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
iterateElmt = iterateElmt->NextSiblingElement("config");
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (iterateElmt != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// get all the parameters saved in this Element
|
|
Packit |
47f805 |
const std::string * tmpname;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Smart output parameter
|
|
Packit |
47f805 |
tmpElt = iterateElmt->FirstChildElement("Smart");
|
|
Packit |
47f805 |
if (tmpElt != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpname = tmpElt->Attribute("use");
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
bSmartOutput = (tmpname->compare("true") == 0);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
tmpname = tmpElt->Attribute("ratio");
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
SmartRatioMax = atof(tmpname->c_str());
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Smart output parameter
|
|
Packit |
47f805 |
tmpElt = iterateElmt->FirstChildElement("ABR");
|
|
Packit |
47f805 |
if (tmpElt != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpname = tmpElt->Attribute("use");
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
bAbrOutput = (tmpname->compare("true") == 0);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
tmpname = tmpElt->Attribute("min");
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
AverageBitrate_Min = atoi(tmpname->c_str());
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
tmpname = tmpElt->Attribute("max");
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
AverageBitrate_Max = atoi(tmpname->c_str());
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
tmpname = tmpElt->Attribute("step");
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
AverageBitrate_Step = atoi(tmpname->c_str());
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Copyright parameter
|
|
Packit |
47f805 |
tmpElt = iterateElmt->FirstChildElement("Copyright");
|
|
Packit |
47f805 |
if (tmpElt != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpname = tmpElt->Attribute("use");
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
bCopyright = (tmpname->compare("true") == 0);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Copyright parameter
|
|
Packit |
47f805 |
tmpElt = iterateElmt->FirstChildElement("CRC");
|
|
Packit |
47f805 |
if (tmpElt != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpname = tmpElt->Attribute("use");
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
bCRC = (tmpname->compare("true") == 0);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Copyright parameter
|
|
Packit |
47f805 |
tmpElt = iterateElmt->FirstChildElement("Original");
|
|
Packit |
47f805 |
if (tmpElt != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpname = tmpElt->Attribute("use");
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
bOriginal = (tmpname->compare("true") == 0);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Copyright parameter
|
|
Packit |
47f805 |
tmpElt = iterateElmt->FirstChildElement("Private");
|
|
Packit |
47f805 |
if (tmpElt != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpname = tmpElt->Attribute("use");
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
bPrivate = (tmpname->compare("true") == 0);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
/*
|
|
Packit |
47f805 |
// Copyright parameter
|
|
Packit |
47f805 |
tmpElt = iterateElmt->FirstChildElement("Bit_reservoir");
|
|
Packit |
47f805 |
if (tmpElt != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpname = tmpElt->Attribute("use");
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
bNoBitRes = !(tmpname->compare("true") == 0);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// bitrates
|
|
Packit |
47f805 |
tmpElt = iterateElmt->FirstChildElement("bitrate");
|
|
Packit |
47f805 |
tmpname = tmpElt->Attribute("min");
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
unsigned int uitmp = atoi(tmpname->c_str());
|
|
Packit |
47f805 |
for (int i=0;i
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
if (the_Bitrates[i] == uitmp)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
nMinBitrateIndex = i;
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
tmpname = tmpElt->Attribute("max");
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
unsigned int uitmp = atoi(tmpname->c_str());
|
|
Packit |
47f805 |
for (int i=0;i
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
if (the_Bitrates[i] == uitmp)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
nMaxBitrateIndex = i;
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
/*
|
|
Packit |
47f805 |
// resampling parameters
|
|
Packit |
47f805 |
tmpElt = iterateElmt->FirstChildElement("resampling");
|
|
Packit |
47f805 |
if (tmpElt != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpname = tmpElt->Attribute("use");
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
bResample = (tmpname->compare("true") == 0);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
unsigned int uitmp = atoi(tmpElt->Attribute("freq")->c_str());
|
|
Packit |
47f805 |
for (int i=0;i
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
if (the_SamplingFreqs[i] == uitmp)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
nSamplingFreqIndex = i;
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// VBR parameters
|
|
Packit |
47f805 |
tmpElt = iterateElmt->FirstChildElement("VBR");
|
|
Packit |
47f805 |
if (tmpElt != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpname = tmpElt->Attribute("use");
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
if (tmpname->compare("ABR") == 0)
|
|
Packit |
47f805 |
mBRmode = BR_ABR;
|
|
Packit |
47f805 |
else if (tmpname->compare("true") == 0)
|
|
Packit |
47f805 |
mBRmode = BR_VBR;
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
mBRmode = BR_CBR;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
tmpname = tmpElt->Attribute("header");
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
bXingFrame = (tmpname->compare("true") == 0);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
tmpname = tmpElt->Attribute("quality");
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
VbrQuality = atoi(tmpname->c_str());
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
tmpname = tmpElt->Attribute("average");
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
AverageBitrate = atoi(tmpname->c_str());
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// output parameters
|
|
Packit |
47f805 |
tmpElt = iterateElmt->FirstChildElement("output");
|
|
Packit |
47f805 |
if (tmpElt != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
OutputDir = *tmpElt->Attribute("path");
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
//#ifdef OLD
|
|
Packit |
47f805 |
// Channel mode parameter
|
|
Packit |
47f805 |
tmpElt = iterateElmt->FirstChildElement("Channel");
|
|
Packit |
47f805 |
if (tmpElt != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
const std::string * tmpStr = tmpElt->Attribute("mode");
|
|
Packit |
47f805 |
if (tmpStr != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
for (int i=0;i
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
if (tmpStr->compare(GetChannelModeString(i)) == 0)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
nChannelIndex = i;
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
/*
|
|
Packit |
47f805 |
tmpname = tmpElt->Attribute("force");
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
bForceChannel = (tmpname->compare("true") == 0);
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
//#endif // OLD
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Preset parameter
|
|
Packit |
47f805 |
/*
|
|
Packit |
47f805 |
tmpElt = iterateElmt->FirstChildElement("Preset");
|
|
Packit |
47f805 |
if (tmpElt != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
const std::string * tmpStr = tmpElt->Attribute("type");
|
|
Packit |
47f805 |
for (int i=0;i
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
if (tmpStr->compare(GetPresetModeString(i)) == 0)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
nPresetIndex = i;
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
/**
|
|
Packit |
47f805 |
\todo save the parameters
|
|
Packit |
47f805 |
* /
|
|
Packit |
47f805 |
void AEncodeProperties::SaveParams(const HWND hParentWnd)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
char string[MAX_PATH];
|
|
Packit |
47f805 |
/* int nIdx = SendMessage(::GetDlgItem( hParentWnd ,IDC_COMBO_SETTINGS ), CB_GETCURSEL, NULL, NULL);
|
|
Packit |
47f805 |
::SendMessage(::GetDlgItem( hParentWnd ,IDC_COMBO_SETTINGS ), CB_GETLBTEXT , nIdx, (LPARAM) string);
|
|
Packit |
47f805 |
* /
|
|
Packit |
47f805 |
}*/
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
bool AEncodeProperties::operator !=(const AEncodeProperties & the_instance) const
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
/*
|
|
Packit |
47f805 |
::OutputDebugString(bCopyright != the_instance.bCopyright?"1":"-");
|
|
Packit |
47f805 |
::OutputDebugString(bCRC != the_instance.bCRC ?"2":"-");
|
|
Packit |
47f805 |
::OutputDebugString(bOriginal != the_instance.bOriginal ?"3":"-");
|
|
Packit |
47f805 |
::OutputDebugString(bPrivate != the_instance.bPrivate ?"4":"-");
|
|
Packit |
47f805 |
::OutputDebugString(bNoBitRes != the_instance.bNoBitRes ?"5":"-");
|
|
Packit |
47f805 |
::OutputDebugString(mBRmode != the_instance.mBRmode ?"6":"-");
|
|
Packit |
47f805 |
::OutputDebugString(bXingFrame != the_instance.bXingFrame?"7":"-");
|
|
Packit |
47f805 |
::OutputDebugString(bForceChannel != the_instance.bForceChannel?"8":"-");
|
|
Packit |
47f805 |
::OutputDebugString(bResample != the_instance.bResample ?"9":"-");
|
|
Packit |
47f805 |
::OutputDebugString(nChannelIndex != the_instance.nChannelIndex?"10":"-");
|
|
Packit |
47f805 |
::OutputDebugString(nMinBitrateIndex != the_instance.nMinBitrateIndex?"11":"-");
|
|
Packit |
47f805 |
::OutputDebugString(nMaxBitrateIndex != the_instance.nMaxBitrateIndex?"12":"-");
|
|
Packit |
47f805 |
::OutputDebugString(nPresetIndex != the_instance.nPresetIndex?"13":"-");
|
|
Packit |
47f805 |
::OutputDebugString(VbrQuality != the_instance.VbrQuality?"14":"-");
|
|
Packit |
47f805 |
::OutputDebugString(AverageBitrate != the_instance.AverageBitrate?"15":"-");
|
|
Packit |
47f805 |
::OutputDebugString(nSamplingFreqIndex != the_instance.nSamplingFreqIndex?"16":"-");
|
|
Packit |
47f805 |
::OutputDebugString(OutputDir.compare(the_instance.OutputDir) != 0?"17":"-");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
std::string tmp = "";
|
|
Packit |
47f805 |
char tmpI[10];
|
|
Packit |
47f805 |
_itoa(AverageBitrate,tmpI,10);
|
|
Packit |
47f805 |
tmp += tmpI;
|
|
Packit |
47f805 |
tmp += " != ";
|
|
Packit |
47f805 |
_itoa(the_instance.AverageBitrate,tmpI,10);
|
|
Packit |
47f805 |
tmp += tmpI;
|
|
Packit |
47f805 |
::OutputDebugString(tmp.c_str());
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
return ((bCopyright != the_instance.bCopyright)
|
|
Packit |
47f805 |
|| (bCRC != the_instance.bCRC)
|
|
Packit |
47f805 |
|| (bOriginal != the_instance.bOriginal)
|
|
Packit |
47f805 |
|| (bPrivate != the_instance.bPrivate)
|
|
Packit |
47f805 |
|| (bSmartOutput != the_instance.bSmartOutput)
|
|
Packit |
47f805 |
|| (SmartRatioMax != the_instance.SmartRatioMax)
|
|
Packit |
47f805 |
|| (bAbrOutput != the_instance.bAbrOutput)
|
|
Packit |
47f805 |
|| (AverageBitrate_Min != the_instance.AverageBitrate_Min)
|
|
Packit |
47f805 |
|| (AverageBitrate_Max != the_instance.AverageBitrate_Max)
|
|
Packit |
47f805 |
|| (AverageBitrate_Step != the_instance.AverageBitrate_Step)
|
|
Packit |
47f805 |
|| (bNoBitRes != the_instance.bNoBitRes)
|
|
Packit |
47f805 |
|| (mBRmode != the_instance.mBRmode)
|
|
Packit |
47f805 |
|| (bXingFrame != the_instance.bXingFrame)
|
|
Packit |
47f805 |
|| (bForceChannel != the_instance.bForceChannel)
|
|
Packit |
47f805 |
|| (bResample != the_instance.bResample)
|
|
Packit |
47f805 |
|| (nChannelIndex != the_instance.nChannelIndex)
|
|
Packit |
47f805 |
|| (nMinBitrateIndex != the_instance.nMinBitrateIndex)
|
|
Packit |
47f805 |
|| (nMaxBitrateIndex != the_instance.nMaxBitrateIndex)
|
|
Packit |
47f805 |
|| (nPresetIndex != the_instance.nPresetIndex)
|
|
Packit |
47f805 |
|| (VbrQuality != the_instance.VbrQuality)
|
|
Packit |
47f805 |
// || (AverageBitrate != the_instance.AverageBitrate)
|
|
Packit |
47f805 |
|| (nSamplingFreqIndex != the_instance.nSamplingFreqIndex)
|
|
Packit |
47f805 |
// || (OutputDir.compare(the_instance.OutputDir) != 0)
|
|
Packit |
47f805 |
);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
void AEncodeProperties::SelectSavedParams(const std::string the_string)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// get the values from the saved file if possible
|
|
Packit |
47f805 |
if (my_stored_data.LoadFile(my_store_location))
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
TiXmlNode* node;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
node = my_stored_data.FirstChild("lame_acm");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
TiXmlElement* CurrentNode = node->FirstChildElement("encodings");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (CurrentNode != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
CurrentNode->SetAttribute("default",the_string);
|
|
Packit |
47f805 |
GetValuesFromKey(the_string, *CurrentNode);
|
|
Packit |
47f805 |
my_stored_data.SaveFile(my_store_location);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
inline void AEncodeProperties::SetAttributeBool(TiXmlElement * the_elt,const std::string & the_string, const bool the_value) const
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
if (the_value == false)
|
|
Packit |
47f805 |
the_elt->SetAttribute(the_string, "false");
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
the_elt->SetAttribute(the_string, "true");
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
void AEncodeProperties::SaveValuesToElement(TiXmlElement * the_element) const
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// get all the parameters saved in this Element
|
|
Packit |
47f805 |
TiXmlElement * tmpElt;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Bit Reservoir parameter
|
|
Packit |
47f805 |
/*
|
|
Packit |
47f805 |
tmpElt = the_element->FirstChildElement("Bit_reservoir");
|
|
Packit |
47f805 |
if (tmpElt == NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpElt = new TiXmlElement("Bit_reservoir");
|
|
Packit |
47f805 |
SetAttributeBool(tmpElt, "use", !bNoBitRes);
|
|
Packit |
47f805 |
the_element->InsertEndChild(*tmpElt);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
SetAttributeBool(tmpElt, "use", !bNoBitRes);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
// Copyright parameter
|
|
Packit |
47f805 |
tmpElt = the_element->FirstChildElement("Copyright");
|
|
Packit |
47f805 |
if (tmpElt == NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpElt = new TiXmlElement("Copyright");
|
|
Packit |
47f805 |
SetAttributeBool( tmpElt, "use", bCopyright);
|
|
Packit |
47f805 |
the_element->InsertEndChild(*tmpElt);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
SetAttributeBool( tmpElt, "use", bCopyright);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Smart Output parameter
|
|
Packit |
47f805 |
tmpElt = the_element->FirstChildElement("Smart");
|
|
Packit |
47f805 |
if (tmpElt == NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpElt = new TiXmlElement("Smart");
|
|
Packit |
47f805 |
SetAttributeBool( tmpElt, "use", bSmartOutput);
|
|
Packit |
47f805 |
tmpElt->SetAttribute("ratio", SmartRatioMax);
|
|
Packit |
47f805 |
the_element->InsertEndChild(*tmpElt);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
SetAttributeBool( tmpElt, "use", bSmartOutput);
|
|
Packit |
47f805 |
tmpElt->SetAttribute("ratio", SmartRatioMax);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Smart Output parameter
|
|
Packit |
47f805 |
tmpElt = the_element->FirstChildElement("ABR");
|
|
Packit |
47f805 |
if (tmpElt == NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpElt = new TiXmlElement("ABR");
|
|
Packit |
47f805 |
SetAttributeBool( tmpElt, "use", bAbrOutput);
|
|
Packit |
47f805 |
tmpElt->SetAttribute("min", AverageBitrate_Min);
|
|
Packit |
47f805 |
tmpElt->SetAttribute("max", AverageBitrate_Max);
|
|
Packit |
47f805 |
tmpElt->SetAttribute("step", AverageBitrate_Step);
|
|
Packit |
47f805 |
the_element->InsertEndChild(*tmpElt);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
SetAttributeBool( tmpElt, "use", bAbrOutput);
|
|
Packit |
47f805 |
tmpElt->SetAttribute("min", AverageBitrate_Min);
|
|
Packit |
47f805 |
tmpElt->SetAttribute("max", AverageBitrate_Max);
|
|
Packit |
47f805 |
tmpElt->SetAttribute("step", AverageBitrate_Step);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// CRC parameter
|
|
Packit |
47f805 |
tmpElt = the_element->FirstChildElement("CRC");
|
|
Packit |
47f805 |
if (tmpElt == NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpElt = new TiXmlElement("CRC");
|
|
Packit |
47f805 |
SetAttributeBool( tmpElt, "use", bCRC);
|
|
Packit |
47f805 |
the_element->InsertEndChild(*tmpElt);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
SetAttributeBool( tmpElt, "use", bCRC);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Original parameter
|
|
Packit |
47f805 |
tmpElt = the_element->FirstChildElement("Original");
|
|
Packit |
47f805 |
if (tmpElt == NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpElt = new TiXmlElement("Original");
|
|
Packit |
47f805 |
SetAttributeBool( tmpElt, "use", bOriginal);
|
|
Packit |
47f805 |
the_element->InsertEndChild(*tmpElt);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
SetAttributeBool( tmpElt, "use", bOriginal);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Private parameter
|
|
Packit |
47f805 |
tmpElt = the_element->FirstChildElement("Private");
|
|
Packit |
47f805 |
if (tmpElt == NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpElt = new TiXmlElement("Private");
|
|
Packit |
47f805 |
SetAttributeBool( tmpElt, "use", bPrivate);
|
|
Packit |
47f805 |
the_element->InsertEndChild(*tmpElt);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
SetAttributeBool( tmpElt, "use", bPrivate);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Channel Mode parameter
|
|
Packit |
47f805 |
tmpElt = the_element->FirstChildElement("Channel");
|
|
Packit |
47f805 |
if (tmpElt == NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpElt = new TiXmlElement("Channel");
|
|
Packit |
47f805 |
tmpElt->SetAttribute("mode", GetChannelModeString(nChannelIndex));
|
|
Packit |
47f805 |
// SetAttributeBool( tmpElt, "force", bForceChannel);
|
|
Packit |
47f805 |
the_element->InsertEndChild(*tmpElt);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpElt->SetAttribute("mode", GetChannelModeString(nChannelIndex));
|
|
Packit |
47f805 |
// SetAttributeBool( tmpElt, "force", bForceChannel);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
/*
|
|
Packit |
47f805 |
// Preset parameter
|
|
Packit |
47f805 |
tmpElt = the_element->FirstChildElement("Preset");
|
|
Packit |
47f805 |
if (tmpElt == NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpElt = new TiXmlElement("Preset");
|
|
Packit |
47f805 |
tmpElt->SetAttribute("type", GetPresetModeString(nPresetIndex));
|
|
Packit |
47f805 |
the_element->InsertEndChild(*tmpElt);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpElt->SetAttribute("type", GetPresetModeString(nPresetIndex));
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Bitrate parameter
|
|
Packit |
47f805 |
tmpElt = the_element->FirstChildElement("bitrate");
|
|
Packit |
47f805 |
if (tmpElt == NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpElt = new TiXmlElement("bitrate");
|
|
Packit |
47f805 |
tmpElt->SetAttribute("min", the_Bitrates[nMinBitrateIndex]);
|
|
Packit |
47f805 |
tmpElt->SetAttribute("max", the_Bitrates[nMaxBitrateIndex]);
|
|
Packit |
47f805 |
the_element->InsertEndChild(*tmpElt);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpElt->SetAttribute("min", the_Bitrates[nMinBitrateIndex]);
|
|
Packit |
47f805 |
tmpElt->SetAttribute("max", the_Bitrates[nMaxBitrateIndex]);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// Output Directory parameter
|
|
Packit |
47f805 |
tmpElt = the_element->FirstChildElement("output");
|
|
Packit |
47f805 |
if (tmpElt == NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpElt = new TiXmlElement("output");
|
|
Packit |
47f805 |
tmpElt->SetAttribute("path", OutputDir);
|
|
Packit |
47f805 |
the_element->InsertEndChild(*tmpElt);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpElt->SetAttribute("path", OutputDir);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
/*
|
|
Packit |
47f805 |
// Resampling parameter
|
|
Packit |
47f805 |
tmpElt = the_element->FirstChildElement("resampling");
|
|
Packit |
47f805 |
if (tmpElt == NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpElt = new TiXmlElement("resampling");
|
|
Packit |
47f805 |
SetAttributeBool( tmpElt, "use", bResample);
|
|
Packit |
47f805 |
tmpElt->SetAttribute("freq", the_SamplingFreqs[nSamplingFreqIndex]);
|
|
Packit |
47f805 |
the_element->InsertEndChild(*tmpElt);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
SetAttributeBool( tmpElt, "use", bResample);
|
|
Packit |
47f805 |
tmpElt->SetAttribute("freq", the_SamplingFreqs[nSamplingFreqIndex]);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// VBR parameter
|
|
Packit |
47f805 |
tmpElt = the_element->FirstChildElement("VBR");
|
|
Packit |
47f805 |
if (tmpElt == NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
tmpElt = new TiXmlElement("VBR");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (mBRmode == BR_ABR)
|
|
Packit |
47f805 |
tmpElt->SetAttribute("use", "ABR");
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
SetAttributeBool( tmpElt, "use", (mBRmode != BR_CBR));
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
SetAttributeBool( tmpElt, "header", bXingFrame);
|
|
Packit |
47f805 |
tmpElt->SetAttribute("quality", VbrQuality);
|
|
Packit |
47f805 |
tmpElt->SetAttribute("average", AverageBitrate);
|
|
Packit |
47f805 |
the_element->InsertEndChild(*tmpElt);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
if (mBRmode == BR_ABR)
|
|
Packit |
47f805 |
tmpElt->SetAttribute("use", "ABR");
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
SetAttributeBool( tmpElt, "use", (mBRmode != BR_CBR));
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
SetAttributeBool( tmpElt, "header", bXingFrame);
|
|
Packit |
47f805 |
tmpElt->SetAttribute("quality", VbrQuality);
|
|
Packit |
47f805 |
tmpElt->SetAttribute("average", AverageBitrate);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
bool AEncodeProperties::HandleDialogCommand(const HWND parentWnd, const WPARAM wParam, const LPARAM lParam)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
UINT command;
|
|
Packit |
47f805 |
command = GET_WM_COMMAND_ID(wParam, lParam);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
switch (command)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
case IDOK :
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
bool bShouldEnd = true;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// save parameters
|
|
Packit |
47f805 |
char string[MAX_PATH];
|
|
Packit |
47f805 |
// ::GetWindowText(::GetDlgItem( parentWnd, IDC_COMBO_SETTINGS), string, MAX_PATH);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
wsprintf(string,"Current"); // only the Current config is supported at the moment
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
my_debug.OutPut("my_hModule = 0x%08X",my_hModule);
|
|
Packit |
47f805 |
/*
|
|
Packit |
47f805 |
AEncodeProperties tmpDlgProps(my_hModule);
|
|
Packit |
47f805 |
AEncodeProperties tmpSavedProps(my_hModule);
|
|
Packit |
47f805 |
//#ifdef OLD
|
|
Packit |
47f805 |
tmpDlgProps.UpdateValueFromDlg(parentWnd);
|
|
Packit |
47f805 |
tmpSavedProps.SelectSavedParams(string);
|
|
Packit |
47f805 |
tmpSavedProps.ParamsRestore();
|
|
Packit |
47f805 |
// check if the values from the DLG are the same as the one saved in the config file
|
|
Packit |
47f805 |
// if yes, just do nothing
|
|
Packit |
47f805 |
/*
|
|
Packit |
47f805 |
if (tmpDlgProps != tmpSavedProps)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
int save;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (strcmp(string,"Current") == 0)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// otherwise, prompt the user if he wants to overwrite the settings
|
|
Packit |
47f805 |
TCHAR tmpStr[250];
|
|
Packit |
47f805 |
::LoadString(AOut::GetInstance(),IDS_STRING_PROMPT_REPLACE_CURRENT,tmpStr,250);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
save = AOut::MyMessageBox( tmpStr, MB_OKCANCEL|MB_ICONQUESTION, parentWnd);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// otherwise, prompt the user if he wants to overwrite the settings
|
|
Packit |
47f805 |
TCHAR tmpStr[250];
|
|
Packit |
47f805 |
::LoadString(AOut::GetInstance(),IDS_STRING_PROMPT_REPLACE_SETING,tmpStr,250);
|
|
Packit |
47f805 |
TCHAR tmpDsp[500];
|
|
Packit |
47f805 |
wsprintf(tmpDsp,tmpStr,string);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
save = AOut::MyMessageBox( tmpDsp, MB_YESNOCANCEL|MB_ICONQUESTION, parentWnd);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (save == IDCANCEL)
|
|
Packit |
47f805 |
bShouldEnd = false;
|
|
Packit |
47f805 |
else if (save == IDNO)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// save the values in 'current'
|
|
Packit |
47f805 |
UpdateValueFromDlg(parentWnd);
|
|
Packit |
47f805 |
SaveValuesToStringKey("Current");
|
|
Packit |
47f805 |
SelectSavedParams("Current");
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// do so and save in XML
|
|
Packit |
47f805 |
UpdateValueFromDlg(parentWnd);
|
|
Packit |
47f805 |
SaveValuesToStringKey(string);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
//#endif // OLD
|
|
Packit |
47f805 |
my_debug.OutPut("before : nChannelIndex %d, bCRC %d, bCopyright %d, bOriginal %d, bPrivate %d",nChannelIndex, bCRC, bCopyright, bOriginal, bPrivate);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
my_debug.OutPut("call UpdateValueFromDlg");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
UpdateValueFromDlg(parentWnd);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
my_debug.OutPut("call SaveValuesToStringKey");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
SaveValuesToStringKey("Current"); // only Current config is supported now
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// SaveParams(parentWnd);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
//my_debug.OutPut("call SelectSavedParams");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// SelectSavedParams(string);
|
|
Packit |
47f805 |
// UpdateDlgFromValue(parentWnd);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
my_debug.OutPut("finished saving");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (bShouldEnd)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
RemoveProp(parentWnd, "AEncodeProperties-Config");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
EndDialog(parentWnd, true);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
case IDCANCEL:
|
|
Packit |
47f805 |
RemoveProp(parentWnd, "AEncodeProperties-Config");
|
|
Packit |
47f805 |
EndDialog(parentWnd, false);
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
/* case IDC_FIND_DLL:
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
OPENFILENAME file;
|
|
Packit |
47f805 |
char DllLocation[512];
|
|
Packit |
47f805 |
wsprintf(DllLocation,"%s",GetDllLocation());
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
memset(&file, 0, sizeof(file));
|
|
Packit |
47f805 |
file.lStructSize = sizeof(file);
|
|
Packit |
47f805 |
file.hwndOwner = parentWnd;
|
|
Packit |
47f805 |
file.Flags = OFN_FILEMUSTEXIST | OFN_NODEREFERENCELINKS | OFN_ENABLEHOOK | OFN_EXPLORER ;
|
|
Packit |
47f805 |
/// file.lpstrFile = AOut::the_AOut->DllLocation;
|
|
Packit |
47f805 |
file.lpstrFile = DllLocation;
|
|
Packit |
47f805 |
file.lpstrFilter = "Lame DLL (lame_enc.dll)\0LAME_ENC.DLL\0DLL (*.dll)\0*.DLL\0All (*.*)\0*.*\0";
|
|
Packit |
47f805 |
file.nFilterIndex = 1;
|
|
Packit |
47f805 |
file.nMaxFile = sizeof(DllLocation);
|
|
Packit |
47f805 |
file.lpfnHook = DLLFindCallback; // use to validate the DLL chosen
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
GetOpenFileName(&file;;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
SetDllLocation(DllLocation);
|
|
Packit |
47f805 |
// use this filename if necessary
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
/* case IDC_BUTTON_OUTPUT:
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
#ifndef SIMPLE_FOLDER
|
|
Packit |
47f805 |
BROWSEINFO info;
|
|
Packit |
47f805 |
memset(&info,0,sizeof(info));
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
char FolderName[MAX_PATH];
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
info.hwndOwner = parentWnd;
|
|
Packit |
47f805 |
info.pszDisplayName = FolderName;
|
|
Packit |
47f805 |
info.lpfn = BrowseFolderCallbackroc;
|
|
Packit |
47f805 |
info.lParam = (LPARAM) this;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// get the localised window title
|
|
Packit |
47f805 |
TCHAR output[250];
|
|
Packit |
47f805 |
::LoadString(AOut::GetInstance(),IDS_STRING_DIR_SELECT,output,250);
|
|
Packit |
47f805 |
info.lpszTitle = output;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
#ifdef BIF_EDITBOX
|
|
Packit |
47f805 |
info.ulFlags |= BIF_EDITBOX;
|
|
Packit |
47f805 |
#else // BIF_EDITBOX
|
|
Packit |
47f805 |
info.ulFlags |= 0x0010;
|
|
Packit |
47f805 |
#endif // BIF_EDITBOX
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
#ifdef BIF_VALIDATE
|
|
Packit |
47f805 |
info.ulFlags |= BIF_VALIDATE;
|
|
Packit |
47f805 |
#else // BIF_VALIDATE
|
|
Packit |
47f805 |
info.ulFlags |= 0x0020;
|
|
Packit |
47f805 |
#endif // BIF_VALIDATE
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
#ifdef BIF_NEWDIALOGSTYLE
|
|
Packit |
47f805 |
info.ulFlags |= BIF_NEWDIALOGSTYLE;
|
|
Packit |
47f805 |
#else // BIF_NEWDIALOGSTYLE
|
|
Packit |
47f805 |
info.ulFlags |= 0x0040;
|
|
Packit |
47f805 |
#endif // BIF_NEWDIALOGSTYLE
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
ITEMIDLIST *item = SHBrowseForFolder(&info;;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (item != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
char tmpOutputDir[MAX_PATH];
|
|
Packit |
47f805 |
wsprintf(tmpOutputDir,"%s",GetOutputDirectory());
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
SHGetPathFromIDList( item,tmpOutputDir );
|
|
Packit |
47f805 |
SetOutputDirectory( tmpOutputDir );
|
|
Packit |
47f805 |
::SetWindowText(GetDlgItem( parentWnd, IDC_EDIT_OUTPUTDIR), tmpOutputDir);
|
|
Packit |
47f805 |
// wsprintf(OutputDir,FolderName);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
#else // SIMPLE_FOLDER
|
|
Packit |
47f805 |
OPENFILENAME file;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
memset(&file, 0, sizeof(file));
|
|
Packit |
47f805 |
file.lStructSize = sizeof(file);
|
|
Packit |
47f805 |
file.hwndOwner = parentWnd;
|
|
Packit |
47f805 |
file.Flags = OFN_FILEMUSTEXIST | OFN_NODEREFERENCELINKS | OFN_ENABLEHOOK | OFN_EXPLORER ;
|
|
Packit |
47f805 |
// file.lpstrFile = GetDllLocation();
|
|
Packit |
47f805 |
// file.lpstrFile = GetOutputDirectory();
|
|
Packit |
47f805 |
file.lpstrInitialDir = GetOutputDirectory();
|
|
Packit |
47f805 |
file.lpstrFilter = "A Directory\0.*\0";
|
|
Packit |
47f805 |
// file.nFilterIndex = 1;
|
|
Packit |
47f805 |
file.nMaxFile = MAX_PATH;
|
|
Packit |
47f805 |
// file.lpfnHook = DLLFindCallback; // use to validate the DLL chosen
|
|
Packit |
47f805 |
// file.Flags = OFN_ENABLESIZING | OFN_NOREADONLYRETURN | OFN_HIDEREADONLY;
|
|
Packit |
47f805 |
file.Flags = OFN_NOREADONLYRETURN | OFN_HIDEREADONLY | OFN_EXPLORER;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
TCHAR output[250];
|
|
Packit |
47f805 |
::LoadString(AOut::GetInstance(),IDS_STRING_DIR_SELECT,output,250);
|
|
Packit |
47f805 |
file.lpstrTitle = output;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
GetSaveFileName(&file;;
|
|
Packit |
47f805 |
#endif // SIMPLE_FOLDER
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
case IDC_CHECK_ENC_ABR:
|
|
Packit |
47f805 |
EnableAbrOptions(parentWnd, ::IsDlgButtonChecked( parentWnd, IDC_CHECK_ENC_ABR) == BST_CHECKED);
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
/* case IDC_RADIO_BITRATE_CBR:
|
|
Packit |
47f805 |
AEncodeProperties::DisplayVbrOptions(parentWnd, AEncodeProperties::BR_CBR);
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
case IDC_RADIO_BITRATE_VBR:
|
|
Packit |
47f805 |
AEncodeProperties::DisplayVbrOptions(parentWnd, AEncodeProperties::BR_VBR);
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
case IDC_RADIO_BITRATE_ABR:
|
|
Packit |
47f805 |
AEncodeProperties::DisplayVbrOptions(parentWnd, AEncodeProperties::BR_ABR);
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
case IDC_CHECK_RESAMPLE:
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
bool tmp_bResampleUsed = (::IsDlgButtonChecked( parentWnd, IDC_CHECK_RESAMPLE) == BST_CHECKED);
|
|
Packit |
47f805 |
if (tmp_bResampleUsed)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem(parentWnd,IDC_COMBO_SAMPLEFREQ), TRUE);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem(parentWnd,IDC_COMBO_SAMPLEFREQ), FALSE);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
/* case IDC_COMBO_SETTINGS:
|
|
Packit |
47f805 |
// if (CBN_SELCHANGE == GET_WM_COMMAND_CMD(wParam, lParam))
|
|
Packit |
47f805 |
if (CBN_SELENDOK == GET_WM_COMMAND_CMD(wParam, lParam))
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
char string[MAX_PATH];
|
|
Packit |
47f805 |
int nIdx = SendMessage(HWND(lParam), CB_GETCURSEL, NULL, NULL);
|
|
Packit |
47f805 |
SendMessage(HWND(lParam), CB_GETLBTEXT , nIdx, (LPARAM) string);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// get the info corresponding to the new selected item
|
|
Packit |
47f805 |
SelectSavedParams(string);
|
|
Packit |
47f805 |
UpdateDlgFromValue(parentWnd);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
/* case IDC_BUTTON_CONFIG_SAVE:
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// save the data in the current config
|
|
Packit |
47f805 |
char string[MAX_PATH];
|
|
Packit |
47f805 |
::GetWindowText(::GetDlgItem( parentWnd, IDC_COMBO_SETTINGS), string, MAX_PATH);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
UpdateValueFromDlg(parentWnd);
|
|
Packit |
47f805 |
SaveValuesToStringKey(string);
|
|
Packit |
47f805 |
SelectSavedParams(string);
|
|
Packit |
47f805 |
UpdateConfigs(parentWnd);
|
|
Packit |
47f805 |
UpdateDlgFromValue(parentWnd);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
case IDC_BUTTON_CONFIG_RENAME:
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
char string[MAX_PATH];
|
|
Packit |
47f805 |
::GetWindowText(::GetDlgItem( parentWnd, IDC_COMBO_SETTINGS), string, MAX_PATH);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (RenameCurrentTo(string))
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// Update the names displayed
|
|
Packit |
47f805 |
UpdateConfigs(parentWnd);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
case IDC_BUTTON_CONFIG_DELETE:
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
char string[MAX_PATH];
|
|
Packit |
47f805 |
::GetWindowText(::GetDlgItem( parentWnd, IDC_COMBO_SETTINGS), string, MAX_PATH);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (DeleteConfig(string))
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// Update the names displayed
|
|
Packit |
47f805 |
UpdateConfigs(parentWnd);
|
|
Packit |
47f805 |
UpdateDlgFromValue(parentWnd);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
return FALSE;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
bool AEncodeProperties::RenameCurrentTo(const std::string & new_config_name)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
bool bResult = false;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// display all the names of the saved configs
|
|
Packit |
47f805 |
// get the values from the saved file if possible
|
|
Packit |
47f805 |
if (my_stored_data.LoadFile(my_store_location))
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
TiXmlNode* node;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
node = my_stored_data.FirstChild("lame_acm");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
TiXmlElement* CurrentNode = node->FirstChildElement("encodings");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (CurrentNode->Attribute("default") != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
std::string CurrentConfigName = *CurrentNode->Attribute("default");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// no rename possible for Current
|
|
Packit |
47f805 |
if (CurrentConfigName == "")
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
bResult = true;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
else if (CurrentConfigName != "Current")
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// find the config that correspond to CurrentConfig
|
|
Packit |
47f805 |
TiXmlElement* iterateElmt = CurrentNode->FirstChildElement("config");
|
|
Packit |
47f805 |
// int Idx = 0;
|
|
Packit |
47f805 |
while (iterateElmt != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
const std::string * tmpname = iterateElmt->Attribute("name");
|
|
Packit |
47f805 |
/**
|
|
Packit |
47f805 |
\todo support language names
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
if (tmpname->compare(CurrentConfigName) == 0)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
iterateElmt->SetAttribute("name",new_config_name);
|
|
Packit |
47f805 |
bResult = true;
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
// Idx++;
|
|
Packit |
47f805 |
iterateElmt = iterateElmt->NextSiblingElement("config");
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (bResult)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
CurrentNode->SetAttribute("default",new_config_name);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
my_stored_data.SaveFile(my_store_location);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
return bResult;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
bool AEncodeProperties::DeleteConfig(const std::string & config_name)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
bool bResult = false;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (config_name != "Current")
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// display all the names of the saved configs
|
|
Packit |
47f805 |
// get the values from the saved file if possible
|
|
Packit |
47f805 |
if (my_stored_data.LoadFile(my_store_location))
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
TiXmlNode* node;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
node = my_stored_data.FirstChild("lame_acm");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
TiXmlElement* CurrentNode = node->FirstChildElement("encodings");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
TiXmlElement* iterateElmt = CurrentNode->FirstChildElement("config");
|
|
Packit |
47f805 |
// int Idx = 0;
|
|
Packit |
47f805 |
while (iterateElmt != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
const std::string * tmpname = iterateElmt->Attribute("name");
|
|
Packit |
47f805 |
/**
|
|
Packit |
47f805 |
\todo support language names
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
if (tmpname->compare(config_name) == 0)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
CurrentNode->RemoveChild(iterateElmt);
|
|
Packit |
47f805 |
bResult = true;
|
|
Packit |
47f805 |
break;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
// Idx++;
|
|
Packit |
47f805 |
iterateElmt = iterateElmt->NextSiblingElement("config");
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (bResult)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
my_stored_data.SaveFile(my_store_location);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// select a new default config : "Current"
|
|
Packit |
47f805 |
SelectSavedParams("Current");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
return bResult;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
void AEncodeProperties::UpdateConfigs(const HWND HwndDlg)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// Add User configs
|
|
Packit |
47f805 |
// SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_SETTINGS), CB_RESETCONTENT , NULL, NULL);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// display all the names of the saved configs
|
|
Packit |
47f805 |
// get the values from the saved file if possible
|
|
Packit |
47f805 |
if (my_stored_data.LoadFile(my_store_location))
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
TiXmlNode* node;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
node = my_stored_data.FirstChild("lame_acm");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
TiXmlElement* CurrentNode = node->FirstChildElement("encodings");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
std::string CurrentConfig = "";
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (CurrentNode->Attribute("default") != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
CurrentConfig = *CurrentNode->Attribute("default");
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
TiXmlElement* iterateElmt;
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
my_debug.OutPut("are we here ?");
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
// find the config that correspond to CurrentConfig
|
|
Packit |
47f805 |
iterateElmt = CurrentNode->FirstChildElement("config");
|
|
Packit |
47f805 |
int Idx = 0;
|
|
Packit |
47f805 |
while (iterateElmt != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
const std::string * tmpname = iterateElmt->Attribute("name");
|
|
Packit |
47f805 |
/**
|
|
Packit |
47f805 |
\todo support language names
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
if (tmpname != NULL)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_SETTINGS), CB_ADDSTRING, NULL, (LPARAM) tmpname->c_str());
|
|
Packit |
47f805 |
if (tmpname->compare(CurrentConfig) == 0)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
// SendMessage(GetDlgItem( HwndDlg, IDC_COMBO_SETTINGS), CB_SETCURSEL, Idx, NULL);
|
|
Packit |
47f805 |
SelectSavedParams(*tmpname);
|
|
Packit |
47f805 |
UpdateDlgFromValue(HwndDlg);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
my_debug.OutPut("Idx = %d",Idx);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
Idx++;
|
|
Packit |
47f805 |
// only Current config supported now
|
|
Packit |
47f805 |
// iterateElmt = iterateElmt->NextSiblingElement("config");
|
|
Packit |
47f805 |
iterateElmt = NULL;
|
|
Packit |
47f805 |
my_debug.OutPut("iterateElmt = 0x%08X",iterateElmt);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
/*
|
|
Packit |
47f805 |
void AEncodeProperties::UpdateAbrSteps(unsigned int min, unsigned int max, unsigned int step) const
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
*/
|
|
Packit |
47f805 |
void AEncodeProperties::UpdateDlgFromSlides(HWND hwndDlg) const
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
UINT value_min, value_max, value_step, value;
|
|
Packit |
47f805 |
char tmp[4];
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
value_min = SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_MIN), TBM_GETPOS, NULL, NULL);
|
|
Packit |
47f805 |
value_max = SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_MAX), TBM_GETPOS, NULL, NULL);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (value_min>value_max)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_MIN), TBM_SETPOS, TRUE, value_max);
|
|
Packit |
47f805 |
UpdateDlgFromSlides(hwndDlg);
|
|
Packit |
47f805 |
return;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
if (value_max
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_MAX), TBM_SETPOS, TRUE, value_min);
|
|
Packit |
47f805 |
UpdateDlgFromSlides(hwndDlg);
|
|
Packit |
47f805 |
return;
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
wsprintf(tmp,"%3d",value_min);
|
|
Packit |
47f805 |
::SetWindowText(GetDlgItem( hwndDlg, IDC_STATIC_AVERAGE_MIN_VALUE), tmp);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_SAMPLE), TBM_SETRANGEMIN, TRUE, value_min);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
wsprintf(tmp,"%3d",value_max);
|
|
Packit |
47f805 |
::SetWindowText(GetDlgItem( hwndDlg, IDC_STATIC_AVERAGE_MAX_VALUE), tmp);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_SAMPLE), TBM_SETRANGEMAX, TRUE, value_max);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
value_step = SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_STEP), TBM_GETPOS, NULL, NULL);
|
|
Packit |
47f805 |
wsprintf(tmp,"%3d",value_step);
|
|
Packit |
47f805 |
::SetWindowText(GetDlgItem( hwndDlg, IDC_STATIC_AVERAGE_STEP_VALUE), tmp);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_SAMPLE), TBM_CLEARTICS, TRUE, 0);
|
|
Packit |
47f805 |
for(UINT i=value_max; i>=value_min;i-=value_step)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_SAMPLE), TBM_SETTIC, 0, i);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_SAMPLE), TBM_SETLINESIZE, 0, value_step);
|
|
Packit |
47f805 |
SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_SAMPLE), TBM_SETPAGESIZE, 0, value_step);
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
value = SendMessage(GetDlgItem( hwndDlg, IDC_SLIDER_AVERAGE_SAMPLE), TBM_GETPOS, NULL, NULL);
|
|
Packit |
47f805 |
wsprintf(tmp,"%3d",value);
|
|
Packit |
47f805 |
::SetWindowText(GetDlgItem( hwndDlg, IDC_STATIC_AVERAGE_SAMPLE_VALUE), tmp);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|
|
Packit |
47f805 |
void AEncodeProperties::EnableAbrOptions(HWND hDialog, bool enable)
|
|
Packit |
47f805 |
{
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_SLIDER_AVERAGE_MIN), enable);
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_SLIDER_AVERAGE_MAX), enable);
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_SLIDER_AVERAGE_STEP), enable);
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_SLIDER_AVERAGE_SAMPLE), enable);
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_MIN), enable);
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_MAX), enable);
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_STEP), enable);
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_SAMPLE), enable);
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_MIN_VALUE), enable);
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_MAX_VALUE), enable);
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_STEP_VALUE), enable);
|
|
Packit |
47f805 |
::EnableWindow(::GetDlgItem( hDialog, IDC_STATIC_AVERAGE_SAMPLE_VALUE), enable);
|
|
Packit |
47f805 |
}
|
|
Packit |
47f805 |
|