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 #if !defined(_AENCODEPROPERTIES_H__INCLUDED_)
00026 #define _AENCODEPROPERTIES_H__INCLUDED_
00027
00028 #if _MSC_VER > 1000
00029 #pragma once
00030 #endif // _MSC_VER > 1000
00031
00032 #include <windows.h>
00033 #include <string>
00034
00035 #include "BladeMP3EncDLL.h"
00036 #include "tinyxml/tinyxml.h"
00037
00038
00043 class AEncodeProperties
00044 {
00045 public:
00049 AEncodeProperties();
00050
00054 virtual ~AEncodeProperties() {}
00055
00059 bool HandleDialogCommand(const HWND parentWnd, const WPARAM wParam, const LPARAM lParam);
00063 bool operator != (const AEncodeProperties & the_instance) const;
00064
00068 inline const bool GetCopyrightMode() const { return bCopyright; }
00072 inline const bool GetCRCMode() const { return bCRC; }
00076 inline const bool GetOriginalMode() const { return bOriginal; }
00080 inline const bool GetPrivateMode() const { return bPrivate; }
00081
00085 inline const bool GetNoBiResMode() const { return bNoBitRes; }
00086
00090 inline const bool GetForceChannelMode() const { return bForceChannel; }
00091
00095 inline const bool GetVBRUseMode() const { return bVBRused; }
00100 inline const bool GetXingFrameMode() const { return bXingFrame; }
00101
00105 inline const bool GetResampleMode() const { return bResample; }
00106
00110 inline void SetCopyrightMode(const bool bMode) { bCopyright = bMode; }
00114 inline void SetCRCMode(const bool bMode) { bCRC = bMode; }
00118 inline void SetOriginalMode(const bool bMode) { bOriginal = bMode; }
00122 inline void SetPrivateMode(const bool bMode) { bPrivate = bMode; }
00123
00127 inline void SetNoBiResMode(const bool bMode) { bNoBitRes = bMode; }
00128
00132 inline void SetForceChannelMode(const bool bMode) { bForceChannel = bMode; }
00133
00137 inline void SetVBRUseMode(const bool bMode) { bVBRused = bMode; }
00142 inline void SetXingFrameMode(const bool bMode) { bXingFrame = bMode; }
00143
00148 const unsigned int GetBitrateValue() const;
00149
00158 const int GetBitrateValue(DWORD & bitrate, const DWORD MPEG_Version) const;
00166 const int GetBitrateValueMPEG1(DWORD & bitrate) const;
00174 const int GetBitrateValueMPEG2(DWORD & bitrate) const;
00175
00184 inline const int GetBitrateString(char * string, int string_size) const {return GetBitrateString(string,string_size,nMinBitrateIndex); }
00185
00195 const int GetBitrateString(char * string, int string_size, int a_bitrateID) const;
00196
00200 inline const int GetBitrateLentgh() const { return sizeof(the_Bitrates) / sizeof(unsigned int); }
00204 inline const unsigned int GetResampleFreq() const { return the_SamplingFreqs[nSamplingFreqIndex]; }
00205
00216 bool GetVBRValue(DWORD & MaxBitrate, int & Quality, BOOL & VBRHeader, const DWORD MPEG_Version) const;
00217
00221 const char * GetDllLocation() const { return DllLocation.c_str(); }
00225 void SetDllLocation( const char * the_string ) { DllLocation = the_string; }
00226
00230 const char * GetOutputDirectory() const { return OutputDir.c_str(); }
00234 void SetOutputDirectory( const char * the_string ) { OutputDir = the_string; }
00235
00239 const unsigned int GetChannelModeValue() const;
00243 inline const char * GetChannelModeString() const {return GetChannelModeString(nChannelIndex); }
00249 const char * GetChannelModeString(const int a_channelID) const;
00253 inline const int GetChannelLentgh() const { return sizeof(the_ChannelModes) / sizeof(unsigned int); }
00254
00258 const LAME_QUALTIY_PRESET GetPresetModeValue() const;
00264 const char * GetPresetModeString(const int a_presetID) const;
00268 inline const int GetPresetLentgh() const { return sizeof(the_Presets) / sizeof(LAME_QUALTIY_PRESET); }
00269
00273 bool Config(const HINSTANCE hInstance, const HWND HwndParent);
00274
00278 bool InitConfigDlg(HWND hDialog);
00279
00283 bool UpdateValueFromDlg(HWND hDialog);
00287 bool UpdateDlgFromValue(HWND hDialog);
00288
00292 static void DisplayVbrOptions(HWND hDialog, bool bValue);
00293
00297 void SaveParams(const HWND hDialog);
00298
00302 void ParamsSave(void);
00306 void ParamsRestore(void);
00307
00311 void SelectSavedParams(const std::string config_name);
00315 void SaveValuesToStringKey(const std::string & config_name);
00319 bool RenameCurrentTo(const std::string & new_config_name);
00323 bool DeleteConfig(const std::string & config_name);
00324
00325 private:
00326
00327 bool bCopyright;
00328 bool bCRC;
00329 bool bOriginal;
00330 bool bPrivate;
00331 bool bNoBitRes;
00332 bool bVBRused;
00333 bool bXingFrame;
00334 bool bForceChannel;
00335 bool bResample;
00336
00337 int VbrQuality;
00338
00339 static const unsigned int the_ChannelModes[4];
00340 int nChannelIndex;
00341
00342 static const unsigned int the_Bitrates[18];
00343 static const unsigned int the_MPEG1_Bitrates[14];
00344 static const unsigned int the_MPEG2_Bitrates[14];
00345 int nMinBitrateIndex;
00346 int nMaxBitrateIndex;
00347
00348 static const unsigned int the_SamplingFreqs[9];
00349 int nSamplingFreqIndex;
00350
00351 static const LAME_QUALTIY_PRESET the_Presets[15];
00352 int nPresetIndex;
00353
00354
00355 std::string DllLocation;
00356
00357 std::string OutputDir;
00358
00359
00360 TiXmlDocument my_stored_data;
00361 std::string my_store_location;
00362 std::string my_current_config;
00363
00364 HINSTANCE hDllInstance;
00365
00366 void SaveValuesToElement(TiXmlElement * the_element) const;
00367 inline void SetAttributeBool(TiXmlElement * the_elt,const std::string & the_string, const bool the_value) const;
00368 void UpdateConfigs(const HWND HwndDlg);
00369
00376 void GetValuesFromKey(const std::string & config_name, const TiXmlNode & parentNode);
00377 };
00378
00379 #endif // !defined(_AENCODEPROPERTIES_H__INCLUDED_)