added build and stability patches from fedora [release 0.9.12-3mamba;Fri Dec 09 2011]

This commit is contained in:
Silvan Calarco 2024-01-06 05:58:38 +01:00
parent c3a030a12c
commit 5e5ee7b37c
8 changed files with 506 additions and 0 deletions

View File

@ -1,2 +1,5 @@
# libunicap
unicap provides a uniform interface to video capture devices.
It allows applications to use any supported video capture device via a single API

View File

@ -0,0 +1,78 @@
From 6cf16e964e312a2e040cc3e7b45be21715961a19 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Thu, 7 Oct 2010 11:02:48 +0200
Subject: [PATCH 2/2] linunicap: do not compare arrays with NULL
---
cpi/vid21394/vid21394_base.c | 2 +-
cpi/vid21394/vid21394_cpi.c | 3 ---
src/unicap_helpers.c | 10 +++++-----
3 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/cpi/vid21394/vid21394_base.c b/cpi/vid21394/vid21394_base.c
index 464a760..2ba576d 100644
--- a/cpi/vid21394/vid21394_base.c
+++ b/cpi/vid21394/vid21394_base.c
@@ -501,7 +501,7 @@ static unicap_status_t _vid21394_send_fcp_command_new( vid21394handle_t vid21394
raw1394handle_t raw1394handle = vid21394handle->raw1394handle;
- nodeid_t nodeid = nodeid = 0xffc0 | vid21394handle->node;
+ nodeid_t nodeid = 0xffc0 | vid21394handle->node;
unicap_status_t status = STATUS_SUCCESS;
diff --git a/cpi/vid21394/vid21394_cpi.c b/cpi/vid21394/vid21394_cpi.c
index e3778e4..738d0d7 100644
--- a/cpi/vid21394/vid21394_cpi.c
+++ b/cpi/vid21394/vid21394_cpi.c
@@ -654,7 +654,6 @@ int cpi_enumerate_formats( void *cpi_data, unicap_format_t *format, int index )
return STATUS_INVALID_PARAMETER;
}
- if( !data->current_formats )
{
int tmp;
cpi_reenumerate_formats( cpi_data, &tmp );
@@ -683,7 +682,6 @@ int cpi_set_format( void *cpi_data, unicap_format_t *format )
TRACE( "cpi_set_format\n" );
- if( !data->current_formats )
{
int tmp;
cpi_reenumerate_formats( cpi_data, &tmp );
@@ -845,7 +843,6 @@ unicap_status_t cpi_get_format( void *cpi_data, unicap_format_t *format )
{
vid21394_data_t *data = cpi_data;
- if( !data->current_formats )
{
int tmp;
cpi_reenumerate_formats( cpi_data, &tmp );
diff --git a/src/unicap_helpers.c b/src/unicap_helpers.c
index c2e1ec4..67578ac 100644
--- a/src/unicap_helpers.c
+++ b/src/unicap_helpers.c
@@ -105,13 +105,13 @@ unicap_status_t unicap_describe_device( unicap_device_t *device, char *buffer, s
"Vendor id: %u ( 0x%x )\n"\
"cpi: %s\n"\
"device: %s\n",
- device->identifier ? device->identifier : "(nil)",
- device->model_name ? device->model_name : "(nil)",
- device->vendor_name ? device->vendor_name : "(nil)",
+ device->identifier,
+ device->model_name,
+ device->vendor_name,
device->model_id,
device->vendor_id, device->vendor_id,
- device->cpi_layer ? device->cpi_layer : "(nil)",
- device->device ? device->device : "(nil)" );
+ device->cpi_layer,
+ device->device);
strncpy( buffer, tmp_buffer, (*buffer_size)-1 );
--
1.7.2.3

View File

@ -0,0 +1,15 @@
Patch by Kamil Dudka <kdudka@redhat.com> for libunicap >= 0.9.12, to get it building on Red Hat
Enterprise Linux 5 (or derivates); see https://bugzilla.redhat.com/show_bug.cgi?id=635377#c2 for
more details.
--- libunicap-0.9.12/cpi/v4l2cpi/buffermanager.c 2010-08-17 18:13:08.000000000 +0200
+++ libunicap-0.9.12/cpi/v4l2cpi/buffermanager.c.includes 2010-10-04 21:44:09.942065713 +0200
@@ -1,5 +1,8 @@
#include "config.h"
+#include <sys/time.h>
+
+#include <linux/ioctl.h>
#include <linux/types.h>
#include <linux/videodev2.h>
#include <semaphore.h>

View File

@ -0,0 +1,126 @@
From 739d6bde46f6d7dd68e228f2a27eb039d0550999 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Thu, 7 Oct 2010 10:56:06 +0200
Subject: [PATCH] libunicap: fix various memory errors
---
cpi/dcam/dcam_v_modes.c | 3 ++-
cpi/euvccam/euvccam_capture.c | 1 +
cpi/v4l/v4l.c | 2 +-
cpi/v4l2cpi/v4l2.c | 12 ++++++++++--
cpi/vid21394/vid21394_cpi.c | 5 ++---
src/unicap.c | 2 ++
6 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/cpi/dcam/dcam_v_modes.c b/cpi/dcam/dcam_v_modes.c
index 2b8e45a..05dd318 100644
--- a/cpi/dcam/dcam_v_modes.c
+++ b/cpi/dcam/dcam_v_modes.c
@@ -182,7 +182,8 @@ unicap_status_t _dcam_prepare_format_array( dcam_handle_t dcamhandle,
int index = _dcam_get_mode_index( f, i );
TRACE( "f: %d m: %d index: %d (%s)\n", f, i, index, _dcam_unicap_formats[index].identifier );
TRACE( "size: %d x %d\n", _dcam_unicap_formats[index].size.width, _dcam_unicap_formats[index].size.height );
- memcpy( format_array + current_format, &_dcam_unicap_formats[index], sizeof( unicap_format_t ) );
+ if( 0 < index )
+ memcpy( format_array + current_format, &_dcam_unicap_formats[index], sizeof( unicap_format_t ) );
current_format++;
}
}
diff --git a/cpi/euvccam/euvccam_capture.c b/cpi/euvccam/euvccam_capture.c
index 2909bdb..d4ea60e 100644
--- a/cpi/euvccam/euvccam_capture.c
+++ b/cpi/euvccam/euvccam_capture.c
@@ -231,6 +231,7 @@ static void *capture_thread( euvccam_handle_t handle )
if( ret < 0 ){
TRACE( "Failed to submit urb!\n" );
perror( "ioctl" );
+ free( urb );
return NULL;
}
diff --git a/cpi/v4l/v4l.c b/cpi/v4l/v4l.c
index 91b7e87..416dc30 100644
--- a/cpi/v4l/v4l.c
+++ b/cpi/v4l/v4l.c
@@ -292,7 +292,7 @@ static unicap_status_t v4l_open( void **cpi_data, unicap_device_t *device )
v4l_handle_t v4lhandle;
*cpi_data = malloc( sizeof( struct _v4l_handle ) );
- if( !cpi_data )
+ if( !*cpi_data )
{
TRACE( "malloc failed\n" );
return STATUS_FAILURE;
diff --git a/cpi/v4l2cpi/v4l2.c b/cpi/v4l2cpi/v4l2.c
index ba3d5b3..925659c 100644
--- a/cpi/v4l2cpi/v4l2.c
+++ b/cpi/v4l2cpi/v4l2.c
@@ -864,7 +864,7 @@ static unicap_status_t v4l2_reenumerate_formats( void *cpi_data, int *_pcount )
sizes = build_format_size_table( handle, v4l2_fmt.pixelformat, &size_count );
- if( size_count == 0 )
+ if( sizes == NULL )
{
handle->unicap_formats[v4l2_fmt.index].min_size.width =
handle->unicap_formats[v4l2_fmt.index].min_size.height = 1;
@@ -2148,6 +2150,8 @@ static unicap_status_t v4l2_queue_buffer( void *cpi_data, unicap_data_buffer_t *
else
{
TRACE( "queue buffer failed\n" );
+ free( queue );
+ /* FIXME: should return STATUS_FAILURE? */
}
if( ( status == STATUS_NO_BUFFERS ) && ( buffer->type == UNICAP_BUFFER_TYPE_SYSTEM ) )
@@ -2155,6 +2159,10 @@ static unicap_status_t v4l2_queue_buffer( void *cpi_data, unicap_data_buffer_t *
status = STATUS_SUCCESS;
}
}
+ else
+ {
+ free( queue );
+ }
return STATUS_SUCCESS;
diff --git a/cpi/vid21394/vid21394_cpi.c b/cpi/vid21394/vid21394_cpi.c
index c79e8db..e3778e4 100644
--- a/cpi/vid21394/vid21394_cpi.c
+++ b/cpi/vid21394/vid21394_cpi.c
@@ -504,9 +504,6 @@ int cpi_close( void *cpi_data )
{
vid21394_data_t *data = cpi_data;
- vid21394_close( data->vid21394handle );
-
-
ucutil_destroy_queue( data->in_queue );
ucutil_destroy_queue( data->out_queue );
@@ -515,6 +512,8 @@ int cpi_close( void *cpi_data )
free( data->vid21394handle->unicap_handle );
}
+ vid21394_close( data->vid21394handle );
+
g_instance_count--;
free( data );
diff --git a/src/unicap.c b/src/unicap.c
index 5cfa673..f56c6f0 100644
--- a/src/unicap.c
+++ b/src/unicap.c
@@ -1521,7 +1521,9 @@ unicap_status_t unicap_data_buffer_unref( unicap_data_buffer_t *buffer )
buffer->private->unref_func (buffer, buffer->private->unref_func_data);
}
if (buffer->private->ref_count == 0 ){
+ sem_post (&buffer->private->lock);
unicap_data_buffer_free( buffer );
+ return STATUS_SUCCESS;
}
}else{
TRACE( "unref of a buffer with refcount <= 0!" );
--
1.7.2.3

View File

@ -0,0 +1,25 @@
Patch by Robert Scheck <robert@fedoraproject.org> for libunicap >= 0.9.12, which switches
after the removal of v4l1 from the Linux kernel to the libv4l1compat header of libv4l.
--- libunicap-0.9.12/cpi/v4l/v4l.c 2010-01-17 08:49:29.000000000 +0100
+++ libunicap-0.9.12/cpi/v4l/v4l.c.videodev 2011-10-09 02:50:26.000000000 +0200
@@ -49,7 +49,7 @@
#endif
#include <debug.h>
-#include <linux/videodev.h>
+#include <libv4l1-videodev.h>
#include <linux/videodev2.h> // for v4l2 checks
#include "v4l.h"
--- libunicap-0.9.12/cpi/v4l2cpi/uvcvideo.h 2010-01-17 08:49:29.000000000 +0100
+++ libunicap-0.9.12/cpi/v4l2cpi/uvcvideo.h.videodev 2011-10-09 02:50:09.000000000 +0200
@@ -2,7 +2,7 @@
#define _USB_VIDEO_H_
#include <linux/kernel.h>
-#include <linux/videodev.h>
+#include <libv4l1-videodev.h>
#include "uvc_compat.h"

15
libunicap-bz641623.patch Normal file
View File

@ -0,0 +1,15 @@
diff --git a/cpi/v4l2cpi/v4l2.c b/cpi/v4l2cpi/v4l2.c
index a8e0c92..ec4c8db 100644
--- a/cpi/v4l2cpi/v4l2.c
+++ b/cpi/v4l2cpi/v4l2.c
@@ -1928,6 +1928,10 @@ static unicap_status_t v4l2_capture_start( void *cpi_data )
}
handle->buffer_mgr = buffer_mgr_create( handle->fd, &handle->current_format );
+ if( !handle->buffer_mgr )
+ {
+ return STATUS_FAILURE;
+ }
handle->capture_running = 1;

138
libunicap-bz642118.patch Normal file
View File

@ -0,0 +1,138 @@
include/unicap.h | 2 +-
src/unicap.c | 62 +++++++++++++++++++++++++++---------------------------
2 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/include/unicap.h b/include/unicap.h
index 43a3040..e516734 100644
--- a/include/unicap.h
+++ b/include/unicap.h
@@ -215,7 +215,7 @@ struct _unicap_data_buffer_t
unicap_buffer_flags_t flags;
- unicap_data_buffer_private_t *private;
+ unicap_data_buffer_private_t *priv;
};
typedef struct _unicap_data_buffer_t unicap_data_buffer_t;
diff --git a/src/unicap.c b/src/unicap.c
index f56c6f0..adac44d 100644
--- a/src/unicap.c
+++ b/src/unicap.c
@@ -1467,7 +1467,7 @@ unicap_data_buffer_t *unicap_data_buffer_new( unicap_format_t *format )
buffer->buffer_size = buffer->format.buffer_size;
buffer->data = malloc( buffer->buffer_size );
unicap_copy_format( &buffer->format, format );
- buffer->private = NULL;
+ buffer->priv = NULL;
return buffer;
}
@@ -1475,28 +1475,28 @@ unicap_data_buffer_t *unicap_data_buffer_new( unicap_format_t *format )
void unicap_data_buffer_init( unicap_data_buffer_t *buffer, unicap_format_t *format, unicap_data_buffer_init_data_t *init_data )
{
unicap_copy_format( &buffer->format, format );
- buffer->private = malloc( sizeof( unicap_data_buffer_private_t ) );
- sem_init( &buffer->private->lock, 0, 1 );
- buffer->private->ref_count = 0;
- buffer->private->free_func = init_data->free_func;
- buffer->private->free_func_data = init_data->free_func_data;
- buffer->private->ref_func = init_data->ref_func;
- buffer->private->ref_func_data = init_data->ref_func_data;
- buffer->private->unref_func = init_data->unref_func;
- buffer->private->unref_func_data = init_data->unref_func_data;
+ buffer->priv = malloc( sizeof( unicap_data_buffer_private_t ) );
+ sem_init( &buffer->priv->lock, 0, 1 );
+ buffer->priv->ref_count = 0;
+ buffer->priv->free_func = init_data->free_func;
+ buffer->priv->free_func_data = init_data->free_func_data;
+ buffer->priv->ref_func = init_data->ref_func;
+ buffer->priv->ref_func_data = init_data->ref_func_data;
+ buffer->priv->unref_func = init_data->unref_func;
+ buffer->priv->unref_func_data = init_data->unref_func_data;
}
void unicap_data_buffer_free( unicap_data_buffer_t *buffer )
{
- sem_wait( &buffer->private->lock );
- if( buffer->private->ref_count > 0 ){
- TRACE( "freeing a buffer with refcount = %d!!!\n", buffer->private.refcount );
+ sem_wait( &buffer->priv->lock );
+ if( buffer->priv->ref_count > 0 ){
+ TRACE( "freeing a buffer with refcount = %d!!!\n", buffer->priv.refcount );
}
- if( buffer->private->free_func ){
- buffer->private->free_func( buffer, buffer->private->free_func_data );
+ if( buffer->priv->free_func ){
+ buffer->priv->free_func( buffer, buffer->priv->free_func_data );
}
- sem_destroy( &buffer->private->lock );
+ sem_destroy( &buffer->priv->lock );
if (buffer->data)
free( buffer->data );
free( buffer );
@@ -1504,9 +1504,9 @@ void unicap_data_buffer_free( unicap_data_buffer_t *buffer )
unicap_status_t unicap_data_buffer_ref( unicap_data_buffer_t *buffer )
{
- sem_wait( &buffer->private->lock );
- buffer->private->ref_count++;
- sem_post( &buffer->private->lock );
+ sem_wait( &buffer->priv->lock );
+ buffer->priv->ref_count++;
+ sem_post( &buffer->priv->lock );
return STATUS_SUCCESS;
}
@@ -1514,14 +1514,14 @@ unicap_status_t unicap_data_buffer_ref( unicap_data_buffer_t *buffer )
unicap_status_t unicap_data_buffer_unref( unicap_data_buffer_t *buffer )
{
unicap_status_t status = STATUS_SUCCESS;
- sem_wait( &buffer->private->lock );
- if( buffer->private->ref_count > 0 ){
- buffer->private->ref_count--;
- if (buffer->private->unref_func){
- buffer->private->unref_func (buffer, buffer->private->unref_func_data);
+ sem_wait( &buffer->priv->lock );
+ if( buffer->priv->ref_count > 0 ){
+ buffer->priv->ref_count--;
+ if (buffer->priv->unref_func){
+ buffer->priv->unref_func (buffer, buffer->priv->unref_func_data);
}
- if (buffer->private->ref_count == 0 ){
- sem_post (&buffer->private->lock);
+ if (buffer->priv->ref_count == 0 ){
+ sem_post (&buffer->priv->lock);
unicap_data_buffer_free( buffer );
return STATUS_SUCCESS;
}
@@ -1529,23 +1529,23 @@ unicap_status_t unicap_data_buffer_unref( unicap_data_buffer_t *buffer )
TRACE( "unref of a buffer with refcount <= 0!" );
status = STATUS_FAILURE;
}
- sem_post (&buffer->private->lock);
+ sem_post (&buffer->priv->lock);
return status;
}
unsigned int unicap_data_buffer_get_refcount( unicap_data_buffer_t *buffer )
{
- return buffer->private->ref_count;
+ return buffer->priv->ref_count;
}
void *unicap_data_buffer_set_user_data( unicap_data_buffer_t *buffer, void *data )
{
- void *old_data = buffer->private->user_data;
- buffer->private->user_data = data;
+ void *old_data = buffer->priv->user_data;
+ buffer->priv->user_data = data;
return old_data;
}
void *unicap_data_buffer_get_user_data( unicap_data_buffer_t *buffer )
{
- return buffer->private->user_data;
+ return buffer->priv->user_data;
}

106
libunicap.spec Normal file
View File

@ -0,0 +1,106 @@
Name: libunicap
Version: 0.9.12
Release: 3mamba
Summary: A library that provides a uniform interface to video capture devices
Group: System/Libraries
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://www.unicap-imaging.org
Source: http://www.unicap-imaging.org/downloads/libunicap-%{version}.tar.gz
Patch0: %{name}-0.9.12-videodev.patch
Patch1: %{name}-0.9.12-includes.patch
Patch2: %{name}-0.9.12-arraycmp.patch
Patch3: %{name}-0.9.12-memerrs.patch
Patch4: %{name}-bz641623.patch
Patch5: %{name}-bz642118.patch
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libraw1394-devel
## AUTOBUILDREQ-END
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
unicap provides a uniform interface to video capture devices.
It allows applications to use any supported video capture device via a single API
%package devel
Summary: Devel package for %{name}
Group: Development/Libraries
Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
%description devel
unicap provides a uniform interface to video capture devices.
It allows applications to use any supported video capture device via a single API
This package contains static libraries and header files need for development.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
%configure
%make
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%makeinstall
sed -i 's/SYSFS/ATTRS/g' %{buildroot}%{_sysconfdir}/udev/rules.d/50-euvccam.rules
%find_lang unicap
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files -f unicap.lang
%defattr(-,root,root)
%{_sysconfdir}/udev/rules.d/50-euvccam.rules
%{_libdir}/libunicap.so.*
%doc AUTHORS COPYING README
%files devel
%defattr(-,root,root)
%{_includedir}/unicap/*.h
%{_libdir}/libunicap.a
%{_libdir}/libunicap.la
%{_libdir}/libunicap.so
%{_libdir}/unicap2/cpi/*.so
%{_libdir}/unicap2/cpi/*.la
%{_libdir}/unicap2/cpi/*.a
%{_libdir}/pkgconfig/*.pc
%{_datadir}/gtk-doc/html/libunicap/*
%doc ChangeLog
%changelog
* Fri Dec 09 2011 Silvan Calarco <silvan.calarco@mambasoft.it> 0.9.12-3mamba
- added build and stability patches from fedora
* Sat Dec 18 2010 Davide Madrisan <davide.madrisan@gmail.com> 0.9.12-2mamba
- fix udev warning about deprecated SYSFS tag
- run ldconfig
* Wed Dec 15 2010 Automatic Build System <autodist@mambasoft.it> 0.9.12-1mamba
- update to 0.9.12
* Wed Dec 15 2010 Automatic Build System <autodist@mambasoft.it> 0.9.3-3mamba
- automatic rebuild by autodist
* Wed Jan 07 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 0.9.3-2mamba
- automatic rebuild by autodist
* Tue Dec 02 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 0.9.3-1mamba
- automatic update by autodist
* Mon May 05 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 0.2.21-1mamba
- package created by autospec