本文整理汇总了C++中AudioParameter::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioParameter::remove方法的具体用法?C++ AudioParameter::remove怎么用?C++ AudioParameter::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AudioParameter
的用法示例。
在下文中一共展示了AudioParameter::remove方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AudioParameter
String8 A2dpAudioInterface::getParameters(const String8& keys)
{
AudioParameter param = AudioParameter(keys);
AudioParameter a2dpParam = AudioParameter();
String8 value;
String8 key;
key = "bluetooth_enabled";
if (param.get(key, value) == NO_ERROR) {
value = mBluetoothEnabled ? "true" : "false";
a2dpParam.add(key, value);
param.remove(key);
}
key = "A2dpSuspended";
if (param.get(key, value) == NO_ERROR) {
value = mSuspended ? "true" : "false";
a2dpParam.add(key, value);
param.remove(key);
}
String8 keyValuePairs = a2dpParam.toString();
if (param.size()) {
if (keyValuePairs != "") {
keyValuePairs += ";";
}
keyValuePairs += mHardwareInterface->getParameters(param.toString());
}
LOGV("getParameters() %s", keyValuePairs.string());
return keyValuePairs;
}
示例2: getParameters
String8 AudioALSAStreamOut::getParameters(const String8 &keys)
{
#ifdef MTK_DYNAMIC_CHANGE_HAL_BUFFER_SIZE
ALOGD("%s, keyvalue %s", __FUNCTION__, keys.string());
String8 value;
String8 keyLowLatency = String8("LowLatency");
AudioParameter param = AudioParameter(keys);
AudioParameter returnParam = AudioParameter();
if (param.get(keyLowLatency, value) == NO_ERROR)
{
param.remove(keyLowLatency);
char buf[10];
sprintf(buf, "%d", LOW_LATENCY_HAL_BUFFER_SIZE);
returnParam.add(keyLowLatency, String8(buf));
}
const String8 keyValuePairs = returnParam.toString();
ALOGD("-%s(), return \"%s\"", __FUNCTION__, keyValuePairs.string());
return keyValuePairs;
#else
ALOGD("%s()", __FUNCTION__);
AudioParameter param = AudioParameter(keys);
return param.toString();
#endif
}
示例3: setParameters
status_t AudioStreamInWrapper::setParameters(const String8& keyValuePairs)
{
LOGV("AudioStreamInWrapper::setParameters(\"%s\")", keyValuePairs.string());
AudioParameter param = AudioParameter(keyValuePairs);
String8 key;
status_t status = NO_ERROR;
int device;
// reading routing parameter
key = String8(AudioParameter::keyRouting);
if (param.getInt(key, device) == NO_ERROR) {
LOGV("set input routing %x", device);
if (device & (device - 1)) {
status = BAD_VALUE;
} else {
mDevices = device;
status = mHardware->doRouting();
}
param.remove(key);
}
if (param.size()) {
status = BAD_VALUE;
}
return status;
}
示例4: setParameters
status_t AudioStreamInMotorola::setParameters(const String8& keyValuePairs)
{
AudioParameter param = AudioParameter(keyValuePairs);
status_t status = NO_ERROR;
int device;
String8 key;
int source;
LOGD("setParameters(%s) called", keyValuePairs.string());
// reading routing parameter
key = String8(AudioParameter::keyRouting);
if (param.getInt(key, device) == NO_ERROR) {
LOGD("setParameters(): set input routing %x", device);
if (device & (device - 1)) {
LOGE("setParameters(): device value is invalid for routing");
status = BAD_VALUE;
} else {
mDevices = device;
status = mHardware->doRouting();
}
param.remove(key);
}
if (param.size()) {
LOGE("setParameters(): parameter size is invalid");
status = BAD_VALUE;
}
return status;
}
示例5: setParameter
status_t AudioResourceManager::setParameter(const String8& keyValuePairs) {
String8 key;
String8 value;
status_t status = NO_ERROR;
AudioParameter param = AudioParameter(keyValuePairs);
Mutex::Autolock autolock(mLock);
ALOGD(" setParameter %s:", keyValuePairs.string());
for(uint8_t i=0; i < ARRAY_SIZE(sUseCaseNameToEnumValue); i++) {
key = sUseCaseNameToEnumValue[i].name;
if (param.get(key, value) == NO_ERROR) {
audio_use_case_value_t useCase =
(audio_use_case_value_t) extractMetaData(
sUseCaseNameToEnumValue,
ARRAY_SIZE(sUseCaseNameToEnumValue),
key);
ALOGD("key = %s, value = %s, useCase = %d",
key.string(), value.string(), (int32_t)useCase);
if(value == "true") {
// check if there is a conflicting usecase
// if yes, return error without updating the refCount
// if no increment the refCount
ALOGV("handleConcurrency");
status = handleConcurrency(useCase, true);
}
else if(value == "false") {
// Decrement the refCount
ALOGV("updateUsecaseRefCount");
status = updateUsecaseRefCount(useCase, false);
}
else {
ALOGE(" Wrong value set for use case = %s", key.string());
status = BAD_VALUE;
}
break;
} else {
status = NAME_NOT_FOUND;
ALOGV("Not a concurrency setParameter - Not an error");
}
}
param.remove(key);
return status;
}
示例6: setParameters
status_t AudioAACStreamIn::setParameters(const String8& keyValuePairs)
{
AudioParameter param = AudioParameter(keyValuePairs);
String8 key = String8(AudioParameter::keyRouting);
status_t status = NO_ERROR;
int device;
ALOGV("setParameters() %s", keyValuePairs.string());
if (param.getInt(key, device) == NO_ERROR) {
mDevice = device;
param.remove(key);
}
if (param.size()) {
status = BAD_VALUE;
}
return status;
}
示例7: AudioParameter
status_t AudioHardware::AudioStreamOutMSM72xx::setParameters(const String8& keyValuePairs)
{
AudioParameter param = AudioParameter(keyValuePairs);
String8 key = String8(AudioParameter::keyRouting);
status_t status = NO_ERROR;
int device;
LOGV("AudioStreamOutMSM72xx::setParameters() %s", keyValuePairs.string());
if (param.getInt(key, device) == NO_ERROR) {
mDevices = device;
LOGV("set output routing %x", mDevices);
status = mHardware->doRouting();
param.remove(key);
}
if (param.size()) {
status = BAD_VALUE;
}
return status;
}
示例8: setParameters
status_t AudioHardwareOutput::setParameters(const char* kvpairs) {
AudioParameter param = AudioParameter(String8(kvpairs));
status_t status = NO_ERROR;
float floatVal;
int intVal;
Settings initial, s;
{
// Record the initial state of the settings from inside the lock. Then
// leave the lock in order to parse the changes to be made.
Mutex::Autolock _l(mSettingsLock);
initial = s = mSettings;
}
/***************************************************************
* HDMI Audio Options *
***************************************************************/
if (param.getInt(kHDMIAllowedParamKey, intVal) == NO_ERROR) {
s.hdmi.allowed = (intVal != 0);
param.remove(kHDMIAllowedParamKey);
}
if ((param.getFloat(kHDMIDelayCompParamKey, floatVal) == NO_ERROR) &&
(floatVal >= 0.0) &&
(floatVal <= AudioOutput::kMaxDelayCompensationMSec)) {
uint32_t delay_comp = static_cast<uint32_t>(floatVal * 1000.0);
s.hdmi.delayCompUsec = delay_comp;
param.remove(kHDMIDelayCompParamKey);
}
if (param.getInt(kFixedHDMIOutputParamKey, intVal) == NO_ERROR) {
s.hdmi.isFixed = (intVal != 0);
param.remove(kFixedHDMIOutputParamKey);
}
if ((param.getFloat(kFixedHDMIOutputLevelParamKey, floatVal) == NO_ERROR)
&& (floatVal <= 0.0)) {
s.hdmi.fixedLvl = floatVal;
param.remove(kFixedHDMIOutputLevelParamKey);
}
/***************************************************************
* Other Options *
***************************************************************/
if ((param.getFloat(kVideoDelayCompParamKey, floatVal) == NO_ERROR) &&
(floatVal >= 0.0) &&
(floatVal <= AudioOutput::kMaxDelayCompensationMSec)) {
s.videoDelayCompUsec = static_cast<uint32_t>(floatVal * 1000.0);
param.remove(kVideoDelayCompParamKey);
}
if (param.size())
status = BAD_VALUE;
// If there was a change made to settings, go ahead and apply it now.
bool allowedOutputsChanged = false;
if (memcmp(&initial, &s, sizeof(initial))) {
Mutex::Autolock _l1(mOutputLock);
Mutex::Autolock _l2(mSettingsLock);
if (memcmp(&initial.hdmi, &s.hdmi, sizeof(initial.hdmi)))
allowedOutputsChanged = allowedOutputsChanged ||
applyOutputSettings_l(initial.hdmi, s.hdmi, mSettings.hdmi,
HDMIAudioOutput::classDevMask());
if (initial.videoDelayCompUsec != s.videoDelayCompUsec)
mSettings.videoDelayCompUsec = s.videoDelayCompUsec;
uint32_t tmp = 0;
if (mSettings.hdmi.allowed && (tmp < mSettings.hdmi.delayCompUsec))
tmp = mSettings.hdmi.delayCompUsec;
if (mMaxDelayCompUsec != tmp)
mMaxDelayCompUsec = tmp;
}
if (allowedOutputsChanged) {
Mutex::Autolock _l(mStreamLock);
updateTgtDevices_l();
}
return status;
}
示例9: setParameters
status_t AudioALSAStreamOut::setParameters(const String8 &keyValuePairs)
{
ALOGD("+%s(): %s", __FUNCTION__, keyValuePairs.string());
AudioParameter param = AudioParameter(keyValuePairs);
/// keys
const String8 keyRouting = String8(AudioParameter::keyRouting);
const String8 keySampleRate = String8(AudioParameter::keySamplingRate);
const String8 keyDynamicSampleRate = String8("DynamicSampleRate");
const String8 keyLowLatencyMode = String8("LowLatencyMode");
const String8 keyRoutingToNone = String8(AudioParameter::keyRoutingToNone);
const String8 keyFmDirectControl = String8(AudioParameter::keyFmDirectControl);
audio_devices_t mydevice = 0;
/// parse key value pairs
status_t status = NO_ERROR;
int value = 0;
/// routing
if (param.getInt(keyRouting, value) == NO_ERROR)
{
param.remove(keyRouting);
mydevice = static_cast<audio_devices_t>(value);
ALOGD("%s(), mydevice 0x%x", __FUNCTION__, mydevice);
AudioAutoTimeoutLock _l(mLock);
if (mStreamOutType == STREAM_OUT_PRIMARY)
{
status = mStreamManager->routingOutputDevice(mStreamAttributeSource.output_devices, static_cast<audio_devices_t>(value));
}
else if ((mStreamOutType == STREAM_OUT_HDMI_STEREO) || (mStreamOutType == STREAM_OUT_HDMI_MULTI_CHANNEL))
{
ALOGD("%s(), HDMI \"%s\"", __FUNCTION__, param.toString().string());
status = mStreamManager->routingOutputDevice(mStreamAttributeSource.output_devices, static_cast<audio_devices_t>(value));
}
else
{
ALOGW("%s(), NUM_STREAM_OUT_TYPE \"%s\"", __FUNCTION__, param.toString().string());
status = INVALID_OPERATION;
}
}
if (param.getInt(keyFmDirectControl, value) == NO_ERROR)
{
param.remove(keyFmDirectControl);
AudioAutoTimeoutLock _l(mLock);
AudioALSAFMController::getInstance()->setUseFmDirectConnectionMode(value?true:false);
}
// routing none, for no stream but has device change. e.g. vow path change
if (param.getInt(keyRoutingToNone, value) == NO_ERROR)
{
param.remove(keyRoutingToNone);
AudioAutoTimeoutLock _l(mLock);
status = mStreamManager->DeviceNoneUpdate();
}
// samplerate
if (param.getInt(keySampleRate, value) == NO_ERROR)
{
param.remove(keySampleRate);
AudioAutoTimeoutLock _l(mLock);
if (mPlaybackHandler == NULL)
{
UpdateSampleRate(value);
}
else
{
status = INVALID_OPERATION;
}
}
/// sample rate
if (param.getInt(keyDynamicSampleRate, value) == NO_ERROR)
{
param.remove(keyRouting);
AudioAutoTimeoutLock _l(mLock);
if (mStreamOutType == STREAM_OUT_PRIMARY)
{
status = NO_ERROR; //AudioALSASampleRateController::getInstance()->setPrimaryStreamOutSampleRate(value); // TODO(Harvey): enable it later
}
else
{
ALOGW("%s(), HDMI bypass \"%s\"", __FUNCTION__, param.toString().string());
status = INVALID_OPERATION;
}
}
#ifdef MTK_DYNAMIC_CHANGE_HAL_BUFFER_SIZE
// set low latency
if (param.getInt(keyLowLatencyMode, value) == NO_ERROR)
{
param.remove(keyLowLatencyMode);
setLowLatencyMode(value);
}
//.........这里部分代码省略.........
示例10: setParameters
status_t AudioALSAStreamIn::setParameters(const String8 &keyValuePairs)
{
ALOGD("+%s(): %s", __FUNCTION__, keyValuePairs.string());
AudioParameter param = AudioParameter(keyValuePairs);
/// keys
const String8 keyInputSource = String8(AudioParameter::keyInputSource);
const String8 keyRouting = String8(AudioParameter::keyRouting);
/// parse key value pairs
status_t status = NO_ERROR;
int value = 0;
/// intput source
if (param.getInt(keyInputSource, value) == NO_ERROR)
{
param.remove(keyInputSource);
// TODO(Harvey): input source
AudioAutoTimeoutLock _l(mLock);
ALOGD("%s() InputSource = %d", __FUNCTION__, value);
mStreamAttributeTarget.input_source = static_cast<audio_source_t>(value);
if (mStreamAttributeTarget.BesRecord_Info.besrecord_ForceMagiASREnable == true)
{
ALOGD("%s() force input source to AUDIO_SOURCE_CUSTOMIZATION1", __FUNCTION__);
mStreamAttributeTarget.input_source = AUDIO_SOURCE_CUSTOMIZATION1;
}
if (mStreamAttributeTarget.BesRecord_Info.besrecord_ForceAECRecEnable == true)
{
ALOGD("%s() force input source to AUDIO_SOURCE_CUSTOMIZATION2", __FUNCTION__);
mStreamAttributeTarget.input_source = AUDIO_SOURCE_CUSTOMIZATION2;
}
}
/// routing
if (param.getInt(keyRouting, value) == NO_ERROR)
{
param.remove(keyRouting);
AudioAutoTimeoutLock _l(mLock);
audio_devices_t inputdevice = static_cast<audio_devices_t>(value);
//only need to modify the device while VoIP
if (mStreamAttributeTarget.BesRecord_Info.besrecord_voip_enable == true)
{
if (mStreamAttributeTarget.output_devices == AUDIO_DEVICE_OUT_SPEAKER)
{
if (inputdevice == AUDIO_DEVICE_IN_BUILTIN_MIC)
{
if (USE_REFMIC_IN_LOUDSPK == 1)
{
inputdevice = AUDIO_DEVICE_IN_BACK_MIC;
ALOGD("%s() force change to back mic", __FUNCTION__);
}
}
}
}
status = mStreamManager->routingInputDevice(mStreamAttributeTarget.input_device, inputdevice);
}
if (param.size())
{
ALOGW("%s(), still have param.size() = %d, remain param = \"%s\"",
__FUNCTION__, param.size(), param.toString().string());
status = BAD_VALUE;
}
ALOGD("-%s(): %s ", __FUNCTION__, keyValuePairs.string());
return status;
}