[v0.3.35][wearable][ACR-845] move evas type enum for backward compatibility 28/99828/3
authorEunhae Choi <eunhae1.choi@samsung.com>
Thu, 24 Nov 2016 07:57:43 +0000 (16:57 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Fri, 25 Nov 2016 10:16:08 +0000 (19:16 +0900)
Change-Id: Ibf0b44e6b09c0c8d04d904b858c284e5faaecb39
Signed-off-by: Eunhae Choi <eunhae1.choi@samsung.com>
include/player_private.h
include/wearable/player.h
packaging/capi-media-player.spec
src/player.c
src/player_internal.c

index c5e7fc9fa19a6961418156f8c7e119f087cc6232..9379a00df3d293419bf55e12434420efc0185726 100644 (file)
@@ -52,6 +52,15 @@ extern "C" {
 #define MAX_SERVER_TIME_OUT 35000 /* ms */
 #define MAX_URL_LEN    2048    /**< Maximum length of the maximum URL */
 
+/**
+ * @brief Enumeration for private display type
+ */
+typedef enum {
+       PLAYER_PRIVATE_DISPLAY_TYPE_OVERLAY = 0,    /**< Overlay surface display */
+       PLAYER_PRIVATE_DISPLAY_TYPE_EVAS,           /**< Evas image object surface display */
+       PLAYER_PRIVATE_DISPLAY_TYPE_NONE,           /**< This disposes off buffers */
+} player_private_display_type_e;
+
 typedef struct _ret_msg_s {
        gint api;
        gchar *msg;
@@ -167,6 +176,7 @@ typedef struct _player_cli_s {
 
 int client_get_api_timeout(player_cli_s * pc, muse_player_api_e api);
 int client_wait_for_cb_return(muse_player_api_e api, callback_cb_info_s * cb_info, char **ret_buf, int time_out);
+int _player_convert_display_type (player_display_type_e type, player_private_display_type_e *out_type);
 
 #ifdef __cplusplus
 }
index 33211d663776392d925d404c0802515348c67c11..ab67a1124165e18e8b97fc5714396451480c7227 100644 (file)
@@ -117,8 +117,8 @@ typedef enum {
  */
 typedef enum {
        PLAYER_DISPLAY_TYPE_OVERLAY = 0,    /**< Overlay surface display */
-       PLAYER_DISPLAY_TYPE_EVAS,                       /**< Evas image object surface display (Since 3.0)*/
        PLAYER_DISPLAY_TYPE_NONE,           /**< This disposes off buffers */
+       PLAYER_DISPLAY_TYPE_EVAS,           /**< Evas image object surface display (Since 3.0)*/
 } player_display_type_e;
 
 /**
index b97efc7898cfc0c4bbe6c3b8484c8660e4a273e3..484933f55b97a48ddf0380b3dde4ed64b64c4888 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-player
 Summary:    A Media Player API
-Version:    0.3.34
+Version:    0.3.35
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 549d4a72fc3a52d6acea9256f123f8288e6494ad..148ef234f380abe240865c652c778ea005425bb5 100644 (file)
@@ -118,14 +118,15 @@ int _player_media_packet_finalize(media_packet_h pkt, int error_code, void *user
                }
        }
 
-       packet = fin_data->remote_pkt;
-       snd_msg = muse_core_msg_json_factory_new(api, MUSE_TYPE_POINTER, "packet", packet, 0);
-       snd_len = muse_core_ipc_send_msg(fin_data->fd, snd_msg);
-       muse_core_msg_json_factory_free(snd_msg);
-
-       if (snd_len <= 0)
-               LOGE("fail to send msg.");
+       if (muse_core_ipc_fd_is_valid(fin_data->fd)) {
+               packet = fin_data->remote_pkt;
+               snd_msg = muse_core_msg_json_factory_new(api, MUSE_TYPE_POINTER, "packet", packet, 0);
+               snd_len = muse_core_ipc_send_msg(fin_data->fd, snd_msg);
+               muse_core_msg_json_factory_free(snd_msg);
 
+               if (snd_len <= 0)
+                       LOGE("fail to send msg.");
+       }
 EXIT:
        if (fin_data) {
                g_free(fin_data);
@@ -2344,6 +2345,30 @@ int player_get_duration(player_h player, int *pduration)
        return ret;
 }
 
+/* The player_display_type_e is different at wearable profile */
+int _player_convert_display_type (player_display_type_e type, player_private_display_type_e *out_type)
+{
+       int ret = PLAYER_ERROR_NONE;
+
+       switch (type) {
+       case PLAYER_DISPLAY_TYPE_OVERLAY:
+               *out_type = PLAYER_PRIVATE_DISPLAY_TYPE_OVERLAY;
+               break;
+       case PLAYER_DISPLAY_TYPE_EVAS:
+               *out_type = PLAYER_PRIVATE_DISPLAY_TYPE_EVAS;
+               break;
+       case PLAYER_DISPLAY_TYPE_NONE:
+               *out_type = PLAYER_PRIVATE_DISPLAY_TYPE_NONE;
+               break;
+       default:
+               ret = PLAYER_ERROR_INVALID_PARAMETER;
+               break;
+       }
+
+       LOGD("display type(%d) => (%d)", type, out_type);
+       return ret;
+}
+
 int player_set_display(player_h player, player_display_type_e type, player_display_h display)
 {
        PLAYER_INSTANCE_CHECK(player);
@@ -2360,6 +2385,8 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
        struct wl_display *wl_display;
        Ecore_Wl_Window *wl_window = NULL;
        Evas *e;
+       player_private_display_type_e conv_type;
+
        /* init */
        wl_win.wl_window_x = 0;
        wl_win.wl_window_y = 0;
@@ -2368,17 +2395,22 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
 
        LOGD("ENTER type: %d", type);
 
-       if (type != PLAYER_DISPLAY_TYPE_NONE) {
+       ret = _player_convert_display_type(type, &conv_type);
+       if (ret != PLAYER_ERROR_NONE) {
+               return ret;
+       }
+
+       if (conv_type != PLAYER_PRIVATE_DISPLAY_TYPE_NONE) {
                obj = (Evas_Object *) display;
                if (!obj)
                        return PLAYER_ERROR_INVALID_PARAMETER;
 
                object_type = evas_object_type_get(obj);
                if (object_type) {
-                       if (type == PLAYER_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
+                       if (conv_type == PLAYER_PRIVATE_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
                                /* wayland overlay surface */
                                LOGI("Wayland overlay surface type");
-                               wl_win.type = type;
+                               wl_win.type = conv_type;
 
                                e = evas_object_evas_get(obj);
                                return_val_if_fail(e != NULL, PLAYER_ERROR_INVALID_OPERATION);
@@ -2419,10 +2451,10 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
 
                        }
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
-                       else if (type == PLAYER_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
+                       else if (conv_type == PLAYER_PRIVATE_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
                                /* evas object surface */
                                LOGI("evas surface type");
-                               wl_win.type = type;
+                               wl_win.type = conv_type;
 
                                evas_object_geometry_get(obj, &wl_win.wl_window_x, &wl_win.wl_window_y,
                                        &wl_win.wl_window_width, &wl_win.wl_window_height);
@@ -2475,7 +2507,7 @@ int player_set_display(player_h player, player_display_type_e type, player_displ
                        return PLAYER_ERROR_INVALID_PARAMETER;
        } else {        /* PLAYER_DISPLAY_TYPE_NONE */
                LOGI("Wayland surface type is NONE");
-               wl_win.type = type;
+               wl_win.type = conv_type;
        }
        player_msg_send_array(api, pc, ret_buf, ret, wl_win_msg, sizeof(wl_win_msg_type), sizeof(char));
        g_free(ret_buf);
index 0eb448b862523e6fb1287e99894db5767eb60854..ab84ac1fbc49758ad4ada808cb1d90acef7ba5dd 100644 (file)
@@ -200,10 +200,16 @@ int player_set_ecore_wl_display(player_h player, player_display_type_e type, Eco
        struct wl_surface *wl_surface;
        struct wl_display *wl_display;
        Ecore_Wl_Window *wl_window = NULL;
+       player_private_display_type_e conv_type;
 
        LOGD("ENTER");
-       if (type != PLAYER_DISPLAY_TYPE_OVERLAY) {
-               LOGE("Display type(%d) is not overlay", type);
+       ret = _player_convert_display_type(type, &conv_type);
+       if (ret != PLAYER_ERROR_NONE) {
+               return ret;
+       }
+
+       if (conv_type != PLAYER_PRIVATE_DISPLAY_TYPE_OVERLAY) {
+               LOGE("Display type(%d) is not overlay", conv_type);
                return PLAYER_ERROR_INVALID_PARAMETER;
        }
        if (!ecore_wl_window)
@@ -214,7 +220,7 @@ int player_set_ecore_wl_display(player_h player, player_display_type_e type, Eco
        wl_window = ecore_wl_window;
 
        /* set wl_win */
-       wl_win.type = type;
+       wl_win.type = conv_type;
        wl_win.wl_window_x = x;
        wl_win.wl_window_y = y;
        wl_win.wl_window_width = width;