From 5cc74c3941afaebe06f7b637571828e4a504c846 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 | 7 +++---- src/zm_monitor.cpp | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/zm_local_camera.cpp b/src/zm_local_camera.cpp index 76b07a32e..4cc041893 100644 --- a/src/zm_local_camera.cpp +++ b/src/zm_local_camera.cpp @@ -783,8 +783,8 @@ 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 { v4l2_data.reqbufs.count = 1; @@ -792,7 +792,6 @@ void LocalCamera::Initialise() } else { v4l2_data.reqbufs.count = 8; } - Debug( 3, "Request buffers count is %d", v4l2_data.reqbufs.count ); v4l2_data.reqbufs.type = v4l2_data.fmt.type; v4l2_data.reqbufs.memory = V4L2_MEMORY_MMAP; @@ -812,7 +811,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 data buffers: Channels %d MultiBuffer %d Buffers: %d", channel_count, v4l_multi_buffer, 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 91afcee82..ad370f9c6 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -1868,8 +1868,8 @@ 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++; - int v4l_captures_per_frame = 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++; int width = atoi(dbrow[col]); col++; @@ -2470,7 +2470,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++; bool v4l_multi_buffer;