summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEunhye Choi <eunhae1.choi@samsung.com>2023-06-23 18:40:13 +0900
committerEunhye Choi <eunhae1.choi@samsung.com>2023-06-29 10:54:08 +0900
commit31cfe3a00e9955275e94964ad4e79d092702eb6a (patch)
tree839cb130edf8bd3317162c5f6030c9a31bea3b10
parent49372524f6b2a0a4da568a1a22a06f257f1bc668 (diff)
downloadplayer-tizen_8.0.tar.gz
player-tizen_8.0.tar.bz2
player-tizen_8.0.zip
- Version : 0.3.157 - New functions : int player_set_video_codec_type(player_h player, player_codec_type_e codec_type); : int player_get_video_codec_type(player_h player, player_codec_type_e *codec_type); Change-Id: I9b0d7f123000b1f8cc728219fce45cd9cb299ad3
-rw-r--r--include/player.h37
-rw-r--r--packaging/capi-media-player.spec2
-rw-r--r--src/player.c46
-rw-r--r--test/player_test.c75
4 files changed, 113 insertions, 47 deletions
diff --git a/include/player.h b/include/player.h
index 13096a0..1b2ad89 100644
--- a/include/player.h
+++ b/include/player.h
@@ -2816,7 +2816,7 @@ int player_audio_offload_is_activated(player_h player, bool *activated);
* @remarks If selected H/W audio codec type does not support in some cases,
* S/W audio codec type could be used instead.\n
* @remarks If application use the H/W audio codec type by default,
- * following functions should be called after setting codec type
+ * following functions have to be called after setting codec type
* because the availability could be changed depending on the codec capability. :\n
* player_audio_effect_equalizer_is_available()\n
* player_set_media_packet_audio_frame_decoded_cb()\n
@@ -2856,6 +2856,39 @@ int player_set_audio_codec_type(player_h player, player_codec_type_e codec_type)
int player_get_audio_codec_type(player_h player, player_codec_type_e *codec_type);
/**
+ * @brief Sets the default codec type of the video decoder.
+ * @since_tizen 8.0
+ * @remarks The default codec type could be different depending on the device capability.
+ * 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
+ * @retval #PLAYER_ERROR_NOT_SUPPORTED_VIDEO_CODEC Not supported video codec type
+ * @pre The player state must be #PLAYER_STATE_IDLE by player_create() or player_unprepare().
+ * @see player_get_video_codec_type()
+ */
+int player_set_video_codec_type(player_h player, player_codec_type_e codec_type);
+
+/**
+ * @brief Gets the default codec type of the video decoder.
+ * @since_tizen 8.0
+ * @param[in] player The handle to the media player
+ * @param[out] codec_type The default 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
+ * @see player_set_video_codec_type()
+ */
+int player_get_video_codec_type(player_h player, player_codec_type_e *codec_type);
+
+/**
* @}
*/
@@ -3004,7 +3037,7 @@ int player_360_is_enabled(player_h player, bool *enabled);
* @details This function is to set horizontal (yaw) and vertical (pitch) angles
* of current direction of view in radians. Default direction of view
* is taken from meta-data stored in the media. If meta-data omits
- * these values, zeros are assumed to be equal to the centre of the
+ * these values, zeros are assumed to be equal to the center of the
* panorama image.
* @since_tizen 5.0
* @remarks This function is related to the following features:\n
diff --git a/packaging/capi-media-player.spec b/packaging/capi-media-player.spec
index eb14a62..0a201d6 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.156
+Version: 0.3.157
Release: 0
Group: Multimedia/API
License: Apache-2.0
diff --git a/src/player.c b/src/player.c
index 0e55b5d..ea82154 100644
--- a/src/player.c
+++ b/src/player.c
@@ -5541,3 +5541,49 @@ int player_get_audio_codec_type(player_h player, player_codec_type_e *codec_type
LOGD("LEAVE codec: %d", *codec_type);
return ret;
}
+
+int player_set_video_codec_type(player_h player, player_codec_type_e codec_type)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_RANGE_ARG_CHECK(codec_type, PLAYER_CODEC_TYPE_HW, PLAYER_CODEC_TYPE_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(player_h player, player_codec_type_e *codec_type)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(codec_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 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(type, ret_buf);
+ *codec_type = (player_codec_type_e)type;
+ }
+
+ g_free(ret_buf);
+ LOGD("LEAVE codec: %d", *codec_type);
+ return ret;
+}
diff --git a/test/player_test.c b/test/player_test.c
index 8356b66..83b32c7 100644
--- a/test/player_test.c
+++ b/test/player_test.c
@@ -175,8 +175,8 @@ enum {
CURRENT_STATUS_VIDEO360_SET_ZOOM_WITH_FOV,
CURRENT_STATUS_VIDEO360_SET_ZOOM_WITH_FOV1,
CURRENT_STATUS_VIDEO360_SET_ZOOM_WITH_FOV2,
- CURRENT_STATUS_SET_VIDEO_CODEC_TYPE,
- CURRENT_STATUS_SET_AUDIO_CODEC_TYPE,
+ CURRENT_STATUS_SET_STREAM_TYPE_FOR_CODEC_TYPE,
+ CURRENT_STATUS_SET_CODEC_TYPE,
CURRENT_STATUS_GET_CODEC_TYPE,
CURRENT_STATUS_REPLAYGAIN_ENABLE,
CURRENT_STATUS_AUDIO_OFFLOAD,
@@ -1535,39 +1535,29 @@ static void get_duration()
g_print(" ==> [Player_Test] Duration: [%d ] msec\n", duration);
}
-static void set_video_codec_type(int codec_type)
+static void set_codec_type(int stream_type, int codec_type)
{
int ret;
- ret = player_set_video_codec_type_ex(g_player[0], codec_type);
- g_print(" ==> [Player_Test] video codec type (%d) return: %d\n", codec_type, ret);
-
-}
-
-static void set_audio_codec_type(int codec_type)
-{
- int ret;
-
- ret = player_set_audio_codec_type(g_player[0], codec_type);
- g_print(" ==> [Player_Test] audio codec type (%d) return: %d\n", codec_type, ret);
+ if (stream_type == 0)
+ ret = player_set_video_codec_type(g_player[0], (player_codec_type_e)codec_type);
+ else
+ ret = player_set_audio_codec_type(g_player[0], (player_codec_type_e)codec_type);
+ g_print(" ==> [Player_Test] set codec type [%d][%d][ret 0x%X]\n", stream_type, codec_type, ret);
}
static void get_codec_type(int stream_type)
{
int ret;
- int type = 0;
+ player_codec_type_e codec_type = PLAYER_CODEC_TYPE_SW;
- if (stream_type == 1) {
- player_video_codec_type_ex_e vtype = PLAYER_VIDEO_CODEC_TYPE_EX_DEFAULT;
- ret = player_get_video_codec_type_ex(g_player[0], &vtype);
- type = vtype;
- } else {
- player_codec_type_e atype = PLAYER_CODEC_TYPE_SW;
- ret = player_get_audio_codec_type(g_player[0], &atype);
- type = atype;
- }
- g_print(" ==> [Player_Test] Codec type: [%d][ret 0x%X]\n", type, ret);
+ if (stream_type == 0)
+ ret = player_get_video_codec_type(g_player[0], &codec_type);
+ else
+ ret = player_get_audio_codec_type(g_player[0], &codec_type);
+
+ g_print(" ==> [Player_Test] get codec type: [%d][%d][ret 0x%X]\n", stream_type, codec_type, ret);
}
static void get_stream_info()
@@ -2515,12 +2505,6 @@ void _interpret_main_menu(char *cmd)
g_menu_state = CURRENT_STATUS_SET_AUDIO_ONLY;
} else if (strncmp(cmd, "bf", 2) == 0) {
g_menu_state = CURRENT_STATUS_SET_PRE_BUFFERING_SIZE;
- } else if (strncmp(cmd, "C1", 2) == 0) {
- g_menu_state = CURRENT_STATUS_SET_VIDEO_CODEC_TYPE;
- } else if (strncmp(cmd, "C2", 2) == 0) {
- g_menu_state = CURRENT_STATUS_SET_AUDIO_CODEC_TYPE;
- } else if (strncmp(cmd, "C3", 2) == 0) {
- g_menu_state = CURRENT_STATUS_GET_CODEC_TYPE;
} else if (!strncmp(cmd, "si", 2)) {
video360_is_spherical();
} else if (!strncmp(cmd, "se", 2)) {
@@ -2552,6 +2536,10 @@ void _interpret_main_menu(char *cmd)
is_replaygain_enabled(&enable);
} else if (!strncmp(cmd, "szz", 3)) {
g_menu_state = CURRENT_STATUS_VIDEO360_SET_ZOOM_WITH_FOV;
+ } else if (strncmp(cmd, "sct", 3) == 0) {
+ g_menu_state = CURRENT_STATUS_SET_STREAM_TYPE_FOR_CODEC_TYPE;
+ } else if (strncmp(cmd, "gct", 3) == 0) {
+ g_menu_state = CURRENT_STATUS_GET_CODEC_TYPE;
} else {
g_print("unknown menu \n");
}
@@ -2607,8 +2595,8 @@ void display_sub_basic()
g_print("[Track] tg. Get Track info\n");
g_print("[Track] ts. Set track\n");
g_print("[Video Capture] C. Capture \n");
- g_print("[Video Codec] C1. Set codec type (1:HW, 2:SW)\t");
- g_print("C2. Get codec type\n");
+ g_print("[Codec Type] sct. Set codec type\t");
+ g_print("gct. Get codec type\n");
g_print("[next uri] su. set next uri. \t");
g_print("gu. get next uri. \t");
g_print("sg. set gapless. \n");
@@ -2713,12 +2701,12 @@ static void displaymenu()
g_print("*** input horizontal field of view angle (1~360 deg.)\n");
} else if (g_menu_state == CURRENT_STATUS_VIDEO360_SET_ZOOM_WITH_FOV2) {
g_print("*** input vertical field of view angle (1~180 deg.)\n");
- } else if (g_menu_state == CURRENT_STATUS_SET_VIDEO_CODEC_TYPE) {
- g_print("*** set video codec type (0: HW, 1: SW) \n");
- } else if (g_menu_state == CURRENT_STATUS_SET_AUDIO_CODEC_TYPE) {
- g_print("*** set audio codec type (0: HW, 1: SW) \n");
+ } else if (g_menu_state == CURRENT_STATUS_SET_STREAM_TYPE_FOR_CODEC_TYPE) {
+ g_print("*** set stream type (0: video, 1: audio) \n");
+ } else if (g_menu_state == CURRENT_STATUS_SET_CODEC_TYPE) {
+ g_print("*** set codec type (0: HW, 1: SW) \n");
} else if (g_menu_state == CURRENT_STATUS_GET_CODEC_TYPE) {
- g_print("*** stream type (1: video, 2: audio) \n");
+ g_print("*** stream type (0: video, 1: audio) \n");
} else if (g_menu_state == CURRENT_STATUS_REPLAYGAIN_ENABLE) {
g_print("*** input replaygain value.(0:disable, 1: enable) \n");
} else if (g_menu_state == CURRENT_STATUS_AUDIO_OFFLOAD) {
@@ -3067,17 +3055,16 @@ static void interpret(char *cmd)
reset_menu_state();
}
break;
- case CURRENT_STATUS_SET_VIDEO_CODEC_TYPE:
+ case CURRENT_STATUS_SET_STREAM_TYPE_FOR_CODEC_TYPE:
{
value1 = atoi(cmd);
- set_video_codec_type(value1);
- reset_menu_state();
+ g_menu_state = CURRENT_STATUS_SET_CODEC_TYPE;
}
break;
- case CURRENT_STATUS_SET_AUDIO_CODEC_TYPE:
+ case CURRENT_STATUS_SET_CODEC_TYPE:
{
- value1 = atoi(cmd);
- set_audio_codec_type(value1);
+ value2 = atoi(cmd);
+ set_codec_type(value1, value2);
reset_menu_state();
}
break;