Add Tizen internal API without checking the permission.
Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
/* Tizen ML feature */
#if defined (__TIZEN__)
+#include "nnstreamer-tizen-internal.h"
+
#define check_feature_state() \
do { \
int feature_ret = ml_tizen_get_feature_enabled (); \
--- /dev/null
+/**
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ */
+
+/**
+ * @file nnstreamer-tizen-internal.h
+ * @date 02 October 2019
+ * @brief NNStreamer/Pipeline(main) C-API Header for Tizen Internal API. This header should be used only in Tizen.
+ * @author Jaeyun Jung <jy1210.jung@samsung.com>
+ * @bug No known bugs except for NYI items
+ */
+
+#ifndef __TIZEN_MACHINELEARNING_NNSTREAMER_INTERNAL_H__
+#define __TIZEN_MACHINELEARNING_NNSTREAMER_INTERNAL_H__
+
+#include <nnstreamer.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @brief Constructs the pipeline (GStreamer + NNStreamer).
+ * @details This function is to construct the pipeline without checking the permission in platform internally. See ml_pipeline_construct() for the details.
+ * @since_tizen 5.5
+ */
+int ml_pipeline_construct_internal (const char *pipeline_description, ml_pipeline_state_cb cb, void *user_data, ml_pipeline_h *pipe);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __TIZEN_MACHINELEARNING_NNSTREAMER_INTERNAL_H__ */
capi_devel_main = []
capi_devel_main += join_paths(meson.current_source_dir(), 'include', 'nnstreamer.h')
capi_devel_main += join_paths(meson.current_source_dir(), 'include', 'nnstreamer-single.h')
+if get_option('enable-tizen')
+ # header for Tizen internal API
+ capi_devel_main += join_paths(meson.current_source_dir(), 'include', 'nnstreamer-tizen-internal.h')
+endif
-tizen_deps = []
+# Dependencies
+capi_deps = [
+ nnstreamer_dep, glib_dep, gst_dep, gst_app_dep
+]
if (get_option('enable-tizen'))
message('CAPI is in Tizen mode')
+
tizen_deps = [
dependency('mm-resource-manager'),
dependency('mm-camcorder'),
dependency('capi-system-info'),
dependency('dlog')
]
-endif
-capi_deps = [
- nnstreamer_dep, glib_dep, gst_dep, gst_app_dep, tizen_deps
-]
+ capi_deps += tizen_deps
+endif
shared_library ('capi-nnstreamer',
capi_main,
return construct_pipeline_internal (pipeline_description, cb, user_data, pipe, FALSE);
}
+#if defined (__TIZEN__)
+/**
+ * @brief Construct the pipeline (Tizen internal, see nnstreamer-tizen-internal.h)
+ */
+int
+ml_pipeline_construct_internal (const char *pipeline_description,
+ ml_pipeline_state_cb cb, void *user_data, ml_pipeline_h * pipe)
+{
+ /* Tizen internal pipeline construction */
+ return construct_pipeline_internal (pipeline_description, cb, user_data, pipe, TRUE);
+}
+#endif /* __TIZEN__ */
+
/**
* @brief Destroy the pipeline (more info in nnstreamer.h)
*/
Requires: capi-nnstreamer-single-new = %{version}-%{release}
%description -n capi-nnstreamer-single-new-devel
Developmental kit for Tizen Native new single-shot NNStreamer API.
+
+%package -n nnstreamer-tizen-internal-capi-devel
+Summary: Tizen internal API to construct the pipeline
+Group: Multimedia/Framework
+Requires: capi-nnstreamer-devel = %{version}-%{release}
+%description -n nnstreamer-tizen-internal-capi-devel
+Tizen internal API to construct the pipeline without the permissions.
%endif
# Define build options
%{_includedir}/nnstreamer/nnstreamer-single.h
%{_libdir}/pkgconfig/capi-nnstreamer-single-new.pc
%{_libdir}/libcapi-nnstreamer-single-new.a
+
+%files -n nnstreamer-tizen-internal-capi-devel
+%{_includedir}/nnstreamer/nnstreamer-tizen-internal.h
%endif
%changelog
g_free (pipeline);
}
+
+/**
+ * @brief Test NNStreamer pipeline construct with Tizen internal API.
+ */
+TEST (nnstreamer_capi_construct_destruct, tizen_internal_01_p)
+{
+ ml_pipeline_h handle;
+ gchar *pipeline;
+ int status;
+
+ pipeline = g_strdup_printf ("videotestsrc ! videoconvert ! videoscale ! video/x-raw,format=RGB,width=320,height=240 ! tensor_converter ! tensor_sink");
+
+ status = ml_pipeline_construct_internal (pipeline, NULL, NULL, &handle);
+ EXPECT_EQ (status, ML_ERROR_NONE);
+
+ status = ml_pipeline_destroy (handle);
+ EXPECT_EQ (status, ML_ERROR_NONE);
+
+ g_free (pipeline);
+}
+
+/**
+ * @brief Test NNStreamer pipeline construct with Tizen internal API.
+ */
+TEST (nnstreamer_capi_construct_destruct, tizen_internal_02_p)
+{
+ ml_pipeline_h handle;
+ gchar *pipeline;
+ int status;
+
+ pipeline = g_strdup_printf ("audiotestsrc ! audioconvert ! audio/x-raw,format=S16LE,rate=16000 ! tensor_converter ! tensor_sink");
+
+ status = ml_pipeline_construct_internal (pipeline, NULL, NULL, &handle);
+ EXPECT_EQ (status, ML_ERROR_NONE);
+
+ status = ml_pipeline_destroy (handle);
+ EXPECT_EQ (status, ML_ERROR_NONE);
+
+ g_free (pipeline);
+}
#endif /* __TIZEN__ */
/**