mirror of
git://nv-tegra.nvidia.com/tegra/gst-src/gst-nvarguscamera.git
synced 2025-12-22 09:22:58 +03:00
Compare commits
1 Commits
l4t/l4t-r3
...
jetson_38.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
499d077ff9 |
10
commitFile.txt
Normal file
10
commitFile.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
Updating prebuilts and/or headers
|
||||
|
||||
1be6fc0d7406e0633b7e2cba49166a2f0a085cdd - gst-nvarguscamera/Makefile
|
||||
ebface35fce001fdc5889214e11a84bf13cb5fde - gst-nvarguscamera/3rdpartyheaders.tbz2
|
||||
599e80d95060e15842bc5d41b27ef7da35cbf8c0 - gst-nvarguscamera/gstnvarguscamerasrc.hpp
|
||||
5d36eec5a4929d1a09ab8ca8e7f618b8f349275d - gst-nvarguscamera/gstnvarguscamerasrc.cpp
|
||||
f2949ff626879be5aaeabf40e9ad8eab11238b6e - gst-nvarguscamera/gstnvarguscamera_utils.h
|
||||
44b0e909f18f7e2f457ba501fc47d80ecedd150b - gst-nvarguscamera/nvbufsurface.h
|
||||
5b71a3ab30d24949dcf3770e509d17dd1af64256 - gst-nvarguscamera/gstnvarguscamera_utils.cpp
|
||||
fa14f1cb043a26a6465ce793ac78479d8f6afa02 - gst-nvarguscamera/gstnvdsbufferpool.h
|
||||
BIN
gst-nvarguscamera/3rdpartyheaders.tbz2
Normal file
BIN
gst-nvarguscamera/3rdpartyheaders.tbz2
Normal file
Binary file not shown.
74
gst-nvarguscamera/Makefile
Normal file
74
gst-nvarguscamera/Makefile
Normal file
@@ -0,0 +1,74 @@
|
||||
# Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
|
||||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
SO_NAME := libgstnvarguscamerasrc.so
|
||||
|
||||
CC := g++
|
||||
|
||||
GST_INSTALL_DIR?=/usr/lib/aarch64-linux-gnu/gstreamer-1.0/
|
||||
LIB_INSTALL_DIR?=/usr/lib/aarch64-linux-gnu/tegra/
|
||||
CFLAGS:=
|
||||
LIBS:= -lnvbufsurface -lnvbufsurftransform -lnvdsbufferpool -lnvargus_socketclient -lpthread
|
||||
|
||||
SRCS := $(wildcard *.cpp)
|
||||
|
||||
INCLUDES += -I./ -I../
|
||||
|
||||
# Include jetson_mm_api include path
|
||||
INCLUDES += -I/usr/src/jetson_multimedia_api/include/
|
||||
INCLUDES += -I/usr/src/jetson_multimedia_api/argus/samples/utils/
|
||||
|
||||
PKGS := gstreamer-1.0 \
|
||||
gstreamer-base-1.0 \
|
||||
gstreamer-video-1.0 \
|
||||
gstreamer-allocators-1.0 \
|
||||
glib-2.0
|
||||
|
||||
OBJS := $(SRCS:.cpp=.o)
|
||||
|
||||
CFLAGS += -fPIC
|
||||
|
||||
CFLAGS += `pkg-config --cflags $(PKGS)`
|
||||
|
||||
LDFLAGS = -Wl,--no-undefined -L$(LIB_INSTALL_DIR) -Wl,-rpath,$(LIB_INSTALL_DIR)
|
||||
|
||||
LIBS += `pkg-config --libs $(PKGS)`
|
||||
|
||||
all: $(SO_NAME)
|
||||
|
||||
%.o: %.cpp
|
||||
$(CC) -c $< $(CFLAGS) $(INCLUDES) -o $@
|
||||
|
||||
$(SO_NAME): $(OBJS)
|
||||
$(CC) -shared -o $(SO_NAME) $(OBJS) $(LIBS) $(LDFLAGS)
|
||||
|
||||
.PHONY: install
|
||||
install: $(SO_NAME)
|
||||
cp -vp $(SO_NAME) $(GST_INSTALL_DIR)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf $(OBJS) $(SO_NAME)
|
||||
51
gst-nvarguscamera/README.txt
Normal file
51
gst-nvarguscamera/README.txt
Normal file
@@ -0,0 +1,51 @@
|
||||
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
|
||||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Steps to compile the "gst-nvarguscamera" sources natively:
|
||||
|
||||
1) Install gstreamer related packages on target using the command:
|
||||
|
||||
sudo apt-get install libgstreamer1.0-dev \
|
||||
gstreamer1.0-plugins-base \
|
||||
gstreamer1.0-plugins-good \
|
||||
libgstreamer-plugins-base1.0-dev \
|
||||
libegl1-mesa-dev
|
||||
|
||||
2) Install "jetson_multimedia_api" package from latest Jetpack release.
|
||||
|
||||
3) Download and extract the package "gst-nvarguscamera_src.tbz2" as follow:
|
||||
|
||||
tar -I lbzip2 -xvf gst-nvarguscamera_src.tbz2
|
||||
|
||||
3) Run the following commands to build and install "libgstnvarguscamerasrc.so":
|
||||
cd "gst-nvarguscamera"
|
||||
make
|
||||
make install
|
||||
or
|
||||
DEST_DIR=<dir> make install
|
||||
|
||||
Note: "make install" will copy library "libgstnvarguscamerasrc.so"
|
||||
into "/usr/lib/aarch64-linux-gnu/gstreamer-1.0" directory.
|
||||
114
gst-nvarguscamera/gstnvarguscamera_utils.cpp
Normal file
114
gst-nvarguscamera/gstnvarguscamera_utils.cpp
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "gstnvarguscamera_utils.h"
|
||||
#include <string.h>
|
||||
|
||||
GType
|
||||
gst_nvarguscam_white_balance_mode_get_type (void)
|
||||
{
|
||||
static gsize white_balance_type = 0;
|
||||
static const GEnumValue white_balance_mode[] = {
|
||||
{NvArgusCamAwbMode_Off, "GST_NVCAM_WB_MODE_OFF", "off"},
|
||||
{NvArgusCamAwbMode_Auto, "GST_NVCAM_WB_MODE_AUTO", "auto"},
|
||||
{NvArgusCamAwbMode_Incandescent, "GST_NVCAM_WB_MODE_INCANDESCENT",
|
||||
"incandescent"},
|
||||
{NvArgusCamAwbMode_Fluorescent, "GST_NVCAM_WB_MODE_FLUORESCENT", "fluorescent"},
|
||||
{NvArgusCamAwbMode_WarmFluorescent, "GST_NVCAM_WB_MODE_WARM_FLUORESCENT",
|
||||
"warm-fluorescent"},
|
||||
{NvArgusCamAwbMode_Daylight, "GST_NVCAM_WB_MODE_DAYLIGHT", "daylight"},
|
||||
{NvArgusCamAwbMode_CloudyDaylight, "GST_NVCAM_WB_MODE_CLOUDY_DAYLIGHT",
|
||||
"cloudy-daylight"},
|
||||
{NvArgusCamAwbMode_Twilight, "GST_NVCAM_WB_MODE_TWILIGHT", "twilight"},
|
||||
{NvArgusCamAwbMode_Shade, "GST_NVCAM_WB_MODE_SHADE", "shade"},
|
||||
{NvArgusCamAwbMode_Manual, "GST_NVCAM_WB_MODE_MANUAL", "manual"},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
if (g_once_init_enter (&white_balance_type)) {
|
||||
GType tmp = g_enum_register_static ("GstNvArgusCamWBMode", white_balance_mode);
|
||||
g_once_init_leave (&white_balance_type, tmp);
|
||||
}
|
||||
|
||||
return (GType) white_balance_type;
|
||||
}
|
||||
|
||||
GType
|
||||
gst_nvarguscam_tnr_mode_get_type (void)
|
||||
{
|
||||
static gsize tnr_type = 0;
|
||||
static const GEnumValue tnr_mode[] = {
|
||||
{NvArgusCamNoiseReductionMode_Off, "GST_NVCAM_NR_OFF", "NoiseReduction_Off"},
|
||||
{NvArgusCamNoiseReductionMode_Fast, "GST_NVCAM_NR_FAST", "NoiseReduction_Fast"},
|
||||
{NvArgusCamNoiseReductionMode_HighQuality, "GST_NVCAM_NR_HIGHQUALITY", "NoiseReduction_HighQuality"},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
if (g_once_init_enter (&tnr_type)) {
|
||||
GType tmp = g_enum_register_static ("GstNvArgusCamTNRMode", tnr_mode);
|
||||
g_once_init_leave (&tnr_type, tmp);
|
||||
}
|
||||
return (GType) tnr_type;
|
||||
}
|
||||
|
||||
GType
|
||||
gst_nvarguscam_edge_enhancement_mode_get_type (void)
|
||||
{
|
||||
static gsize edge_enhancement_type = 0;
|
||||
static const GEnumValue edge_enhancement_mode[] = {
|
||||
{NvArgusCamEdgeEnhancementMode_Off, "GST_NVCAM_EE_OFF", "EdgeEnhancement_Off"},
|
||||
{NvArgusCamEdgeEnhancementMode_Fast, "GST_NVCAM_EE_FAST", "EdgeEnhancement_Fast"},
|
||||
{NvArgusCamEdgeEnhancementMode_HighQuality, "GST_NVCAM_EE_HIGHQUALITY", "EdgeEnhancement_HighQuality"},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
if (g_once_init_enter (&edge_enhancement_type)) {
|
||||
GType tmp = g_enum_register_static ("GstNvArgusCamEEMode", edge_enhancement_mode);
|
||||
g_once_init_leave (&edge_enhancement_type, tmp);
|
||||
}
|
||||
return (GType) edge_enhancement_type;
|
||||
}
|
||||
|
||||
GType
|
||||
gst_nvarguscam_aeantibanding_mode_get_type (void)
|
||||
{
|
||||
static gsize aeantibanding_type = 0;
|
||||
static const GEnumValue aeantibanding_mode[] = {
|
||||
{NvArgusCamAeAntibandingMode_Off, "GST_NVCAM_AEANTIBANDING_OFF", "AeAntibandingMode_Off"},
|
||||
{NvArgusCamAeAntibandingMode_Auto, "GST_NVCAM_AEANTIBANDING_AUTO", "AeAntibandingMode_Auto"},
|
||||
{NvArgusCamAeAntibandingMode_50HZ, "GST_NVCAM_AEANTIBANDING_50HZ", "AeAntibandingMode_50HZ"},
|
||||
{NvArgusCamAeAntibandingMode_60HZ, "GST_NVCAM_AEANTIBANDING_60HZ", "AeAntibandingMode_60HZ"},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
if (g_once_init_enter (&aeantibanding_type)) {
|
||||
GType tmp = g_enum_register_static ("GstNvArgusCamAeAntiBandingMode", aeantibanding_mode);
|
||||
g_once_init_leave (&aeantibanding_type, tmp);
|
||||
}
|
||||
return (GType) aeantibanding_type;
|
||||
}
|
||||
95
gst-nvarguscamera/gstnvarguscamera_utils.h
Normal file
95
gst-nvarguscamera/gstnvarguscamera_utils.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef GSTNVARGUSCAMERA_UTILS_H_
|
||||
#define GSTNVARGUSCAMERA_UTILS_H_
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NvArgusCamAwbMode_Off = 0,
|
||||
NvArgusCamAwbMode_Auto,
|
||||
NvArgusCamAwbMode_Incandescent,
|
||||
NvArgusCamAwbMode_Fluorescent,
|
||||
NvArgusCamAwbMode_WarmFluorescent,
|
||||
NvArgusCamAwbMode_Daylight,
|
||||
NvArgusCamAwbMode_CloudyDaylight,
|
||||
NvArgusCamAwbMode_Twilight,
|
||||
NvArgusCamAwbMode_Shade,
|
||||
NvArgusCamAwbMode_Manual,
|
||||
|
||||
} NvArgusCamAwbMode;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NvArgusCamNoiseReductionMode_Off = 0,
|
||||
NvArgusCamNoiseReductionMode_Fast,
|
||||
NvArgusCamNoiseReductionMode_HighQuality
|
||||
|
||||
} NvArgusCamNoiseReductionMode;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NvArgusCamEdgeEnhancementMode_Off = 0,
|
||||
NvArgusCamEdgeEnhancementMode_Fast,
|
||||
NvArgusCamEdgeEnhancementMode_HighQuality
|
||||
|
||||
} NvArgusCamEdgeEnhancementMode;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NvArgusCamAeAntibandingMode_Off = 0,
|
||||
NvArgusCamAeAntibandingMode_Auto,
|
||||
NvArgusCamAeAntibandingMode_50HZ,
|
||||
NvArgusCamAeAntibandingMode_60HZ
|
||||
|
||||
} NvArgusCamAeAntibandingMode;
|
||||
|
||||
GType gst_nvarguscam_white_balance_mode_get_type (void);
|
||||
#define GST_TYPE_NVARGUSCAM_WB_MODE (gst_nvarguscam_white_balance_mode_get_type())
|
||||
|
||||
GType gst_nvarguscam_tnr_mode_get_type (void);
|
||||
#define GST_TYPE_NVARGUSCAM_TNR_MODE (gst_nvarguscam_tnr_mode_get_type())
|
||||
|
||||
GType gst_nvarguscam_edge_enhancement_mode_get_type (void);
|
||||
#define GST_TYPE_NVARGUSCAM_EDGE_ENHANCEMENT_MODE (gst_nvarguscam_edge_enhancement_mode_get_type())
|
||||
|
||||
GType gst_nvarguscam_aeantibanding_mode_get_type (void);
|
||||
#define GST_TYPE_NVARGUSCAM_AEANTIBANDING_MODE (gst_nvarguscam_aeantibanding_mode_get_type())
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GSTNVARGUSCAMERA_UTILS_H_ */
|
||||
2589
gst-nvarguscamera/gstnvarguscamerasrc.cpp
Normal file
2589
gst-nvarguscamera/gstnvarguscamerasrc.cpp
Normal file
File diff suppressed because it is too large
Load Diff
296
gst-nvarguscamera/gstnvarguscamerasrc.hpp
Normal file
296
gst-nvarguscamera/gstnvarguscamerasrc.hpp
Normal file
@@ -0,0 +1,296 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2017-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __GST_NVARGUSCAMERASRC_H__
|
||||
#define __GST_NVARGUSCAMERASRC_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <condition_variable>
|
||||
#include <chrono>
|
||||
|
||||
#include "nvbufsurface.h"
|
||||
#include "nvbufsurftransform.h"
|
||||
#include "gstnvarguscamera_utils.h"
|
||||
#include "gstnvdsbufferpool.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* #defines don't like whitespacey bits */
|
||||
#define GST_TYPE_NVARGUSCAMERASRC \
|
||||
(gst_nv_argus_camera_src_get_type())
|
||||
#define GST_NVARGUSCAMERASRC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_NVARGUSCAMERASRC,GstNvArgusCameraSrc))
|
||||
#define GST_NVARGUSCAMERASRC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_NVARGUSCAMERASRC,GstNvArgusCameraSrcClass))
|
||||
#define GST_IS_NVARGUSCAMERASRC(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_NVARGUSCAMERASRC))
|
||||
#define GST_IS_NVARGUSCAMERASRC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_NVARGUSCAMERASRC))
|
||||
|
||||
#define NVARGUSCAM_DEFAULT_WB_MODE NvArgusCamAwbMode_Auto
|
||||
#define NVARGUSCAM_DEFAULT_SATURATION 1.0
|
||||
#define NVARGUSCAM_DEFAULT_EXPOSURE_TIME "34000 358733000"
|
||||
#define NVARGUSCAM_DEFAULT_SENSOR_ID 0
|
||||
#define NVARGUSCAM_DEFAULT_SENSOR_MODE_STATE -1
|
||||
#define NVARGUSCAM_DEFAULT_TOTAL_SENSOR_MODES 0
|
||||
#define NVARGUSCAM_DEFAULT_GAIN_RANGE "1 16"
|
||||
#define NVARGUSCAM_DEFAULT_DIGITAL_GAIN_RANGE "1 256"
|
||||
#define NVARGUSCAM_DEFAULT_TNR_MODE NvArgusCamNoiseReductionMode_Fast
|
||||
#define NVARGUSCAM_DEFAULT_TNR_STRENGTH -1.0
|
||||
#define NVARGUSCAM_DEFAULT_EE_MODE NvArgusCamEdgeEnhancementMode_Fast
|
||||
#define NVARGUSCAM_DEFAULT_EE_STRENGTH -1.0
|
||||
#define NVARGUSCAM_DEFAULT_AEANTIBANDING_MODE NvArgusCamAeAntibandingMode_Auto
|
||||
#define NVARGUSCAM_DEFAULT_EXP_COMPENSATION 0.0
|
||||
#define NVARGUSCAM_DEFAULT_AE_LOCK FALSE
|
||||
#define NVARGUSCAM_DEFAULT_AWB_LOCK FALSE
|
||||
|
||||
typedef struct _GstNvArgusCameraSrc GstNvArgusCameraSrc;
|
||||
typedef struct _GstNvArgusCameraSrcClass GstNvArgusCameraSrcClass;
|
||||
|
||||
typedef struct _GstNvArgusCameraSrcBuffer GstNvArgusCameraSrcBuffer;
|
||||
|
||||
typedef struct NvArgusCameraRangeRec
|
||||
{
|
||||
/** Lower limit for the range. */
|
||||
gfloat low;
|
||||
/** Upper limit for the range. */
|
||||
gfloat high;
|
||||
} NvArgusCameraRange;
|
||||
|
||||
/* NvArgusCameraSrc Controls */
|
||||
typedef struct NvArgusCamControls
|
||||
{
|
||||
NvArgusCamAwbMode wbmode;
|
||||
gfloat saturation;
|
||||
NvArgusCameraRange exposureTimeRange;
|
||||
NvArgusCameraRange gainRange;
|
||||
NvArgusCameraRange ispDigitalGainRange;
|
||||
NvArgusCamNoiseReductionMode NoiseReductionMode;
|
||||
NvArgusCamEdgeEnhancementMode EdgeEnhancementMode;
|
||||
NvArgusCamAeAntibandingMode AeAntibandingMode;
|
||||
gfloat NoiseReductionStrength;
|
||||
gfloat EdgeEnhancementStrength;
|
||||
gfloat ExposureCompensation;
|
||||
gboolean AeLock;
|
||||
gboolean AwbLock;
|
||||
Argus::AcRegion AeRegion;
|
||||
} NvArgusCamControls;
|
||||
/* NvArgusCameraSrc buffer */
|
||||
struct _GstNvArgusCameraSrcBuffer
|
||||
{
|
||||
gint dmabuf_fd;
|
||||
GstBuffer *gst_buf;
|
||||
NvBufSurface *surf;
|
||||
};
|
||||
|
||||
typedef struct NvArgusFrameInfo
|
||||
{
|
||||
gint fd;
|
||||
guint64 frameNum;
|
||||
guint64 frameTime;
|
||||
guint64 captureTime;
|
||||
} NvArgusFrameInfo;
|
||||
|
||||
struct _GstNvArgusCameraSrc
|
||||
{
|
||||
GstBaseSrc base_nvarguscamera;
|
||||
|
||||
GstPad *srcpad;
|
||||
|
||||
GThread *consumer_thread;
|
||||
GThread *argus_thread;
|
||||
|
||||
gboolean silent;
|
||||
gboolean show_latency;
|
||||
|
||||
GstBufferPool *pool;
|
||||
|
||||
GstCaps *outcaps;
|
||||
|
||||
gint width;
|
||||
gint height;
|
||||
gint fps_n;
|
||||
gint fps_d;
|
||||
gint sensor_id;
|
||||
gint sensor_mode;
|
||||
|
||||
guint total_sensor_modes;
|
||||
guint timeout;
|
||||
guint secToRun;
|
||||
guint64 event_timeout;
|
||||
guint64 acquire_timeout;
|
||||
gchar *exposureTimeString;
|
||||
gchar *gainRangeString;
|
||||
gchar *ispDigitalGainRangeString;
|
||||
gchar *aeRegionString;
|
||||
|
||||
GQueue *nvmm_buffers;
|
||||
GMutex nvmm_buffers_queue_lock;
|
||||
GCond nvmm_buffers_queue_cond;
|
||||
|
||||
gboolean stop_requested;
|
||||
gboolean unlock_requested;
|
||||
gboolean timeout_complete;
|
||||
|
||||
NvBufSurfTransformParams transform_params;
|
||||
|
||||
GQueue *argus_buffers;
|
||||
GMutex argus_buffers_queue_lock;
|
||||
GCond argus_buffers_queue_cond;
|
||||
|
||||
GMutex argus_buffer_consumed_lock;
|
||||
GCond argus_buffer_consumed_cond;
|
||||
gboolean is_argus_buffer_consumed;
|
||||
|
||||
GMutex eos_lock;
|
||||
GCond eos_cond;
|
||||
GMutex queue_lock;
|
||||
|
||||
std::condition_variable cv;
|
||||
std::mutex mtx;
|
||||
|
||||
NvArgusCamControls controls;
|
||||
gboolean wbPropSet;
|
||||
gboolean saturationPropSet;
|
||||
gboolean exposureTimePropSet;
|
||||
gboolean gainRangePropSet;
|
||||
gboolean ispDigitalGainRangePropSet;
|
||||
gboolean tnrStrengthPropSet;
|
||||
gboolean tnrModePropSet;
|
||||
gboolean edgeEnhancementStrengthPropSet;
|
||||
gboolean edgeEnhancementModePropSet;
|
||||
gboolean aeAntibandingPropSet;
|
||||
gboolean exposureCompensationPropSet;
|
||||
gboolean aeLockPropSet;
|
||||
gboolean aeRegionPropSet;
|
||||
gboolean awbLockPropSet;
|
||||
gboolean argus_in_error;
|
||||
gboolean dol_sensormode;
|
||||
void *iRequest_ptr;
|
||||
void *iCaptureSession_ptr;
|
||||
void *AeRegion_ptr;
|
||||
void *iEventProvider_ptr;
|
||||
void *iEventQueue_ptr;
|
||||
void *iAutoControlSettings_ptr;
|
||||
void *request_ptr;
|
||||
void *outRequest_ptr;
|
||||
void *iDenoiseSettings_ptr;
|
||||
void *iEeSettings_ptr;
|
||||
void *iRequestSourceSettings_ptr;
|
||||
Argus::UniqueObj<Argus::EventQueue> queue;
|
||||
Argus::UniqueObj<Argus::OutputStream> outputStream;
|
||||
Argus::UniqueObj<Argus::OutputStreamSettings> streamSettings;
|
||||
Argus::UniqueObj<Argus::Request> request;
|
||||
NvArgusFrameInfo *frameInfo;
|
||||
|
||||
/* Key: capture id, value: timestamp */
|
||||
std::map<guint64, guint64> captureIdMap;
|
||||
};
|
||||
|
||||
struct _GstNvArgusCameraSrcClass
|
||||
{
|
||||
GstBaseSrcClass base_nvarguscamera_class;
|
||||
};
|
||||
|
||||
GType gst_nv_argus_camera_src_get_type (void);
|
||||
|
||||
namespace ArgusSamples
|
||||
{
|
||||
|
||||
/**
|
||||
* Base class for threads. Derived classes need to implement 'threadInitialize', 'threadExecute'
|
||||
* and 'threadShutdown'. This class handles the transition between the thread states.
|
||||
*/
|
||||
class ThreadArgus
|
||||
{
|
||||
public:
|
||||
ThreadArgus();
|
||||
virtual ~ThreadArgus();
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
*/
|
||||
bool initialize(GstNvArgusCameraSrc *);
|
||||
/**
|
||||
* Shutdown
|
||||
*/
|
||||
bool shutdown();
|
||||
|
||||
/**
|
||||
* Wait until the thread is in 'running' state
|
||||
*
|
||||
* @param timeout [in] timeout in us
|
||||
*/
|
||||
bool waitRunning(useconds_t timeoutUs = 5 * 1000 * 1000);
|
||||
|
||||
GstNvArgusCameraSrc *src;
|
||||
|
||||
protected:
|
||||
virtual bool threadInitialize(GstNvArgusCameraSrc *) = 0;
|
||||
virtual bool threadExecute(GstNvArgusCameraSrc *) = 0;
|
||||
virtual bool threadShutdown(GstNvArgusCameraSrc *) = 0;
|
||||
|
||||
/**
|
||||
* Request thread shutdown
|
||||
*/
|
||||
bool requestShutdown()
|
||||
{
|
||||
m_doShutdown = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
Ordered<bool> m_doShutdown; ///< set to request shutdown of the thread
|
||||
|
||||
private:
|
||||
pthread_t m_threadID; ///< thread ID
|
||||
|
||||
/**
|
||||
* Thread states
|
||||
*/
|
||||
enum ThreadState
|
||||
{
|
||||
THREAD_INACTIVE, ///< is inactive
|
||||
THREAD_INITIALIZING, ///< is initializing
|
||||
THREAD_RUNNING, ///< is running
|
||||
THREAD_FAILED, ///< has failed
|
||||
THREAD_DONE, ///< execution done
|
||||
};
|
||||
Ordered<ThreadState> m_threadState;
|
||||
|
||||
bool threadFunction(GstNvArgusCameraSrc *);
|
||||
|
||||
static void *threadFunctionStub(void *dataPtr);
|
||||
};
|
||||
|
||||
} // namespace ArgusSamples
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_NVARGUSCAMERASRC_H__ */
|
||||
66
gst-nvarguscamera/gstnvdsbufferpool.h
Normal file
66
gst-nvarguscamera/gstnvdsbufferpool.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef GSTNVDSBUFFERPOOL_H_
|
||||
#define GSTNVDSBUFFERPOOL_H_
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GstNvDsBufferPool GstNvDsBufferPool;
|
||||
typedef struct _GstNvDsBufferPoolClass GstNvDsBufferPoolClass;
|
||||
typedef struct _GstNvDsBufferPoolPrivate GstNvDsBufferPoolPrivate;
|
||||
|
||||
#define GST_TYPE_NVDS_BUFFER_POOL (gst_nvds_buffer_pool_get_type())
|
||||
#define GST_IS_NVDS_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NVDS_BUFFER_POOL))
|
||||
#define GST_NVDS_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_NVDS_BUFFER_POOL, GstNvDsBufferPool))
|
||||
#define GST_NVDS_BUFFER_POOL_CAST(obj) ((GstNvDsBufferPool*)(obj))
|
||||
|
||||
#define GST_NVDS_MEMORY_TYPE "nvds"
|
||||
#define GST_BUFFER_POOL_OPTION_NVDS_META "GstBufferPoolOptionNvDsMeta"
|
||||
|
||||
struct _GstNvDsBufferPool
|
||||
{
|
||||
GstBufferPool bufferpool;
|
||||
|
||||
GstNvDsBufferPoolPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GstNvDsBufferPoolClass
|
||||
{
|
||||
GstBufferPoolClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_nvds_buffer_pool_get_type (void);
|
||||
|
||||
GstBufferPool* gst_nvds_buffer_pool_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* GSTNVDSBUFFERPOOL_H_ */
|
||||
1075
gst-nvarguscamera/nvbufsurface.h
Normal file
1075
gst-nvarguscamera/nvbufsurface.h
Normal file
File diff suppressed because it is too large
Load Diff
1
push_info.txt
Normal file
1
push_info.txt
Normal file
@@ -0,0 +1 @@
|
||||
jetson_38.2
|
||||
Reference in New Issue
Block a user