From c361ef13507ec30d604e20fdf4c614efecb1c2db Mon Sep 17 00:00:00 2001 From: Eunhye Choi Date: Thu, 29 Aug 2019 19:27:07 +0900 Subject: [PATCH] [0.3.122] Add internal API to set video codec type - setting audio codec type will be released in public - add setting video codec type api - the original internal api about codec type will be removed Change-Id: I0c2145e73e271ca9a843e4070074dfae918f6087 --- include/player_internal.h | 46 ++++++++++++++++++++++++++++++++++----- packaging/capi-media-player.spec | 2 +- src/player_internal.c | 47 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 7 deletions(-) diff --git a/include/player_internal.h b/include/player_internal.h index e0d510b..5464107 100644 --- a/include/player_internal.h +++ b/include/player_internal.h @@ -40,10 +40,10 @@ typedef enum { * @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_VIDEO_CODEC_TYPE_EX_DEFAULT = 0, /**< This is an optional flag for using codec which has higher priority */ + PLAYER_VIDEO_CODEC_TYPE_EX_HW, /**< This is an optional flag for using the h/w codec */ + PLAYER_VIDEO_CODEC_TYPE_EX_SW, /**< This is an optional flag for using the s/w codec */ +} player_video_codec_type_ex_e; /** * @brief Enumeration for codec type. @@ -495,7 +495,7 @@ int player_enable_media_packet_video_frame_decoded_cb(player_h player, bool enab * @pre The player state must be #PLAYER_STATE_IDLE by player_create() or player_unprepare(). * @see player_get_codec_type() */ -int player_set_codec_type(player_h player, player_stream_type_e stream_type, player_codec_type_e codec_type); +int player_set_codec_type(player_h player, player_stream_type_e stream_type, player_codec_type_e codec_type); /* Deprecated */ /** * @brief Get video codec type. @@ -512,7 +512,41 @@ int player_set_codec_type(player_h player, player_stream_type_e stream_type, pla * @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 player_get_codec_type(player_h player, player_stream_type_e stream_type, player_codec_type_e *pcodec_type); +int player_get_codec_type(player_h player, player_stream_type_e stream_type, player_codec_type_e *pcodec_type); /* Deprecated */ + +/** + * @brief Set video codec type as h/w codec or s/w codec. + * @since_tizen 5.5 + * @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] 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_video_codec_type_ex() + */ +int player_set_video_codec_type_ex(player_h player, player_video_codec_type_ex_e codec_type); + +/** + * @brief Get video codec type. + * @since_tizen 5.5 + * @param[in] player The handle to the media player + * @param[out] 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 one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. + * @see player_set_video_codec_type_ex() + */ +int player_get_video_codec_type_ex(player_h player, player_video_codec_type_ex_e *codec_type); #ifdef __cplusplus } diff --git a/packaging/capi-media-player.spec b/packaging/capi-media-player.spec index cf87fa9..da58586 100644 --- a/packaging/capi-media-player.spec +++ b/packaging/capi-media-player.spec @@ -1,6 +1,6 @@ Name: capi-media-player Summary: A Media Player API -Version: 0.3.121 +Version: 0.3.122 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/player_internal.c b/src/player_internal.c index b45b26d..bd74f17 100644 --- a/src/player_internal.c +++ b/src/player_internal.c @@ -347,6 +347,7 @@ int player_enable_media_packet_video_frame_decoded_cb(player_h player, bool enab return ret; } +/* Deprecated */ int player_set_codec_type(player_h player, player_stream_type_e stream_type, player_codec_type_e codec_type) { PLAYER_INSTANCE_CHECK(player); @@ -368,6 +369,7 @@ int player_set_codec_type(player_h player, player_stream_type_e stream_type, pla return ret; } +/* Deprecated */ int player_get_codec_type(player_h player, player_stream_type_e stream_type, player_codec_type_e *pcodec_type) { PLAYER_INSTANCE_CHECK(player); @@ -392,3 +394,48 @@ int player_get_codec_type(player_h player, player_stream_type_e stream_type, pla LOGD("LEAVE"); return ret; } + +int player_set_video_codec_type_ex(player_h player, player_video_codec_type_ex_e codec_type) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_RANGE_ARG_CHECK(codec_type, PLAYER_VIDEO_CODEC_TYPE_EX_DEFAULT, PLAYER_VIDEO_CODEC_TYPE_EX_SW); + + int ret = PLAYER_ERROR_NONE; + muse_player_api_e api = MUSE_PLAYER_API_SET_CODEC_TYPE; + player_cli_s *pc = (player_cli_s *)player; + char *ret_buf = NULL; + + LOGD("ENTER codec: %d", codec_type); + + PLAYER_SEND_MSG(api, pc, ret_buf, ret, + MUSE_TYPE_INT, "stream_type", PLAYER_STREAM_TYPE_VIDEO, + MUSE_TYPE_INT, "codec_type", codec_type); + + g_free(ret_buf); + LOGD("LEAVE"); + return ret; +} + +int player_get_video_codec_type_ex(player_h player, player_video_codec_type_ex_e *pcodec_type) +{ + PLAYER_INSTANCE_CHECK(player); + PLAYER_NULL_ARG_CHECK(pcodec_type); + + int ret = PLAYER_ERROR_NONE; + muse_player_api_e api = MUSE_PLAYER_API_GET_CODEC_TYPE; + player_cli_s *pc = (player_cli_s *)player; + char *ret_buf = NULL; + int codec_type = 0; + + LOGD("ENTER"); + + PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "stream_type", PLAYER_STREAM_TYPE_VIDEO); + if (ret == PLAYER_ERROR_NONE) { + player_msg_get(codec_type, ret_buf); + *pcodec_type = codec_type; + } + + g_free(ret_buf); + LOGD("LEAVE codec: %d", *pcodec_type); + return ret; +} -- 2.7.4