[0.2.69] add considering of audio codec_type 23/166623/1
authorEunhae Choi <eunhae1.choi@samsung.com>
Thu, 11 Jan 2018 07:27:11 +0000 (16:27 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Thu, 11 Jan 2018 07:27:11 +0000 (16:27 +0900)
Change-Id: I1c37273cd16f9acbf9a7625d082f4c37b5c7d403

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

index 9c79133..de70958 100644 (file)
@@ -32,15 +32,15 @@ extern "C" {
  */
 
 /**
- * @brief Enumeration for video codec type.
+ * @brief Enumeration for codec type.
  * @since_tizen 4.0
  */
 typedef enum
 {
-       PLAYER_VIDEO_CODEC_TYPE_DEFAULT = 0,  /**< This is an optional flag for using codec which has higher priority */
-       PLAYER_VIDEO_CODEC_TYPE_HW,           /**< This is an optional flag for using the h/w codec */
-       PLAYER_VIDEO_CODEC_TYPE_SW,           /**< This is an optional flag for using the s/w codec */
-} player_video_codec_type_e;
+       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 This file contains the media player API for custom features.
@@ -282,12 +282,13 @@ int legacy_player_is_gapless(player_h player, bool *gapless);
 int legacy_player_enable_media_packet_video_frame_decoded_cb(player_h player, bool enable);
 
 /**
- * @brief Set video codec type as h/w codec or s/w codec.
+ * @brief Set audio/video codec type as h/w codec or s/w codec.
  * @since_tizen 4.0
- * @details The default video codec type of the player is #PLAYER_VIDEO_CODEC_TYPE_DEFAULT.
+ * @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] type   The video codec type
+ * @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
@@ -295,15 +296,16 @@ int legacy_player_enable_media_packet_video_frame_decoded_cb(player_h player, bo
  * @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 legacy_player_get_video_codec_type()
+ * @see player_get_codec_type()
  */
-int legacy_player_set_video_codec_type(player_h player, player_video_codec_type_e type);
+int legacy_player_set_codec_type(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[out] ptype  The video codec type
+ * @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
@@ -311,9 +313,9 @@ int legacy_player_set_video_codec_type(player_h player, player_video_codec_type_
  * @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 legacy_player_set_video_codec_type()
+ * @see player_set_codec_type()
  */
-int legacy_player_get_video_codec_type(player_h player, player_video_codec_type_e *type);
+int legacy_player_get_codec_type(player_h player, player_stream_type_e stream_type, player_codec_type_e *pcodec_type);
 
 /**
  * @}
index 832739b..22bafba 100644 (file)
@@ -106,6 +106,7 @@ int __player_convert_error_code(int code, char *func_name)
                msg = "PLAYER_ERROR_NOT_SUPPORTED_SUBTITLE";
                break;
        case MM_ERROR_INVALID_ARGUMENT:
+       case MM_ERROR_COMMON_INVALID_ARGUMENT:
                ret = PLAYER_ERROR_INVALID_PARAMETER;
                msg = "PLAYER_ERROR_INVALID_PARAMETER";
                break;
index 6b0faa4..7dbe8fa 100644 (file)
@@ -335,30 +335,39 @@ int legacy_player_enable_media_packet_video_frame_decoded_cb(player_h player, bo
                return PLAYER_ERROR_NONE;
 }
 
-int legacy_player_set_video_codec_type(player_h player, player_video_codec_type_e type)
+int legacy_player_set_codec_type(player_h player, player_stream_type_e stream_type, player_codec_type_e codec_type)
 {
+       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_s * handle = (player_s *) player;
        PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
 
-       LOGI("video codec type : %d", type);
-       int ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_VIDEO_CODEC_TYPE, type, (char*)NULL);
+       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 __player_convert_error_code(ret, (char*)__FUNCTION__);
        else
                return PLAYER_ERROR_NONE;
 }
 
-int legacy_player_get_video_codec_type(player_h player, player_video_codec_type_e *type)
+int legacy_player_get_codec_type(player_h player, player_stream_type_e stream_type, player_codec_type_e *pcodec_type)
 {
+       int ret = MM_ERROR_NONE;
        PLAYER_INSTANCE_CHECK(player);
-       PLAYER_NULL_ARG_CHECK(type);
+       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");
+
        player_s * handle = (player_s *) player;
+       const char* attr_name = (stream_type == PLAYER_STREAM_TYPE_AUDIO) ? (MM_PLAYER_AUDIO_CODEC_TYPE) : (MM_PLAYER_VIDEO_CODEC_TYPE);
 
-       int ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_VIDEO_CODEC_TYPE, type, (char*)NULL);
-       if (ret != MM_ERROR_NONE)
+       ret = mm_player_get_attribute(handle->mm_handle, NULL, attr_name, pcodec_type, (char*)NULL);
+       if (ret != MM_ERROR_NONE) {
                return __player_convert_error_code(ret, (char*)__FUNCTION__);
-       else
+       } else {
+               LOGD("stream %d, codec %d", stream_type, *pcodec_type);
                return PLAYER_ERROR_NONE;
+       }
 }
 
index 8507678..26ff342 100644 (file)
@@ -93,5 +93,5 @@ get_streaming_buffering_time
 360_get_zoom
 360_set_field_of_view
 360_get_field_of_view
-set_video_codec_type
-get_video_codec_type
\ No newline at end of file
+set_codec_type
+get_codec_type
\ No newline at end of file
index c6ce11f..e303d9f 100644 (file)
@@ -3263,36 +3263,48 @@ int player_disp_360_get_field_of_view(muse_module_h module)
        return ret;
 }
 
-int player_disp_set_video_codec_type(muse_module_h module)
+int player_disp_set_codec_type(muse_module_h module)
 {
        int ret = PLAYER_ERROR_NONE;
        muse_player_handle_s *muse_player = NULL;
-       muse_player_api_e api = MUSE_PLAYER_API_SET_VIDEO_CODEC_TYPE;
-       int type = 0;
+       muse_player_api_e api = MUSE_PLAYER_API_SET_CODEC_TYPE;
+       int stream_type = 0, codec_type = 0;
 
        muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
-       player_msg_get(type, muse_server_module_get_msg(module));
+       player_msg_get(stream_type, muse_server_module_get_msg(module));
+       player_msg_get(codec_type, muse_server_module_get_msg(module));
+
+       if (stream_type != PLAYER_STREAM_TYPE_AUDIO && stream_type != PLAYER_STREAM_TYPE_VIDEO) {
+               ret = PLAYER_ERROR_INVALID_PARAMETER;
+               goto EXIT;
+       }
+       if (codec_type < PLAYER_CODEC_TYPE_DEFAULT || codec_type > PLAYER_CODEC_TYPE_SW) {
+               ret = PLAYER_ERROR_INVALID_PARAMETER;
+               goto EXIT;
+       }
 
-       ret = legacy_player_set_video_codec_type(muse_player->player_handle, (player_video_codec_type_e)type);
+       ret = legacy_player_set_codec_type(muse_player->player_handle, (player_stream_type_e)stream_type, (player_codec_type_e)codec_type);
 
+EXIT:
        player_msg_return(api, ret, module);
 
        return ret;
 }
 
-int player_disp_get_video_codec_type(muse_module_h module)
+int player_disp_get_codec_type(muse_module_h module)
 {
        int ret = PLAYER_ERROR_NONE;
        muse_player_handle_s *muse_player = NULL;
-       muse_player_api_e api = MUSE_PLAYER_API_GET_VIDEO_CODEC_TYPE;
-       player_video_codec_type_e type = 0;
+       muse_player_api_e api = MUSE_PLAYER_API_GET_CODEC_TYPE;
+       int stream_type = 0;
+       player_codec_type_e codec_type = 0;
 
        muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
+       player_msg_get(stream_type, muse_server_module_get_msg(module));
 
-       ret = legacy_player_get_video_codec_type(muse_player->player_handle, &type);
+       ret = legacy_player_get_codec_type(muse_player->player_handle, (player_stream_type_e)stream_type, &codec_type);
 
-       player_msg_return1(api, ret, module, INT, type);
+       player_msg_return1(api, ret, module, INT, codec_type);
 
        return ret;
 }
-
index 41aa087..d0c2b17 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mmsvc-player
 Summary:    A Media Player module for muse server
-Version:    0.2.68
+Version:    0.2.69
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0