Add 'scmirroring_get_state' on public. 13/164113/8 accepted/tizen/unified/20180205.060524 submit/tizen/20180202.080634
authorHyunsoo Park <hance.park@samsung.com>
Fri, 15 Dec 2017 08:23:20 +0000 (17:23 +0900)
committerHyunsoo Park <hance.park@samsung.com>
Tue, 30 Jan 2018 06:31:07 +0000 (15:31 +0900)
It functions to get current state of screen mirroring sink.

Change-Id: I03dc95c8575473b445ee7b6a83b78eaaa0da9d83
Signed-off-by: Hyunsoo Park <hance.park@samsung.com>
include/scmirroring_internal.h
include/scmirroring_sink.h
packaging/capi-media-screen-mirroring.spec
src/scmirroring_sink.c
src/scmirroring_sink_internal.c [deleted file]

index 0c5b29f47e40ffc02d88b2452110ec4279805552..ece8e68c82615e8ebb0df5763cdac1e2f89e8877 100644 (file)
@@ -72,13 +72,6 @@ typedef enum {
  */
 typedef void(*scmirroring_state_cb)(scmirroring_error_e error, scmirroring_state_e state, void *user_data);
 
-/**
- * @brief Gets state of screen mirroring sink.
- *
- * @param[in] scmirroring_sink     The screen mirroring object
-   @param[out] state               The screen mirroring state
- */
-int scmirroring_sink_get_state(scmirroring_sink_h scmirroring_sink, scmirroring_sink_state_e *state);
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index 769fb95bc11bc529bad9df2296b6f6c6ebf22547..0bc6d1bb5fb4dc168807b02e6f10ddc2f533ac75 100644 (file)
@@ -212,7 +212,7 @@ int scmirroring_sink_prepare(scmirroring_sink_h scmirroring_sink);
 int scmirroring_sink_connect(scmirroring_sink_h scmirroring_sink);
 
 /**
- * @brief Start receiving data from the SCMIRRORING source and display it(mirror).
+ * @brief Starts receiving data from the SCMIRRORING source and display it(mirror).
  *
  * @since_tizen 2.4
  * @privlevel public
@@ -275,7 +275,7 @@ int scmirroring_sink_start(scmirroring_sink_h scmirroring_sink);
 int scmirroring_sink_pause(scmirroring_sink_h scmirroring_sink);
 
 /**
- * @brief Pauses receiving data from the SCMIRRORING source.
+ * @brief Resumes receiving data from the SCMIRRORING source.
  * @details This function pauses receiving data from the SCMIRRORING source, which means it sends RTSP PLAY message to source.
  *
  * @since_tizen 2.4
@@ -571,6 +571,27 @@ int scmirroring_sink_get_negotiated_audio_sample_rate(scmirroring_sink_h *scmirr
  */
 int scmirroring_sink_get_negotiated_audio_bitwidth(scmirroring_sink_h *scmirroring_sink, int *bitwidth);
 
+/**
+ * @brief Gets the current state of screen mirroring sink.
+ * @details The current state of screen mirroring sink is changed by calling CAPIs. And it provides the state of screen mirroring sink the time this api is called.
+ *
+ * @since_tizen 5.0
+ *
+ * @param[in] scmirroring_sink The handle to the screen mirroring sink
+ * @param[out] The current state of screen mirroring sink
+ *
+ * @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().
+ */
+int scmirroring_sink_get_current_state(scmirroring_sink_h scmirroring_sink, scmirroring_sink_state_e *state);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index c458656206623d5d007d0e664b4daee4673910c5..186f68d842313b1ea1ff0ce2972e98007ddcf499 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-screen-mirroring
 Summary:    A screen mirroring library in Tizen C API
-Version:    0.1.89
+Version:    0.1.90
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index bb58a1637f69db77f664e4f7e3a5472a6f22afd9..0faac238c4dffafc4775ccec60c07b3536a6f6ca 100644 (file)
@@ -696,3 +696,23 @@ int scmirroring_sink_get_negotiated_audio_bitwidth(scmirroring_sink_h *scmirrori
 
        return ret;
 }
+
+int scmirroring_sink_get_current_state(scmirroring_sink_h scmirroring_sink, scmirroring_sink_state_e *state)
+{
+       int result = MM_ERROR_NONE;
+       int mm_state = MM_WFD_SINK_STATE_NONE;
+       scmirroring_sink_s *handle = (scmirroring_sink_s *)(scmirroring_sink);
+
+       scmirroring_debug_fenter();
+       scmirroring_retvm_if(scmirroring_sink == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink* is NULL");
+       scmirroring_retvm_if(state == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "state is NULL");
+       scmirroring_retvm_if(handle->magic_num != SCMIRRORING_MAGIC_NUMBER, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is invalid handle");
+
+       result = mm_wfd_sink_get_current_state(handle->mm_handle, &mm_state);
+       if (result == MM_ERROR_NONE) {
+               *state = __scmirroring_sink_state_convert(mm_state);
+               scmirroring_debug("ScreenMirroring current state is [%d]", *state);
+       }
+       scmirroring_debug_fleave();
+       return __scmirroring_sink_error_convert(__func__, result);
+}
diff --git a/src/scmirroring_sink_internal.c b/src/scmirroring_sink_internal.c
deleted file mode 100644 (file)
index 83d5517..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
-* Copyright (c) 2017 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 <mmf/mm_wfd_sink.h>
-#include <scmirroring_sink.h>
-#include <scmirroring_internal.h>
-#include <scmirroring_private.h>
-
-
-static scmirroring_error_e __scmirroring_sink_error_convert(const char *func, int error)
-{
-       int ret = SCMIRRORING_ERROR_NONE;
-       const char *errorstr = NULL;
-
-       switch (error) {
-       case MM_ERROR_NONE:
-               ret = SCMIRRORING_ERROR_NONE;
-               errorstr = "ERROR_NONE";
-               break;
-
-       case MM_ERROR_WFD_NO_FREE_SPACE:
-               ret = SCMIRRORING_ERROR_OUT_OF_MEMORY;
-               errorstr = "OUT_OF_MEMORY";
-               break;
-
-       case MM_ERROR_WFD_NOT_INITIALIZED:
-       case MM_ERROR_COMMON_INVALID_ATTRTYPE:
-       case MM_ERROR_COMMON_INVALID_PERMISSION:
-       case MM_ERROR_COMMON_OUT_OF_ARRAY:
-       case MM_ERROR_COMMON_OUT_OF_RANGE:
-       case MM_ERROR_COMMON_ATTR_NOT_EXIST:
-               ret = SCMIRRORING_ERROR_INVALID_PARAMETER;
-               errorstr = "INVALID_PARAMETER";
-               break;
-
-       default:
-               ret = SCMIRRORING_ERROR_INVALID_OPERATION;
-               errorstr = "INVALID_OPERATION";
-       }
-
-       if (ret != SCMIRRORING_ERROR_NONE)
-               scmirroring_error("[%s] %s (0x%08x) : core frameworks error code(0x%08x)", func, errorstr, ret, error);
-       else
-               scmirroring_debug("[%s] %s", func, errorstr);
-
-       return ret;
-}
-
-
-static scmirroring_sink_state_e __scmirroring_sink_state_convert(MMWFDSinkStateType mm_state)
-{
-       scmirroring_sink_state_e temp_state = SCMIRRORING_SINK_STATE_NONE;
-
-       switch (mm_state) {
-       case MM_WFD_SINK_STATE_NONE:
-               temp_state = SCMIRRORING_SINK_STATE_NONE;
-               break;
-       case MM_WFD_SINK_STATE_NULL:
-               temp_state = SCMIRRORING_SINK_STATE_NULL;
-               break;
-       case MM_WFD_SINK_STATE_PREPARED:
-               temp_state = SCMIRRORING_SINK_STATE_PREPARED;
-               break;
-       case MM_WFD_SINK_STATE_CONNECTED:
-               temp_state = SCMIRRORING_SINK_STATE_CONNECTED;
-               break;
-       case MM_WFD_SINK_STATE_PLAYING:
-               temp_state = SCMIRRORING_SINK_STATE_PLAYING;
-               break;
-       case MM_WFD_SINK_STATE_PAUSED:
-               temp_state = SCMIRRORING_SINK_STATE_PAUSED;
-               break;
-       case MM_WFD_SINK_STATE_DISCONNECTED:
-               temp_state = SCMIRRORING_SINK_STATE_DISCONNECTED;
-               break;
-       default:
-               temp_state = SCMIRRORING_SINK_STATE_NONE;
-               scmirroring_debug("In default case, MMWFDSinkStateType is [%d]", mm_state);
-               break;
-       }
-
-       return temp_state;
-}
-
-int scmirroring_sink_get_state(scmirroring_sink_h scmirroring_sink, scmirroring_sink_state_e *state)
-{
-       int result = MM_ERROR_NONE;
-       int mm_state = MM_WFD_SINK_STATE_NONE;
-       scmirroring_sink_s *handle = (scmirroring_sink_s *)(scmirroring_sink);
-
-       scmirroring_debug_fenter();
-       scmirroring_retvm_if(scmirroring_sink == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink* is NULL");
-       scmirroring_retvm_if(state == NULL, SCMIRRORING_ERROR_INVALID_PARAMETER, "state is NULL");
-       scmirroring_retvm_if(handle->magic_num != SCMIRRORING_MAGIC_NUMBER, SCMIRRORING_ERROR_INVALID_PARAMETER, "scmirroring_sink is invalid handle");
-
-       result = mm_wfd_sink_get_state(handle->mm_handle, &mm_state);
-       if (result == MM_ERROR_NONE) {
-               *state = __scmirroring_sink_state_convert(mm_state);
-               scmirroring_debug("ScreenMirroring state is [%d]", *state);
-       }
-       scmirroring_debug_fleave();
-
-       return __scmirroring_sink_error_convert(__func__, result);
-}