Support using wl_surface for legacy_player_test 52/60552/1
authorHyunil <hyunil46.park@samsung.com>
Mon, 29 Feb 2016 03:23:33 +0000 (12:23 +0900)
committerHyunil <hyunil46.park@samsung.com>
Mon, 29 Feb 2016 03:23:33 +0000 (12:23 +0900)
Change-Id: Ib5dbdea2fee8151d41549a01c74f07ce1e25e667
Signed-off-by: Hyunil <hyunil46.park@samsung.com>
src/mm_player_attrs.c
src/mm_player_priv.c

index a5a6f46..aa598ee 100644 (file)
@@ -753,6 +753,16 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        0,
                        MMPLAYER_MAX_INT
                },
+               {
+                       "use_wl_surface",
+                       MM_ATTRS_TYPE_INT,
+                       MM_ATTRS_FLAG_RW,
+                       (void *) FALSE,
+                       MM_ATTRS_VALID_TYPE_INT_RANGE,
+                       FALSE,
+                       TRUE
+               },
+
 #endif
                {
                        "display_overlay_user_data",
index cefaa51..6c8e2ff 100644 (file)
@@ -4140,23 +4140,51 @@ _mmplayer_update_video_param(mm_player_t* player) // @
                        int wl_window_width = 0;
                        int wl_window_height = 0;
 
+                       /*use wl_surface*/
+                       gboolean use_wl_surface = 0;
+                       void * wl_display = NULL;
+                       GstContext *context = NULL;
+
+                       mm_attrs_get_int_by_name(attrs, "use_wl_surface", &use_wl_surface);
+                       if (use_wl_surface)
+                       {
+                               mm_attrs_get_data_by_name(attrs, "wl_display", &wl_display);
+                               if (wl_display)
+                                       context = gst_wayland_display_handle_context_new(wl_display);
+                               if (context)
+                                       gst_element_set_context(GST_ELEMENT(player->pipeline->videobin[MMPLAYER_V_SINK].gst), context);
+                       }
+
                        /*It should be set after setting window*/
                        mm_attrs_get_int_by_name(attrs, "wl_window_render_x", &wl_window_x);
                        mm_attrs_get_int_by_name(attrs, "wl_window_render_y", &wl_window_y);
                        mm_attrs_get_int_by_name(attrs, "wl_window_render_width", &wl_window_width);
                        mm_attrs_get_int_by_name(attrs, "wl_window_render_height", &wl_window_height);
+
 #endif
                        /* common case if using x surface */
                        mm_attrs_get_data_by_name(attrs, "display_overlay", &handle);
                        if ( handle )
                        {
 #ifdef HAVE_WAYLAND
-                               unsigned int wl_surface_id  = 0;
-                               wl_surface_id = *(int*)handle;
-                               LOGD("set video param : wl_surface_id %d %p", wl_surface_id, *(int*)handle);
-                               gst_video_overlay_set_wl_window_wl_surface_id(
-                                               GST_VIDEO_OVERLAY( player->pipeline->videobin[MMPLAYER_V_SINK].gst ),
-                                               *(int*)handle );
+                               if (use_wl_surface) //use wl_surface for legacy_player_test
+                               {
+                                       guintptr wl_surface = (guintptr)handle;
+                                       LOGD("[use wl_surface for legacy_player_test] set video param : wayland surface %p", handle);
+                                       gst_video_overlay_set_window_handle(
+                                                       GST_VIDEO_OVERLAY( player->pipeline->videobin[MMPLAYER_V_SINK].gst ),
+                                                       wl_surface );
+                               }
+                               else /*default is using wl_surface_id*/
+                               {
+                                       unsigned int wl_surface_id  = 0;
+                                       wl_surface_id = *(int*)handle;
+                                       LOGD("set video param : wl_surface_id %d %p", wl_surface_id, *(int*)handle);
+                                       gst_video_overlay_set_wl_window_wl_surface_id(
+                                                       GST_VIDEO_OVERLAY( player->pipeline->videobin[MMPLAYER_V_SINK].gst ),
+                                                       *(int*)handle );
+                               }
+
                                /* After setting window handle, set render      rectangle */
                                gst_video_overlay_set_render_rectangle(
                                         GST_VIDEO_OVERLAY( player->pipeline->videobin[MMPLAYER_V_SINK].gst ),