SET(submodule "screen-mirroring")
# for package file
-SET(dependents "mm-wfd dlog glib-2.0 gio-2.0 capi-base-common capi-network-wifi-direct iniparser")
+SET(dependents "mm-wfd dlog glib-2.0 gio-2.0 capi-base-common capi-network-wifi-direct iniparser mm-display-interface")
SET(fw_name "${project_prefix}-${service}-${submodule}")
*/
typedef void(*scmirroring_state_cb)(scmirroring_error_e error, scmirroring_state_e state, void *user_data);
+/**
+ * @internal
+ * @brief Sets the ecore wayland video display.
+ *
+ * @since_tizen 6.5
+ *
+ * @remarks This function must be called in main thread of the application.
+ * Otherwise, it will return #SCMIRRORING_ERROR_INVALID_OPERATION by internal restriction.
+ * To avoid #SCMIRRORING_ERROR_INVALID_OPERATION in sub thread, ecore_thread_main_loop_begin() and
+ * ecore_thread_main_loop_end() can be used, but deadlock can occur if the main thread is busy.
+ * So, it's not recommended to use them.
+ *
+ * @param[in] scmirroring_sink The handle to the screen mirroring sink
+ * @param[in] display_surface The ecore wayland window handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #SCMIRRORING_ERROR_NONE Successful
+ * @retval #SCMIRRORING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SCMIRRORING_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #SCMIRRORING_ERROR_INVALID_OPERATION Invalid operation
+ *
+ * @pre Create a screen mirroring sink handle by calling scmirroring_sink_create().
+ *
+ * @see scmirroring_sink_create()
+ */
+int scmirroring_sink_set_ecore_wl_display(scmirroring_sink_h scmirroring_sink, void *display_surface);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#include <system_info.h>
#include <scmirroring_internal.h>
#include <mmf/mm_wfd_sink.h>
+#include <mm_display_interface.h>
#ifndef TRUE
#define TRUE 1
int _scmirroring_sink_pause(MMHandleType handle);
int _scmirroring_sink_resume(MMHandleType handle);
int _scmirroring_sink_disconnect(MMHandleType handle);
-int _scmirroring_sink_set_display(MMHandleType handle, scmirroring_display_type_e type, void *display_surface);
+int _scmirroring_sink_set_display(MMHandleType handle, scmirroring_display_type_e type, void *display_surface, mm_display_type_e display_type);
int _scmirroring_sink_set_resolution(MMHandleType handle, int resolution);
int _scmirroring_sink_get_negotiated_video_codec(MMHandleType handle, scmirroring_video_codec_e *codec);
int _scmirroring_sink_get_negotiated_video_resolution(MMHandleType handle, int *width, int *height);
BuildRequires: pkgconfig(elementary)
BuildRequires: pkgconfig(evas)
BuildRequires: pkgconfig(libtzplatform-config)
+BuildRequires: pkgconfig(mm-display-interface)
+BuildRequires: pkgconfig(ecore)
+BuildRequires: pkgconfig(ecore-wl2)
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
scmirroring_retvm_if(!__is_valid_handle(handle), SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_primary_sink is invalid");
- return _scmirroring_sink_set_display(handle->mm_handle, type, display_surface);
+ return _scmirroring_sink_set_display(handle->mm_handle, type, display_surface, MM_DISPLAY_TYPE_OVERLAY);
}
int scmirroring_primary_sink_set_resolution(scmirroring_primary_sink_h scmirroring_primary_sink, int resolution)
scmirroring_retvm_if(!__is_valid_handle(handle), SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is invalid");
- return _scmirroring_sink_set_display(handle->mm_handle, type, display_surface);
+ return _scmirroring_sink_set_display(handle->mm_handle, type, display_surface, MM_DISPLAY_TYPE_OVERLAY);
}
int scmirroring_sink_set_resolution(scmirroring_sink_h scmirroring_sink, int resolution)
--- /dev/null
+/*
+* Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+#include <stdio.h>
+#include <mm.h>
+#include <mm_types.h>
+#include <mmf/mm_wfd_sink.h>
+#include <scmirroring_sink.h>
+#include <scmirroring_internal.h>
+#include <scmirroring_private.h>
+
+static gboolean __is_valid_handle(scmirroring_sink_s *handle)
+{
+ scmirroring_retvm_if(!handle, FALSE, "scmirroring_sink_s is NULL");
+ scmirroring_retvm_if(handle->magic_num != SCMIRRORING_MAGIC_NUMBER, FALSE, "invalid magic_num");
+
+ return TRUE;
+}
+
+int scmirroring_sink_set_ecore_wl_display(scmirroring_sink_h scmirroring_sink, void *display_surface)
+{
+ scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
+
+ scmirroring_retvm_if(!__is_valid_handle(handle), SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is invalid");
+
+ return _scmirroring_sink_set_display(handle->mm_handle, SCMIRRORING_DISPLAY_TYPE_OVERLAY, display_surface, MM_DISPLAY_TYPE_OVERLAY_EXT);
+}
return _scmirroring_error_convert(__func__, mm_wfd_sink_disconnect(handle));
}
-int _scmirroring_sink_set_display(MMHandleType handle, scmirroring_display_type_e type, void *display_surface)
+int _scmirroring_sink_set_display(MMHandleType handle, scmirroring_display_type_e type, void *display_surface, mm_display_type_e display_type)
{
int ret = SCMIRRORING_ERROR_NONE;
scmirroring_retvm_if(!display_surface, SCMIRRORING_ERROR_INVALID_PARAMETER, "display_surface is NULL");
- if ((type != SCMIRRORING_DISPLAY_TYPE_OVERLAY) && (type != SCMIRRORING_DISPLAY_TYPE_EVAS)) {
+ scmirroring_debug("display surface type(%d)", type);
+ scmirroring_debug("display type(%d)", display_type);
+
+ if (type >= SCMIRRORING_DISPLAY_TYPE_MAX) {
+ scmirroring_error("Invalid surface type [%d]", type);
+ return SCMIRRORING_ERROR_INVALID_PARAMETER;
+ }
+
+ if (display_type > MM_DISPLAY_TYPE_OVERLAY_SYNC_UI) {
scmirroring_error("Invalid display type [%d]", type);
return SCMIRRORING_ERROR_INVALID_PARAMETER;
}
- scmirroring_debug("display type(%d)", type);
ret = mm_wfd_sink_set_attribute(handle, NULL, "display_visible", TRUE, NULL);
if (ret != MM_ERROR_NONE) {
- scmirroring_error("Fail to Set Display Visible as TRUE");
+ scmirroring_error("Fail to set Display Visible as TRUE");
return _scmirroring_error_convert(__func__, ret);
}
- ret = mm_wfd_sink_set_attribute(handle, NULL, "display_surface_type", type, NULL);
+ ret = mm_wfd_sink_set_attribute(handle, NULL, "display_type", display_type, NULL);
if (ret != MM_ERROR_NONE) {
scmirroring_error("Fail to Set Display Type");
return _scmirroring_error_convert(__func__, ret);
}
+ ret = mm_wfd_sink_set_attribute(handle, NULL, "display_surface_type", type, NULL);
+ if (ret != MM_ERROR_NONE) {
+ scmirroring_error("Fail to Set Display Surface Type");
+ return _scmirroring_error_convert(__func__, ret);
+ }
+
ret = mm_wfd_sink_set_attribute(handle, NULL, "display_overlay", display_surface, sizeof(void *), NULL);
if (ret != MM_ERROR_NONE) {
scmirroring_error("Fail to Set Display Overlay");
scmirroring_debug("Miracast server is launched successfully");
return ret;
-}
-
+}
\ No newline at end of file
SET(fw_test "${fw_name}-test-sink")
INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_test} REQUIRED glib-2.0 dlog capi-base-common mm-wfd capi-network-wifi-direct elementary evas appcore-efl)
+pkg_check_modules(${fw_test} REQUIRED glib-2.0 dlog capi-base-common mm-wfd capi-network-wifi-direct elementary evas appcore-efl ecore ecore-wl2)
FOREACH(flag ${${fw_test}_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
#include <Elementary.h>
#include <appcore-efl.h>
-
+#include <Ecore_Wayland2.h>
+#include <Ecore.h>
#define MAX_STRING_LEN 2048
#define SINKTEST_EXECUTE_DELAY 5000
#define MAIN_MENU 0
#define SUBMENU_GETTING_STREAM_INFO 2
#define SUBMENU_SETTING_SINK 3
#define SUBMENU_SETTING_WINDOW_SIZE 4
-
+//#define WL_DISPLAY
//#define TEST_WITH_WIFI_DIRECT
#define PACKAGE "screen_mirroring_sink_test"
static gint g_menu = MAIN_MENU;
+#ifdef WL_DISPLAY
+static Ecore_Wl2_Subsurface *g_ecore_wl2_subsurface = NULL;
+static Ecore_Wl2_Window *g_ecore_wl2_window = NULL;
+#endif
+
#ifdef TEST_WITH_WIFI_DIRECT
static int g_peer_cnt = 0;
static char g_peer_ip[32];
}
if (g_sinktype != -1) {
if (g_sinktype == SCMIRRORING_DISPLAY_TYPE_OVERLAY) {
+#ifdef WL_DISPLAY
+ g_print("display type is overlay\n");
+ Eina_Bool res = EINA_FALSE;
+ Ecore_Wl2_Window *ecore_wl2_win = (Ecore_Wl2_Window *)elm_win_wl_window_get(g_evas);
+ Ecore_Wl2_Subsurface *ecore_wl2_subsurface = ecore_wl2_subsurface_new(ecore_wl2_win);
+ g_ecore_wl2_window = ecore_wl2_win;
+ res = ecore_wl2_subsurface_export(ecore_wl2_subsurface);
+ if (res != EINA_TRUE) {
+ g_print("failed to export foreign shell");
+ }
+ ecore_wl2_subsurface_exported_surface_sync_set(ecore_wl2_subsurface, EINA_TRUE);
+ ecore_wl2_subsurface_exported_surface_place_below(ecore_wl2_subsurface, NULL);
+ ecore_wl2_subsurface_exported_surface_move(ecore_wl2_subsurface, 200, 200);
+ ecore_wl2_subsurface_exported_surface_resize(ecore_wl2_subsurface, 500, 500);
+ ecore_wl2_subsurface_exported_surface_show(ecore_wl2_subsurface);
+ ecore_wl2_subsurface_exported_surface_commit(ecore_wl2_subsurface);
+ g_ecore_wl2_subsurface = ecore_wl2_subsurface;
+ ret = scmirroring_sink_set_ecore_wl_display(g_scmirroring, (void *)g_ecore_wl2_window);
+#else
evas_object_show(g_evas);
ret = scmirroring_sink_set_display(g_scmirroring, SCMIRRORING_DISPLAY_TYPE_OVERLAY, (void *)g_evas);
+#endif
} else if (g_sinktype == SCMIRRORING_DISPLAY_TYPE_EVAS) {
+ g_print("display type is evas\n");
g_eo = create_evas_image_object(g_evas);
evas_object_image_size_set(g_eo, 800, 1200);
evas_object_image_fill_set(g_eo, 0, 0, 800, 1200);