[0.3.123] remove deprecated internal api
[platform/core/api/player.git] / src / player_internal.c
index 94c09f7..7bf25a2 100644 (file)
 #include "player_msg.h"
 #include "player_internal.h"
 
-int player_set_pcm_extraction_mode(player_h player, bool sync, player_audio_pcm_extraction_cb callback, void *user_data)
-{
-       PLAYER_INSTANCE_CHECK(player);
-       PLAYER_NULL_ARG_CHECK(callback);
-       int ret = PLAYER_ERROR_NONE;
-       muse_player_api_e api = MUSE_PLAYER_API_SET_PCM_EXTRACTION_MODE;
-       player_cli_s *pc = (player_cli_s *) player;
-       char *ret_buf = NULL;
-       muse_player_event_e event = MUSE_PLAYER_EVENT_TYPE_AUDIO_FRAME;
-
-       LOGD("ENTER");
-
-       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "sync", sync);
-
-       if (ret == PLAYER_ERROR_NONE) {
-               pc->cb_info->user_cb[event] = callback;
-               pc->cb_info->user_data[event] = user_data;
-               LOGI("Event type : %d ", event);
-       }
-
-       g_free(ret_buf);
-       return ret;
-}
-
-int player_set_pcm_spec(player_h player, const char *format, int samplerate, int channel)
-{
-       PLAYER_INSTANCE_CHECK(player);
-       int ret = PLAYER_ERROR_NONE;
-       muse_player_api_e api = MUSE_PLAYER_API_SET_PCM_SPEC;
-       player_cli_s *pc = (player_cli_s *) player;
-       char *ret_buf = NULL;
-
-       LOGD("ENTER");
-
-       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
-                                       MUSE_TYPE_STRING, "format", format,
-                                       MUSE_TYPE_INT, "samplerate", samplerate,
-                                       MUSE_TYPE_INT, "channel", channel);
-
-       g_free(ret_buf);
-       return ret;
-}
-
 int player_set_streaming_playback_rate(player_h player, float rate)
 {
        PLAYER_INSTANCE_CHECK(player);
        int ret = PLAYER_ERROR_NONE;
        muse_player_api_e api = MUSE_PLAYER_API_SET_STREAMING_PLAYBACK_RATE;
-       player_cli_s *pc = (player_cli_s *) player;
+       player_cli_s *pc = (player_cli_s *)player;
        char *ret_buf = NULL;
 
        LOGD("ENTER");
@@ -89,7 +46,7 @@ int player_set_media_stream_buffer_status_cb_ex(player_h player, player_stream_t
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(callback);
        int ret = PLAYER_ERROR_NONE;
-       player_cli_s *pc = (player_cli_s *) player;
+       player_cli_s *pc = (player_cli_s *)player;
        muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK;
        char *ret_buf = NULL;
        muse_player_event_e type;
@@ -97,11 +54,11 @@ int player_set_media_stream_buffer_status_cb_ex(player_h player, player_stream_t
 
        LOGD("ENTER");
 
-       if (stream_type == PLAYER_STREAM_TYPE_VIDEO)
+       if (stream_type == PLAYER_STREAM_TYPE_VIDEO) {
                type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO;
-       else if (stream_type == PLAYER_STREAM_TYPE_AUDIO)
+       } else if (stream_type == PLAYER_STREAM_TYPE_AUDIO) {
                type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO;
-       else {
+       else {
                LOGE("PLAYER_ERROR_INVALID_PARAMETER(type : %d)", stream_type);
                return PLAYER_ERROR_INVALID_PARAMETER;
        }
@@ -118,7 +75,7 @@ int player_set_media_stream_buffer_status_cb_ex(player_h player, player_stream_t
        return ret;
 }
 
-static void set_null_user_cb(callback_cb_info_s * cb_info, muse_player_event_e event)
+static void set_null_user_cb(callback_cb_info_s *cb_info, muse_player_event_e event)
 {
        if (cb_info && event < MUSE_PLAYER_EVENT_TYPE_NUM) {
                cb_info->user_cb[event] = NULL;
@@ -126,7 +83,7 @@ static void set_null_user_cb(callback_cb_info_s * cb_info, muse_player_event_e e
        }
 }
 
-static void set_null_user_cb_lock(callback_cb_info_s * cb_info, muse_player_event_e event)
+static void set_null_user_cb_lock(callback_cb_info_s *cb_info, muse_player_event_e event)
 {
        bool lock = g_thread_self() != cb_info->event_queue.thread;
 
@@ -143,7 +100,7 @@ int player_unset_media_stream_buffer_status_cb_ex(player_h player, player_stream
 {
        PLAYER_INSTANCE_CHECK(player);
        int ret = PLAYER_ERROR_NONE;
-       player_cli_s *pc = (player_cli_s *) player;
+       player_cli_s *pc = (player_cli_s *)player;
        muse_player_api_e api = MUSE_PLAYER_API_SET_CALLBACK;
        char *ret_buf = NULL;
        muse_player_event_e type;
@@ -151,11 +108,11 @@ int player_unset_media_stream_buffer_status_cb_ex(player_h player, player_stream
 
        LOGD("ENTER");
 
-       if (stream_type == PLAYER_STREAM_TYPE_VIDEO)
+       if (stream_type == PLAYER_STREAM_TYPE_VIDEO) {
                type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_VIDEO_BUFFER_STATUS_WITH_INFO;
-       else if (stream_type == PLAYER_STREAM_TYPE_AUDIO)
+       } else if (stream_type == PLAYER_STREAM_TYPE_AUDIO) {
                type = MUSE_PLAYER_EVENT_TYPE_MEDIA_STREAM_AUDIO_BUFFER_STATUS_WITH_INFO;
-       else {
+       else {
                LOGE("PLAYER_ERROR_INVALID_PARAMETER(type : %d)", stream_type);
                return PLAYER_ERROR_INVALID_PARAMETER;
        }
@@ -173,7 +130,7 @@ int player_set_media_stream_dynamic_resolution(player_h player, bool drc)
        PLAYER_INSTANCE_CHECK(player);
        int ret = PLAYER_ERROR_NONE;
        muse_player_api_e api = MUSE_PLAYER_API_SET_MEDIA_STREAM_DYNAMIC_RESOLUTION;
-       player_cli_s *pc = (player_cli_s *) player;
+       player_cli_s *pc = (player_cli_s *)player;
        char *ret_buf = NULL;
 
        LOGD("ENTER");
@@ -188,13 +145,13 @@ int player_set_ecore_wl_display(player_h player, player_display_type_e type, voi
        PLAYER_INSTANCE_CHECK(player);
        int ret = PLAYER_ERROR_NONE;
        muse_player_api_e api = MUSE_PLAYER_API_SET_DISPLAY;
-       player_cli_s *pc = (player_cli_s *) player;
+       player_cli_s *pc = (player_cli_s *)player;
        char *ret_buf = NULL;
        wl_win_msg_type wl_win;
        char *wl_win_msg = (char *)&wl_win;
-       unsigned int wl_surface_id;
+       int wl_surface_id;
        player_private_display_type_e conv_type;
-       unsigned int (*p_disp_set_wl_display)(int, void *) = NULL;
+       int (*p_disp_set_wl_display)(int, void *) = NULL;
        int arr_msg_len = 0;
 
        LOGD("ENTER");
@@ -214,13 +171,15 @@ int player_set_ecore_wl_display(player_h player, player_display_type_e type, voi
        PLAYER_DISP_DLSYM(pc->dl_handle, p_disp_set_wl_display, "disp_set_wl_display");
        wl_surface_id = p_disp_set_wl_display(ECORE_WAYLAND_WIN, ecore_wl2_window);
        if (wl_surface_id > 0) {
-               wl_win.wl_surface_id = wl_surface_id;
+               wl_win.surface_id = wl_surface_id;
                wl_win.type = conv_type;
-       } else return PLAYER_ERROR_INVALID_OPERATION;
+       } else {
+               return PLAYER_ERROR_INVALID_OPERATION;
+       }
 
        arr_msg_len = (sizeof(wl_win_msg_type) / sizeof(int) + (sizeof(wl_win_msg_type) % sizeof(int) ? 1 : 0));
        PLAYER_SEND_MSG(api, pc, ret_buf, ret,
-                                       MUSE_TYPE_ARRAY, "wl_win_msg", arr_msg_len, (int*)wl_win_msg);
+                                       MUSE_TYPE_ARRAY, "wl_win_msg", arr_msg_len, (int *)wl_win_msg);
        g_free(ret_buf);
 
        return ret;
@@ -232,7 +191,7 @@ int player_set_next_uri(player_h player, const char *uri)
        PLAYER_NULL_ARG_CHECK(uri);
        int ret = PLAYER_ERROR_NONE;
        muse_player_api_e api = MUSE_PLAYER_API_SET_NEXT_URI;
-       player_cli_s *pc = (player_cli_s *) player;
+       player_cli_s *pc = (player_cli_s *)player;
        char *ret_buf = NULL;
        char path[MAX_URL_LEN] = {0, };
 
@@ -253,7 +212,7 @@ int player_get_next_uri(player_h player, char **uri)
        PLAYER_NULL_ARG_CHECK(uri);
        int ret = PLAYER_ERROR_NONE;
        muse_player_api_e api = MUSE_PLAYER_API_GET_NEXT_URI;
-       player_cli_s *pc = (player_cli_s *) player;
+       player_cli_s *pc = (player_cli_s *)player;
        char *ret_buf = NULL;
        char next_uri[MUSE_MSG_MAX_LENGTH] = { 0, };
 
@@ -282,7 +241,7 @@ int player_set_gapless(player_h player, bool gapless)
        PLAYER_INSTANCE_CHECK(player);
        int ret = PLAYER_ERROR_NONE;
        muse_player_api_e api = MUSE_PLAYER_API_SET_GAPLESS;
-       player_cli_s *pc = (player_cli_s *) player;
+       player_cli_s *pc = (player_cli_s *)player;
        char *ret_buf = NULL;
 
        LOGD("ENTER");
@@ -298,7 +257,7 @@ int player_is_gapless(player_h player, bool *gapless)
        PLAYER_NULL_ARG_CHECK(gapless);
        int ret = PLAYER_ERROR_NONE;
        muse_player_api_e api = MUSE_PLAYER_API_IS_GAPLESS;
-       player_cli_s *pc = (player_cli_s *) player;
+       player_cli_s *pc = (player_cli_s *)player;
        char *ret_buf = NULL;
        int value = 0;
 
@@ -317,7 +276,7 @@ int player_enable_tsurf_pool(player_h player, bool enable)
 {
        PLAYER_INSTANCE_CHECK(player);
        int ret = PLAYER_ERROR_NONE;
-       player_cli_s *pc = (player_cli_s *) player;
+       player_cli_s *pc = (player_cli_s *)player;
 
        LOGD("ENTER enable:%d", enable);
 
@@ -336,7 +295,7 @@ int player_is_enabled_tsurf_pool(player_h player, bool *enabled)
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(enabled);
        int ret = PLAYER_ERROR_NONE;
-       player_cli_s *pc = (player_cli_s *) player;
+       player_cli_s *pc = (player_cli_s *)player;
 
        LOGD("ENTER");
        if (pc && pc->cb_info) {
@@ -356,7 +315,7 @@ int player_get_media_packet_video_frame_pool_size(player_h player, int *size)
 
        int ret = PLAYER_ERROR_NONE;
        muse_player_api_e api = MUSE_PLAYER_API_GET_MEDIA_PACKET_VIDEO_FRAME_POOL_SIZE;
-       player_cli_s *pc = (player_cli_s *) player;
+       player_cli_s *pc = (player_cli_s *)player;
        char *ret_buf = NULL;
        int value = 0;
 
@@ -378,30 +337,30 @@ int player_enable_media_packet_video_frame_decoded_cb(player_h player, bool enab
        PLAYER_INSTANCE_CHECK(player);
        int ret = PLAYER_ERROR_NONE;
        muse_player_api_e api = MUSE_PLAYER_API_ENABLE_MEDIA_PACKET_VIDEO_FRAME_DECODED_CB;
-       player_cli_s *pc = (player_cli_s *) player;
+       player_cli_s *pc = (player_cli_s *)player;
        char *ret_buf = NULL;
 
-       LOGD("ENTER");
+       LOGD("ENTER %d", enable);
 
        PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "enable", enable);
        g_free(ret_buf);
        return ret;
 }
 
-int player_set_video_codec_type(player_h player, player_video_codec_type_e codec_type)
+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;
+       player_cli_s *pc = (player_cli_s *)player;
        char *ret_buf = NULL;
-       int stream_type = PLAYER_STREAM_TYPE_VIDEO;
 
-       LOGD("ENTER %d", codec_type);
+       LOGD("ENTER codec: %d", codec_type);
 
        PLAYER_SEND_MSG(api, pc, ret_buf, ret,
-                                       MUSE_TYPE_INT, "stream_type", stream_type,
+                                       MUSE_TYPE_INT, "stream_type", PLAYER_STREAM_TYPE_VIDEO,
                                        MUSE_TYPE_INT, "codec_type", codec_type);
 
        g_free(ret_buf);
@@ -409,73 +368,26 @@ int player_set_video_codec_type(player_h player, player_video_codec_type_e codec
        return ret;
 }
 
-int player_get_video_codec_type(player_h player, player_video_codec_type_e *pcodec_type)
+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;
+       player_cli_s *pc = (player_cli_s *)player;
        char *ret_buf = NULL;
-       int stream_type = PLAYER_STREAM_TYPE_VIDEO;
        int codec_type = 0;
 
        LOGD("ENTER");
 
-       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "stream_type", stream_type);
+       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");
-       return ret;
-}
-
-int player_set_codec_type(player_h player, player_stream_type_e stream_type, player_codec_type_e codec_type)
-{
-       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");
-
-       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 stream: %d, codec: %d", stream_type, codec_type);
-
-       PLAYER_SEND_MSG(api, pc, ret_buf, ret,
-                                       MUSE_TYPE_INT, "stream_type", stream_type,
-                                       MUSE_TYPE_INT, "codec_type", codec_type);
-
-       g_free(ret_buf);
-       LOGD("LEAVE");
-       return ret;
-}
-
-int player_get_codec_type(player_h player, player_stream_type_e stream_type, player_codec_type_e *pcodec_type)
-{
-       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");
-
-       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 stream_type: %d", stream_type);
-
-       PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "stream_type", stream_type);
-       if (ret == PLAYER_ERROR_NONE) {
-               player_msg_get(codec_type, ret_buf);
-               *pcodec_type = codec_type;
-       }
-
-       g_free(ret_buf);
-       LOGD("LEAVE");
+       LOGD("LEAVE codec: %d", *pcodec_type);
        return ret;
 }