[0.2.124] add the default codec type configuration 46/214246/2 accepted/tizen_5.5_unified_mobile_hotfix tizen_5.5_mobile_hotfix accepted/tizen/5.5/unified/20191031.022849 accepted/tizen/5.5/unified/mobile/hotfix/20201027.090546 accepted/tizen/unified/20190923.110319 submit/tizen/20190920.072750 submit/tizen_5.5/20191031.000004 submit/tizen_5.5_mobile_hotfix/20201026.185104 tizen_5.5.m2_release
authorEunhye Choi <eunhae1.choi@samsung.com>
Thu, 19 Sep 2019 08:06:48 +0000 (17:06 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Thu, 19 Sep 2019 12:09:01 +0000 (21:09 +0900)
- add new error code : PLAYER_ERROR_NOT_AVAILABLE
- some audio functions become optional in case
  the HW audio codec is selected.
  : audio effect, replaygain, pitch, pcm exporting

Change-Id: I8e97a0408a52bc53b511d1e3a6eb4464e049c53d

legacy/include/legacy_player.h
legacy/include/legacy_player_internal.h
legacy/src/legacy_player.c
legacy/src/legacy_player_internal.c
muse/src/muse_player.c
packaging/mmsvc-player.spec

index 46fce5d..d1df11a 100644 (file)
 extern "C" {
 #endif
 
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "MMSVC_PLAYER"
+
 #define PLAYER_ERROR_CLASS          TIZEN_ERROR_PLAYER | 0x20
 
 /* This is for custom defined player error. */
@@ -84,6 +89,7 @@ typedef enum {
        PLAYER_ERROR_NOT_SUPPORTED_VIDEO_CODEC = PLAYER_ERROR_CLASS | 0x0f,        /**< Not supported video codec but audio can be played (Since 4.0) */
        PLAYER_ERROR_NOT_SUPPORTED_SUBTITLE = PLAYER_ERROR_CLASS | 0x10,           /**< Not supported subtitle format (Since 4.0) */
        PLAYER_ERROR_NOT_SUPPORTED_FORMAT = PLAYER_ERROR_CLASS | 0x11,             /**< Not supported format (Since 5.5) */
+       PLAYER_ERROR_NOT_AVAILABLE        = PLAYER_ERROR_CLASS | 0x12,             /**< Not available operation (Since 5.5)*/
 } player_error_e;
 
 /**
@@ -212,6 +218,13 @@ typedef enum {
        LEGACY_PLAYER_CALLBACK_TYPE_NUM
 } legacy_player_callback_type_e;
 
+typedef enum
+{
+       PLAYER_CODEC_TYPE_EX_HW,           /**< This is an optional flag for using the h/w codec */
+       PLAYER_CODEC_TYPE_EX_SW,           /**< This is an optional flag for using the s/w codec */
+       PLAYER_CODEC_TYPE_EX_DEFAULT,      /**< This is an optional flag for using codec which has higher priority */
+} player_codec_type_ex_e;
+
 /**
  * @brief  Default callback type
  */
@@ -1652,6 +1665,10 @@ int legacy_player_pitch_is_enabled(legacy_player_h player, bool *enabled);
 int legacy_player_pitch_set_value(legacy_player_h player, float pitch);
 int legacy_player_pitch_get_value(legacy_player_h player, float *pitch);
 
+/* default codec type */
+int legacy_player_set_codec_type(legacy_player_h player, player_stream_type_e stream_type, player_codec_type_ex_e codec_type);
+int legacy_player_get_codec_type(legacy_player_h player, player_stream_type_e stream_type, player_codec_type_ex_e *codec_type);
+
 #ifdef __cplusplus
 }
 #endif
