From 99a3684fb517ce4df356959801a8c6fec30cdb1d Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 14 Jul 2014 12:53:48 -0400 Subject: [PATCH] change the way v4l_multi_buffer is loaded. Since t's a bool, it theoretically is 1 byte, so can't use atoi --- src/zm_local_camera.cpp | 13 ++++++++----- src/zm_monitor.cpp | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/zm_local_camera.cpp b/src/zm_local_camera.cpp index cc9b654b6..296a9c728 100644 --- a/src/zm_local_camera.cpp +++ b/src/zm_local_camera.cpp @@ -781,13 +781,16 @@ void LocalCamera::Initialise() Debug( 3, "Setting up request buffers" ); memset( &v4l2_data.reqbufs, 0, sizeof(v4l2_data.reqbufs) ); - if ( channel_count > 1 ) - if ( v4l_multi_buffer ) + if ( channel_count > 1 ) { + if ( v4l_multi_buffer ){ v4l2_data.reqbufs.count = 2*channel_count; - else + } else { v4l2_data.reqbufs.count = 1; - else + } + } else { v4l2_data.reqbufs.count = 8; + } + v4l2_data.reqbufs.type = v4l2_data.fmt.type; v4l2_data.reqbufs.memory = V4L2_MEMORY_MMAP; @@ -806,7 +809,7 @@ void LocalCamera::Initialise() if ( v4l2_data.reqbufs.count < (v4l_multi_buffer?2:1) ) Fatal( "Insufficient buffer memory %d on video device", v4l2_data.reqbufs.count ); - Debug( 3, "Setting up %d data buffers", v4l2_data.reqbufs.count ); + Debug( 3, "Setting up data buffers: Channels %d MultiBuffer %d Buffers: %s", channel_count, v4l_multi_buffer, v4l2_data.reqbufs.count ); v4l2_data.buffers = new V4L2MappedBuffer[v4l2_data.reqbufs.count]; #if HAVE_LIBSWSCALE diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index c612b5a3c..a65b81cac 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -1862,7 +1862,7 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose const char *device = dbrow[col]; col++; int channel = atoi(dbrow[col]); col++; int format = atoi(dbrow[col]); col++; - bool v4l_multi_buffer = atoi(dbrow[col]); col++; + bool v4l_multi_buffer = (*dbrow[col] == 48 ? false : true); col++; int v4l_captures_per_frame = atoi(dbrow[col]); col++; const char *method = dbrow[col]; col++; @@ -2464,7 +2464,7 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose ) std::string device = dbrow[col]; col++; int channel = atoi(dbrow[col]); col++; int format = atoi(dbrow[col]); col++; - bool v4l_multi_buffer = atoi(dbrow[col]); col++; + bool v4l_multi_buffer = (*dbrow[col] == 48 ? false : true); col++; int v4l_captures_per_frame = atoi(dbrow[col]); col++; std::string protocol = dbrow[col]; col++;