本文整理汇总了C++中AudioParameter::getInt方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioParameter::getInt方法的具体用法?C++ AudioParameter::getInt怎么用?C++ AudioParameter::getInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AudioParameter
的用法示例。
在下文中一共展示了AudioParameter::getInt方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: out_set_parameters
static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
{
int exiting = -1;
AudioParameter parms = AudioParameter(String8(kvpairs));
// FIXME this is using hard-coded strings but in the future, this functionality will be
// converted to use audio HAL extensions required to support tunneling
if ((parms.getInt(String8("exiting"), exiting) == NO_ERROR) && (exiting > 0)) {
const struct submix_stream_out *out =
reinterpret_cast<const struct submix_stream_out *>(stream);
pthread_mutex_lock(&out->dev->lock);
{ // using the sink
sp<MonoPipe> sink = out->dev->rsxSink.get();
if (sink == 0) {
pthread_mutex_unlock(&out->dev->lock);
return 0;
}
ALOGI("shutdown");
sink->shutdown(true);
} // done using the sink
pthread_mutex_unlock(&out->dev->lock);
}
return 0;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}
示例6: AudioParameter
status_t A2dpAudioInterface::A2dpAudioStreamOut::setParameters(const String8& keyValuePairs)
{
AudioParameter param = AudioParameter(keyValuePairs);
String8 value;
String8 key = String8("a2dp_sink_address");
status_t status = NO_ERROR;
int device;
LOGV("A2dpAudioStreamOut::setParameters() %s", keyValuePairs.string());
if (param.get(key, value) == NO_ERROR) {
if (value.length() != strlen("00:00:00:00:00:00")) {
status = BAD_VALUE;
} else {
setAddress(value.string());
}
param.remove(key);
}
key = String8("closing");
if (param.get(key, value) == NO_ERROR) {
mClosing = (value == "true");
param.remove(key);
}
key = AudioParameter::keyRouting;
if (param.getInt(key, device) == NO_ERROR) {
if (AudioSystem::isA2dpDevice((AudioSystem::audio_devices)device)) {
mDevice = device;
status = NO_ERROR;
} else {
status = BAD_VALUE;
}
param.remove(key);
}
if (param.size()) {
status = BAD_VALUE;
}
return status;
}
示例7: 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;
}
示例8: 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);
}
//.........这里部分代码省略.........
示例9: 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;
}