index bab93dd..9218c78 100644 (file)
@@ -32,17 +32,6 @@ extern "C" {
  */
 
 /**
- * @brief Enumeration for codec type.
- * @since_tizen 4.0
- */
-typedef enum
-{
-       PLAYER_CODEC_TYPE_DEFAULT = 0,  /**< This is an optional flag for using codec which has higher priority */
-       PLAYER_CODEC_TYPE_HW,           /**< This is an optional flag for using the h/w codec */
-       PLAYER_CODEC_TYPE_SW,           /**< This is an optional flag for using the s/w codec */
-} player_codec_type_e;
-
-/**
  * @brief Called when the buffer level drops below the min size or exceeds the max size.
  */
 typedef void (*legacy_player_media_stream_buffer_status_cb_ex)(legacy_player_callback_type_e type,
@@ -178,42 +167,6 @@ int legacy_player_is_gapless(legacy_player_h player, bool *gapless);
 int legacy_player_enable_media_packet_video_frame_decoded_cb(legacy_player_h player, bool enable);
 
 /**
- * @brief Set audio/video codec type as h/w codec or s/w codec.
- * @since_tizen 4.0
- * @details The default codec type of the player is #PLAYER_CODEC_TYPE_DEFAULT.
- *          Usually the H/W codec has higher priority than S/W codec if it exist.
- * @param[in] player The handle to the media player
- * @param[in] stream_type  The stream type and it have to be #PLAYER_STREAM_TYPE_AUDIO or #PLAYER_STREAM_TYPE_VIDEO.
- * @param[in] codec_type   The codec type
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #PLAYER_ERROR_NONE Successful
- * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
- * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
- * @pre The player state must be #PLAYER_STATE_IDLE by player_create() or player_unprepare().
- * @see player_get_codec_type()
- */
-int legacy_player_set_codec_type(legacy_player_h player, player_stream_type_e stream_type, player_codec_type_e codec_type);
-
-/**
- * @brief Get video codec type.
- * @since_tizen 4.0
- * @param[in]  player The handle to the media player
- * @param[in]  stream_type  The stream type and it have to be #PLAYER_STREAM_TYPE_AUDIO or #PLAYER_STREAM_TYPE_VIDEO.
- * @param[out] pcodec_type   The codec type
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #PLAYER_ERROR_NONE Successful
- * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
- * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
- * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
- * @see player_set_codec_type()
- */
-int legacy_player_get_codec_type(legacy_player_h player, player_stream_type_e stream_type, player_codec_type_e *pcodec_type);
-
-/**
  * @}
  */
 
index 1313cc4..5ce1c71 100644 (file)
@@ -99,14 +99,14 @@ int _lplayer_convert_error_code(int code, char *func_name)
        case MM_ERROR_PLAYER_INVALID_STREAM:
        case MM_ERROR_PLAYER_STREAMING_FAIL:
        case MM_ERROR_PLAYER_NO_OP:
+       case MM_ERROR_NOT_SUPPORT_API:
                ret = PLAYER_ERROR_INVALID_OPERATION;
                msg = "PLAYER_ERROR_INVALID_OPERATION";
                break;
        case MM_ERROR_PLAYER_SOUND_EFFECT_INVALID_STATUS:
-       case MM_ERROR_NOT_SUPPORT_API:
        case MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER:
-               ret = PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE;
-               msg = "PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE";
+               ret = PLAYER_ERROR_NOT_AVAILABLE;
+               msg = "PLAYER_ERROR_NOT_AVAILABLE";
                break;
        case MM_ERROR_PLAYER_NO_FREE_SPACE:
                ret = PLAYER_ERROR_FILE_NO_SPACE_ON_DEVICE;
@@ -593,10 +593,46 @@ static int __lplayer_check_callback_precondition(legacy_player_t *handle, legacy
        return PLAYER_ERROR_NONE;
 }
 
+static bool __lplayer_is_offload_precondition_valid(legacy_player_h player)
+{
+       legacy_player_t *handle = (legacy_player_t *)player;
+       int ret = MM_ERROR_NONE;
+       int enabled = 0;
+
+       ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_AUDIO_OFFLOAD, &enabled, (char *)NULL);
+       if (ret != MM_ERROR_NONE) {
+               LOGE("failed to get offload status 0x%X", ret);
+               return false;
+       }
+
+       LOGD("offload status %d", enabled);
+       return (enabled) ? (false) : (true);
+}
+
+static bool __lplayer_is_audio_control_available(legacy_player_h player, mmplayer_audio_control_opt_e opt)
+{
+       int ret = MM_ERROR_NONE;
+       legacy_player_t *handle = (legacy_player_t *)player;
+       bool available = false;
+
+       LOGD("opt %d", opt);
+       if (!__lplayer_is_offload_precondition_valid(player))
+               return false;
+
+       ret = mm_player_is_audio_control_available(handle->mm_handle, opt, &available);
+       if (ret != MM_ERROR_NONE || !available) {
+               LOGW("available %d, ret 0x%X", available, ret);
+               return false;
+       }
+
+       return true;
+}
+
 static int
-__lplayer_set_buffer_export_callback(legacy_player_t *handle)
+__lplayer_set_buffer_export_callback(legacy_player_h player)
 {
        int ret = MM_ERROR_NONE;
+       legacy_player_t *handle = (legacy_player_t *)player;
        legacy_player_callback_type_e video_type = LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_PACKET_VIDEO_FRAME;
        legacy_player_callback_type_e audio_type = LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_PACKET_AUDIO_FRAME;
 
@@ -605,10 +641,18 @@ __lplayer_set_buffer_export_callback(legacy_player_t *handle)
                                (mm_player_video_decoded_callback)handle->user_cb[video_type],
                                handle->user_data[video_type]);
 
-       if (handle->user_cb[audio_type])
+       if (handle->user_cb[audio_type]) {
+               if (!__lplayer_is_audio_control_available(player, MM_PLAYER_AUDIO_CONTROL_OPT_PCM_EXPORTING)) {
+                       LOGW("HW audio path will be setup. exporting audio data is not available");
+                       handle->user_cb[audio_type] = NULL;
+                       handle->user_data[audio_type] = NULL;
+                       return MM_ERROR_NONE;
+               }
+
                ret = mm_player_set_audio_decoded_callback(handle->mm_handle, handle->pcm_extract_opt,
                                (mm_player_audio_decoded_callback)handle->user_cb[audio_type],
                                handle->user_data[audio_type]);
+       }
 
        return ret;
 }
