return MEDIA_STREAMER_ERROR_NONE;
}
-int ms_node_create(media_streamer_node_s *node, media_format_h in_fmt, media_format_h out_fmt)
-{
- int ret = MEDIA_STREAMER_ERROR_NONE;
- GstCaps *sink_caps = NULL;
- GstCaps *src_caps = NULL;
-
- ms_debug_fenter();
-
- ms_retvm_if(node == NULL, MEDIA_STREAMER_ERROR_INVALID_PARAMETER, "node is NULL");
-
- sink_caps = in_fmt ? ms_create_caps_from_fmt(in_fmt) : NULL;
- src_caps = out_fmt ? ms_create_caps_from_fmt(out_fmt) : NULL;
-
- node_plug_s plug_info = {&(nodes_info[node->type]), src_caps, sink_caps, NULL};
-
- ms_info("Creating node with info: klass_name[%s]; default[%s]",
- plug_info.info->klass_name, plug_info.info->default_name);
-
- node->gst_element = ms_node_element_create(&plug_info, node->type);
- if (node->gst_element)
- node->name = gst_element_get_name(node->gst_element);
- else
- return MEDIA_STREAMER_ERROR_INVALID_OPERATION;
-
- if (src_caps)
- gst_caps_unref(src_caps);
-
- if (sink_caps)
- gst_caps_unref(sink_caps);
-
- ms_debug_fleave();
-
- return ret;
-}
-
-/* This signal callback is called when appsrc needs data, we add an idle handler
- * to the mainloop to start pushing data into the appsrc */
-static void __ms_src_start_feed_cb(GstElement *pipeline, guint size, gpointer data)
-{
- media_streamer_node_s *ms_src = (media_streamer_node_s *) data;
- media_streamer_callback_s *src_callback = NULL;
- media_streamer_custom_buffer_status_cb buffer_status_cb = NULL;
-
- ms_debug_fenter();
-
- ms_retm_if(ms_src == NULL, "data is NULL");
- ms_retm_if(pipeline == NULL, "pipeline is NULL");
-
- if (ms_src->callbacks_structure != NULL) {
- src_callback = (media_streamer_callback_s *) ms_src->callbacks_structure;
- buffer_status_cb = (media_streamer_custom_buffer_status_cb) src_callback->callback;
- buffer_status_cb((media_streamer_node_h) ms_src, MEDIA_STREAMER_CUSTOM_BUFFER_UNDERRUN, src_callback->user_data);
- }
-
- ms_debug_fleave();
-}
-
-/* This callback is called when appsrc has enough data and we can stop sending.
- * We remove the idle handler from the mainloop */
-static void __ms_src_stop_feed_cb(GstElement *pipeline, gpointer data)
-{
- media_streamer_node_s *ms_src = (media_streamer_node_s *) data;
- media_streamer_callback_s *src_callback = NULL;
- media_streamer_custom_buffer_status_cb buffer_status_cb = NULL;
-
- ms_debug_fenter();
-
- ms_retm_if(ms_src == NULL, "data is NULL");
- ms_retm_if(pipeline == NULL, "pipeline is NULL");
-
- if (ms_src->callbacks_structure != NULL) {
- src_callback = (media_streamer_callback_s *) ms_src->callbacks_structure;
- buffer_status_cb = (media_streamer_custom_buffer_status_cb) src_callback->callback;
- buffer_status_cb((media_streamer_node_h) ms_src, MEDIA_STREAMER_CUSTOM_BUFFER_OVERFLOW, src_callback->user_data);
- }
-
- ms_debug_fleave();
-}
-
static int __ms_node_check_privileges(media_streamer_node_s *node)
{
int ret = MEDIA_STREAMER_ERROR_NONE;
}
}
+ if (node->type == MEDIA_STREAMER_NODE_TYPE_WEBRTC)
+ privilege = "http://tizen.org/privilege/internet";
+
/* Skip checking for privilege permission in case of other types of Nodes */
if (privilege == NULL)
return ret;
return ret;
}
+static int __ms_node_check_feature(media_streamer_node_s *node)
+{
+ bool enabled = FALSE;
+
+ ms_debug_fenter();
+
+ ms_retvm_if(node == NULL, MEDIA_STREAMER_ERROR_INVALID_PARAMETER, "node is NULL");
+
+ switch (node->type) {
+ case MEDIA_STREAMER_NODE_TYPE_WEBRTC:
+ if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_WIFI, &enabled)) {
+ ms_info("wifi status = %d", enabled);
+ if (enabled)
+ return MEDIA_STREAMER_ERROR_NONE;
+ }
+ if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_TELEPHONY, &enabled)) {
+ ms_info("telephony status = %d", enabled);
+ if (enabled)
+ return MEDIA_STREAMER_ERROR_NONE;
+ }
+ if (SYSTEM_INFO_ERROR_NONE == system_info_get_platform_bool(_FEATURE_NAME_ETHERNET, &enabled)) {
+ ms_info("ethernet status = %d", enabled);
+ if (enabled)
+ return MEDIA_STREAMER_ERROR_NONE;
+ }
+ ms_error("None of [%s] [%s] [%s] features is enabled", _FEATURE_NAME_WIFI, _FEATURE_NAME_TELEPHONY, _FEATURE_NAME_ETHERNET);
+ return MEDIA_STREAMER_ERROR_NOT_SUPPORTED;
+ default:
+ ms_debug("For current node type[%d], feature is not needed", node->type);
+ break;
+ }
+
+ ms_debug_fleave();
+
+ return MEDIA_STREAMER_ERROR_NONE;
+}
+
+int ms_node_create(media_streamer_node_s *node, media_format_h in_fmt, media_format_h out_fmt)
+{
+ int ret = MEDIA_STREAMER_ERROR_NONE;
+ GstCaps *sink_caps = NULL;
+ GstCaps *src_caps = NULL;
+
+ ms_debug_fenter();
+
+ ms_retvm_if(node == NULL, MEDIA_STREAMER_ERROR_INVALID_PARAMETER, "node is NULL");
+
+ ret = __ms_node_check_privileges(node);
+ if (ret != MEDIA_STREAMER_ERROR_NONE) {
+ ms_error("Failed to get privilege for this node type(%d)", node->type);
+ return ret;
+ }
+
+ ret = __ms_node_check_feature(node);
+ if (ret != MEDIA_STREAMER_ERROR_NONE) {
+ ms_error("Failed to get feature for this node type(%d)", node->type);
+ return ret;
+ }
+
+ sink_caps = in_fmt ? ms_create_caps_from_fmt(in_fmt) : NULL;
+ src_caps = out_fmt ? ms_create_caps_from_fmt(out_fmt) : NULL;
+
+ node_plug_s plug_info = {&(nodes_info[node->type]), src_caps, sink_caps, NULL};
+
+ ms_info("Creating node with info: klass_name[%s]; default[%s]",
+ plug_info.info->klass_name, plug_info.info->default_name);
+
+ node->gst_element = ms_node_element_create(&plug_info, node->type);
+ if (node->gst_element)
+ node->name = gst_element_get_name(node->gst_element);
+ else
+ return MEDIA_STREAMER_ERROR_INVALID_OPERATION;
+
+ if (src_caps)
+ gst_caps_unref(src_caps);
+
+ if (sink_caps)
+ gst_caps_unref(sink_caps);
+
+ ms_debug_fleave();
+
+ return ret;
+}
+
+/* This signal callback is called when appsrc needs data, we add an idle handler
+ * to the mainloop to start pushing data into the appsrc */
+static void __ms_src_start_feed_cb(GstElement *pipeline, guint size, gpointer data)
+{
+ media_streamer_node_s *ms_src = (media_streamer_node_s *) data;
+ media_streamer_callback_s *src_callback = NULL;
+ media_streamer_custom_buffer_status_cb buffer_status_cb = NULL;
+
+ ms_debug_fenter();
+
+ ms_retm_if(ms_src == NULL, "data is NULL");
+ ms_retm_if(pipeline == NULL, "pipeline is NULL");
+
+ if (ms_src->callbacks_structure != NULL) {
+ src_callback = (media_streamer_callback_s *) ms_src->callbacks_structure;
+ buffer_status_cb = (media_streamer_custom_buffer_status_cb) src_callback->callback;
+ buffer_status_cb((media_streamer_node_h) ms_src, MEDIA_STREAMER_CUSTOM_BUFFER_UNDERRUN, src_callback->user_data);
+ }
+
+ ms_debug_fleave();
+}
+
+/* This callback is called when appsrc has enough data and we can stop sending.
+ * We remove the idle handler from the mainloop */
+static void __ms_src_stop_feed_cb(GstElement *pipeline, gpointer data)
+{
+ media_streamer_node_s *ms_src = (media_streamer_node_s *) data;
+ media_streamer_callback_s *src_callback = NULL;
+ media_streamer_custom_buffer_status_cb buffer_status_cb = NULL;
+
+ ms_debug_fenter();
+
+ ms_retm_if(ms_src == NULL, "data is NULL");
+ ms_retm_if(pipeline == NULL, "pipeline is NULL");
+
+ if (ms_src->callbacks_structure != NULL) {
+ src_callback = (media_streamer_callback_s *) ms_src->callbacks_structure;
+ buffer_status_cb = (media_streamer_custom_buffer_status_cb) src_callback->callback;
+ buffer_status_cb((media_streamer_node_h) ms_src, MEDIA_STREAMER_CUSTOM_BUFFER_OVERFLOW, src_callback->user_data);
+ }
+
+ ms_debug_fleave();
+}
+
static int __ms_src_node_check_feature(media_streamer_node_s *node)
{
int ret = MEDIA_STREAMER_ERROR_NONE;