--- /dev/null
+# How to run examples
+
+## Build examples (Ubuntu)
+
+Use Cmake.
+
+See [Getting started](getting-started.md) : **Approach 2.** Build with Cmake
+
+Build example (DEV_ROOT=/dev, and gst plugin path is ```/dev/lib```)
+
+```
+$ mkdir -p build # We recommend to build in a "build" directory
+$ cd build
+$ rm -rf * # Ensure the build directory is empty
+$ cmake -DCMAKE_INSTALL_PREFIX=${DEV_ROOT} -DINCLUDE_INSTALL_DIR=${DEV_ROOT}/include ..
+$ make install # Install nnstreamer plugin libraries into /dev/lib
+$ cd ..
+```
+
+## Example : cam
+
+```
+v4l2src -- tee ------------------------------------------ videomixer -- videoconvert -- xvimagesink
+ | |
+ --- tensor_converter -- tensordec -- videoscale ---
+ |
+ --- videoconvert -- xvimagesink
+```
+
+Displays two video sinks,
+
+1. Original from cam (640 x 480)
+2. Mixed : original + scaled (tensor_converter-tensor_dec-videoscale)
+
+```
+$ cd build/nnstreamer_example/example_cam
+$ ./nnstreamer_example_cam --gst-plugin-path=/dev/lib
+```
+
+## Example : tensor sink
+
+Two simple examples to use tensor sink.
+
+#### 1. 100 buffers passed to tensor sink
+
+```
+videotestsrc -- tensor_converter -- tensor_sink
+```
+
+Displays nothing, this sample code shows how to get buffer from tensor sink.
+
+```
+$ cd build/nnstreamer_example/example_sink
+$ ./nnstreamer_sink_example --gst-plugin-path=/dev/lib
+```
+
+#### 2. launch two pipelines
+
+```
+videotestsrc -- tensor_converter -- tensor_sink
+[push buffer from tensor_sink to appsrc]
+appsrc -- tensordec -- videoconvert -- xvimagesink
+```
+
+Displays video sink.
+
+Tensor_sink receives buffer and pushes it into 2nd pipeline.
+
+```
+$ cd build/nnstreamer_example/example_sink
+$ ./nnstreamer_sink_example_play --gst-plugin-path=/dev/lib
+```
#include <unistd.h>
#include <gst/gst.h>
-#include <gst/app/gstappsrc.h>
/**
* @brief Macro for debug mode.
("v4l2src name=cam_src ! "
"video/x-raw,width=%d,height=%d,format=RGB,framerate=30/1 ! tee name=t_raw "
"videomixer name=mix "
- "sink_0::xpos=0 sink_0::ypos=0 sink_0::zorder=0 sink_0::alpha=0.7 "
- "sink_1::xpos=50 sink_1::ypos=50 sink_1::zorder=1 sink_1::alpha=0.5 ! "
+ "sink_0::xpos=0 sink_0::ypos=0 sink_0::zorder=0 "
+ "sink_1::xpos=0 sink_1::ypos=0 sink_1::zorder=1 sink_1::alpha=0.7 ! "
"videoconvert ! xvimagesink name=img_mixed "
- "t_raw. ! queue ! tensor_converter ! tensordec ! tee name=t_tensor "
"t_raw. ! queue ! mix.sink_0 "
- "t_tensor. ! queue ! mix.sink_1 "
- "t_tensor. ! queue ! videoconvert ! xvimagesink name=img_tensor",
- width, height);
+ "t_raw. ! queue ! tensor_converter ! tensordec ! videoscale ! video/x-raw,width=%d,height=%d ! mix.sink_1 "
+ "t_raw. ! queue ! videoconvert ! xvimagesink name=img_origin",
+ width, height, width / 2, height / 2);
g_app.pipeline = gst_parse_launch (str_pipeline, NULL);
g_free (str_pipeline);
_check_cond_err (g_app.pipeline != NULL);
_set_window_title (element, "Mixed");
gst_object_unref (element);
- element = gst_bin_get_by_name (GST_BIN (g_app.pipeline), "img_tensor");
- _set_window_title (element, "Tensor");
+ element = gst_bin_get_by_name (GST_BIN (g_app.pipeline), "img_origin");
+ _set_window_title (element, "Original");
gst_object_unref (element);
/* run main loop */
*
* This sample app shows video frame using two pipelines.
*
- * [1st pipeline : videotestsrc-videoconvert-tensor_converter-tensor_sink]
+ * [1st pipeline : videotestsrc-tensor_converter-tensor_sink]
* push buffer to appsrc
* [2nd pipeline : appsrc-tensordec-videoconvert-xvimagesink]
*