diff --git a/CMakeLists.txt b/CMakeLists.txt index 627b7d7..21f033e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION "2.8.0") project(gst-plugins-vision) +option(ENABLE_KLV "Whether to enable KLV support" OFF) + set(CMAKE_SHARED_MODULE_PREFIX "lib") set(CMAKE_SHARED_LIBRARY_PREFIX "lib") diff --git a/gst-libs/CMakeLists.txt b/gst-libs/CMakeLists.txt index 0dc1f09..fdbcf64 100644 --- a/gst-libs/CMakeLists.txt +++ b/gst-libs/CMakeLists.txt @@ -1 +1,3 @@ -add_subdirectory (klv) \ No newline at end of file +if (ENABLE_KLV) + add_subdirectory (klv) +endif () \ No newline at end of file diff --git a/gst/CMakeLists.txt b/gst/CMakeLists.txt index 38e4cb9..41295e2 100644 --- a/gst/CMakeLists.txt +++ b/gst/CMakeLists.txt @@ -4,7 +4,11 @@ endif (OPENCV_FOUND) add_subdirectory (bayerutils) add_subdirectory (extractcolor) -add_subdirectory (klv) + +if (ENABLE_KLV) + add_subdirectory (klv) +endif () + add_subdirectory (misb) add_subdirectory (select) add_subdirectory (videoadjust) diff --git a/sys/pleora/CMakeLists.txt b/sys/pleora/CMakeLists.txt index 80fcdde..cafa736 100644 --- a/sys/pleora/CMakeLists.txt +++ b/sys/pleora/CMakeLists.txt @@ -1,3 +1,7 @@ +if (ENABLE_KLV) + add_definitions(-DGST_PLUGINS_VISION_ENABLE_KLV) +endif () + add_definitions(-D_XKEYCHECK_H) set (SOURCES @@ -32,13 +36,21 @@ add_library (${libname} MODULE ${SOURCES} ${HEADERS}) -target_link_libraries (${libname} +set (LIBRARIES ${GLIB2_LIBRARIES} ${GOBJECT_LIBRARIES} ${GSTREAMER_LIBRARY} ${GSTREAMER_BASE_LIBRARY} ${GSTREAMER_VIDEO_LIBRARY} - gstklv-1.0-0) + ) + +if (ENABLE_KLV) + set (LIBRARIES ${LIBRARIES} gstklv-1.0-0) +endif () + +target_link_libraries (${libname} + ${LIBRARIES} + ) if (WIN32) install (FILES $ DESTINATION ${PDB_INSTALL_DIR} COMPONENT pdb OPTIONAL) diff --git a/sys/pleora/gstpleorasink.cpp b/sys/pleora/gstpleorasink.cpp index 89e0d14..db01fc2 100644 --- a/sys/pleora/gstpleorasink.cpp +++ b/sys/pleora/gstpleorasink.cpp @@ -94,7 +94,7 @@ enum #define DEFAULT_PROP_INFO "Pleora eBUS GStreamer Sink" #define DEFAULT_PROP_SERIAL "0001" #define DEFAULT_PROP_MAC "" -#define DEFAULT_PROP_OUTPUT_KLV TRUE +#define DEFAULT_PROP_OUTPUT_KLV FALSE #define DEFAULT_PROP_AUTO_MULTICAST FALSE #define DEFAULT_PROP_MULTICAST_GROUP "239.192.1.1" #define DEFAULT_PROP_MULTICAST_PORT 1042 @@ -197,12 +197,14 @@ gst_pleorasink_class_init (GstPleoraSinkClass * klass) DEFAULT_PROP_MAC, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_MUTABLE_READY))); +#ifdef GST_PLUGINS_VISION_ENABLE_KLV g_object_class_install_property (gobject_class, PROP_OUTPUT_KLV, g_param_spec_boolean ("output-klv", "Output KLV", "Whether to output KLV as chunk data according to MISB ST1608", DEFAULT_PROP_OUTPUT_KLV, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_MUTABLE_READY))); +#endif g_object_class_install_property (gobject_class, PROP_AUTO_MULTICAST, g_param_spec_boolean ("auto-multicast", "Auto multicast", "Automatically multicast video, removing the need for a controller", diff --git a/sys/pleora/gstpleorasrc.cpp b/sys/pleora/gstpleorasrc.cpp index b16e570..b010adb 100644 --- a/sys/pleora/gstpleorasrc.cpp +++ b/sys/pleora/gstpleorasrc.cpp @@ -101,7 +101,7 @@ enum #define DEFAULT_PROP_PACKET_SIZE 0 #define DEFAULT_PROP_CONFIG_FILE "" #define DEFAULT_PROP_CONFIG_FILE_CONNECT TRUE -#define DEFAULT_PROP_OUTPUT_KLV TRUE +#define DEFAULT_PROP_OUTPUT_KLV FALSE #define VIDEO_CAPS_MAKE_BAYER8(format) \ "video/x-bayer, " \ @@ -226,12 +226,14 @@ gst_pleorasrc_class_init (GstPleoraSrcClass * klass) "connects using properties and then restores configuration", DEFAULT_PROP_CONFIG_FILE_CONNECT, (GParamFlags) (G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE))); +#ifdef GST_PLUGINS_VISION_ENABLE_KLV g_object_class_install_property (gobject_class, PROP_OUTPUT_KLV, g_param_spec_boolean ("output-klv", "Output KLV", "Whether to output MISB ST1608 KLV as buffer meta", DEFAULT_PROP_OUTPUT_KLV, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_MUTABLE_READY))); +#endif } static void @@ -1646,6 +1648,7 @@ gst_pleorasrc_create (GstPushSrc * psrc, GstBuffer ** buf) clock_time = gst_clock_get_time (clock); gst_object_unref (clock); +#ifdef GST_PLUGINS_VISION_ENABLE_KLV if (src->output_klv && pvbuffer->HasChunks ()) { guint32 num_chunks; num_chunks = pvbuffer->GetChunkCount (); @@ -1697,6 +1700,7 @@ gst_pleorasrc_create (GstPushSrc * psrc, GstBuffer ** buf) gst_buffer_add_klv_meta_from_data (*buf, chunk_data, chunk_size); } } +#endif // GST_PLUGINS_VISION_ENABLE_KLV if (src->pleora_stride != src->gst_stride) { src->pipeline->ReleaseBuffer (pvbuffer); diff --git a/sys/pleora/streamingchannelsource.cpp b/sys/pleora/streamingchannelsource.cpp index 2885006..9c4e626 100644 --- a/sys/pleora/streamingchannelsource.cpp +++ b/sys/pleora/streamingchannelsource.cpp @@ -313,8 +313,10 @@ GByteArray * GstStreamingChannelSource::GetKlvByteArray (GstBuffer * buf) gpointer iter = NULL; GByteArray *byte_array; - /* spec says KLV can all be in one chunk, or multiple chunks, we do one chunk */ byte_array = g_byte_array_new (); + +#ifdef GST_PLUGINS_VISION_ENABLE_KLV + /* spec says KLV can all be in one chunk, or multiple chunks, we do one chunk */ while ((klv_meta = (GstKLVMeta *) gst_buffer_iterate_meta_filtered (buf, &iter, GST_KLV_META_API_TYPE))) { gsize klv_size; @@ -334,6 +336,7 @@ GByteArray * GstStreamingChannelSource::GetKlvByteArray (GstBuffer * buf) const guint padding_len = GST_ROUND_UP_4 (byte_array->len) - byte_array->len; g_byte_array_append (byte_array, padding, padding_len); } +#endif // GST_PLUGINS_VISION_ENABLE_KLV return byte_array; } \ No newline at end of file