[v0.1.8] add implementation of feature check when create node 40/87840/4
authorVolodymyr Brynza <v.brynza@samsung.com>
Fri, 9 Sep 2016 14:09:31 +0000 (17:09 +0300)
committerEunhae Choi <eunhae1.choi@samsung.com>
Thu, 22 Sep 2016 02:29:12 +0000 (11:29 +0900)
Change-Id: I48eee1b3378a9b49bb59978552a52dc46f9b68fe
Signed-off-by: Volodymyr Brynza <v.brynza@samsung.com>
CMakeLists.txt
doc/mediastreamer_doc.h
include/media_streamer.h
packaging/capi-media-streamer.spec
src/media_streamer_node.c

index 5e5697934ba61b4a95642d51ca0e4680059a49a8..c87ed3057a21896004636384adcb70b5ad9e4b28 100644 (file)
@@ -10,8 +10,8 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(INC_DIR include)
 INCLUDE_DIRECTORIES(${INC_DIR})
 
-SET(dependents "dlog glib-2.0 mm-common capi-media-tool iniparser bundle libtbm gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-app-1.0 cynara-client")
-SET(pc_dependents "capi-base-common capi-media-tool gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-app-1.0 cynara-client")
+SET(dependents "dlog glib-2.0 mm-common capi-media-tool iniparser bundle libtbm gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-app-1.0 cynara-client capi-system-info")
+SET(pc_dependents "capi-base-common capi-media-tool gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-app-1.0 cynara-client capi-system-info")
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(${fw_name} REQUIRED ${dependents})
index 3d073108392188b5997c7250cc6e992b7606eae6..117e05bdb9f16194be2a3def5a0dd7cbad88f810 100755 (executable)
 /**
  * @ingroup CAPI_MEDIA_FRAMEWORK
  * @defgroup CAPI_MEDIA_STREAMER_MODULE Media Streamer
- * @brief  The @ref CAPI_MEDIA_STREAMER_MODULE  APIs provides functions for building custom pipeline
+ * @brief The @ref CAPI_MEDIA_STREAMER_MODULE APIs provides functions for building custom player
  *
  * @section CAPI_MEDIA_STREAMER_MODULE_HEADER Required Header
  *   \#include <media_streamer.h>
  *
  * @section CAPI_MEDIA_STREAMER_MODULE_OVERVIEW Overview
+ * The Media Streamer API allows application developers to construct the custom player.
+ * It includes provides a way to handle media content by user speicific player.
  *
  * MEDIASTREAMER allows :
- * Create streamer handle and elements to build custom pipeline.
- * Application can create, add and link elements manually.
+ * - Application can decide input type of media source.
+ * - Application can decide output type of media content.
+ * - Application can create filter nodes considering requirements.
+ * - Application can set/get properties of each nodes.
+ *
+ * The Media Streamer API also notifies you by callback mechanism when state is changed.
+ *
+ * @section CAPI_MEDIA_STREAMER_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ *  - http://tizen.org/feature/network.wifi\n
+ *  - http://tizen.org/feature/network.telephony\n
+ *  - http://tizen.org/feature/network.ethernet\n
+ *  - http://tizen.org/feature/camera\n
+ *  - http://tizen.org/feature/microphone
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tools/native-tools/manifest-text-editor#feature"><b>Feature Element</b>.</a>
  *
  */
 
index bff337ef52ac1417ac896c3697693bf18de347ec..2b3f9c79c1ce40226627244fe654c3f4e561a2a4 100644 (file)
@@ -103,7 +103,7 @@ typedef enum {
        MEDIA_STREAMER_NODE_SRC_TYPE_AUDIO_TEST,     /**<  Audio test src type */
        MEDIA_STREAMER_NODE_SRC_TYPE_VIDEO_TEST,     /**<  Video test src type */
        MEDIA_STREAMER_NODE_SRC_TYPE_CUSTOM,         /**<  Custom src type */
-       MEDIA_STREAMER_NODE_SRC_TYPE_ADAPTIVE        /**<  Adaptive src type */
+       MEDIA_STREAMER_NODE_SRC_TYPE_ADAPTIVE        /**<  Adaptive src type, Network internet feature is required */
 } media_streamer_node_src_type_e;
 
 /**
@@ -121,7 +121,7 @@ typedef enum {
        MEDIA_STREAMER_NODE_SINK_TYPE_EVAS,   /**<  EVAS sink type */
        MEDIA_STREAMER_NODE_SINK_TYPE_FAKE,   /**<  Fake sink type */
        MEDIA_STREAMER_NODE_SINK_TYPE_CUSTOM, /**<  Custom sink type */
