[0.2.90] use attr for pcm spec 12/192512/1
authorEunhae Choi <eunhae1.choi@samsung.com>
Tue, 6 Nov 2018 06:11:20 +0000 (15:11 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Tue, 6 Nov 2018 06:11:55 +0000 (15:11 +0900)
- remove unused attr
- use attr for pcm spec

Change-Id: Idfba9947b18575f906e8815b450e4e41608e891a

legacy/src/legacy_player_internal.c
packaging/mmsvc-player.spec

index 2bb7247..e1b5639 100644 (file)
@@ -63,10 +63,6 @@ int legacy_player_set_pcm_extraction_mode(player_h player, bool sync, player_aud
 
        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__);
@@ -82,14 +78,25 @@ int legacy_player_set_pcm_spec(player_h player, const char *format, int samplera
        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;
 }
index 3278002..67754a6 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mmsvc-player
 Summary:    A Media Player module for muse server
-Version:    0.2.89
+Version:    0.2.90
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0