rpms/dvgrab/F-8 dvgrab-3.0-fixes.patch, NONE, 1.1 dvgrab.spec, 1.20, 1.21

Jarod Wilson (jwilson) fedora-extras-commits at redhat.com
Mon Oct 22 21:57:26 UTC 2007


Author: jwilson

Update of /cvs/pkgs/rpms/dvgrab/F-8
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv8876

Modified Files:
	dvgrab.spec 
Added Files:
	dvgrab-3.0-fixes.patch 
Log Message:
* Mon Oct 22 2007 Jarod Wilson <jwilson at redhat.com> - 3.0-2
- Fix segfault on cleanup (#331271)
- fix pipe output in conjunction with file capture
- fix hang at end of reading from stdin
- fix potential data loss due to short writes


dvgrab-3.0-fixes.patch:

--- NEW FILE dvgrab-3.0-fixes.patch ---
diff -Naurp dvgrab-3.0.orig/dvgrab.cc dvgrab-3.0/dvgrab.cc
--- dvgrab-3.0.orig/dvgrab.cc	2007-08-06 23:00:43.000000000 -0400
+++ dvgrab-3.0/dvgrab.cc	2007-10-22 17:22:18.000000000 -0400
@@ -436,9 +436,6 @@ void DVgrab::getargs( int argc, char *ar
 			print_version();
 			exit( EXIT_SUCCESS );
 			break;
-		case '-':
-			m_raw_pipe = true;
-			break;
 		default:
 			print_usage();
 			exit( EXIT_FAILURE );
@@ -447,15 +444,31 @@ void DVgrab::getargs( int argc, char *ar
 
 	if ( optind < argc )
 	{
+		if ( argv[ optind ][0] == '-' )
+		{
+			m_raw_pipe = true;
+			++optind;
+		}
+	}
+	if ( optind < argc )
+	{
 		m_dst_file_name = argv[ optind++ ];
 		set_format_from_name();
 	}
 
 	if ( optind < argc )
 	{
-		cerr << "Too many output file names." << endl;
-		print_usage();
-		exit( EXIT_FAILURE );
+		if ( argv[ optind ][0] == '-' )
+		{
+			m_raw_pipe = true;
+			++optind;
+		}
+		else
+		{
+			cerr << "Too many output file names." << endl;
+			print_usage();
+			exit( EXIT_FAILURE );
+		}
 	}
 
 	if ( m_dst_file_name == NULL && !m_raw_pipe )
diff -Naurp dvgrab-3.0.orig/filehandler.cc dvgrab-3.0/filehandler.cc
--- dvgrab-3.0.orig/filehandler.cc	2007-07-28 23:47:15.000000000 -0400
+++ dvgrab-3.0/filehandler.cc	2007-10-22 17:25:53.000000000 -0400
@@ -41,6 +41,7 @@ using std::setfill;
 #include <sys/stat.h>
 #include <assert.h>
 #include <time.h>
+#include <errno.h>
 
 #include "filehandler.h"
 #include "error.h"
@@ -459,6 +460,32 @@ TimeSys:
 	return true;
 }
 
+static ssize_t writen( int fd, unsigned char *vptr, size_t n )
+{
+	size_t nleft = n;
+	ssize_t nwritten;
+	unsigned char *ptr = vptr;
+
+	while ( nleft > 0 )
+	{
+		if ( ( nwritten = write( fd, ptr, nleft ) ) <= 0 )
+		{
+			if ( errno == EINTR )
+			{
+				nwritten = 0;
+			}
+			else
+			{
+				n = -1;
+				break;
+			}
+		}
+		nleft -= nwritten;
+		ptr += nwritten;
+	}
+	return n;
+}
+
 /***************************************************************************/
 
 
@@ -497,7 +524,7 @@ bool RawHandler::Create( const string& f
 
 int RawHandler::Write( Frame *frame )
 {
-	int result = write( fd, frame->data, frame->GetDataLen() );
+	int result = writen( fd, frame->data, frame->GetDataLen() );
 	return result;
 }
 
@@ -1261,12 +1288,12 @@ int Mpeg2Handler::Write( Frame *frame )
 	// Write any buffered data first.
 	if ( bufferLen > 0 )
 	{
-		if ( 0 > ( result = write( fd, buffer, bufferLen ) ) )
+		if ( 0 > ( result = writen( fd, buffer, bufferLen ) ) )
 			return result;
 		bufferLen = 0;
 	}
 
-	result = write( fd, frame->data, frame->GetDataLen() );
+	result = writen( fd, frame->data, frame->GetDataLen() );
 
 	if ( 0 <= result )
 		totalFrames++;
diff -Naurp dvgrab-3.0.orig/ieee1394io.cc dvgrab-3.0/ieee1394io.cc
--- dvgrab-3.0.orig/ieee1394io.cc	2007-07-07 03:10:12.000000000 -0400
+++ dvgrab-3.0/ieee1394io.cc	2007-10-22 17:14:52.000000000 -0400
@@ -432,14 +432,18 @@ bool iec61883Reader::Open()
 
 void iec61883Reader::Close()
 {
-	if ( m_iec61883.ref != NULL )
-	{
-		if ( isHDV )
+	if ( isHDV ) {
+		if ( m_iec61883.mpeg2 != NULL ) {
 			iec61883_mpeg2_close( m_iec61883.mpeg2 );
-		else
+			m_iec61883.mpeg2 = NULL;
+		}
+	}
+	else
+	{
+		if ( m_iec61883.dv != NULL ) {
 			iec61883_dv_fb_close( m_iec61883.dv );
-
-		m_iec61883.dv = NULL;
+			m_iec61883.dv = NULL;
+		}
 	}
 }
 
@@ -470,9 +474,9 @@ void iec61883Reader::StopReceive()
 	if ( m_iec61883.ref != NULL )
 	{
 		if ( isHDV )
-			iec61883_mpeg2_close( m_iec61883.mpeg2 );
+			iec61883_mpeg2_recv_stop( m_iec61883.mpeg2 );
 		else
-			iec61883_dv_fb_close( m_iec61883.dv );
+			iec61883_dv_fb_stop( m_iec61883.dv );
 
 		m_iec61883.ref = NULL;
 	}
@@ -1085,6 +1089,7 @@ void* pipeReader::Thread()
 	pthread_mutex_lock( &mutex );
 	if ( currentFrame ) outFrames.push_back( currentFrame );
 	currentFrame = NULL;
+	outFrames.push_back( currentFrame );
 	TriggerAction( );
 	pthread_mutex_unlock( &mutex );
 	return NULL;


Index: dvgrab.spec
===================================================================
RCS file: /cvs/pkgs/rpms/dvgrab/F-8/dvgrab.spec,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- dvgrab.spec	7 Oct 2007 04:44:36 -0000	1.20
+++ dvgrab.spec	22 Oct 2007 21:56:54 -0000	1.21
@@ -1,11 +1,12 @@
 Summary:        Utility to capture video from a DV camera
 Name:           dvgrab
 Version:        3.0
-Release:        1%{?dist}
+Release:        2%{?dist}
 License:        GPL
 Group:          Applications/Multimedia
 URL:            http://www.kinodv.org/
 Source:         http://dl.sf.net/kino/dvgrab-%{version}.tar.gz
+Patch:          dvgrab-3.0-fixes.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:  libraw1394-devel libavc1394-devel libdv-devel libiec61883-devel
 BuildRequires:  libjpeg-devel libpng-devel libogg-devel libvorbis-devel
@@ -17,6 +18,7 @@
 
 %prep
 %setup -q
+%patch -p1
 
 %build
 %configure
@@ -36,6 +38,12 @@
 %{_mandir}/man1/dvgrab.1*
 
 %changelog
+* Mon Oct 22 2007 Jarod Wilson <jwilson at redhat.com> - 3.0-2
+- Fix segfault on cleanup (#331271)
+- fix pipe output in conjunction with file capture
+- fix hang at end of reading from stdin
+- fix potential data loss due to short writes
+
 * Sun Oct 07 2007 Jarod Wilson <jwilson at redhat.com> - 3.0-1
 - New upstream release
 




More information about the fedora-extras-commits mailing list