move v4l_multibuffer and v4l_captures_per_frame from Config to Monitor and Local Camera
This commit is contained in:
parent
ef19ed2e23
commit
c80bf07ea7
|
@ -323,8 +323,8 @@ CREATE TABLE `Monitors` (
|
|||
`Device` varchar(64) NOT NULL default '',
|
||||
`Channel` tinyint(3) unsigned NOT NULL default '0',
|
||||
`Format` int(10) unsigned NOT NULL default '0',
|
||||
`V4LMultiBuffer` tinyint(1) unsigned,
|
||||
`V4LCapturesPerFrame` tinyint(3) unsigned,
|
||||
`V4LMultiBuffer` tinyint(1) unsigned NOT NULL default '0',
|
||||
`V4LCapturesPerFrame` tinyint(3) unsigned NOT NULL default '1',
|
||||
`Protocol` varchar(16) NOT NULL default '',
|
||||
`Method` varchar(16) NOT NULL default '',
|
||||
`Host` varchar(64) NOT NULL default '',
|
||||
|
|
|
@ -783,9 +783,8 @@ void LocalCamera::Initialise()
|
|||
Debug( 3, "Setting up request buffers" );
|
||||
|
||||
memset( &v4l2_data.reqbufs, 0, sizeof(v4l2_data.reqbufs) );
|
||||
if ( channel_count > 1 ) {
|
||||
Debug( 3, "Channel count is %d", channel_count );
|
||||
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;
|
||||
|
@ -1982,11 +1981,6 @@ int LocalCamera::Capture( Image &image )
|
|||
int captures_per_frame = 1;
|
||||
if ( channel_count > 1 )
|
||||
captures_per_frame = v4l_captures_per_frame;
|
||||
if ( captures_per_frame <= 0 ) {
|
||||
captures_per_frame = 1;
|
||||
Warning( "Invalid Captures Per Frame setting: %d", captures_per_frame );
|
||||
}
|
||||
|
||||
|
||||
// Do the capture, unless we are the second or subsequent camera on a channel, in which case just reuse the buffer
|
||||
if ( channel_prime )
|
||||
|
|
|
@ -1837,7 +1837,7 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose
|
|||
}
|
||||
else
|
||||
{
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, V4LMultiBuffer, V4LCapturesPerFrame, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' and Device = '%s' order by Channel", device );
|
||||
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, V4LCapturesPerFrame, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' and Device = '%s' order by Channel", device );
|
||||
}
|
||||
if ( mysql_query( &dbconn, sql ) )
|
||||
{
|
||||
|
@ -1868,26 +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;
|
||||
if ( dbrow[col] ) {
|
||||
if (*dbrow[col] == '0' ) {
|
||||
v4l_multi_buffer = false;
|
||||
} else if ( *dbrow[col] == '1' ) {
|
||||
v4l_multi_buffer = true;
|
||||
}
|
||||
} else {
|
||||
v4l_multi_buffer = config.v4l_multi_buffer;
|
||||
}
|
||||
col++;
|
||||
|
||||
int v4l_captures_per_frame = 0;
|
||||
if ( dbrow[col] ) {
|
||||
v4l_captures_per_frame = atoi(dbrow[col]);
|
||||
} else {
|
||||
v4l_captures_per_frame = config.captures_per_frame;
|
||||
}
|
||||
Debug( 1, "Got %d for v4l_captures_per_frame", v4l_captures_per_frame );
|
||||
col++;
|
||||
bool v4l_multi_buffer = atoi(dbrow[col]); col++;
|
||||
int v4l_captures_per_frame = atoi(dbrow[col]); col++;
|
||||
const char *method = dbrow[col]; col++;
|
||||
|
||||
int width = atoi(dbrow[col]); col++;
|
||||
|
@ -2488,6 +2470,8 @@ 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++;
|
||||
int v4l_captures_per_frame = atoi(dbrow[col]); col++;
|
||||
|
||||
bool v4l_multi_buffer;
|
||||
if ( dbrow[col] ) {
|
||||
|
|
|
@ -35,20 +35,18 @@ if ( ZM_OPT_CONTROL && canView( 'Control' ) )
|
|||
if ( ZM_OPT_X10 )
|
||||
$tabs["x10"] = $SLANG['X10'];
|
||||
$tabs["misc"] = $SLANG['Misc'];
|
||||
$tabs["v4l"] = $SLANG['V4L'];
|
||||
|
||||
if ( isset($_REQUEST['tab']) )
|
||||
$tab = validHtmlStr($_REQUEST['tab']);
|
||||
else
|
||||
$tab = "general";
|
||||
|
||||
if ( !empty($_REQUEST['mid']) )
|
||||
{
|
||||
if ( ! empty($_REQUEST['mid']) ) {
|
||||
$monitor = dbFetchMonitor( $_REQUEST['mid'] );
|
||||
if ( ZM_OPT_X10 )
|
||||
$x10Monitor = dbFetchOne( 'SELECT * FROM TriggersX10 WHERE MonitorId = ?', NULL, array( $_REQUEST['mid']) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$x10Monitor = dbFetchOne( 'SELECT * FROM TriggersX10 WHERE MonitorId = ?', NULL, array($_REQUEST['mid']) );
|
||||
} else {
|
||||
$nextId = getTableAutoInc( 'Monitors' );
|
||||
$monitor = array(
|
||||
'Id' => 0,
|
||||
|
@ -111,6 +109,8 @@ else
|
|||
'ConfigType' => "None",
|
||||
'ConfigURL' => "",
|
||||
'ConfigOptions' => "",
|
||||
'V4LMultiBuffer' => '',
|
||||
'V4LCapturesPerFrame' => 1,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,8 @@ if ( $newMonitor['MaxFPS'] == '0.00' )
|
|||
if ( $newMonitor['AlarmMaxFPS'] == '0.00' )
|
||||
$newMonitor['AlarmMaxFPS'] = '';
|
||||
|
||||
if ( !empty($_REQUEST['preset']) ) {
|
||||
if ( !empty($_REQUEST['preset']) )
|
||||
{
|
||||
$preset = dbFetchOne( 'SELECT Type, Device, Channel, Format, Protocol, Method, Host, Port, Path, Width, Height, Palette, MaxFPS, Controllable, ControlId, ControlDevice, ControlAddress, DefaultRate, DefaultScale FROM MonitorPresets WHERE Id = ?', NULL, array($_REQUEST['preset']) );
|
||||
foreach ( $preset as $name=>$value )
|
||||
{
|
||||
|
@ -629,7 +630,7 @@ switch ( $tab )
|
|||
foreach ( getEnumValues( 'Monitors', 'Function' ) as $optFunction )
|
||||
{
|
||||
?>
|
||||
<option value="<?= $optFunction ?>"<?php if ( $optFunction == $newMonitor['Function'] ) { ?> selected="selected"<?php } ?>><?= $SLANG['Fn'.$optFunction] ?></option>
|
||||
<option value="<?= $optFunction ?>"<?php if ( $optFunction == $newMonitor['Function'] ) { ?> selected="selected"<?php } ?>><?= $optFunction ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
@ -737,6 +738,10 @@ switch ( $tab )
|
|||
<tr><td><?= $SLANG['CapturePalette'] ?></td><td><select name="newMonitor[Palette]"><?php foreach ( $v4l2LocalPalettes as $name => $value ) { ?><option value="<?= $value ?>"<?php if ( $value == $newMonitor['Palette'] ) { ?> selected="selected"<?php } ?>><?= $name ?></option><?php } ?></select></td></tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr><td><?= $SLANG['V4LMultiBuffer'] ?></td><td><input type="checkbox" name="V4LMultiBuffer" value="1" <?php echo $newMonitor['V4LMultiBuffer'] ? 'checked="checked"' : '' ?>/></td></tr>
|
||||
<tr><td><?= $SLANG['V4LCapturesPerFrame'] ?></td><td><input type="number" name="V4LCapturesPerFrame" value="<?= $newMonitor['V4LCapturesPerFrame'] ?>"/></td></tr>
|
||||
<?php
|
||||
}
|
||||
elseif ( $newMonitor['Type'] == "Remote" )
|
||||
{
|
||||
|
|
|
@ -34,6 +34,7 @@ if ( ZM_OPT_CONTROL && canView( 'Control' ) )
|
|||
if ( ZM_OPT_X10 )
|
||||
$tabs["x10"] = $SLANG['X10'];
|
||||
$tabs["misc"] = $SLANG['Misc'];
|
||||
$tabs["v4l"] = $SLANG['V4L'];
|
||||
|
||||
if ( isset($_REQUEST['tab']) )
|
||||
$tab = validHtmlStr($_REQUEST['tab']);
|
||||
|
@ -709,15 +710,8 @@ switch ( $tab )
|
|||
<?php
|
||||
}
|
||||
?>
|
||||
<tr><td><?= $SLANG['V4LMultiBuffer'] ?></td><td>
|
||||
<input type="radio" name="newMonitor[V4LMultiBuffer]" id="newMonitor[V4LMultiBuffer]1" value="1" <?php echo ( $newMonitor['V4LMultiBuffer'] == 1 ? 'checked="checked"' : '' ) ?>/>
|
||||
<label for="newMonitor[V4LMultiBuffer]1">Yes</label>
|
||||
<input type="radio" name="newMonitor[V4LMultiBuffer]" id="newMonitor[V4LMultiBuffer]0" value="0" <?php echo ( $newMonitor['V4LMultiBuffer'] == 0 ? 'checked="checked"' : '' ) ?>/>
|
||||
<label for="newMonitor[V4LMultiBuffer]0">No</label>
|
||||
<input type="radio" name="newMonitor[V4LMultiBuffer]" id="newMonitor[V4LMultiBuffer]" value="" <?php echo ( empty($newMonitor['V4LMultiBuffer']) ? 'checked="checked"' : '' ) ?>/>
|
||||
<label for="newMonitor[V4LMultiBuffer]">Use Config Value</label>
|
||||
</td></tr>
|
||||
<tr><td><?= $SLANG['V4LCapturesPerFrame'] ?></td><td><input type="number" name="newMonitor[V4LCapturesPerFrame]" value="<?php echo $newMonitor['V4LCapturesPerFrame'] ?>"/></td></tr>
|
||||
<tr><td><?= $SLANG['V4LMultiBuffer'] ?></td><td><input type="checkbox" name="V4LMultiBuffer" value="1" <?php echo $newMonitor['V4LMultiBuffer'] ? 'checked="checked"' : '' ?>/></td></tr>
|
||||
<tr><td><?= $SLANG['V4LCapturesPerFrame'] ?></td><td><input type="number" name="V4LCapturesPerFrame" value="<?= $newMonitor['V4LCapturesPerFrame'] ?>"/></td></tr>
|
||||
<?php
|
||||
}
|
||||
elseif ( $newMonitor['Type'] == "Remote" )
|
||||
|
|
Loading…
Reference in New Issue