PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
- ret = mm_player_set_attribute(handle->mm_handle, NULL, "pcm_extraction", TRUE, NULL);
- if (ret != MM_ERROR_NONE)
- return __player_convert_error_code(ret, (char *)__FUNCTION__);
-
ret = mm_player_set_audio_stream_callback_ex(handle->mm_handle, sync, __audio_stream_callback_ex, (void *)handle);
if (ret != MM_ERROR_NONE)
return __player_convert_error_code(ret, (char *)__FUNCTION__);
player_s *handle = (player_s *)player;
int ret = MM_ERROR_NONE;
- LOGE("[%s] legacy_player_set_pcm_spec %s %d %d", __FUNCTION__, format, samplerate, channel);
- ret = mm_player_set_attribute(handle->mm_handle, NULL, "pcm_audioformat", format, strlen(format), NULL);
- if (ret != MM_ERROR_NONE)
- return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ LOGD("format: %s, rate: %d, ch: %d", format, samplerate, channel);
- ret = mm_player_set_pcm_spec(handle->mm_handle, samplerate, channel);
- if (ret != MM_ERROR_NONE)
- return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ if (format) {
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, "pcm_audioformat", format, strlen(format), NULL);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ }
+
+ if (samplerate > 0) {
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, "pcm_extraction_samplerate", samplerate, NULL);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ }
+
+ if (channel > 0) {
+ ret = mm_player_set_attribute(handle->mm_handle, NULL, "pcm_extraction_channels", channel, NULL);
+ if (ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret, (char *)__FUNCTION__);
+ }
return PLAYER_ERROR_NONE;
}