Add scmirroring_device_type_e, scmirroring_sink_set_src_device_type() 89/318189/10 accepted/tizen/unified/20250311.054112 accepted/tizen/unified/x/20250311.211309
authorYoungwoo Cho <young222.cho@samsung.com>
Tue, 14 Jan 2025 05:23:51 +0000 (14:23 +0900)
committerYoungwoo Cho <young222.cho@samsung.com>
Fri, 7 Mar 2025 05:26:38 +0000 (14:26 +0900)
- api to set source`s device type
- required to distinguish pipeline options

[Version] 0.3.3
[Issue type] API

Change-Id: Ia94379aac60a7f616cda7bd4cdb73c94d87e6460
Signed-off-by: Youngwoo Cho <young222.cho@samsung.com>
include/scmirroring_private.h
include/scmirroring_sink.h
include/scmirroring_type.h
packaging/capi-media-screen-mirroring.spec
src/scmirroring_sink.c
src/scmirroring_util.c

index 35a3043b221ef62255883e5edef60a67582185aa..57d2bfe9a3941e2c1624e658e07373401e26ac42 100644 (file)
@@ -278,6 +278,7 @@ int _scmirroring_sink_set_display_mode(MMHandleType handle, scmirroring_display_
 int _scmirroring_sink_set_display_roi(MMHandleType handle, int x, int y, int width, int height);
 int _scmirroring_sink_set_display_rotation(MMHandleType handle, scmirroring_display_rotation_e rotation);
 int _scmirroring_sink_set_resolution(MMHandleType handle, int resolution);
+int _scmirroring_sink_set_src_device_type(MMHandleType handle, scmirroring_device_type_e device_type);
 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);
 int _scmirroring_sink_get_negotiated_video_frame_rate(MMHandleType handle, int *frame_rate);
index 8cfb5bdbffb9a3abc2c96a59287735325a15a7e8..e25eb989b04e38afd1e6a03549f93f05285d8cc6 100644 (file)
@@ -247,6 +247,34 @@ int scmirroring_sink_set_display_rotation(scmirroring_sink_h scmirroring_sink, s
  */
 int scmirroring_sink_set_resolution(scmirroring_sink_h scmirroring_sink, int resolution);
 
+/**
+ * @brief Sets device type of screen mirroring source.
+ * @details This function sets device type of screen mirroring source(not sink) using scmirroring_device_type_e, like #SCMIRRORING_DEVICE_TYPE_TV.
+ *          Use it only when you want to set the device type of the source to branch internal processing according to the device type.
+ *
+ * @since_tizen 10.0
+ *
+ * @remarks This function must be called before scmirroring_sink_prepare().
+ * @remarks This function is related to the following feature:\n
+ *          %http://tizen.org/feature/network.wifi.direct.display\n
+ *
+ * @param[in] scmirroring_sink The handle to the screen mirroring sink
+ * @param[in] device_type The device type of screen mirroring source
+ * @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_INVALID_OPERATION Invalid operation
+ * @retval #SCMIRRORING_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SCMIRRORING_ERROR_UNKNOWN Unknown Error
+ *
+ * @pre Create a screen mirroring sink handle by calling scmirroring_sink_create().
+ *
+ * @see scmirroring_sink_create()
+ * @see scmirroring_sink_prepare()
+ */
+int scmirroring_sink_set_src_device_type(scmirroring_sink_h scmirroring_sink, scmirroring_device_type_e device_type);
+
 /**
  * @brief Prepares the screen mirroring sink handle and allocates specific resources.
  * @details This function constructs pipeline to prepare playing media
index 54e94465a75e5a0523565632b0062de22050c351..a07770fef55929048eee10969b4757f1c4364099 100644 (file)
@@ -128,6 +128,16 @@ typedef enum {
        SCMIRRORING_DISPLAY_ROTATION_270,       /**< Display is rotated 270 degrees */
 }scmirroring_display_rotation_e;
 
+/**
+ * @brief Enumeration for screen mirroring device type.
+ * @since_tizen 10.0
+ */
+typedef enum {
+       SCMIRRORING_DEVICE_TYPE_GENERIC = 0,  /**< Generic device type */
+       SCMIRRORING_DEVICE_TYPE_TV,           /**< Device is TV */
+       SCMIRRORING_DEVICE_TYPE_MOBILE,       /**< Device is Mobile(Phone, Tablet) */
+} scmirroring_device_type_e;
+
 /**
  * @brief Enumeration for screen mirroring audio codec.
  * @since_tizen 2.4
index ba2c667c883ddf18b2e76ef67ff190ad192ab4cf..9ddf86676df634a746e5886120a3e49c82425684 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-screen-mirroring
 Summary:    A screen mirroring library in Tizen C API
-Version:    0.3.2
+Version:    0.3.3
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 2a4250e0ef7fc3a7909840d71eeb83d4d93b7c5b..2bd5a4fe72870a22b932d78bc7df689d0a2f0995 100644 (file)
@@ -266,6 +266,19 @@ int scmirroring_sink_set_resolution(scmirroring_sink_h scmirroring_sink, int res
        return _scmirroring_sink_set_resolution(handle->mm_handle, resolution);
 }
 
+int scmirroring_sink_set_src_device_type(scmirroring_sink_h scmirroring_sink, scmirroring_device_type_e device_type)
+{
+       scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
+
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_DISPLAY_FEATURE);
+
+       scmirroring_error_fenter();
+
+       scmirroring_retvm_if(!__is_valid_handle(handle), SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is invalid");
+
+       return _scmirroring_sink_set_src_device_type(handle->mm_handle, device_type);
+}
+
 int scmirroring_sink_pause(scmirroring_sink_h scmirroring_sink)
 {
        scmirroring_sink_s *handle = (scmirroring_sink_s *)scmirroring_sink;
index 696c77131c9d91d38970e7ca2de3f63bec679854..029cbd99d8c1615511efbc8790a346f9a7b5ac52 100644 (file)
@@ -309,6 +309,26 @@ int _scmirroring_sink_set_resolution(MMHandleType handle, int resolution)
        return _scmirroring_error_convert(__func__, ret);
 }
 
+int _scmirroring_sink_set_src_device_type(MMHandleType handle, scmirroring_device_type_e device_type)
+{
+       int ret = SCMIRRORING_ERROR_NONE;
+
+       scmirroring_debug_fenter();
+
+       if ((device_type < SCMIRRORING_DEVICE_TYPE_GENERIC) || (device_type > SCMIRRORING_DEVICE_TYPE_MOBILE)) {
+               scmirroring_error("Invalid device type : %d", device_type);
+               return SCMIRRORING_ERROR_INVALID_PARAMETER;
+       }
+
+       scmirroring_debug("device_type(%d)", device_type);
+
+       ret = mm_wfd_sink_set_src_device_type(handle, device_type);
+       if (ret != MM_ERROR_NONE)
+               scmirroring_error("Fail to Set source`s device type");
+
+       return _scmirroring_error_convert(__func__, ret);
+}
+
 int _scmirroring_sink_get_negotiated_video_codec(MMHandleType handle, scmirroring_video_codec_e *codec)
 {
        int ret = SCMIRRORING_ERROR_NONE;