@@ -653,22 +697,6 @@ __lplayer_convert_audio_pcm_mime_to_str(media_format_mimetype_e mime)
        return NULL;
 }
 
-static bool __lplayer_is_offload_precondition_valid(legacy_player_h player)
-{
-       int ret = MM_ERROR_NONE;
-       int enabled = 0;
-       legacy_player_t *handle = (legacy_player_t *)player;
-
-       ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_AUDIO_OFFLOAD, &enabled, (char *)NULL);
-       if (ret != MM_ERROR_NONE) {
-               LOGE("failed to get offload status 0x%X", ret);
-               return false;
-       }
-
-       LOGD("offload status %d", enabled);
-       return (enabled) ? (false) : (true);
-}
-
 /*
  * Public Implementation
  */
@@ -818,7 +846,7 @@ int legacy_player_prepare_async(legacy_player_h player, legacy_player_prepared_c
                goto ERROR;
        }
 
-       mm_ret = __lplayer_set_buffer_export_callback(handle);
+       mm_ret = __lplayer_set_buffer_export_callback(player);
        if (mm_ret != MM_ERROR_NONE) {
                LOGE("failed to set buffer export callback function (0x%x)", mm_ret);
                goto ERROR;
@@ -897,7 +925,7 @@ int legacy_player_prepare(legacy_player_h player)
        if (ret != MM_ERROR_NONE)
                LOGW("Failed to set message callback function (0x%x)", ret);
 
-       ret = __lplayer_set_buffer_export_callback(handle);
+       ret = __lplayer_set_buffer_export_callback(player);
        if (ret != MM_ERROR_NONE) {
                LOGW("Failed to set buffer export callback function (0x%x)", ret);
                return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
@@ -1065,7 +1093,7 @@ int legacy_player_set_audio_latency_mode(legacy_player_h player, audio_latency_m
        PLAYER_INSTANCE_CHECK(player);
 
        if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
+               return PLAYER_ERROR_NOT_AVAILABLE;
 
        ret = mm_player_set_attribute(handle->mm_handle, NULL, "sound_latency_mode", latency_mode, (char *)NULL);
        if (ret != MM_ERROR_NONE)
@@ -1083,7 +1111,7 @@ int legacy_player_get_audio_latency_mode(legacy_player_h player, audio_latency_m
        PLAYER_NULL_ARG_CHECK(latency_mode);
 
        if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
+               return PLAYER_ERROR_NOT_AVAILABLE;
 
        ret = mm_player_get_attribute(handle->mm_handle, NULL, "sound_latency_mode", latency_mode, (char *)NULL);
        if (ret != MM_ERROR_NONE)
@@ -1372,7 +1400,7 @@ int legacy_player_set_playback_rate(legacy_player_h player, float rate)
        PLAYER_CHECK_CONDITION(rate >= -5.0 && rate <= 5.0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
 
        if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
+               return PLAYER_ERROR_NOT_AVAILABLE;
 
        if (!_lplayer_state_validate(handle, PLAYER_STATE_READY)) {
                LOGE("PLAYER_ERROR_INVALID_STATE : current state - %d", handle->state);
@@ -1640,9 +1668,6 @@ int legacy_player_audio_effect_get_equalizer_bands_count(legacy_player_h player,
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(count);
 
-       if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
-
        ret = mm_player_audio_effect_custom_get_eq_bands_number(handle->mm_handle, count);
        if (ret != MM_ERROR_NONE)
                return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
@@ -1658,9 +1683,6 @@ int legacy_player_audio_effect_set_equalizer_all_bands(legacy_player_h player, i
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(band_levels);
 
-       if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
-
        ret = mm_player_audio_effect_custom_set_level_eq_from_list(handle->mm_handle, band_levels, length);
        if (ret != MM_ERROR_NONE)
                return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
@@ -1676,9 +1698,6 @@ int legacy_player_audio_effect_set_equalizer_band_level(legacy_player_h player,
 
        PLAYER_INSTANCE_CHECK(player);
 
-       if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
-
        ret = mm_player_audio_effect_custom_set_level(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ, index, level);
        if (ret != MM_ERROR_NONE)
                return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
@@ -1698,9 +1717,6 @@ int legacy_player_audio_effect_get_equalizer_band_level(legacy_player_h player,
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(level);
 
-       if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
-
        ret = mm_player_audio_effect_custom_get_level(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ, index, level);
        if (ret != MM_ERROR_NONE)
                return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
@@ -1716,9 +1732,6 @@ int legacy_player_audio_effect_get_equalizer_level_range(legacy_player_h player,
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(min && max);
 
-       if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
-
        ret = mm_player_audio_effect_custom_get_level_range(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ, min, max);
        if (ret != MM_ERROR_NONE)
                return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
@@ -1734,9 +1747,6 @@ int legacy_player_audio_effect_get_equalizer_band_frequency(legacy_player_h play
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(frequency);
 
-       if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
-
        ret = mm_player_audio_effect_custom_get_eq_bands_freq(handle->mm_handle, index, frequency);
        if (ret != MM_ERROR_NONE)
                return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
@@ -1752,9 +1762,6 @@ int legacy_player_audio_effect_get_equalizer_band_frequency_range(legacy_player_
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(range);
 
-       if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
-
        ret = mm_player_audio_effect_custom_get_eq_bands_width(handle->mm_handle, index, range);
        if (ret != MM_ERROR_NONE)
                return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
@@ -1766,11 +1773,13 @@ int legacy_player_audio_effect_equalizer_clear(legacy_player_h player)
 {
        legacy_player_t *handle = (legacy_player_t *)player;
        int ret = MM_ERROR_NONE;
+       bool available = false;
 
        PLAYER_INSTANCE_CHECK(player);
 
-       if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
+       ret = mm_player_is_available_custom_effect(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ, &available);
+       if (ret != MM_ERROR_NONE || available == false)
+               return PLAYER_ERROR_NOT_AVAILABLE;
 
        ret = mm_player_audio_effect_custom_clear_eq_all(handle->mm_handle);
        if (ret != MM_ERROR_NONE)
@@ -1791,19 +1800,17 @@ int legacy_player_audio_effect_equalizer_is_available(legacy_player_h player, bo
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(available);
 
-       if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
-
        if (!_lplayer_state_validate(handle, PLAYER_STATE_IDLE)) {
                LOGE("PLAYER_ERROR_INVALID_STATE : current state - %d", handle->state);
                return PLAYER_ERROR_INVALID_STATE;
        }
 
-       ret = mm_player_is_supported_custom_effect_type(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ);
+       /* checked in mm function about audio offload status, filter valid status, etc */
+       ret = mm_player_is_available_custom_effect(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ, available);
        if (ret != MM_ERROR_NONE)
                *available = false;
-       else
-               *available = true;
+
+       LOGD("audio effect is availeble %d", *available);
 
        return PLAYER_ERROR_NONE;
 }
@@ -1968,6 +1975,12 @@ int legacy_player_unset_callback(legacy_player_h player, legacy_player_callback_
                return ret;
        }
 
+       if (type == LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_PACKET_AUDIO_FRAME) {
+               if (!__lplayer_is_audio_control_available(player,
+                                       MM_PLAYER_AUDIO_CONTROL_OPT_PCM_EXPORTING))
+                       return PLAYER_ERROR_NOT_AVAILABLE;
+       }
+
        L_PLAYER_USER_CB_LOCK(player, type);
 
        handle->user_cb[type] = NULL;
@@ -2002,8 +2015,8 @@ int legacy_player_set_media_packet_audio_frame_decoded_cb(legacy_player_h player
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(callback);
 
-       if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
+       if (!__lplayer_is_audio_control_available(player, MM_PLAYER_AUDIO_CONTROL_OPT_PCM_EXPORTING))
+               return PLAYER_ERROR_NOT_AVAILABLE;
 
        PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
 
@@ -2024,10 +2037,9 @@ int legacy_player_set_media_packet_audio_frame_decoded_cb(legacy_player_h player
                LOGW("Invalid audio format information (%s, %d, %d)", audio_pcm_format, samplerate, channel);
        }
 
-       ret = mm_player_set_audio_decoded_callback(handle->mm_handle,
-                       (mmplayer_audio_extract_opt_e)opt, (mm_player_audio_decoded_callback)callback, user_data);
-       if (ret != MM_ERROR_NONE)
-               return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
+       handle->user_cb[LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_PACKET_AUDIO_FRAME] = callback;
+       handle->user_data[LEGACY_PLAYER_CALLBACK_TYPE_MEDIA_PACKET_AUDIO_FRAME] = user_data;
+       handle->pcm_extract_opt = opt;
 
        return PLAYER_ERROR_NONE;
 }
@@ -2223,7 +2235,7 @@ int legacy_player_get_track_count(legacy_player_h player, player_stream_type_e t
        PLAYER_NULL_ARG_CHECK(count);
 
        if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
+               return PLAYER_ERROR_NOT_AVAILABLE;
 
        if (!_lplayer_state_validate(handle, PLAYER_STATE_READY)) {
                LOGE("PLAYER_ERROR_INVALID_STATE : current state - %d", handle->state);
@@ -2259,7 +2271,7 @@ int legacy_player_get_current_track(legacy_player_h player, player_stream_type_e
        PLAYER_NULL_ARG_CHECK(index);
 
        if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
+               return PLAYER_ERROR_NOT_AVAILABLE;
 
        if (!_lplayer_state_validate(handle, PLAYER_STATE_READY)) {
                LOGE("PLAYER_ERROR_INVALID_STATE : current state - %d", handle->state);
@@ -2296,7 +2308,7 @@ int legacy_player_select_track(legacy_player_h player, player_stream_type_e type
        PLAYER_CHECK_CONDITION(index >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
 
        if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
+               return PLAYER_ERROR_NOT_AVAILABLE;
 
        if (!_lplayer_state_validate(handle, PLAYER_STATE_READY)) {
                LOGE("PLAYER_ERROR_INVALID_STATE : current state - %d", handle->state);
@@ -2333,7 +2345,7 @@ int legacy_player_get_track_language_code(legacy_player_h player, player_stream_
        PLAYER_NULL_ARG_CHECK(code && len);
 
        if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
+               return PLAYER_ERROR_NOT_AVAILABLE;
 
        if (!_lplayer_state_validate(handle, PLAYER_STATE_READY)) {
                LOGE("PLAYER_ERROR_INVALID_STATE : current state - %d", handle->state);
@@ -2864,8 +2876,8 @@ int legacy_player_set_replaygain_enabled(legacy_player_h player, bool enabled)
 
        PLAYER_INSTANCE_CHECK(player);
 
-       if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
+       if (!__lplayer_is_audio_control_available(player, MM_PLAYER_AUDIO_CONTROL_OPT_REPLAYGAIN))
+               return PLAYER_ERROR_NOT_AVAILABLE;
 
        if (!_lplayer_state_validate(handle, PLAYER_STATE_IDLE)) {
                LOGE("PLAYER_ERROR_INVALID_STATE : current state - %d", handle->state);
@@ -2888,8 +2900,8 @@ int legacy_player_is_replaygain_enabled(legacy_player_h player, bool *enabled)
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(enabled);
 
-       if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
+       if (!__lplayer_is_audio_control_available(player, MM_PLAYER_AUDIO_CONTROL_OPT_REPLAYGAIN))
+               return PLAYER_ERROR_NOT_AVAILABLE;
 
        if (!_lplayer_state_validate(handle, PLAYER_STATE_IDLE)) {
                LOGE("PLAYER_ERROR_INVALID_STATE : current state - %d", handle->state);
@@ -3005,8 +3017,8 @@ int legacy_player_pitch_set_enabled(legacy_player_h player, bool enabled)
 
        PLAYER_INSTANCE_CHECK(player);
 
-       if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
+       if (!__lplayer_is_audio_control_available(player, MM_PLAYER_AUDIO_CONTROL_OPT_PITCH))
+               return PLAYER_ERROR_NOT_AVAILABLE;
 
        PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
 
@@ -3028,8 +3040,8 @@ int legacy_player_pitch_is_enabled(legacy_player_h player, bool *enabled)
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(enabled);
 
-       if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
+       if (!__lplayer_is_audio_control_available(player, MM_PLAYER_AUDIO_CONTROL_OPT_PITCH))
+               return PLAYER_ERROR_NOT_AVAILABLE;
 
        if (!_lplayer_state_validate(handle, PLAYER_STATE_IDLE)) {
                LOGE("PLAYER_ERROR_INVALID_STATE : current state - %d", handle->state);
@@ -3053,8 +3065,8 @@ int legacy_player_pitch_set_value(legacy_player_h player, float pitch)
 
        PLAYER_INSTANCE_CHECK(player);
 
-       if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
+       if (!__lplayer_is_audio_control_available(player, MM_PLAYER_AUDIO_CONTROL_OPT_PITCH))
+               return PLAYER_ERROR_NOT_AVAILABLE;
 
        if (!_lplayer_state_validate(handle, PLAYER_STATE_IDLE)) {
                LOGE("PLAYER_ERROR_INVALID_STATE : current state - %d", handle->state);
@@ -3087,8 +3099,8 @@ int legacy_player_pitch_get_value(legacy_player_h player, float *pitch)
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(pitch);
 
-       if (!__lplayer_is_offload_precondition_valid(player))
-               return PLAYER_ERROR_INVALID_OPERATION;
+       if (!__lplayer_is_audio_control_available(player, MM_PLAYER_AUDIO_CONTROL_OPT_PITCH))
+               return PLAYER_ERROR_NOT_AVAILABLE;
 
        if (!_lplayer_state_validate(handle, PLAYER_STATE_IDLE)) {
                LOGE("PLAYER_ERROR_INVALID_STATE : current state - %d", handle->state);
@@ -3104,3 +3116,46 @@ int legacy_player_pitch_get_value(legacy_player_h player, float *pitch)
 
        return PLAYER_ERROR_NONE;
 }
+
+int legacy_player_set_codec_type(legacy_player_h player, player_stream_type_e stream_type, player_codec_type_ex_e codec_type)
+{
+       legacy_player_t *handle = (legacy_player_t *)player;
+       int ret = MM_ERROR_NONE;
+       PLAYER_INSTANCE_CHECK(player);
+       PLAYER_CHECK_CONDITION((stream_type == PLAYER_STREAM_TYPE_AUDIO || stream_type == PLAYER_STREAM_TYPE_VIDEO),
+                       PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
+       PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
+
+       LOGI("stream %d, codec %d", stream_type, codec_type);
+       ret = mm_player_set_codec_type(handle->mm_handle, stream_type, codec_type);
+       if (ret == MM_ERROR_PLAYER_NO_OP) {
+               if (stream_type == PLAYER_STREAM_TYPE_AUDIO)
+                       return PLAYER_ERROR_NOT_SUPPORTED_AUDIO_CODEC;
+               else
+                       return PLAYER_ERROR_NOT_SUPPORTED_VIDEO_CODEC;
+       } else if (ret != MM_ERROR_NONE) {
+               return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
+       }
+
+       return PLAYER_ERROR_NONE;
+}
+
+int legacy_player_get_codec_type(legacy_player_h player, player_stream_type_e stream_type, player_codec_type_ex_e *codec_type)
+{
+       legacy_player_t *handle = (legacy_player_t *)player;
+       int ret = MM_ERROR_NONE;
+       const char *attr_name;
+       PLAYER_INSTANCE_CHECK(player);
+       PLAYER_NULL_ARG_CHECK(codec_type);
+       PLAYER_CHECK_CONDITION((stream_type == PLAYER_STREAM_TYPE_AUDIO || stream_type == PLAYER_STREAM_TYPE_VIDEO),
+                       PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
+
+       attr_name = (stream_type == PLAYER_STREAM_TYPE_AUDIO) ? (MM_PLAYER_AUDIO_CODEC_TYPE) : (MM_PLAYER_VIDEO_CODEC_TYPE);
+
+       ret = mm_player_get_attribute(handle->mm_handle, NULL, attr_name, codec_type, (char *)NULL);
+       if (ret != MM_ERROR_NONE)
+               return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
+
+       LOGD("stream %d, codec %d", stream_type, *codec_type);
+       return PLAYER_ERROR_NONE;
+}
index 8848960..827d7ca 100644 (file)
@@ -162,38 +162,3 @@ int legacy_player_enable_media_packet_video_frame_decoded_cb(legacy_player_h pla
 
        return PLAYER_ERROR_NONE;
 }
-
-int legacy_player_set_codec_type(legacy_player_h player, player_stream_type_e stream_type, player_codec_type_e codec_type)
-{
-       legacy_player_t *handle = (legacy_player_t *)player;
-       int ret = MM_ERROR_NONE;
-       PLAYER_INSTANCE_CHECK(player);
-       PLAYER_CHECK_CONDITION(stream_type == PLAYER_STREAM_TYPE_AUDIO || stream_type == PLAYER_STREAM_TYPE_VIDEO, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
-       PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
-
-       LOGI("stream %d, codec %d", stream_type, codec_type);
-       ret = mm_player_set_codec_type(handle->mm_handle, stream_type, codec_type);
-       if (ret != MM_ERROR_NONE)
-               return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
-
-       return PLAYER_ERROR_NONE;
-}
-
-int legacy_player_get_codec_type(legacy_player_h player, player_stream_type_e stream_type, player_codec_type_e *pcodec_type)
-{
-       legacy_player_t *handle = (legacy_player_t *)player;
-       int ret = MM_ERROR_NONE;
-       const char *attr_name;
-       PLAYER_INSTANCE_CHECK(player);
-       PLAYER_NULL_ARG_CHECK(pcodec_type);
-       PLAYER_CHECK_CONDITION(stream_type == PLAYER_STREAM_TYPE_AUDIO || stream_type == PLAYER_STREAM_TYPE_VIDEO, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
-
-       attr_name = (stream_type == PLAYER_STREAM_TYPE_AUDIO) ? (MM_PLAYER_AUDIO_CODEC_TYPE) : (MM_PLAYER_VIDEO_CODEC_TYPE);
-
-       ret = mm_player_get_attribute(handle->mm_handle, NULL, attr_name, pcodec_type, (char *)NULL);
-       if (ret != MM_ERROR_NONE)
-               return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
-
-       LOGD("stream %d, codec %d", stream_type, *pcodec_type);
-       return PLAYER_ERROR_NONE;
-}
index 0898d53..9f5a61d 100644 (file)
@@ -312,6 +312,7 @@ static void __mplayer_remove_export_media_packet(muse_module_h module)
 
                g_mutex_unlock(&muse_player->list_lock);
        }
+       LOGD("LEAVE");
 }
 
 /* check the given path is indicating sdp file */
@@ -3289,12 +3290,13 @@ int player_disp_set_codec_type(muse_module_h module)
                ret = PLAYER_ERROR_INVALID_PARAMETER;
                goto EXIT;
        }
-       if (codec_type < PLAYER_CODEC_TYPE_DEFAULT || codec_type > PLAYER_CODEC_TYPE_SW) {
+       if (codec_type < PLAYER_CODEC_TYPE_EX_HW || codec_type > PLAYER_CODEC_TYPE_EX_DEFAULT) {
                ret = PLAYER_ERROR_INVALID_PARAMETER;
                goto EXIT;
        }
 
-       ret = legacy_player_set_codec_type(muse_player->player_handle, (player_stream_type_e)stream_type, (player_codec_type_e)codec_type);
+       ret = legacy_player_set_codec_type(muse_player->player_handle,
+                       (player_stream_type_e)stream_type, (player_codec_type_ex_e)codec_type);
 
 EXIT:
        PLAYER_RETURN_MSG(api, ret, module);
@@ -3308,15 +3310,15 @@ int player_disp_get_codec_type(muse_module_h module)
        muse_player_handle_t *muse_player = NULL;
        muse_player_api_e api = MUSE_PLAYER_API_GET_CODEC_TYPE;
        int stream_type = 0;
-       player_codec_type_e codec_type = 0;
+       player_codec_type_ex_e codec_type = 0;
 
        muse_player = (muse_player_handle_t *)muse_server_ipc_get_handle(module);
        player_msg_get(stream_type, muse_server_module_get_msg(module));
 
-       ret = legacy_player_get_codec_type(muse_player->player_handle, (player_stream_type_e)stream_type, &codec_type);
-
-       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "codec_type", (int)codec_type);
+       ret = legacy_player_get_codec_type(muse_player->player_handle,
+                       (player_stream_type_e)stream_type, &codec_type);
 
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "type", (int)codec_type);
        return ret;
 }
 
@@ -3498,7 +3500,6 @@ int player_disp_set_media_packet_audio_frame_decoded_cb(muse_module_h module)
        int opt = 0;
 
        /* event type : MUSE_PLAYER_EVENT_TYPE_MEDIA_PACKET_AUDIO_FRAME */
-
        ret_val = __mplayer_disp_get_param_value(muse_server_module_get_msg(module),
                                                                MUSE_TYPE_INT, "opt", (void *)&opt,
                                                                MUSE_TYPE_INT, "mimetype", (void *)&mimetype,
@@ -3509,6 +3510,7 @@ int player_disp_set_media_packet_audio_frame_decoded_cb(muse_module_h module)
        if (ret_val) {
                muse_player = (muse_player_handle_t *)muse_server_ipc_get_handle(module);
                muse_player->export_audio_data = true;
+
                ret = legacy_player_set_media_packet_audio_frame_decoded_cb(
                        muse_player->player_handle, opt, mimetype, channel, samplerate, __mplayer_audio_decoded_cb, module);
        }
index 74c4f73..745fdd5 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mmsvc-player
 Summary:    A Media Player module for muse server
-Version:    0.2.123
+Version:    0.2.124
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0