⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aencodeproperties.cpp

📁 音频编码
💻 CPP
📖 第 1 页 / 共 4 页
字号:
		// Copyright parameter		tmpElt = iterateElmt->FirstChildElement("Copyright");		if (tmpElt != NULL)		{			tmpname = tmpElt->Attribute("use");			if (tmpname != NULL)				bCopyright = (tmpname->compare("true") == 0);		}		// Copyright parameter		tmpElt = iterateElmt->FirstChildElement("CRC");		if (tmpElt != NULL)		{			tmpname = tmpElt->Attribute("use");			if (tmpname != NULL)				bCRC = (tmpname->compare("true") == 0);		}		// Copyright parameter		tmpElt = iterateElmt->FirstChildElement("Original");		if (tmpElt != NULL)		{			tmpname = tmpElt->Attribute("use");			if (tmpname != NULL)				bOriginal = (tmpname->compare("true") == 0);		}		// Copyright parameter		tmpElt = iterateElmt->FirstChildElement("Private");		if (tmpElt != NULL)		{			tmpname = tmpElt->Attribute("use");			if (tmpname != NULL)				bPrivate = (tmpname->compare("true") == 0);		}/*		// Copyright parameter		tmpElt = iterateElmt->FirstChildElement("Bit_reservoir");		if (tmpElt != NULL)		{			tmpname = tmpElt->Attribute("use");			if (tmpname != NULL)				bNoBitRes = !(tmpname->compare("true") == 0);		}		// bitrates		tmpElt = iterateElmt->FirstChildElement("bitrate");		tmpname = tmpElt->Attribute("min");		if (tmpname != NULL)		{			unsigned int uitmp = atoi(tmpname->c_str());			for (int i=0;i<sizeof(the_Bitrates)/sizeof(unsigned int);i++)			{				if (the_Bitrates[i] == uitmp)				{					nMinBitrateIndex = i;					break;				}			}		}		tmpname = tmpElt->Attribute("max");		if (tmpname != NULL)		{			unsigned int uitmp = atoi(tmpname->c_str());			for (int i=0;i<sizeof(the_Bitrates)/sizeof(unsigned int);i++)			{				if (the_Bitrates[i] == uitmp)				{					nMaxBitrateIndex = i;					break;				}			}		}*//*		// resampling parameters		tmpElt = iterateElmt->FirstChildElement("resampling");		if (tmpElt != NULL)		{			tmpname = tmpElt->Attribute("use");			if (tmpname != NULL)				bResample = (tmpname->compare("true") == 0);			unsigned int uitmp = atoi(tmpElt->Attribute("freq")->c_str());			for (int i=0;i<sizeof(the_SamplingFreqs)/sizeof(unsigned int);i++)			{				if (the_SamplingFreqs[i] == uitmp)				{					nSamplingFreqIndex = i;					break;				}			}		}		// VBR parameters		tmpElt = iterateElmt->FirstChildElement("VBR");		if (tmpElt != NULL)		{			tmpname = tmpElt->Attribute("use");			if (tmpname != NULL)			{				if (tmpname->compare("ABR") == 0)					mBRmode = BR_ABR;				else if (tmpname->compare("true") == 0)					mBRmode = BR_VBR;				else					mBRmode = BR_CBR;			}			tmpname = tmpElt->Attribute("header");			if (tmpname != NULL)				bXingFrame = (tmpname->compare("true") == 0);			tmpname = tmpElt->Attribute("quality");			if (tmpname != NULL)			{				VbrQuality = atoi(tmpname->c_str());			}			tmpname = tmpElt->Attribute("average");			if (tmpname != NULL)			{				AverageBitrate = atoi(tmpname->c_str());			}			else			{			}		}		// output parameters		tmpElt = iterateElmt->FirstChildElement("output");		if (tmpElt != NULL)		{			OutputDir = *tmpElt->Attribute("path");		}*///#ifdef OLD		// Channel mode parameter		tmpElt = iterateElmt->FirstChildElement("Channel");		if (tmpElt != NULL)		{			const std::string * tmpStr = tmpElt->Attribute("mode");			if (tmpStr != NULL)			{				for (int i=0;i<GetChannelLentgh();i++)				{					if (tmpStr->compare(GetChannelModeString(i)) == 0)					{						nChannelIndex = i;						break;					}				}			}/*			tmpname = tmpElt->Attribute("force");			if (tmpname != NULL)				bForceChannel = (tmpname->compare("true") == 0);*/		}//#endif // OLD		// Preset parameter/*		tmpElt = iterateElmt->FirstChildElement("Preset");		if (tmpElt != NULL)		{			const std::string * tmpStr = tmpElt->Attribute("type");			for (int i=0;i<GetPresetLentgh();i++)			{				if (tmpStr->compare(GetPresetModeString(i)) == 0)				{					nPresetIndex = i;					break;				}			}		}*/	}}/**	\todo save the parameters* /void AEncodeProperties::SaveParams(const HWND hParentWnd){	char string[MAX_PATH];/*	int nIdx = SendMessage(::GetDlgItem( hParentWnd ,IDC_COMBO_SETTINGS ), CB_GETCURSEL, NULL, NULL);	::SendMessage(::GetDlgItem( hParentWnd ,IDC_COMBO_SETTINGS ), CB_GETLBTEXT , nIdx, (LPARAM) string);* /}*/bool AEncodeProperties::operator !=(const AEncodeProperties & the_instance) const{/*	::OutputDebugString(bCopyright != the_instance.bCopyright?"1":"-");	::OutputDebugString(bCRC != the_instance.bCRC            ?"2":"-");	::OutputDebugString(bOriginal != the_instance.bOriginal  ?"3":"-");	::OutputDebugString(bPrivate != the_instance.bPrivate    ?"4":"-");	::OutputDebugString(bNoBitRes != the_instance.bNoBitRes  ?"5":"-");	::OutputDebugString(mBRmode != the_instance.mBRmode      ?"6":"-");	::OutputDebugString(bXingFrame != the_instance.bXingFrame?"7":"-");	::OutputDebugString(bForceChannel != the_instance.bForceChannel?"8":"-");	::OutputDebugString(bResample != the_instance.bResample  ?"9":"-");	::OutputDebugString(nChannelIndex != the_instance.nChannelIndex?"10":"-");	::OutputDebugString(nMinBitrateIndex != the_instance.nMinBitrateIndex?"11":"-");	::OutputDebugString(nMaxBitrateIndex != the_instance.nMaxBitrateIndex?"12":"-");	::OutputDebugString(nPresetIndex != the_instance.nPresetIndex?"13":"-");	::OutputDebugString(VbrQuality != the_instance.VbrQuality?"14":"-");	::OutputDebugString(AverageBitrate != the_instance.AverageBitrate?"15":"-");	::OutputDebugString(nSamplingFreqIndex != the_instance.nSamplingFreqIndex?"16":"-");	::OutputDebugString(OutputDir.compare(the_instance.OutputDir) != 0?"17":"-");	std::string tmp = "";	char tmpI[10];	_itoa(AverageBitrate,tmpI,10);	tmp += tmpI;	tmp += " != ";	_itoa(the_instance.AverageBitrate,tmpI,10);	tmp += tmpI;	::OutputDebugString(tmp.c_str());*/	return ((bCopyright != the_instance.bCopyright)		 || (bCRC != the_instance.bCRC)		 || (bOriginal != the_instance.bOriginal)		 || (bPrivate != the_instance.bPrivate)		 || (bSmartOutput != the_instance.bSmartOutput)		 || (SmartRatioMax != the_instance.SmartRatioMax)		 || (bAbrOutput != the_instance.bAbrOutput)		 || (AverageBitrate_Min != the_instance.AverageBitrate_Min)		 || (AverageBitrate_Max != the_instance.AverageBitrate_Max)		 || (AverageBitrate_Step != the_instance.AverageBitrate_Step)		 || (bNoBitRes != the_instance.bNoBitRes)		 || (mBRmode != the_instance.mBRmode)		 || (bXingFrame != the_instance.bXingFrame)		 || (bForceChannel != the_instance.bForceChannel)		 || (bResample != the_instance.bResample)		 || (nChannelIndex != the_instance.nChannelIndex)		 || (nMinBitrateIndex != the_instance.nMinBitrateIndex)		 || (nMaxBitrateIndex != the_instance.nMaxBitrateIndex)		 || (nPresetIndex != the_instance.nPresetIndex)		 || (VbrQuality != the_instance.VbrQuality)//		 || (AverageBitrate != the_instance.AverageBitrate)		 || (nSamplingFreqIndex != the_instance.nSamplingFreqIndex)//		 || (OutputDir.compare(the_instance.OutputDir) != 0)		);}void AEncodeProperties::SelectSavedParams(const std::string the_string){	// get the values from the saved file if possible	if (my_stored_data.LoadFile(my_store_location))	{		TiXmlNode* node;		node = my_stored_data.FirstChild("lame_acm");		TiXmlElement* CurrentNode = node->FirstChildElement("encodings");		if (CurrentNode != NULL)		{			CurrentNode->SetAttribute("default",the_string);			GetValuesFromKey(the_string, *CurrentNode);			my_stored_data.SaveFile(my_store_location);		}	}}inline void AEncodeProperties::SetAttributeBool(TiXmlElement * the_elt,const std::string & the_string, const bool the_value) const{	if (the_value == false)		the_elt->SetAttribute(the_string, "false");	else		the_elt->SetAttribute(the_string, "true");}void AEncodeProperties::SaveValuesToElement(TiXmlElement * the_element) const{	// get all the parameters saved in this Element	TiXmlElement * tmpElt;	// Bit Reservoir parameter/*	tmpElt = the_element->FirstChildElement("Bit_reservoir");	if (tmpElt == NULL)	{		tmpElt = new TiXmlElement("Bit_reservoir");		SetAttributeBool(tmpElt, "use", !bNoBitRes);		the_element->InsertEndChild(*tmpElt);	}	else	{		SetAttributeBool(tmpElt, "use", !bNoBitRes);	}*/	// Copyright parameter	tmpElt = the_element->FirstChildElement("Copyright");	if (tmpElt == NULL)	{		tmpElt = new TiXmlElement("Copyright");		SetAttributeBool( tmpElt, "use", bCopyright);		the_element->InsertEndChild(*tmpElt);	}	else	{		SetAttributeBool( tmpElt, "use", bCopyright);	}	// Smart Output parameter	tmpElt = the_element->FirstChildElement("Smart");	if (tmpElt == NULL)	{		tmpElt = new TiXmlElement("Smart");		SetAttributeBool( tmpElt, "use", bSmartOutput);		tmpElt->SetAttribute("ratio", SmartRatioMax);		the_element->InsertEndChild(*tmpElt);	}	else	{		SetAttributeBool( tmpElt, "use", bSmartOutput);		tmpElt->SetAttribute("ratio", SmartRatioMax);	}	// Smart Output parameter	tmpElt = the_element->FirstChildElement("ABR");	if (tmpElt == NULL)	{		tmpElt = new TiXmlElement("ABR");		SetAttributeBool( tmpElt, "use", bAbrOutput);		tmpElt->SetAttribute("min", AverageBitrate_Min);		tmpElt->SetAttribute("max", AverageBitrate_Max);		tmpElt->SetAttribute("step", AverageBitrate_Step);		the_element->InsertEndChild(*tmpElt);	}	else	{		SetAttributeBool( tmpElt, "use", bAbrOutput);		tmpElt->SetAttribute("min", AverageBitrate_Min);		tmpElt->SetAttribute("max", AverageBitrate_Max);		tmpElt->SetAttribute("step", AverageBitrate_Step);	}	// CRC parameter	tmpElt = the_element->FirstChildElement("CRC");	if (tmpElt == NULL)	{		tmpElt = new TiXmlElement("CRC");		SetAttributeBool( tmpElt, "use", bCRC);		the_element->InsertEndChild(*tmpElt);	}	else	{		SetAttributeBool( tmpElt, "use", bCRC);	}	// Original parameter	tmpElt = the_element->FirstChildElement("Original");	if (tmpElt == NULL)	{		tmpElt = new TiXmlElement("Original");		SetAttributeBool( tmpElt, "use", bOriginal);		the_element->InsertEndChild(*tmpElt);	}	else	{		SetAttributeBool( tmpElt, "use", bOriginal);	}	// Private parameter	tmpElt = the_element->FirstChildElement("Private");	if (tmpElt == NULL)	{		tmpElt = new TiXmlElement("Private");		SetAttributeBool( tmpElt, "use", bPrivate);		the_element->InsertEndChild(*tmpElt);	}	else	{		SetAttributeBool( tmpElt, "use", bPrivate);	}	// Channel Mode parameter	tmpElt = the_element->FirstChildElement("Channel");	if (tmpElt == NULL)	{		tmpElt = new TiXmlElement("Channel");		tmpElt->SetAttribute("mode", GetChannelModeString(nChannelIndex));//		SetAttributeBool( tmpElt, "force", bForceChannel);		the_element->InsertEndChild(*tmpElt);	}	else	{		tmpElt->SetAttribute("mode", GetChannelModeString(nChannelIndex));//		SetAttributeBool( tmpElt, "force", bForceChannel);	}/*	// Preset parameter	tmpElt = the_element->FirstChildElement("Preset");	if (tmpElt == NULL)	{		tmpElt = new TiXmlElement("Preset");		tmpElt->SetAttribute("type", GetPresetModeString(nPresetIndex));		the_element->InsertEndChild(*tmpElt);	}	else	{		tmpElt->SetAttribute("type", GetPresetModeString(nPresetIndex));	}	// Bitrate parameter	tmpElt = the_element->FirstChildElement("bitrate");	if (tmpElt == NULL)	{		tmpElt = new TiXmlElement("bitrate");		tmpElt->SetAttribute("min", the_Bitrates[nMinBitrateIndex]);		tmpElt->SetAttribute("max", the_Bitrates[nMaxBitrateIndex]);		the_element->InsertEndChild(*tmpElt);	}	else	{		tmpElt->SetAttribute("min", the_Bitrates[nMinBitrateIndex]);		tmpElt->SetAttribute("max", the_Bitrates[nMaxBitrateIndex]);	}	// Output Directory parameter	tmpElt = the_element->FirstChildElement("output");	if (tmpElt == NULL)	{		tmpElt = new TiXmlElement("output");		tmpElt->SetAttribute("path", OutputDir);		the_element->InsertEndChild(*tmpElt);	}	else	{		tmpElt->SetAttribute("path", OutputDir);	}*//*	// Resampling parameter	tmpElt = the_element->FirstChildElement("resampling");	if (tmpElt == NULL)	{		tmpElt = new TiXmlElement("resampling");		SetAttributeBool( tmpElt, "use", bResample);		tmpElt->SetAttribute("freq", the_SamplingFreqs[nSamplingFreqIndex]);		the_element->InsertEndChild(*tmpElt);	}	else	{		SetAttributeBool( tmpElt, "use", bResample);		tmpElt->SetAttribute("freq", the_SamplingFreqs[nSamplingFreqIndex]);	}	// VBR parameter	tmpElt = the_element->FirstChildElement("VBR");	if (tmpElt == NULL)	{		tmpElt = new TiXmlElement("VBR");				if (mBRmode == BR_ABR)			tmpElt->SetAttribute("use", "ABR");		else			SetAttributeBool( tmpElt, "use", (mBRmode != BR_CBR));		SetAttributeBool( tmpElt, "header", bXingFrame);		tmpElt->SetAttribute("quality", VbrQuality);		tmpElt->SetAttribute("average", AverageBitrate);		the_element->InsertEndChild(*tmpElt);	}	else	{		if (mBRmode == BR_ABR)			tmpElt->SetAttribute("use", "ABR");		else			SetAttributeBool( tmpElt, "use", (mBRmode != BR_CBR));		SetAttributeBool( tmpElt, "header", bXingFrame);		tmpElt->SetAttribute("quality", VbrQuality);		tmpElt->SetAttribute("average", AverageBitrate);	}*/}bool AEncodeProperties::HandleDialogCommand(const HWND parentWnd, const WPARAM wParam, const LPARAM lParam){	UINT command;	command = GET_WM_COMMAND_ID(wParam, lParam);	switch (command)	{	case IDOK :	{		bool bShouldEnd = true;		// save parameters		char string[MAX_PATH];//		::GetWindowText(::GetDlgItem( parentWnd, IDC_COMBO_SETTINGS), string, MAX_PATH);		wsprintf(string,"Current"); // only the Current config is supported at the moment				my_debug.OutPut("my_hModule = 0x%08X",my_hModule);/*		AEncodeProperties tmpDlgProps(my_hModule);		AEncodeProperties tmpSavedProps(my_hModule);//#ifdef OLD		tmpDlgProps.UpdateValueFromDlg(parentWnd);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -