audio: add implementation for TV related API
1. AudioDescriptionMixLevel getter/setter. 2. DualMonoMode getter/setter. 3. PlaybackRate getter/setter. Test: TIS player with instrumented HAL Test: atest AudioTrackTest#testTunerConfiguration Test: atest AudioTrackTest#testDualMonoMode Test: atest AudioTrackTest#testAudioDescriptionMixLevel Test: atest AudioManagerTest#testGetAdditionalOutputDeviceDelay Bug: 173482792 Change-Id: I7e4f14387b45a5387ba2c4e8797edf18f373b936
This commit is contained in:
parent
27758747d1
commit
a0177a0566
1 changed files with 44 additions and 11 deletions
|
@ -658,32 +658,65 @@ Return<Result> StreamOut::selectPresentation(int32_t /*presentationId*/, int32_t
|
|||
|
||||
#if MAJOR_VERSION >= 6
|
||||
Return<void> StreamOut::getDualMonoMode(getDualMonoMode_cb _hidl_cb) {
|
||||
_hidl_cb(Result::NOT_SUPPORTED, DualMonoMode::OFF);
|
||||
audio_dual_mono_mode_t mode = AUDIO_DUAL_MONO_MODE_OFF;
|
||||
Result retval = mStream->get_dual_mono_mode != nullptr
|
||||
? Stream::analyzeStatus("get_dual_mono_mode",
|
||||
mStream->get_dual_mono_mode(mStream, &mode))
|
||||
: Result::NOT_SUPPORTED;
|
||||
_hidl_cb(retval, DualMonoMode(mode));
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<Result> StreamOut::setDualMonoMode(DualMonoMode /*mode*/) {
|
||||
return Result::NOT_SUPPORTED;
|
||||
Return<Result> StreamOut::setDualMonoMode(DualMonoMode mode) {
|
||||
return mStream->set_dual_mono_mode != nullptr
|
||||
? Stream::analyzeStatus(
|
||||
"set_dual_mono_mode",
|
||||
mStream->set_dual_mono_mode(mStream,
|
||||
static_cast<audio_dual_mono_mode_t>(mode)))
|
||||
: Result::NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
Return<void> StreamOut::getAudioDescriptionMixLevel(getAudioDescriptionMixLevel_cb _hidl_cb) {
|
||||
_hidl_cb(Result::NOT_SUPPORTED, -std::numeric_limits<float>::infinity());
|
||||
float leveldB = -std::numeric_limits<float>::infinity();
|
||||
Result retval = mStream->get_audio_description_mix_level != nullptr
|
||||
? Stream::analyzeStatus(
|
||||
"get_audio_description_mix_level",
|
||||
mStream->get_audio_description_mix_level(mStream, &leveldB))
|
||||
: Result::NOT_SUPPORTED;
|
||||
_hidl_cb(retval, leveldB);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<Result> StreamOut::setAudioDescriptionMixLevel(float /*leveldB*/) {
|
||||
return Result::NOT_SUPPORTED;
|
||||
Return<Result> StreamOut::setAudioDescriptionMixLevel(float leveldB) {
|
||||
return mStream->set_audio_description_mix_level != nullptr
|
||||
? Stream::analyzeStatus(
|
||||
"set_audio_description_mix_level",
|
||||
mStream->set_audio_description_mix_level(mStream, leveldB))
|
||||
: Result::NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
Return<void> StreamOut::getPlaybackRateParameters(getPlaybackRateParameters_cb _hidl_cb) {
|
||||
_hidl_cb(Result::NOT_SUPPORTED,
|
||||
// Same as AUDIO_PLAYBACK_RATE_INITIALIZER
|
||||
PlaybackRate{1.0f, 1.0f, TimestretchMode::DEFAULT, TimestretchFallbackMode::FAIL});
|
||||
audio_playback_rate_t rate = AUDIO_PLAYBACK_RATE_INITIALIZER;
|
||||
Result retval =
|
||||
mStream->get_playback_rate_parameters != nullptr
|
||||
? Stream::analyzeStatus("get_playback_rate_parameters",
|
||||
mStream->get_playback_rate_parameters(mStream, &rate))
|
||||
: Result::NOT_SUPPORTED;
|
||||
_hidl_cb(retval,
|
||||
PlaybackRate{rate.mSpeed, rate.mPitch, static_cast<TimestretchMode>(rate.mStretchMode),
|
||||
static_cast<TimestretchFallbackMode>(rate.mFallbackMode)});
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<Result> StreamOut::setPlaybackRateParameters(const PlaybackRate& /*playbackRate*/) {
|
||||
return Result::NOT_SUPPORTED;
|
||||
Return<Result> StreamOut::setPlaybackRateParameters(const PlaybackRate& playbackRate) {
|
||||
audio_playback_rate_t rate = {
|
||||
playbackRate.speed, playbackRate.pitch,
|
||||
static_cast<audio_timestretch_stretch_mode_t>(playbackRate.timestretchMode),
|
||||
static_cast<audio_timestretch_fallback_mode_t>(playbackRate.fallbackMode)};
|
||||
return mStream->set_playback_rate_parameters != nullptr
|
||||
? Stream::analyzeStatus("set_playback_rate_parameters",
|
||||
mStream->set_playback_rate_parameters(mStream, &rate))
|
||||
: Result::NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
Return<Result> StreamOut::setEventCallback(const sp<IStreamOutEventCallback>& callback) {
|
||||
|
|
Loading…
Reference in a new issue