-       MEDIA_STREAMER_NODE_SINK_TYPE_ADAPTIVE /**<  Adaptive sink type */
+       MEDIA_STREAMER_NODE_SINK_TYPE_ADAPTIVE /**<  Adaptive sink type to generate fragmented files */
 } media_streamer_node_sink_type_e;
 
 /**
@@ -148,7 +148,7 @@ typedef enum {
        MEDIA_STREAMER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,              /**< Invalid parameter */
        MEDIA_STREAMER_ERROR_INVALID_OPERATION  = TIZEN_ERROR_INVALID_OPERATION,             /**< Invalid operation */
        MEDIA_STREAMER_ERROR_FILE_NO_SPACE_ON_DEVICE = TIZEN_ERROR_FILE_NO_SPACE_ON_DEVICE,  /**< No space left on the device */
-       MEDIA_STREAMER_ERROR_NOT_SUPPORTED  = TIZEN_ERROR_NOT_SUPPORTED,                     /**< Not supported */
+       MEDIA_STREAMER_ERROR_NOT_SUPPORTED  = TIZEN_ERROR_NOT_SUPPORTED,                     /**< The feature is not supported */
        MEDIA_STREAMER_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED,              /**< Permission denied */
        MEDIA_STREAMER_ERROR_INVALID_STATE = TIZEN_ERROR_MEDIA_STREAMER | 0x01,              /**< Invalid state */
        MEDIA_STREAMER_ERROR_CONNECTION_FAILED = TIZEN_ERROR_MEDIA_STREAMER | 0x02,          /**< Connection failed */
index d0c2ad1bbee6acda5aae47c9d1e0f20c83f10200..22d40d3cac978a3ac9584e0d42949929bd5c9d27 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-streamer
-Summary:    A Media Streamer library in Tizen Native API
-Version:    0.1.7
+Summary:    A Media Streamer API
+Version:    0.1.8
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
@@ -21,13 +21,14 @@ BuildRequires:  pkgconfig(gstreamer-app-1.0)
 BuildRequires:  pkgconfig(iniparser)
 BuildRequires:  pkgconfig(bundle)
 BuildRequires:  pkgconfig(cynara-client)
+BuildRequires:  pkgconfig(capi-system-info)
 
 %description
 A MediaStreamer library in Tizen Native API.
 
 %package devel
-Summary:    Multimedia Streamer Library in Tizen Native API (Development)
-Group:      TO_BE/FILLED_IN
+Summary:    Multimedia Streamer API (Development)
+Group:      Multimedia/Development
 Requires:   %{name} = %{version}-%{release}
 
 %description devel
index b509e0313de778800a500dc248c174672df9df66..efd79059fb9557f435f8eb4020073d2cc8e4b63f 100644 (file)
@@ -18,6 +18,7 @@
 #include <media_streamer_util.h>
 #include <media_streamer_gst.h>
 #include <cynara-client.h>
+#include <system_info.h>
 
 #define SMACK_LABEL_LEN 255
 #define DEFAULT_URI_SCHEME_LENGTH 10
@@ -373,6 +374,118 @@ static int __ms_node_check_priveleges(media_streamer_node_s *node)
        return ret;
 }
 
