Merged in montage sizing and scaling improvements.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@853 e3e1d417-86f3-4887-817a-d78f3d33393fpull/27/merge
parent
6998a2ee10
commit
15d83eea1a
|
@ -1508,7 +1508,7 @@ fi
|
|||
|
||||
# Define the identity of the package.
|
||||
PACKAGE=zm
|
||||
VERSION=1.17.2
|
||||
VERSION=1.17.2-ms
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
AC_INIT(src/zm.h)
|
||||
AM_INIT_AUTOMAKE(zm,1.17.2)
|
||||
AM_INIT_AUTOMAKE(zm,1.17.2-ms)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
AC_ARG_WITH(mysql,
|
||||
|
|
|
@ -77,8 +77,8 @@ $ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
|
|||
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
|
||||
|
||||
my $event_id;
|
||||
my $rate = 1;
|
||||
my $scale = 1;
|
||||
my $rate = 0.0;
|
||||
my $scale = 1.0;
|
||||
my $overwrite = 0;
|
||||
|
||||
sub Usage
|
||||
|
@ -87,14 +87,14 @@ sub Usage
|
|||
Usage: zmvideo.pl -e <event_id>,--event=<event_id> [-r <rate>,--rate=<rate>] [-s <scale>,--scale=<scale>] [-o,--overwrite]
|
||||
Parameters are :-
|
||||
-e<event_id>, --event=<event_id> - What event to create the video for
|
||||
-r<rate>, --rate=<rate> - Relative rate to use, 1 = realtime, 2 = double speed , -2 = half speed etc
|
||||
-s<scale>, --scale=<scale> - Scale to use, 1 = normal, 2 = double size, -2 = half size etc
|
||||
-r<rate>, --rate=<rate> - Relative rate to use, 1 = realtime, 2 = double speed , 0.5 = half speed etc
|
||||
-s<scale>, --scale=<scale> - Scale to use, 1 = normal, 2 = double size, 0.5 = half size etc
|
||||
-o, --overwrite - Whether to overwrite an existing file, off by default.
|
||||
");
|
||||
exit( -1 );
|
||||
}
|
||||
|
||||
if ( !GetOptions( 'event=i'=>\$event_id, 'rate=i'=>\$rate, 'scale=i'=>\$scale, 'overwrite'=>\$overwrite ) )
|
||||
if ( !GetOptions( 'event=i'=>\$event_id, 'rate=f'=>\$rate, 'scale=f'=>\$scale, 'overwrite'=>\$overwrite ) )
|
||||
{
|
||||
Usage();
|
||||
}
|
||||
|
@ -111,21 +111,21 @@ if ( ZM_OPT_MPEG eq "no" )
|
|||
exit(-1);
|
||||
}
|
||||
|
||||
if ( ZM_OPT_MPEG eq "mpeg_encode" && $rate != 1 )
|
||||
if ( ZM_OPT_MPEG eq "mpeg_encode" && $rate != 1.0 )
|
||||
{
|
||||
print( STDERR "Variable rate not supported with mpeg_encode\n" );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ( $rate < -4 || $rate > 10 )
|
||||
if ( $rate < 0.25 || $rate > 10 )
|
||||
{
|
||||
print( STDERR "Rate is out of range, -4 >= rate <= 10\n" );
|
||||
print( STDERR "Rate is out of range, 0.25 >= rate <= 10\n" );
|
||||
Usage();
|
||||
}
|
||||
|
||||
if ( !$scale || $scale < -4 || $scale > 4 )
|
||||
if ( !$scale || $scale < 0.25 || $scale > 4 )
|
||||
{
|
||||
print( STDERR "Scale is out of range, -4 >= scale <= 4\n" );
|
||||
print( STDERR "Scale is out of range, 0.25 >= scale <= 4\n" );
|
||||
Usage();
|
||||
}
|
||||
|
||||
|
@ -232,19 +232,9 @@ if ( $overwrite || !-s $video_file )
|
|||
elsif ( ZM_OPT_MPEG eq "ffmpeg" )
|
||||
{
|
||||
my $frame_rate = sprintf( "%.2f", $event->{Frames}/$event->{FullLength} );
|
||||
if ( $rate )
|
||||
if ( $rate != 0.0 )
|
||||
{
|
||||
if ( $rate != 1 )
|
||||
{
|
||||
if ( $rate > 1 )
|
||||
{
|
||||
$frame_rate *= $rate;
|
||||
}
|
||||
else
|
||||
{
|
||||
$frame_rate /= $rate;
|
||||
}
|
||||
}
|
||||
$frame_rate *= $rate;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -252,18 +242,10 @@ if ( $overwrite || !-s $video_file )
|
|||
}
|
||||
my $width = $event->{MonitorWidth};
|
||||
my $height = $event->{MonitorHeight};
|
||||
if ( $scale != 1 )
|
||||
if ( $scale != 1.0 )
|
||||
{
|
||||
if ( $scale > 1 )
|
||||
{
|
||||
$width = int($width*$scale);
|
||||
$height = int($height*$scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
$width = int($width/$scale);
|
||||
$height = int($height/$scale);
|
||||
}
|
||||
$width = int($width*$scale);
|
||||
$height = int($height*$scale);
|
||||
}
|
||||
my $command = ZM_PATH_FFMPEG." -y ".ZM_FFMPEG_OPTIONS." -r $frame_rate -s ${width}x${height} -i %03d-capture.jpg $video_file > mpeg.log";
|
||||
print( LOG $command."\n" );
|
||||
|
|
|
@ -37,6 +37,9 @@
|
|||
#define ZM_MAX_IMAGE_DIM (ZM_MAX_IMAGE_WIDTH*ZM_MAX_IMAGE_HEIGHT)
|
||||
#define ZM_MAX_IMAGE_SIZE (ZM_MAX_IMAGE_DIM*ZM_MAX_IMAGE_COLOURS)
|
||||
|
||||
#define ZM_SCALE_SCALE 100 // The factor by which we bump up 'scale' to simulate FP
|
||||
#define ZM_RATE_SCALE 100 // The factor by which we bump up 'rate' to simulate FP
|
||||
|
||||
class ConfigItem
|
||||
{
|
||||
private:
|
||||
|
|
|
@ -404,10 +404,7 @@ void Event::StreamEvent( int event_id, int rate, int scale, FILE *fd )
|
|||
|
||||
int delay = (int)((DT_GRAN_1000000*frame_delta))-delta_time.delta;
|
||||
|
||||
if ( rate < 0 )
|
||||
delay *= abs(rate);
|
||||
else
|
||||
delay /= rate;
|
||||
delay = (delay * ZM_RATE_SCALE) / rate;
|
||||
|
||||
//Info(( "FD:%lf, DDT:%d, D:%d, N:%d.%d, LN:%d.%d", frame_delta, delta_time.delta, delay, now.tv_sec, now.tv_usec, last_now.tv_sec, last_now.tv_usec ));
|
||||
if ( delay > 0 )
|
||||
|
|
|
@ -834,29 +834,40 @@ void Image::Rotate( int angle )
|
|||
memcpy( buffer, rotate_buffer, size );
|
||||
}
|
||||
|
||||
void Image::Scale( int factor )
|
||||
void Image::Scale( unsigned int factor )
|
||||
{
|
||||
if ( !factor )
|
||||
{
|
||||
Error(( "Bogus scale factor %d found", factor ));
|
||||
return;
|
||||
}
|
||||
if ( factor == 1 )
|
||||
if ( factor == ZM_SCALE_SCALE )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static unsigned char scale_buffer[ZM_MAX_IMAGE_SIZE];
|
||||
if ( factor > 1 )
|
||||
unsigned int new_width = (width*factor)/ZM_SCALE_SCALE;
|
||||
unsigned int new_height = (height*factor)/ZM_SCALE_SCALE;
|
||||
if ( factor > ZM_SCALE_SCALE )
|
||||
{
|
||||
unsigned char *pd = scale_buffer;
|
||||
unsigned int wc = width*colours;
|
||||
unsigned int wcf = wc*factor;
|
||||
unsigned int nwc = new_width*colours;
|
||||
unsigned int h_count = ZM_SCALE_SCALE/2;
|
||||
unsigned int last_h_index = 0;
|
||||
unsigned int h_index;
|
||||
for ( int y = 0; y < height; y++ )
|
||||
{
|
||||
unsigned char *ps = &buffer[y*wc];
|
||||
unsigned int w_count = ZM_SCALE_SCALE/2;
|
||||
unsigned int last_w_index = 0;
|
||||
unsigned int w_index;
|
||||
for ( int x = 0; x < width; x++ )
|
||||
{
|
||||
for ( int f = 0; f < factor; f++ )
|
||||
w_count += factor;
|
||||
w_index = w_count/ZM_SCALE_SCALE;
|
||||
for ( int f = last_w_index; f < w_index; f++ )
|
||||
{
|
||||
for ( int c = 0; c < colours; c++ )
|
||||
{
|
||||
|
@ -864,43 +875,64 @@ void Image::Scale( int factor )
|
|||
}
|
||||
}
|
||||
ps += colours;
|
||||
last_w_index = w_index;
|
||||
}
|
||||
for ( int f = 1; f < factor; f++ )
|
||||
h_count += factor;
|
||||
h_index = h_count/ZM_SCALE_SCALE;
|
||||
for ( int f = last_h_index+1; f < h_index; f++ )
|
||||
{
|
||||
memcpy( pd, pd-wcf, wcf );
|
||||
pd += wcf;
|
||||
memcpy( pd, pd-nwc, nwc );
|
||||
pd += nwc;
|
||||
}
|
||||
last_h_index = h_index;
|
||||
}
|
||||
width *= factor;
|
||||
height *= factor;
|
||||
size = width*height*colours;
|
||||
}
|
||||
else
|
||||
{
|
||||
factor = abs(factor);
|
||||
unsigned int inv_factor = (ZM_SCALE_SCALE*ZM_SCALE_SCALE)/factor;
|
||||
unsigned char *pd = scale_buffer;
|
||||
unsigned int wc = width*colours;
|
||||
unsigned int cf = factor*colours;
|
||||
unsigned int xrem = width%factor;
|
||||
unsigned int yrem = height%factor;
|
||||
unsigned int xstart = xrem/2;
|
||||
unsigned int ystart = yrem/2;
|
||||
for ( int y = xstart; y < height; y += factor )
|
||||
unsigned int xstart = factor/2;
|
||||
unsigned int ystart = factor/2;
|
||||
unsigned int h_count = ystart;
|
||||
unsigned int last_h_index = 0;
|
||||
unsigned int h_index;
|
||||
for ( unsigned int y = 0; y < height; y++ )
|
||||
{
|
||||
unsigned char *ps = &buffer[y*wc];
|
||||
for ( int x = ystart; x < width; x += factor )
|
||||
h_count += factor;
|
||||
h_index = h_count/ZM_SCALE_SCALE;
|
||||
if ( h_index > last_h_index )
|
||||
{
|
||||
for ( int c = 0; c < colours; c++ )
|
||||
unsigned int w_count = xstart;
|
||||
unsigned int last_w_index = 0;
|
||||
unsigned int w_index;
|
||||
|
||||
unsigned char *ps = &buffer[y*wc];
|
||||
for ( unsigned int x = 0; x < width; x++ )
|
||||
{
|
||||
*pd++ = *(ps+c);
|
||||
w_count += factor;
|
||||
w_index = w_count/ZM_SCALE_SCALE;
|
||||
|
||||
if ( w_index > last_w_index )
|
||||
{
|
||||
for ( int c = 0; c < colours; c++ )
|
||||
{
|
||||
*pd++ = *ps++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ps += colours;
|
||||
}
|
||||
last_w_index = w_index;
|
||||
}
|
||||
ps += cf;
|
||||
}
|
||||
last_h_index = h_index;
|
||||
}
|
||||
width = 1+int((width-1)/factor);
|
||||
height = 1+int((height-1)/factor);
|
||||
size = width*height*colours;
|
||||
}
|
||||
width = new_width;
|
||||
height = new_height;
|
||||
size = width*height*colours;
|
||||
delete[] buffer;
|
||||
buffer = new JSAMPLE[size];
|
||||
memcpy( buffer, scale_buffer, size );
|
||||
|
|
|
@ -168,7 +168,7 @@ public:
|
|||
|
||||
void Rotate( int angle );
|
||||
|
||||
void Scale( int factor );
|
||||
void Scale( unsigned int factor );
|
||||
};
|
||||
|
||||
#endif // ZM_IMAGE_H
|
||||
|
|
|
@ -26,8 +26,8 @@ int main(void )
|
|||
int id = 1;
|
||||
unsigned long idle = 5000;
|
||||
unsigned long refresh = 50;
|
||||
unsigned int rate = 1;
|
||||
unsigned int scale = 1;
|
||||
unsigned int rate = 100;
|
||||
unsigned int scale = 100;
|
||||
int event = 0;
|
||||
unsigned int ttl = 0;
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ define( "MAX_EVENTS", 10 ); // The maximum number of events to show in th
|
|||
define( "EVENT_HEADER_LINES", 25 ); // How many events are listed in the event window before a new header is inserted
|
||||
define( "EVENT_FRAMES_PER_LINE", 4 ); // How many images per line in the event image view
|
||||
define( "EVENT_FRAME_LINES", 4 ); // How many lines of images to show in paged mode
|
||||
define( "RATE_SCALE", 100 ); // The additional scaling factor used to help get fractional rates in integer format
|
||||
define( "SCALE_SCALE", 100 ); // The additional scaling factor used to help get fractional scales in integer format
|
||||
define( "LEARN_MODE", false ); // Currently unimplemented, do not change
|
||||
|
||||
require_once( 'zm_db.php' );
|
||||
|
|
|
@ -377,26 +377,19 @@ function zmaCheck( $monitor )
|
|||
|
||||
function createVideo( $event, $rate, $scale, $overwrite=0 )
|
||||
{
|
||||
$command = ZM_PATH_BIN."/zmvideo.pl -e ".$event['Id']." -r $rate -s $scale";
|
||||
$command = ZM_PATH_BIN."/zmvideo.pl -e ".$event['Id']." -r ".sprintf( "%.2f", ($rate/SCALE_SCALE) )." -s ".sprintf( "%.2f", ($scale/SCALE_SCALE) );
|
||||
if ( $overwrite )
|
||||
$command .= " -o";
|
||||
$result = exec( $command, $output, $status );
|
||||
return( $status?"":rtrim($result) );
|
||||
}
|
||||
|
||||
function reScale( $dimension, $scale=1 )
|
||||
function reScale( $dimension, $scale=SCALE_SCALE )
|
||||
{
|
||||
if ( $scale == 1 )
|
||||
if ( $scale == SCALE_SCALE )
|
||||
return( $dimension );
|
||||
|
||||
if ( $scale > 0 )
|
||||
{
|
||||
return( (int)($dimension*$scale) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( (int)(1+(($dimension-1)/-$scale)) );
|
||||
}
|
||||
return( (int)(($dimension*$scale)/SCALE_SCALE) );
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -69,22 +69,24 @@ $bw_array = array(
|
|||
|
||||
$rates = array(
|
||||
"0" => $zmSlangMax,
|
||||
"10" => "10x",
|
||||
"4" => "4x",
|
||||
"2" => "2x",
|
||||
"1" => $zmSlangReal,
|
||||
"-2" => "1/2x",
|
||||
"-4" => "1/4x",
|
||||
"1000" => "10x",
|
||||
"400" => "4x",
|
||||
"200" => "2x",
|
||||
"100" => $zmSlangReal,
|
||||
"50" => "1/2x",
|
||||
"25" => "1/4x",
|
||||
);
|
||||
|
||||
$scales = array(
|
||||
"4" => "4x",
|
||||
"3" => "3x",
|
||||
"2" => "2x",
|
||||
"1" => $zmSlangActual,
|
||||
"-2" => "1/2x",
|
||||
"-3" => "1/3x",
|
||||
"-4" => "1/4x",
|
||||
"400" => "4x",
|
||||
"300" => "3x",
|
||||
"200" => "2x",
|
||||
"150" => "1.5x",
|
||||
"100" => $zmSlangActual,
|
||||
"75" => "3/4x",
|
||||
"50" => "1/2x",
|
||||
"33" => "1/3x",
|
||||
"25" => "1/4x",
|
||||
);
|
||||
|
||||
if ( !isset($user) )
|
||||
|
|
|
@ -61,6 +61,8 @@ while( $row = mysql_fetch_assoc( $result ) )
|
|||
}
|
||||
$montage_rows = intval(ceil($cycle_count/ZM_WEB_MONTAGE_MAX_COLS));
|
||||
$montage_cols = $cycle_count>=ZM_WEB_MONTAGE_MAX_COLS?ZM_WEB_MONTAGE_MAX_COLS:$cycle_count;
|
||||
$montage_width = ZM_WEB_MONTAGE_WIDTH?ZM_WEB_MONTAGE_WIDTH:$max_width;
|
||||
$montage_height = ZM_WEB_MONTAGE_HEIGHT?ZM_WEB_MONTAGE_HEIGHT:$max_height;
|
||||
|
||||
?>
|
||||
<html>
|
||||
|
@ -135,7 +137,7 @@ preg_match( '/load average: ([\d.]+)/', $uptime, $matches );
|
|||
if ( canView( 'Stream' ) && $cycle_count > 1 )
|
||||
{
|
||||
?>
|
||||
<a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=cycle', 'zmCycle', <?= $max_width+$jws['cycle']['w'] ?>, <?= $max_height+$jws['cycle']['h'] ?> );"><?= sprintf( $zmClangMonitorCount, count($monitors), zmVlang( $zmVlangMonitor, count($monitors) ) ) ?></a> (<a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=montage', 'zmMontage', <?= ($montage_cols*$max_width)+$jws['montage']['w'] ?>, <?= ($montage_rows*(40+$max_height))+$jws['montage']['h'] ?> );"><?= $zmSlangMontage ?></a>)
|
||||
<a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=cycle', 'zmCycle', <?= $montage_width+$jws['cycle']['w'] ?>, <?= $montage_height+$jws['cycle']['h'] ?> );"><?= sprintf( $zmClangMonitorCount, count($monitors), zmVlang( $zmVlangMonitor, count($monitors) ) ) ?></a> (<a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=montage', 'zmMontage', <?= ($montage_cols*$montage_width)+$jws['montage']['w'] ?>, <?= ($montage_rows*(40+$montage_height))+$jws['montage']['h'] ?> );"><?= $zmSlangMontage ?></a>)
|
||||
<?php
|
||||
}
|
||||
else
|
||||
|
|
|
@ -47,6 +47,8 @@ while( $row = mysql_fetch_assoc( $result ) )
|
|||
|
||||
$monitor = $monitors[$mon_idx];
|
||||
$next_mid = $mon_idx==(count($monitors)-1)?$monitors[0]['Id']:$monitors[$mon_idx+1]['Id'];
|
||||
$montage_width = ZM_WEB_MONTAGE_WIDTH?ZM_WEB_MONTAGE_WIDTH:$monitor['Width'];
|
||||
$montage_height = ZM_WEB_MONTAGE_HEIGHT?ZM_WEB_MONTAGE_HEIGHT:$monitor['Height'];
|
||||
|
||||
// Prompt an image to be generated
|
||||
chdir( ZM_DIR_IMAGES );
|
||||
|
@ -104,20 +106,20 @@ if ( $mode == "stream" )
|
|||
if ( canStreamNative() )
|
||||
{
|
||||
?>
|
||||
<tr><td colspan="3" align="center"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=watch&mid=<?= $monitor['Id'] ?>', 'zmWatch<?= $monitor['Id'] ?>', <?= $monitor['Width']+$jws['watch']['w'] ?>, <?= $monitor['Height']+$jws['watch']['h'] ?> );"><img src="<?= $stream_src ?>" border="0" width="<?= $monitor['Width'] ?>" height="<?= $monitor['Height'] ?>"></a></td></tr>
|
||||
<tr><td colspan="3" align="center"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=watch&mid=<?= $monitor['Id'] ?>', 'zmWatch<?= $monitor['Id'] ?>', <?= $monitor['Width']+$jws['watch']['w'] ?>, <?= $monitor['Height']+$jws['watch']['h'] ?> );"><img src="<?= $stream_src ?>" border="0" width="<?= $montage_width ?>" height="<?= $montage_height ?>"></a></td></tr>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<tr><td colspan="3" align="center"><applet code="com.charliemouse.cambozola.Viewer" archive="<?= ZM_PATH_CAMBOZOLA ?>" align="middle" width="<?= $monitor['Width'] ?>" height="<?= $monitor['Height'] ?>"><param name="url" value="<?= $stream_src ?>"></applet></td></tr>
|
||||
<tr><td colspan="3" align="center"><applet code="com.charliemouse.cambozola.Viewer" archive="<?= ZM_PATH_CAMBOZOLA ?>" align="middle" width="<?= $montage_width ?>" height="<?= $montage_height ?>"><param name="url" value="<?= $stream_src ?>"></applet></td></tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<tr><td colspan="3" align="center"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=watch&mid=<?= $monitor['Id'] ?>', 'zmWatch<?= $monitor['Id'] ?>', <?= $monitor['Width']+$jws['watch']['w'] ?>, <?= $monitor['Height']+$jws['watch']['h'] ?> );"><img src="<?= ZM_DIR_IMAGES.'/'.$monitor['Name'] ?>.jpg" border="0" width="<?= $monitor['Width'] ?>" height="<?= $monitor['Height'] ?>"></a></td></tr>
|
||||
<tr><td colspan="3" align="center"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=watch&mid=<?= $monitor['Id'] ?>', 'zmWatch<?= $monitor['Id'] ?>', <?= $monitor['Width']+$jws['watch']['w'] ?>, <?= $monitor['Height']+$jws['watch']['h'] ?> );"><img src="<?= ZM_DIR_IMAGES.'/'.$monitor['Name'] ?>.jpg" border="0" width="<?= $montage_width ?>" height="<?= $montage_height ?>"></a></td></tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -56,9 +56,9 @@ if ( !$result )
|
|||
$next_event = mysql_fetch_assoc( $result );
|
||||
|
||||
if ( !isset( $rate ) )
|
||||
$rate = 1;
|
||||
$rate = RATE_SCALE;
|
||||
if ( !isset( $scale ) )
|
||||
$scale = 1;
|
||||
$scale = SCALE_SCALE;
|
||||
|
||||
$frames_per_page = EVENT_FRAMES_PER_LINE * EVENT_FRAME_LINES;
|
||||
|
||||
|
|
|
@ -40,13 +40,14 @@ $heights = array();
|
|||
for ( $i = 0; $i < count($monitors); $i++ )
|
||||
{
|
||||
$monitor = $monitors[$i];
|
||||
$frame_height = $monitor['Height']+16;
|
||||
$frame_height = (ZM_WEB_MONTAGE_HEIGHT?ZM_WEB_MONTAGE_HEIGHT:$monitor['Height'])+16;
|
||||
$frame_width = (ZM_WEB_MONTAGE_WIDTH?ZM_WEB_MONTAGE_WIDTH:$monitor['Width']);
|
||||
$row = $i/ZM_WEB_MONTAGE_MAX_COLS;
|
||||
$col = $i%ZM_WEB_MONTAGE_MAX_COLS;
|
||||
if ( empty( $heights[$row] ) || $frame_height > $heights[$row] )
|
||||
$heights[$row] = $frame_height;
|
||||
if ( empty( $widths[$col] ) || $monitor['Width'] > $widths[$col] )
|
||||
$widths[$col] = $monitor['Width'];
|
||||
if ( empty( $widths[$col] ) || $frame_width > $widths[$col] )
|
||||
$widths[$col] = $frame_width;
|
||||
}
|
||||
$row_spec = join( ',', $heights );
|
||||
$col_spec = join( ',', $widths );
|
||||
|
|
|
@ -36,6 +36,9 @@ if ( !$result )
|
|||
die( mysql_error() );
|
||||
$monitor = mysql_fetch_assoc( $result );
|
||||
|
||||
$montage_width = ZM_WEB_MONTAGE_WIDTH?ZM_WEB_MONTAGE_WIDTH:$monitor['Width'];
|
||||
$montage_height = ZM_WEB_MONTAGE_HEIGHT?ZM_WEB_MONTAGE_HEIGHT:$monitor['Height'];
|
||||
|
||||
if ( $mode != "stream" )
|
||||
{
|
||||
// Prompt an image to be generated
|
||||
|
@ -86,20 +89,27 @@ if ( $mode == "stream" )
|
|||
if ( canStreamNative() )
|
||||
{
|
||||
?>
|
||||
<tr><td colspan="2" align="center"><img src="<?= $stream_src ?>" border="0" width="<?= $monitor['Width'] ?>" height="<?= $monitor['Height'] ?>"></td></tr>
|
||||
<tr><td colspan="2" align="center"><img src="<?= $stream_src ?>" border="0" width="<?= $montage_width ?>" height="<?= $montage_height ?>"></td></tr>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
$width_scale = ($montage_width*SCALE_SCALE)/$monitor['Width'];
|
||||
$height_scale = ($montage_height*SCALE_SCALE)/$monitor['Height'];
|
||||
$scale = (int)(($width_scale<$height_scale)?$width_scale:$height_scale);
|
||||
if ( $scale != SCALE_SCALE )
|
||||
{
|
||||
$stream_src .= "&scale=".$scale;
|
||||
}
|
||||
?>
|
||||
<tr><td colspan="2" align="center"><applet code="com.charliemouse.cambozola.Viewer" archive="<?= ZM_PATH_CAMBOZOLA ?>" align="middle" width="<?= $monitor['Width'] ?>" height="<?= $monitor['Height'] ?>"><param name="url" value="<?= $stream_src ?>"></applet></td></tr>
|
||||
<tr><td colspan="2" align="center"><applet code="com.charliemouse.cambozola.Viewer" archive="<?= ZM_PATH_CAMBOZOLA ?>" align="middle" width="<?= $montage_width ?>" height="<?= $montage_height ?>"><param name="url" value="<?= $stream_src ?>"></applet></td></tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<tr><td colspan="2" align="center"><img src="<?= ZM_DIR_IMAGES.'/'.$monitor['Name'] ?>.jpg" border="0" width="<?= $monitor['Width'] ?>" height="<?= $monitor['Height'] ?>"></td></tr>
|
||||
<tr><td colspan="2" align="center"><img src="<?= ZM_DIR_IMAGES.'/'.$monitor['Name'] ?>.jpg" border="0" width="<?= $montage_width ?>" height="<?= $montage_height ?>"></td></tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -28,10 +28,10 @@ if ( !$result )
|
|||
die( mysql_error() );
|
||||
$event = mysql_fetch_assoc( $result );
|
||||
|
||||
if ( !isset( $scale ) )
|
||||
$scale = 1;
|
||||
if ( !isset( $rate ) )
|
||||
$rate = 1;
|
||||
$rate = RATE_SCALE;
|
||||
if ( !isset( $scale ) )
|
||||
$scale = SCALE_SCALE;
|
||||
|
||||
ob_start();
|
||||
|
||||
|
|
|
@ -28,23 +28,23 @@ if ( !$result )
|
|||
die( mysql_error() );
|
||||
$monitor = mysql_fetch_assoc( $result );
|
||||
|
||||
if ( empty($scale) )
|
||||
$scale = 1;
|
||||
if ( !isset($scale) )
|
||||
$scale = SCALE_SCALE;
|
||||
|
||||
$width_scale = ($scale<1)?1:$scale;
|
||||
$height_scale = ($scale<1)?(1/abs($scale)):$scale;
|
||||
$width_scale = ($scale<SCALE_SCALE)?SCALE_SCALE:$scale;
|
||||
$height_scale = $scale;
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>ZM - <?= $monitor['Name'] ?> - <?= $zmSlangWatch ?></title>
|
||||
<link rel="stylesheet" href="zm_styles.css" type="text/css">
|
||||
<script language="JavaScript">
|
||||
window.resizeTo( <?= ($width_scale*$monitor['Width'])+$jws['watch']['w'] ?>, <?= ($height_scale*$monitor['Height'])+$jws['watch']['h'] ?> );
|
||||
window.resizeTo( <?= reScale($monitor['Width'],$width_scale)+$jws['watch']['w'] ?>, <?= reScale($monitor['Height'],$height_scale)+$jws['watch']['h'] ?> );
|
||||
//opener.location.reload();
|
||||
window.focus();
|
||||
</script>
|
||||
</head>
|
||||
<frameset rows="<?= ($height_scale*$monitor['Height'])+32 ?>,16,*" border="1" frameborder="no" framespacing="0">
|
||||
<frameset rows="<?= reScale($monitor['Height'],$height_scale)+32 ?>,16,*" border="1" frameborder="no" framespacing="0">
|
||||
<frame src="<?= $PHP_SELF ?>?view=watchfeed&mid=<?= $monitor['Id'] ?>&scale=<?= $scale ?>" marginwidth="0" marginheight="0" name="MonitorStream" scrolling="no">
|
||||
<frame src="<?= $PHP_SELF ?>?view=watchstatus&mid=<?= $monitor['Id'] ?>" marginwidth="0" marginheight="0" name="MonitorStatus" scrolling="no">
|
||||
<frame src="<?= $PHP_SELF ?>?view=watchevents&max_events=<?= MAX_EVENTS ?>&mid=<?= $monitor['Id'] ?>" marginwidth="0" marginheight="0" name="MonitorEvents" scrolling="auto">
|
||||
|
|
|
@ -52,7 +52,7 @@ header("Cache-Control: post-check=0, pre-check=0", false);
|
|||
header("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
if ( !isset( $scale ) )
|
||||
$scale = 1;
|
||||
$scale = SCALE_SCALE;
|
||||
|
||||
?>
|
||||
<html>
|
||||
|
|
|
@ -513,6 +513,22 @@ my @options =
|
|||
type => $types{integer},
|
||||
category => 'web',
|
||||
},
|
||||
{
|
||||
name => "ZM_WEB_MONTAGE_WIDTH",
|
||||
default => "0",
|
||||
description => "What width should each monitor in the montage view be",
|
||||
help => "In the montage view it is possible to view all of your monitors at once. If they are all different sizes this can be fairly untidy. Setting this option allows you to constrain the width of each of the monitor views to a fixed value to make the window tidier overall. Leaving it at the default of zero lets each monitor be displayed at it's normal native size.",
|
||||
type => $types{integer},
|
||||
category => 'web',
|
||||
},
|
||||
{
|
||||
name => "ZM_WEB_MONTAGE_HEIGHT",
|
||||
default => "0",
|
||||
description => "What height should each monitor in the montage view be",
|
||||
help => "In the montage view it is possible to view all of your monitors at once. If they are all different sizes this can be fairly untidy. Setting this option allows you to constrain the height of each of the monitor views to a fixed value to make the window tidier overall. Leaving it at the default of zero lets each monitor be displayed at it's normal native size.",
|
||||
type => $types{integer},
|
||||
category => 'web',
|
||||
},
|
||||
{
|
||||
name => "ZM_OPT_FAST_DELETE",
|
||||
default => "yes",
|
||||
|
@ -1076,7 +1092,7 @@ my %options_hash = map { ( $_->{name}, $_ ) } @options;
|
|||
|
||||
foreach my $option ( @options )
|
||||
{
|
||||
if ( $option->{default} )
|
||||
if ( defined($option->{default}) )
|
||||
{
|
||||
$option->{value} = $option->{default}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue