|
|
|
@@ -1,28 +1,30 @@
|
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2017-2023, NVIDIA CORPORATION. All rights reserved.
|
|
|
|
|
* 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:
|
|
|
|
|
* * 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.
|
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
@@ -49,6 +51,7 @@
|
|
|
|
|
#include <EGLStream/NV/ImageNativeBuffer.h>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <fstream>
|
|
|
|
|
#include <map>
|
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
|
|
#include <pthread.h>
|
|
|
|
@@ -69,12 +72,7 @@
|
|
|
|
|
#define MIN_BUFFERS 6
|
|
|
|
|
#define MAX_BUFFERS 8
|
|
|
|
|
|
|
|
|
|
#define MIN_GAIN 1
|
|
|
|
|
#define MAX_GAIN 16
|
|
|
|
|
|
|
|
|
|
#define MIN_EXPOSURE_TIME 34000
|
|
|
|
|
#define MAX_EXPOSURE_TIME 358733000
|
|
|
|
|
|
|
|
|
|
// this is gain value applied by ISP, its default range is [1, 256].
|
|
|
|
|
#define MIN_DIGITAL_GAIN 1
|
|
|
|
|
#define MAX_DIGITAL_GAIN 256
|
|
|
|
|
|
|
|
|
@@ -351,11 +349,13 @@ bool StreamConsumer::threadExecute(GstNvArgusCameraSrc *src)
|
|
|
|
|
|
|
|
|
|
src->frameInfo = g_slice_new(NvArgusFrameInfo);
|
|
|
|
|
src->frameInfo->fd = -1;
|
|
|
|
|
src->captureIdMap.clear();
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
Argus::Status frame_status;
|
|
|
|
|
Argus::EventType frame_event;
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
Event* event = NULL;
|
|
|
|
|
IEvent* iEvent = NULL;
|
|
|
|
|
static GQuark domain = g_quark_from_static_string ("NvArgusCameraSrc");
|
|
|
|
@@ -380,6 +380,7 @@ bool StreamConsumer::threadExecute(GstNvArgusCameraSrc *src)
|
|
|
|
|
|
|
|
|
|
event = (Event* )iEventQueue_ptr->getEvent(iEventQueue_ptr->getSize() - 1);
|
|
|
|
|
iEvent = (IEvent*)interface_cast<const IEvent>(event);
|
|
|
|
|
|
|
|
|
|
if (!iEvent)
|
|
|
|
|
{
|
|
|
|
|
src->argus_in_error = TRUE;
|
|
|
|
@@ -407,7 +408,10 @@ bool StreamConsumer::threadExecute(GstNvArgusCameraSrc *src)
|
|
|
|
|
}
|
|
|
|
|
else if (frame_event == EVENT_TYPE_CAPTURE_STARTED)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
guint64 capture_id = iEvent->getCaptureId();
|
|
|
|
|
guint64 time = g_get_monotonic_time();
|
|
|
|
|
src->captureIdMap.insert(std::pair<guint64, guint64>(capture_id, time));
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else if (frame_event == EVENT_TYPE_CAPTURE_COMPLETE)
|
|
|
|
|
{
|
|
|
|
@@ -563,12 +567,12 @@ bool StreamConsumer::threadExecute(GstNvArgusCameraSrc *src)
|
|
|
|
|
src->edgeEnhancementModePropSet = FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(src->edgeEnhancementStrengthPropSet)
|
|
|
|
|
{
|
|
|
|
|
l_iEeSettings_ptr->setEdgeEnhanceStrength(src->controls.EdgeEnhancementStrength);
|
|
|
|
|
l_iCaptureSession->repeat(l_captureRequest);
|
|
|
|
|
src->edgeEnhancementStrengthPropSet = FALSE;
|
|
|
|
|
}
|
|
|
|
|
if(src->edgeEnhancementStrengthPropSet)
|
|
|
|
|
{
|
|
|
|
|
l_iEeSettings_ptr->setEdgeEnhanceStrength(src->controls.EdgeEnhancementStrength);
|
|
|
|
|
l_iCaptureSession->repeat(l_captureRequest);
|
|
|
|
|
src->edgeEnhancementStrengthPropSet = FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(src->aeAntibandingPropSet)
|
|
|
|
|
{
|
|
|
|
@@ -596,6 +600,19 @@ bool StreamConsumer::threadExecute(GstNvArgusCameraSrc *src)
|
|
|
|
|
|
|
|
|
|
if(src->gainRangePropSet == TRUE)
|
|
|
|
|
{
|
|
|
|
|
if (src->controls.gainRange.low < sensorModeAnalogGainRange.min())
|
|
|
|
|
{
|
|
|
|
|
GST_ARGUS_PRINT("Invalid min gain value, using default minimum gain: %f instead.\n",
|
|
|
|
|
sensorModeAnalogGainRange.min());
|
|
|
|
|
src->controls.gainRange.low = sensorModeAnalogGainRange.min();
|
|
|
|
|
}
|
|
|
|
|
if (src->controls.gainRange.high > sensorModeAnalogGainRange.max())
|
|
|
|
|
{
|
|
|
|
|
GST_ARGUS_PRINT("Invalid max gain value, using default maximum gain: %f instead.\n",
|
|
|
|
|
sensorModeAnalogGainRange.max());
|
|
|
|
|
src->controls.gainRange.high = sensorModeAnalogGainRange.max();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sensorModeAnalogGainRange.min() = src->controls.gainRange.low;
|
|
|
|
|
sensorModeAnalogGainRange.max() = src->controls.gainRange.high;
|
|
|
|
|
l_iRequestSourceSettings_ptr->setGainRange(sensorModeAnalogGainRange);
|
|
|
|
@@ -614,6 +631,19 @@ bool StreamConsumer::threadExecute(GstNvArgusCameraSrc *src)
|
|
|
|
|
|
|
|
|
|
if(src->exposureTimePropSet == TRUE)
|
|
|
|
|
{
|
|
|
|
|
if (src->controls.exposureTimeRange.low < limitExposureTimeRange.min())
|
|
|
|
|
{
|
|
|
|
|
GST_ARGUS_PRINT("Invalid min exp value, using default minimum exp: %ju instead.\n",
|
|
|
|
|
limitExposureTimeRange.min());
|
|
|
|
|
src->controls.exposureTimeRange.low = limitExposureTimeRange.min();
|
|
|
|
|
}
|
|
|
|
|
if (src->controls.exposureTimeRange.high > limitExposureTimeRange.max())
|
|
|
|
|
{
|
|
|
|
|
GST_ARGUS_PRINT("Invalid max exp value, using default maximum exp: %ju instead.\n",
|
|
|
|
|
limitExposureTimeRange.max());
|
|
|
|
|
src->controls.exposureTimeRange.high = limitExposureTimeRange.max();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
limitExposureTimeRange.min() = src->controls.exposureTimeRange.low;
|
|
|
|
|
limitExposureTimeRange.max() = src->controls.exposureTimeRange.high;
|
|
|
|
|
l_iRequestSourceSettings_ptr->setExposureTimeRange(limitExposureTimeRange);
|
|
|
|
@@ -675,6 +705,8 @@ bool StreamConsumer::threadExecute(GstNvArgusCameraSrc *src)
|
|
|
|
|
|
|
|
|
|
src->frameInfo->frameNum = iFrame->getNumber();
|
|
|
|
|
src->frameInfo->frameTime = iFrame->getTime();
|
|
|
|
|
src->frameInfo->captureTime = src->captureIdMap[iFrame->getNumber()];
|
|
|
|
|
src->captureIdMap.erase(iFrame->getNumber());
|
|
|
|
|
|
|
|
|
|
g_mutex_lock (&src->argus_buffers_queue_lock);
|
|
|
|
|
g_queue_push_tail (src->argus_buffers, (src->frameInfo));
|
|
|
|
@@ -709,6 +741,9 @@ bool StreamConsumer::threadExecute(GstNvArgusCameraSrc *src)
|
|
|
|
|
|
|
|
|
|
g_slice_free (NvArgusFrameInfo, src->frameInfo);
|
|
|
|
|
|
|
|
|
|
if (error)
|
|
|
|
|
g_error_free(error);
|
|
|
|
|
|
|
|
|
|
if (!src->argus_in_error)
|
|
|
|
|
{
|
|
|
|
|
CONSUMER_PRINT("Done Success\n");
|
|
|
|
@@ -1095,6 +1130,19 @@ static bool execute(int32_t cameraIndex,
|
|
|
|
|
|
|
|
|
|
if(src->exposureTimePropSet == TRUE)
|
|
|
|
|
{
|
|
|
|
|
if (src->controls.exposureTimeRange.low < limitExposureTimeRange.min())
|
|
|
|
|
{
|
|
|
|
|
GST_ARGUS_PRINT("Invalid min exp value, using default minimum exp: %ju instead.\n",
|
|
|
|
|
limitExposureTimeRange.min());
|
|
|
|
|
src->controls.exposureTimeRange.low = limitExposureTimeRange.min();
|
|
|
|
|
}
|
|
|
|
|
if (src->controls.exposureTimeRange.high > limitExposureTimeRange.max())
|
|
|
|
|
{
|
|
|
|
|
GST_ARGUS_PRINT("Invalid max exp value, using default maximum exp: %ju instead.\n",
|
|
|
|
|
limitExposureTimeRange.max());
|
|
|
|
|
src->controls.exposureTimeRange.high = limitExposureTimeRange.max();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
limitExposureTimeRange.min() = src->controls.exposureTimeRange.low;
|
|
|
|
|
limitExposureTimeRange.max() = src->controls.exposureTimeRange.high;
|
|
|
|
|
requestSourceSettings->setExposureTimeRange(limitExposureTimeRange);
|
|
|
|
@@ -1103,6 +1151,19 @@ static bool execute(int32_t cameraIndex,
|
|
|
|
|
|
|
|
|
|
if(src->gainRangePropSet == TRUE)
|
|
|
|
|
{
|
|
|
|
|
if (src->controls.gainRange.low < sensorModeAnalogGainRange.min())
|
|
|
|
|
{
|
|
|
|
|
GST_ARGUS_PRINT("Invalid min gain value, using default minimum gain: %f instead.\n",
|
|
|
|
|
sensorModeAnalogGainRange.min());
|
|
|
|
|
src->controls.gainRange.low = sensorModeAnalogGainRange.min();
|
|
|
|
|
}
|
|
|
|
|
if (src->controls.gainRange.high > sensorModeAnalogGainRange.max())
|
|
|
|
|
{
|
|
|
|
|
GST_ARGUS_PRINT("Invalid max gain value, using default maximum gain: %f instead.\n",
|
|
|
|
|
sensorModeAnalogGainRange.max());
|
|
|
|
|
src->controls.gainRange.high = sensorModeAnalogGainRange.max();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sensorModeAnalogGainRange.min() = src->controls.gainRange.low;
|
|
|
|
|
sensorModeAnalogGainRange.max() = src->controls.gainRange.high;
|
|
|
|
|
requestSourceSettings->setGainRange(sensorModeAnalogGainRange);
|
|
|
|
@@ -1221,6 +1282,7 @@ enum
|
|
|
|
|
{
|
|
|
|
|
PROP_0,
|
|
|
|
|
PROP_SILENT,
|
|
|
|
|
PROP_SHOW_LATENCY,
|
|
|
|
|
PROP_TIMEOUT,
|
|
|
|
|
PROP_WHITE_BALANCE,
|
|
|
|
|
PROP_SATURATION,
|
|
|
|
@@ -1342,7 +1404,6 @@ gst_nv_memory_allocator_alloc (GstAllocator * allocator,
|
|
|
|
|
mem = g_slice_new0 (GstNVArgusMemory);
|
|
|
|
|
nvbuf = g_slice_new0 (GstNvArgusCameraSrcBuffer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
input_params.params.width = self->width;
|
|
|
|
|
input_params.params.height = self->height;
|
|
|
|
@@ -1449,7 +1510,7 @@ static GstCaps * gst_nv_argus_camera_fixate (GstBaseSrc *src, GstCaps *caps)
|
|
|
|
|
|
|
|
|
|
static gboolean gst_nv_argus_camera_set_caps (GstBaseSrc *base, GstCaps *caps)
|
|
|
|
|
{
|
|
|
|
|
GstVideoInfo info;
|
|
|
|
|
GstVideoInfo info = {0};
|
|
|
|
|
GstCaps *old;
|
|
|
|
|
GstNvArgusCameraSrc *src = GST_NVARGUSCAMERASRC (base);
|
|
|
|
|
// write own allocator here
|
|
|
|
@@ -1481,18 +1542,22 @@ static gboolean gst_nv_argus_camera_set_caps (GstBaseSrc *base, GstCaps *caps)
|
|
|
|
|
gst_object_unref (src->pool);
|
|
|
|
|
src->pool = NULL;
|
|
|
|
|
}
|
|
|
|
|
src->pool = gst_nvds_buffer_pool_new();
|
|
|
|
|
GstStructure *config = gst_buffer_pool_get_config (src->pool);
|
|
|
|
|
gst_buffer_pool_config_set_params (config, src->outcaps, sizeof(NvBufSurface), MIN_BUFFERS, MAX_BUFFERS);
|
|
|
|
|
gst_structure_set (config,
|
|
|
|
|
"memtype", G_TYPE_UINT, NVBUF_MEM_DEFAULT,
|
|
|
|
|
"memtag", G_TYPE_UINT, NvBufSurfaceTag_CAMERA,
|
|
|
|
|
"gpu-id", G_TYPE_UINT, 0,
|
|
|
|
|
"batch-size", G_TYPE_UINT, 1, NULL);
|
|
|
|
|
gst_buffer_pool_set_config (src->pool, config);
|
|
|
|
|
src->argus_buffers = g_queue_new ();
|
|
|
|
|
src->nvmm_buffers = g_queue_new ();
|
|
|
|
|
gst_buffer_pool_set_active (src->pool, TRUE);
|
|
|
|
|
|
|
|
|
|
src->pool = gst_buffer_pool_new();
|
|
|
|
|
GstNVArgusMemoryAllocator *allocator =
|
|
|
|
|
(GstNVArgusMemoryAllocator *)g_object_new(gst_nv_memory_allocator_get_type(), NULL);
|
|
|
|
|
allocator->owner = src;
|
|
|
|
|
GstStructure *config = gst_buffer_pool_get_config(src->pool);
|
|
|
|
|
gst_buffer_pool_config_set_allocator(config, GST_ALLOCATOR(allocator), NULL);
|
|
|
|
|
|
|
|
|
|
gst_buffer_pool_config_set_params(config, NULL, sizeof(NvBufSurface), MIN_BUFFERS, MAX_BUFFERS);
|
|
|
|
|
gst_buffer_pool_set_config(src->pool, config);
|
|
|
|
|
|
|
|
|
|
src->argus_buffers = g_queue_new();
|
|
|
|
|
src->nvmm_buffers = g_queue_new();
|
|
|
|
|
|
|
|
|
|
gst_buffer_pool_set_active(src->pool, TRUE);
|
|
|
|
|
gst_object_unref(allocator);
|
|
|
|
|
|
|
|
|
|
src->consumer_thread = g_thread_new ("consumer_thread", consumer_thread, src);
|
|
|
|
|
|
|
|
|
@@ -1566,7 +1631,7 @@ static gboolean gst_nv_argus_camera_stop (GstBaseSrc * src_base)
|
|
|
|
|
}
|
|
|
|
|
g_thread_join(src->consumer_thread);
|
|
|
|
|
|
|
|
|
|
while (!g_queue_is_empty (src->nvmm_buffers)) {
|
|
|
|
|
while (!g_queue_is_empty (src->nvmm_buffers)) {
|
|
|
|
|
buf = (GstBuffer *) g_queue_pop_head (src->nvmm_buffers);
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
}
|
|
|
|
@@ -1685,14 +1750,34 @@ consumer_thread (gpointer src_base)
|
|
|
|
|
goto done;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mem = gst_buffer_peek_memory (buffer, 0);
|
|
|
|
|
GstMapInfo outmap = GST_MAP_INFO_INIT;
|
|
|
|
|
if (!mem) {
|
|
|
|
|
GST_ERROR_OBJECT(src, "no memory block");
|
|
|
|
|
GstNVArgusMemory *nv_mem = NULL;
|
|
|
|
|
mem = gst_buffer_peek_memory(buffer, 0);
|
|
|
|
|
GstMiniObject *miniobj = NULL;
|
|
|
|
|
|
|
|
|
|
nv_mem = (GstNVArgusMemory *)mem;
|
|
|
|
|
nv_mem->auxData.frame_num = consumerFrameInfo->frameNum;
|
|
|
|
|
nv_mem->auxData.timestamp = consumerFrameInfo->frameTime;
|
|
|
|
|
|
|
|
|
|
miniobj = GST_MINI_OBJECT_CAST(buffer);
|
|
|
|
|
if (gst_mini_object_is_writable(miniobj))
|
|
|
|
|
gst_mini_object_set_qdata(miniobj,
|
|
|
|
|
gst_buffer_metadata_quark, &((GstNVArgusMemory *)mem)->auxData, NULL);
|
|
|
|
|
|
|
|
|
|
if (consumerFrameInfo->fd == 0)
|
|
|
|
|
{
|
|
|
|
|
g_mutex_lock(&src->argus_buffer_consumed_lock);
|
|
|
|
|
g_cond_signal(&src->argus_buffer_consumed_cond);
|
|
|
|
|
src->is_argus_buffer_consumed = TRUE;
|
|
|
|
|
g_mutex_unlock(&src->argus_buffer_consumed_lock);
|
|
|
|
|
goto done;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NvBufSurface *surf = 0;
|
|
|
|
|
retn = NvBufSurfaceFromFd(nv_mem->nvcam_buf->dmabuf_fd, (void **)(&surf));
|
|
|
|
|
if (retn != 0) {
|
|
|
|
|
GST_ERROR_OBJECT(src, "NvBufSurfaceFromFd Failed");
|
|
|
|
|
goto done;
|
|
|
|
|
}
|
|
|
|
|
gst_buffer_map (buffer, &outmap, GST_MAP_WRITE);
|
|
|
|
|
NvBufSurface* surf = (NvBufSurface *)outmap.data;
|
|
|
|
|
|
|
|
|
|
NvBufSurface *nvbuf_surf = 0;
|
|
|
|
|
retn = NvBufSurfaceFromFd(consumerFrameInfo->fd, (void**)(&nvbuf_surf));
|
|
|
|
@@ -1701,6 +1786,7 @@ consumer_thread (gpointer src_base)
|
|
|
|
|
goto done;
|
|
|
|
|
}
|
|
|
|
|
retn = NvBufSurfTransform(nvbuf_surf, surf, &src->transform_params);
|
|
|
|
|
|
|
|
|
|
g_mutex_lock (&src->argus_buffer_consumed_lock);
|
|
|
|
|
g_cond_signal (&src->argus_buffer_consumed_cond);
|
|
|
|
|
src->is_argus_buffer_consumed = TRUE;
|
|
|
|
@@ -1711,7 +1797,11 @@ consumer_thread (gpointer src_base)
|
|
|
|
|
goto done;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gst_buffer_unmap (buffer, &outmap);
|
|
|
|
|
if (src->show_latency)
|
|
|
|
|
{
|
|
|
|
|
double latency = (g_get_monotonic_time() - consumerFrameInfo->captureTime)/1000.0;
|
|
|
|
|
GST_DEBUG_OBJECT (src, "capture id %lu latency %.2lf ms", consumerFrameInfo->frameNum, latency);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_mutex_lock (&src->nvmm_buffers_queue_lock);
|
|
|
|
|
g_queue_push_tail (src->nvmm_buffers, buffer);
|
|
|
|
@@ -1831,22 +1921,12 @@ static gboolean set_range (GstNvArgusCameraSrc *src, guint prop_id)
|
|
|
|
|
{
|
|
|
|
|
if(prop_id == PROP_GAIN_RANGE)
|
|
|
|
|
{
|
|
|
|
|
if (array[0] < MIN_GAIN || array[1] > MAX_GAIN) {
|
|
|
|
|
GST_ARGUS_PRINT("Invalid Gain Range Input\n");
|
|
|
|
|
ret = FALSE;
|
|
|
|
|
goto done;
|
|
|
|
|
}
|
|
|
|
|
range.low = array[0];
|
|
|
|
|
range.high = array[1];
|
|
|
|
|
src->controls.gainRange = range;
|
|
|
|
|
}
|
|
|
|
|
else if(prop_id == PROP_EXPOSURE_TIME_RANGE)
|
|
|
|
|
{
|
|
|
|
|
if (array[0] < MIN_EXPOSURE_TIME || array[1] > MAX_EXPOSURE_TIME) {
|
|
|
|
|
GST_ARGUS_PRINT("Invalid Exposure Time Range Input\n");
|
|
|
|
|
ret = FALSE;
|
|
|
|
|
goto done;
|
|
|
|
|
}
|
|
|
|
|
range.low = array[0];
|
|
|
|
|
range.high = array[1];
|
|
|
|
|
src->controls.exposureTimeRange = range;
|
|
|
|
@@ -1977,6 +2057,11 @@ gst_nv_argus_camera_src_class_init (GstNvArgusCameraSrcClass * klass)
|
|
|
|
|
g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?",
|
|
|
|
|
FALSE, (GParamFlags) G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_SHOW_LATENCY,
|
|
|
|
|
g_param_spec_boolean ("show-latency", "show-latency",
|
|
|
|
|
"Show capture latency between start of frame and GstBuffer push",
|
|
|
|
|
FALSE, (GParamFlags) G_PARAM_READWRITE));
|
|
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_TIMEOUT,
|
|
|
|
|
g_param_spec_uint ("timeout", "timeout",
|
|
|
|
|
"timeout to capture in seconds (Either specify timeout or num-buffers, not both)",
|
|
|
|
@@ -2030,7 +2115,7 @@ gst_nv_argus_camera_src_class_init (GstNvArgusCameraSrcClass * klass)
|
|
|
|
|
"\t\t\tUse string with values of ISP Digital Gain Range (low, high)\n"
|
|
|
|
|
"\t\t\tin that order, to set the property.\n"
|
|
|
|
|
"\t\t\teg: ispdigitalgainrange=\"1 8\"",
|
|
|
|
|
NVARGUSCAM_DEFAULT_GAIN_RANGE, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
|
|
|
|
|
NVARGUSCAM_DEFAULT_DIGITAL_GAIN_RANGE, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
|
|
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_TNR_STRENGTH,
|
|
|
|
|
g_param_spec_float ("tnr-strength", "TNR Strength",
|
|
|
|
@@ -2115,6 +2200,7 @@ gst_nv_argus_camera_src_init (GstNvArgusCameraSrc * src)
|
|
|
|
|
src->stop_requested = FALSE;
|
|
|
|
|
src->unlock_requested = FALSE;
|
|
|
|
|
src->silent = TRUE;
|
|
|
|
|
src->show_latency = FALSE;
|
|
|
|
|
src->outcaps = NULL;
|
|
|
|
|
src->timeout = 0;
|
|
|
|
|
src->event_timeout = DEFAULT_WAIT_FOR_EVENT_TIMEOUT;
|
|
|
|
@@ -2181,6 +2267,10 @@ static void gst_nv_argus_camera_src_finalize (GObject *object)
|
|
|
|
|
g_free (src->ispDigitalGainRangeString);
|
|
|
|
|
src->ispDigitalGainRangeString = NULL;
|
|
|
|
|
}
|
|
|
|
|
if(src->outcaps) {
|
|
|
|
|
gst_caps_unref (src->outcaps);
|
|
|
|
|
src->outcaps = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
@@ -2194,6 +2284,9 @@ gst_nv_argus_camera_src_set_property (GObject * object, guint prop_id,
|
|
|
|
|
case PROP_SILENT:
|
|
|
|
|
src->silent = g_value_get_boolean (value);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_SHOW_LATENCY:
|
|
|
|
|
src->show_latency = g_value_get_boolean (value);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_TIMEOUT:
|
|
|
|
|
src->timeout = g_value_get_uint (value);
|
|
|
|
|
break;
|
|
|
|
@@ -2326,6 +2419,9 @@ gst_nv_argus_camera_src_get_property (GObject * object, guint prop_id,
|
|
|
|
|
case PROP_SILENT:
|
|
|
|
|
g_value_set_boolean (value, src->silent);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_SHOW_LATENCY:
|
|
|
|
|
g_value_set_boolean (value, src->show_latency);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_TIMEOUT:
|
|
|
|
|
g_value_set_uint (value, src->timeout);
|
|
|
|
|
break;
|
|
|
|
|