00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #if !defined(_AENCODEPROPERTIES_H__INCLUDED_)
00035 #define _AENCODEPROPERTIES_H__INCLUDED_
00036
00037 #if _MSC_VER > 1000
00038 #pragma once
00039 #endif // _MSC_VER > 1000
00040
00041 #include <windows.h>
00042 #include <string>
00043
00044 #include "BladeMP3EncDLL.h"
00045 #include "tinyxml/tinyxml.h"
00046
00047
00052 class AEncodeProperties
00053 {
00054 public:
00058 AEncodeProperties();
00059
00063 virtual ~AEncodeProperties() {}
00064
00069 enum BRMode { BR_CBR, BR_VBR, BR_ABR };
00070
00074 bool HandleDialogCommand(const HWND parentWnd, const WPARAM wParam, const LPARAM lParam);
00078 bool operator != (const AEncodeProperties & the_instance) const;
00079
00083 inline const bool GetCopyrightMode() const { return bCopyright; }
00087 inline const bool GetCRCMode() const { return bCRC; }
00091 inline const bool GetOriginalMode() const { return bOriginal; }
00095 inline const bool GetPrivateMode() const { return bPrivate; }
00096
00100 inline const bool GetNoBiResMode() const { return bNoBitRes; }
00101
00105 inline const bool GetForceChannelMode() const { return bForceChannel; }
00106
00110 inline const BRMode GetVBRUseMode() const { return mBRmode; }
00115 inline const bool GetXingFrameMode() const { return bXingFrame; }
00116
00120 inline const bool GetResampleMode() const { return bResample; }
00121
00125 inline void SetCopyrightMode(const bool bMode) { bCopyright = bMode; }
00129 inline void SetCRCMode(const bool bMode) { bCRC = bMode; }
00133 inline void SetOriginalMode(const bool bMode) { bOriginal = bMode; }
00137 inline void SetPrivateMode(const bool bMode) { bPrivate = bMode; }
00138
00142 inline void SetNoBiResMode(const bool bMode) { bNoBitRes = bMode; }
00143
00147 inline void SetForceChannelMode(const bool bMode) { bForceChannel = bMode; }
00148
00152 inline void SetVBRUseMode(const BRMode mode) { mBRmode = mode; }
00153
00158 inline void SetXingFrameMode(const bool bMode) { bXingFrame = bMode; }
00159
00164 const unsigned int GetBitrateValue() const;
00165
00174 const int GetBitrateValue(DWORD & bitrate, const DWORD MPEG_Version) const;
00182 const int GetBitrateValueMPEG1(DWORD & bitrate) const;
00190 const int GetBitrateValueMPEG2(DWORD & bitrate) const;
00191
00200 inline const int GetBitrateString(char * string, int string_size) const {return GetBitrateString(string,string_size,nMinBitrateIndex); }
00201
00211 const int GetBitrateString(char * string, int string_size, int a_bitrateID) const;
00212
00216 inline const int GetBitrateLentgh() const { return sizeof(the_Bitrates) / sizeof(unsigned int); }
00220 inline const unsigned int GetResampleFreq() const { return the_SamplingFreqs[nSamplingFreqIndex]; }
00221
00232 VBRMETHOD GetVBRValue(DWORD & MaxBitrate, int & Quality, DWORD & AbrBitrate, BOOL & VBRHeader, const DWORD MPEG_Version) const;
00233
00237 const char * GetDllLocation() const { return DllLocation.c_str(); }
00241 void SetDllLocation( const char * the_string ) { DllLocation = the_string; }
00242
00246 const char * GetOutputDirectory() const { return OutputDir.c_str(); }
00250 void SetOutputDirectory( const char * the_string ) { OutputDir = the_string; }
00251
00255 const unsigned int GetChannelModeValue() const;
00259 inline const char * GetChannelModeString() const {return GetChannelModeString(nChannelIndex); }
00265 const char * GetChannelModeString(const int a_channelID) const;
00269 inline const int GetChannelLentgh() const { return sizeof(the_ChannelModes) / sizeof(unsigned int); }
00270
00274 const LAME_QUALTIY_PRESET GetPresetModeValue() const;
00280 const char * GetPresetModeString(const int a_presetID) const;
00284 inline const int GetPresetLentgh() const { return sizeof(the_Presets) / sizeof(LAME_QUALTIY_PRESET); }
00285
00289 bool Config(const HINSTANCE hInstance, const HWND HwndParent);
00290
00294 bool InitConfigDlg(HWND hDialog);
00295
00299 bool UpdateValueFromDlg(HWND hDialog);
00303 bool UpdateDlgFromValue(HWND hDialog);
00304
00308 static void DisplayVbrOptions(const HWND hDialog, const BRMode the_mode);
00309
00313 void SaveParams(const HWND hDialog);
00314
00318 void ParamsSave(void);
00322 void ParamsRestore(void);
00323
00327 void SelectSavedParams(const std::string config_name);
00331 void SaveValuesToStringKey(const std::string & config_name);
00335 bool RenameCurrentTo(const std::string & new_config_name);
00339 bool DeleteConfig(const std::string & config_name);
00340
00341 private:
00342
00343 bool bCopyright;
00344 bool bCRC;
00345 bool bOriginal;
00346 bool bPrivate;
00347 bool bNoBitRes;
00348 BRMode mBRmode;
00349 bool bXingFrame;
00350 bool bForceChannel;
00351 bool bResample;
00352
00353 int VbrQuality;
00354 int AverageBitrate;
00355
00356 static const unsigned int the_ChannelModes[4];
00357 int nChannelIndex;
00358
00359 static const unsigned int the_Bitrates[18];
00360 static const unsigned int the_MPEG1_Bitrates[14];
00361 static const unsigned int the_MPEG2_Bitrates[14];
00362 int nMinBitrateIndex;
00363 int nMaxBitrateIndex;
00364
00365 static const unsigned int the_SamplingFreqs[9];
00366 int nSamplingFreqIndex;
00367
00368 static const LAME_QUALTIY_PRESET the_Presets[17];
00369 int nPresetIndex;
00370
00371
00372 std::string DllLocation;
00373
00374 std::string OutputDir;
00375
00376
00377 TiXmlDocument my_stored_data;
00378 std::string my_store_location;
00379 std::string my_current_config;
00380
00381 HINSTANCE hDllInstance;
00382
00383 void SaveValuesToElement(TiXmlElement * the_element) const;
00384 inline void SetAttributeBool(TiXmlElement * the_elt,const std::string & the_string, const bool the_value) const;
00385 void UpdateConfigs(const HWND HwndDlg);
00386
00393 void GetValuesFromKey(const std::string & config_name, const TiXmlNode & parentNode);
00394 };
00395
00396 #endif // !defined(_AENCODEPROPERTIES_H__INCLUDED_)