+static int __ms_node_check_feature(media_streamer_node_s *node)
+{
+#define _FEATURE_NAME_WIFI               "http://tizen.org/feature/network.wifi"
+#define _FEATURE_NAME_TELEPHONY          "http://tizen.org/feature/network.telephony"
+#define _FEATURE_NAME_ETHERNET           "http://tizen.org/feature/network.ethernet"
+#define _FEATURE_NAME_CAMERA             "http://tizen.org/feature/camera"
+#define _FEATURE_NAME_MICROPHONE         "http://tizen.org/feature/microphone"
+
+       int ret = MEDIA_STREAMER_ERROR_NONE;
+       bool enabled = FALSE;
+       bool supported = FALSE;
+
+       if (node->type == MEDIA_STREAMER_NODE_TYPE_SRC) {
+               switch (node->subtype) {
+               case MEDIA_STREAMER_NODE_SRC_TYPE_HTTP:
+               case MEDIA_STREAMER_NODE_SRC_TYPE_RTSP:
+               case MEDIA_STREAMER_NODE_SRC_TYPE_ADAPTIVE:
+                       if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_WIFI, &enabled)) {
+                               ms_info("wifi status = %d", enabled);
+                               if (enabled)
+                                       supported = TRUE;
+                       } else {
+                               ms_error("SYSTEM_INFO_ERROR");
+                       }
+
+                       if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_TELEPHONY, &enabled)) {
+                               ms_info("telephony status = %d", enabled);
+                               if (enabled)
+                                       supported = TRUE;
+                       } else {
+                               ms_error("SYSTEM_INFO_ERROR");
+                       }
+
+                       if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_ETHERNET, &enabled)) {
+                               ms_info("ethernet status = %d", enabled);
+                               if (enabled)
+                                       supported = TRUE;
+                       } else {
+                               ms_error("SYSTEM_INFO_ERROR");
+                       }
+                       if (!supported)
+                               ret = MEDIA_STREAMER_ERROR_NOT_SUPPORTED;
+                       break;
+               case MEDIA_STREAMER_NODE_SRC_TYPE_AUDIO_CAPTURE:
+                       if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_MICROPHONE, &enabled)) {
+                               ms_info("ethernet status = %d", enabled);
+                               if (enabled)
+                                       supported = TRUE;
+                       } else {
+                               ms_error("SYSTEM_INFO_ERROR");
+                       }
+                       if (!supported)
+                               ret = MEDIA_STREAMER_ERROR_NOT_SUPPORTED;
+                       break;
+               case MEDIA_STREAMER_NODE_SRC_TYPE_CAMERA:
+               case MEDIA_STREAMER_NODE_SRC_TYPE_VIDEO_CAPTURE:
+                       if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_CAMERA, &enabled)) {
+                               ms_info("ethernet status = %d", enabled);
+                               if (enabled)
+                                       supported = TRUE;
+                       } else {
+                               ms_error("SYSTEM_INFO_ERROR");
+                       }
+                       if (!supported)
+                               ret = MEDIA_STREAMER_ERROR_NOT_SUPPORTED;
+                       break;
+               default:
+                       ms_info("For current Src Node [%s] subtype [%d] privileges are not needed", node->name, node->subtype);
+                       break;
+               }
+       }
+
+       if (node->type == MEDIA_STREAMER_NODE_TYPE_SINK) {
+               switch (node->subtype) {
+               case MEDIA_STREAMER_NODE_SINK_TYPE_HTTP:
+               case MEDIA_STREAMER_NODE_SINK_TYPE_RTSP:
+               /* case MEDIA_STREAMER_NODE_SINK_TYPE_ADAPTIVE: */
+                       if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_WIFI, &enabled)) {
+                               ms_info("wifi status = %d", enabled);
+                               if (enabled)
+                                       supported = TRUE;
+                       } else {
+                               ms_error("SYSTEM_INFO_ERROR");
+                       }
+
+                       if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_TELEPHONY, &enabled)) {
+                               ms_info("telephony status = %d", enabled);
+                               if (enabled)
+                                       supported = TRUE;
+                       } else {
+                               ms_error("SYSTEM_INFO_ERROR");
+                       }
+
+                       if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_ETHERNET, &enabled)) {
+                               ms_info("ethernet status = %d", enabled);
+                               if (enabled)
+                                       supported = TRUE;
+                       } else {
+                               ms_error("SYSTEM_INFO_ERROR");
+                       }
+                       if (!supported)
+                               ret = MEDIA_STREAMER_ERROR_NOT_SUPPORTED;
+                       break;
+               default:
+                       ms_info("For current Sink Node [%s] subtype [%d] privileges are not needed", node->name, node->subtype);
+                       break;
+               }
+       }
+
+       return ret;
+}
+
 int __ms_src_node_create(media_streamer_node_s *node)
 {
        ms_retvm_if(node == NULL, MEDIA_STREAMER_ERROR_INVALID_PARAMETER, "Handle is NULL");
@@ -386,6 +499,12 @@ int __ms_src_node_create(media_streamer_node_s *node)
                return ret;
        }
 
+       ret = __ms_node_check_feature(node);
+       if (ret != MEDIA_STREAMER_ERROR_NONE) {
+               ms_error("Error getting feature for Src Node");
+               return ret;
+       }
+
        switch (node->subtype) {
        case MEDIA_STREAMER_NODE_SRC_TYPE_FILE:
                plugin_name = __ms_ini_get_string("node type 1:file", DEFAULT_FILE_SOURCE);
@@ -489,6 +608,12 @@ int __ms_sink_node_create(media_streamer_node_s *node)
                return ret;
        }
 
+       ret = __ms_node_check_feature(node);
+       if (ret != MEDIA_STREAMER_ERROR_NONE) {
+               ms_error("Error getting feature for Sink Node");
+               return ret;
+       }
+
        switch (node->subtype) {
        case MEDIA_STREAMER_NODE_SINK_TYPE_FILE:
                plugin_name = __ms_ini_get_string("node type 2:file", DEFAULT_FILE_SINK);