#include <glib.h>
#include <gst/gst.h>
#include <gst/video/video-format.h>
-#include <gst/audio/audio-format.h>
#include <tensor_typedef.h>
G_BEGIN_DECLS
--- /dev/null
+/**
+ * NNStreamer Common API Header for Plug-Ins
+ * Copyright (C) 2019 Jijoong Moon <jijoong.moon@samsung.com>
+ *
+ * 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 no_audio_define.h
+ * @date 07 Mar 2019
+ * @brief Define collection of audio variables and functions for no audio support
+ * @see https://github.com/nnsuite/nnstreamer
+ * @author Jijoong Moon <jijoong.moon@samsung.com>
+ * @bug No known bugs except for NYI items
+ *
+ */
+#ifndef __NO_AUDIO_DEFINE_H__
+#define __NO_AUDIO_DEFINE_H__
+
+/**
+ * @brief Macro for gst_tensor_config_from_audio_info
+ */
+#define gst_tensor_config_from_audio_info(...) do { \
+ GST_ERROR ("\n This binary does not support audio type. Please build NNStreamer with disable-audio-support : false\n"); \
+ return FALSE; \
+ } while(0)
+
+/**
+ * @brief Macro for gst_audio_format_from_string
+ */
+#define gst_audio_format_from_string(...) GST_AUDIO_FORMAT_UNKNOWN
+
+/**
+ * @brief Macro for gst_audio_format_to_string
+ */
+#define gst_audio_format_to_string(...) "Unknown"
+
+/**
+ * @brief Macro for gst_audio_info_init
+ */
+#define gst_audio_info_init(...) do { \
+ GST_ERROR ("\n This binary does not support audio type. Please build NNStreamer with disable-audio-support : false\n"); \
+ } while(0)
+
+/**
+ * @brief Macro for gst_audio_info_from_caps
+ */
+#define gst_audio_info_from_caps(...) FALSE
+
+/**
+ * @brief Macro for GstAudioInfo structure
+ */
+#define GstAudioInfo gsize
+
+/**
+ * @brief Macro for GST_AUDIO_INFO_BPF
+ */
+#define GST_AUDIO_INFO_BPF(...) 1
+
+/**
+ * @brief GstAudioFormat ( There are more variables in audio-format.h )
+ */
+typedef enum _GstAudioFormat
+{
+ GST_AUDIO_FORMAT_UNKNOWN,
+ GST_AUDIO_FORMAT_S8,
+ GST_AUDIO_FORMAT_U8,
+ GST_AUDIO_FORMAT_S16,
+ GST_AUDIO_FORMAT_U16,
+ GST_AUDIO_FORMAT_S32,
+ GST_AUDIO_FORMAT_U32,
+ GST_AUDIO_FORMAT_F32,
+ GST_AUDIO_FORMAT_F64
+} GstAudioFormat;
+
+/**
+ * @brief Macro for GST_AUDIO_CAPS_MAKE
+ */
+#define GST_AUDIO_CAPS_MAKE(format) \
+ "audio/x-raw, " \
+ "format = (string) " format
+#endif
#include <gst/gst.h>
#include <tensor_common.h>
+#include <gst/base/gstadapter.h>
G_BEGIN_DECLS
* @note Change dimention if tensor contains N frames.
* @return TRUE if supported type
*/
-static gboolean
-gst_tensor_config_from_audio_info (GstTensorConfig * config,
+
+__attribute__ ((unused))
+ static gboolean
+ _gst_tensor_config_from_audio_info (GstTensorConfig * config,
const GstStructure * structure)
{
/**
#define nns_memset memset
#endif
+#ifdef NO_AUDIO
+#include <no_audio_define.h>
+#else
+#include <gst/audio/audio-info.h>
+#include <gst/audio/audio-format.h>
+#define gst_tensor_config_from_audio_info(...) _gst_tensor_config_from_audio_info(__VA_ARGS__)
+#endif
+
G_BEGIN_DECLS
/**
#include <gst/gst.h>
#include <gst/video/video-info.h>
-#include <gst/audio/audio-info.h>
#include <tensor_common.h>
G_BEGIN_DECLS
NNSTREAMER_VERSION := 0.1.1
CUSTOM_LINKER64 := -fPIE -pie -Wl,-dynamic-linker,/data/nnstreamer/libandroid/linker64
+NO_AUDIO := false
# Do not specify "TARGET_ARCH_ABI" in this file. If you want to append additional architecture,
# Please append an architecture name behind "APP_ABI" in Application.mk file.
endef
# Describe shared libraries that are needed to run this application.
-so_names_common := gstreamer-1.0 gstbase-1.0 gstaudio-1.0 gstvideo-1.0 glib-2.0 \
+so_names_common := gstreamer-1.0 gstbase-1.0 gstvideo-1.0 glib-2.0 \
gobject-2.0 intl z bz2 orc-0.4 gmodule-2.0 ffi gsttag-1.0 iconv \
- gstapp-1.0 png16 gstbadaudio-1.0 gstbadbase-1.0 gio-2.0 pangocairo-1.0 \
+ gstapp-1.0 png16 gstbadbase-1.0 gio-2.0 pangocairo-1.0 \
pangoft2-1.0 pango-1.0 gthread-2.0 cairo pixman-1 fontconfig expat freetype \
gstbadvideo-1.0 gstcontroller-1.0 jpeg graphene-1.0 gstpbutils-1.0 gstgl-1.0 \
gstallocators-1.0 gstbadallocators-1.0 harfbuzz
+
+ifeq ($(NO_AUDIO), false)
+so_names_common += gstaudio-1.0 gstbadaudio-1.0
+endif
+
$(foreach item,$(so_names_common),$(eval $(call shared_lib_common,$(item))))
-so_names_gst := gstcoreelements gstcoretracers gstadder gstapp gstaudioconvert \
- gstaudiomixer gstaudiorate gstaudioresample gstaudiotestsrc gstgio \
+so_names_gst := gstcoreelements gstcoretracers gstadder gstapp \
gstpango gstrawparse gsttypefindfunctions gstvideoconvert gstvideorate \
gstvideoscale gstvideotestsrc gstvolume gstautodetect gstvideofilter gstopengl \
gstopensles gstcompositor gstpng gstmultifile nnstreamer
-$(foreach item,$(so_names_gst),$(eval $(call shared_lib_gst,$(item))))
+ifeq ($(NO_AUDIO), false)
+so_names_gst += gstaudioconvert gstaudiomixer gstaudiorate gstaudioresample gstaudiotestsrc
+endif
-BUILDING_BLOCK_LIST := gstreamer-1.0 glib-2.0 gobject-2.0 intl gstcoreelements gstcoretracers gstadder \
-gstapp gstaudioconvert gstaudiomixer gstaudioresample gstaudiorate gstaudioresample gstaudiotestsrc gstgio \
+$(foreach item,$(so_names_gst),$(eval $(call shared_lib_gst,$(item))))
+
+BUILDING_BLOCK_LIST := z gstreamer-1.0 glib-2.0 gobject-2.0 intl gstcoreelements gstcoretracers gstadder \
+gstapp gstgio \
gstpango gstrawparse gsttypefindfunctions gstvideoconvert gstvideorate gstvideoscale gstvideotestsrc \
gstvolume gstautodetect gstvideofilter gstopengl gstopensles gmodule-2.0 gstcompositor ffi iconv png multifile \
-gstbase-1.0 gstaudio-1.0 gstvideo-1.0 tag-1.0 orc app-1.0 badaudio badbase-1.0 gio-2.0 pangocairo pango gthread \
+gstbase-1.0 gstvideo-1.0 tag-1.0 orc app-1.0 badbase-1.0 gio-2.0 pangocairo pango gthread \
cairo pixman fontconfig expat gstbadvideo gstcontroller jpeg graphene gstpbutils gstgl gstallocators gstbadallocators \
harfbuzz bz2 nnstreamer
+ifeq ($(NO_AUDIO), false)
+BUILDING_BLOCK_LIST += gstaudio-1.0 gstbadaudio-1.0 gstaudioconvert gstaudiomixer gstaudiorate gstaudioresample gstaudiotestsrc
+endif
+
# In case of Android ARM 64bit environment, the default path of linker is "/data/nnstreamer/".
# We use the "tests/nnstreamer_repo_dynamicity/tensor_repo_dynamic_test.c" file as a test application.
# This application is dependent on 'multifilesrc' and 'png' element that are provided by Gstreamer.
#
NNSTREAMER_VERSION := 0.1.2
+NO_AUDIO := false
# Do not specify "TARGET_ARCH_ABI" in this file. If you want to append additional architecture,
# Please append an architecture name behind "APP_ABI" in Application.mk file.
endef
# Describe shared libraries that are needed to run this application.
-so_names_common := gstreamer-1.0 gstbase-1.0 gstaudio-1.0 gstvideo-1.0 glib-2.0 \
+
+so_names_common := gstreamer-1.0 gstbase-1.0 gstvideo-1.0 glib-2.0 \
gobject-2.0 intl z bz2 orc-0.4 gmodule-2.0 ffi gsttag-1.0 iconv \
- gstapp-1.0 png16 gstbadaudio-1.0 gstbadbase-1.0 gio-2.0 pangocairo-1.0 \
+ gstapp-1.0 png16 gstbadbase-1.0 gio-2.0 pangocairo-1.0 \
pangoft2-1.0 pango-1.0 gthread-2.0 cairo pixman-1 fontconfig expat freetype \
gstbadvideo-1.0 gstcontroller-1.0 jpeg graphene-1.0 gstpbutils-1.0 gstgl-1.0 \
- gstbadallocators-1.0 harfbuzz
+ gstallocators-1.0 gstbadallocators-1.0 harfbuzz
+
+ifeq ($(NO_AUDIO), false)
+so_names_common += gstaudio-1.0 gstbadaudio-1.0
+endif
+
$(foreach item,$(so_names_common),$(eval $(call shared_lib_common,$(item))))
-so_names_gst := gstcoreelements gstcoretracers gstadder gstapp gstaudioconvert \
- gstaudiomixer gstaudiorate gstaudioresample gstaudiotestsrc gstgio \
+so_names_gst := gstcoreelements gstcoretracers gstadder gstapp \
gstpango gstrawparse gsttypefindfunctions gstvideoconvert gstvideorate \
gstvideoscale gstvideotestsrc gstvolume gstautodetect gstvideofilter gstopengl \
gstopensles gstcompositor gstpng gstmultifile
+
+ifeq ($(NO_AUDIO), false)
+so_names_gst += gstaudioconvert gstaudiomixer gstaudiorate gstaudioresample gstaudiotestsrc
+endif
+
$(foreach item,$(so_names_gst),$(eval $(call shared_lib_gst,$(item))))
+BUILDING_BLOCK_LIST := gstreamer-1.0 glib-2.0 gobject-2.0 intl gstcoreelements gstcoretracers gstadder \
+gstapp \
+gstpango gstrawparse gsttypefindfunctions gstvideoconvert gstvideorate gstvideoscale gstvideotestsrc \
+gstvolume gstautodetect gstvideofilter gstopengl gstopensles gmodule-2.0 gstcompositor ffi iconv png multifile \
+gstbase-1.0 gstvideo-1.0 tag-1.0 orc app-1.0 badbase-1.0 pangocairo pango gthread \
+cairo pixman fontconfig expat gstbadvideo gstcontroller jpeg graphene gstpbutils gstgl gstallocators gstbadallocators \
+harfbuzz bz2
+
+ifeq ($(NO_AUDIO), false)
+BUILDING_BLOCK_LIST += gstaudio-1.0 gstbadaudio-1.0 gstaudioconvert gstaudiomixer gstaudiorate gstaudioresample gstaudiotestsrc
+endif
+
include $(CLEAR_VARS)
# Please keep the pthread and openmp library for checking a compatibility
LOCAL_CXXFLAGS += -std=c++11
LOCAL_CFLAGS += -pthread -fopenmp
+ifeq ($(NO_AUDIO), true)
+LOCAL_CFLAGS += -DNO_AUDIO
+LOCAL_CXXFLAGS += -DNO_AUDIO
+endif
+
LOCAL_LDFLAGS += -fuse-ld=bfd
LOCAL_MODULE_TAGS := optional
$(NNSTREAMER_GST_HOME)/tensor_transform/
BUILDING_BLOCK_LIST := gstreamer-1.0 glib-2.0 gobject-2.0 intl gstcoreelements gstcoretracers gstadder \
-gstapp gstaudioconvert gstaudiomixer gstaudioresample gstaudiorate gstaudioresample gstaudiotestsrc gstgio \
+gstapp gstaudioconvert gstaudiomixer gstaudioresample gstaudiorate gstaudioresample gstaudiotestsrc \
gstpango gstrawparse gsttypefindfunctions gstvideoconvert gstvideorate gstvideoscale gstvideotestsrc \
gstvolume gstautodetect gstvideofilter gstopengl gstopensles gmodule-2.0 gstcompositor ffi iconv png multifile \
-gstbase-1.0 gstaudio-1.0 gstvideo-1.0 tag-1.0 orc app-1.0 badaudio badbase-1.0 gio-2.0 pangocairo pango gthread \
+gstbase-1.0 gstaudio-1.0 gstvideo-1.0 tag-1.0 orc app-1.0 badaudio badbase-1.0 pangocairo pango gthread \
cairo pixman fontconfig expat gstbadvideo gstcontroller jpeg graphene gstpbutils gstgl gstbadallocators \
-gstallocators harfbuzz bz2
+gstallocators harfbuzz bz2 z
LOCAL_C_INCLUDES += $(GSTREAMER_ROOT)/include/gstreamer-1.0 \
$(GSTREAMER_ROOT)/include/glib-2.0 \
add_project_arguments('-DDISABLE_ORC=1', language: ['c', 'cpp'])
endif
+# NO Audio support
+disable_audio = false
+
+if get_option('disable-audio-support')
+ disable_audio = true
+ add_project_arguments('-DNO_AUDIO=1', language: ['c', 'cpp'])
+ message('Disable Audio Type Support')
+endif
+
# Tensorflow
have_tensorflow = false
option('enable-tensorflow-lite', type: 'boolean', value: true)
option('enable-tensorflow', type: 'boolean', value: true)
option('install-example', type: 'boolean', value: false)
+option('disable-audio-support', type: 'boolean', value: false)