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.
|
# Define the identity of the package.
|
||||||
PACKAGE=zm
|
PACKAGE=zm
|
||||||
VERSION=1.17.2
|
VERSION=1.17.2-ms
|
||||||
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
AC_INIT(src/zm.h)
|
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)
|
AM_CONFIG_HEADER(config.h)
|
||||||
|
|
||||||
AC_ARG_WITH(mysql,
|
AC_ARG_WITH(mysql,
|
||||||
|
|
|
@ -77,8 +77,8 @@ $ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
|
||||||
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
|
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
|
||||||
|
|
||||||
my $event_id;
|
my $event_id;
|
||||||
my $rate = 1;
|
my $rate = 0.0;
|
||||||
my $scale = 1;
|
my $scale = 1.0;
|
||||||
my $overwrite = 0;
|
my $overwrite = 0;
|
||||||
|
|
||||||
sub Usage
|
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]
|
Usage: zmvideo.pl -e <event_id>,--event=<event_id> [-r <rate>,--rate=<rate>] [-s <scale>,--scale=<scale>] [-o,--overwrite]
|
||||||
Parameters are :-
|
Parameters are :-
|
||||||
-e<event_id>, --event=<event_id> - What event to create the video for
|
-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
|
-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, -2 = half size 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.
|
-o, --overwrite - Whether to overwrite an existing file, off by default.
|
||||||
");
|
");
|
||||||
exit( -1 );
|
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();
|
Usage();
|
||||||
}
|
}
|
||||||
|
@ -111,21 +111,21 @@ if ( ZM_OPT_MPEG eq "no" )
|
||||||
exit(-1);
|
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" );
|
print( STDERR "Variable rate not supported with mpeg_encode\n" );
|
||||||
exit(-1);
|
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();
|
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();
|
Usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,39 +232,21 @@ if ( $overwrite || !-s $video_file )
|
||||||
elsif ( ZM_OPT_MPEG eq "ffmpeg" )
|
elsif ( ZM_OPT_MPEG eq "ffmpeg" )
|
||||||
{
|
{
|
||||||
my $frame_rate = sprintf( "%.2f", $event->{Frames}/$event->{FullLength} );
|
my $frame_rate = sprintf( "%.2f", $event->{Frames}/$event->{FullLength} );
|
||||||
if ( $rate )
|
if ( $rate != 0.0 )
|
||||||
{
|
|
||||||
if ( $rate != 1 )
|
|
||||||
{
|
|
||||||
if ( $rate > 1 )
|
|
||||||
{
|
{
|
||||||
$frame_rate *= $rate;
|
$frame_rate *= $rate;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
$frame_rate /= $rate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$frame_rate = 25.0;
|
$frame_rate = 25.0;
|
||||||
}
|
}
|
||||||
my $width = $event->{MonitorWidth};
|
my $width = $event->{MonitorWidth};
|
||||||
my $height = $event->{MonitorHeight};
|
my $height = $event->{MonitorHeight};
|
||||||
if ( $scale != 1 )
|
if ( $scale != 1.0 )
|
||||||
{
|
|
||||||
if ( $scale > 1 )
|
|
||||||
{
|
{
|
||||||
$width = int($width*$scale);
|
$width = int($width*$scale);
|
||||||
$height = int($height*$scale);
|
$height = int($height*$scale);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$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";
|
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" );
|
print( LOG $command."\n" );
|
||||||
my $output = qx($command);
|
my $output = qx($command);
|
||||||
|
|
|
@ -37,6 +37,9 @@
|
||||||
#define ZM_MAX_IMAGE_DIM (ZM_MAX_IMAGE_WIDTH*ZM_MAX_IMAGE_HEIGHT)
|
#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_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
|
class ConfigItem
|
||||||
{
|
{
|
||||||
private:
|
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;
|
int delay = (int)((DT_GRAN_1000000*frame_delta))-delta_time.delta;
|
||||||
|
|
||||||
if ( rate < 0 )
|
delay = (delay * ZM_RATE_SCALE) / rate;
|
||||||
delay *= abs(rate);
|
|
||||||
else
|
|
||||||
delay /= 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 ));
|
//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 )
|
if ( delay > 0 )
|
||||||
|
|
|
@ -834,29 +834,40 @@ void Image::Rotate( int angle )
|
||||||
memcpy( buffer, rotate_buffer, size );
|
memcpy( buffer, rotate_buffer, size );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Image::Scale( int factor )
|
void Image::Scale( unsigned int factor )
|
||||||
{
|
{
|
||||||
if ( !factor )
|
if ( !factor )
|
||||||
{
|
{
|
||||||
|
Error(( "Bogus scale factor %d found", factor ));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( factor == 1 )
|
if ( factor == ZM_SCALE_SCALE )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char scale_buffer[ZM_MAX_IMAGE_SIZE];
|
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 char *pd = scale_buffer;
|
||||||
unsigned int wc = width*colours;
|
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++ )
|
for ( int y = 0; y < height; y++ )
|
||||||
{
|
{
|
||||||
unsigned char *ps = &buffer[y*wc];
|
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 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++ )
|
for ( int c = 0; c < colours; c++ )
|
||||||
{
|
{
|
||||||
|
@ -864,43 +875,64 @@ void Image::Scale( int factor )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ps += colours;
|
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 );
|
memcpy( pd, pd-nwc, nwc );
|
||||||
pd += wcf;
|
pd += nwc;
|
||||||
}
|
}
|
||||||
|
last_h_index = h_index;
|
||||||
}
|
}
|
||||||
width *= factor;
|
|
||||||
height *= factor;
|
|
||||||
size = width*height*colours;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
factor = abs(factor);
|
unsigned int inv_factor = (ZM_SCALE_SCALE*ZM_SCALE_SCALE)/factor;
|
||||||
unsigned char *pd = scale_buffer;
|
unsigned char *pd = scale_buffer;
|
||||||
unsigned int wc = width*colours;
|
unsigned int wc = width*colours;
|
||||||
unsigned int cf = factor*colours;
|
unsigned int xstart = factor/2;
|
||||||
unsigned int xrem = width%factor;
|
unsigned int ystart = factor/2;
|
||||||
unsigned int yrem = height%factor;
|
unsigned int h_count = ystart;
|
||||||
unsigned int xstart = xrem/2;
|
unsigned int last_h_index = 0;
|
||||||
unsigned int ystart = yrem/2;
|
unsigned int h_index;
|
||||||
for ( int y = xstart; y < height; y += factor )
|
for ( unsigned int y = 0; y < height; y++ )
|
||||||
{
|
{
|
||||||
|
h_count += factor;
|
||||||
|
h_index = h_count/ZM_SCALE_SCALE;
|
||||||
|
if ( h_index > last_h_index )
|
||||||
|
{
|
||||||
|
unsigned int w_count = xstart;
|
||||||
|
unsigned int last_w_index = 0;
|
||||||
|
unsigned int w_index;
|
||||||
|
|
||||||
unsigned char *ps = &buffer[y*wc];
|
unsigned char *ps = &buffer[y*wc];
|
||||||
for ( int x = ystart; x < width; x += factor )
|
for ( unsigned int x = 0; x < width; x++ )
|
||||||
|
{
|
||||||
|
w_count += factor;
|
||||||
|
w_index = w_count/ZM_SCALE_SCALE;
|
||||||
|
|
||||||
|
if ( w_index > last_w_index )
|
||||||
{
|
{
|
||||||
for ( int c = 0; c < colours; c++ )
|
for ( int c = 0; c < colours; c++ )
|
||||||
{
|
{
|
||||||
*pd++ = *(ps+c);
|
*pd++ = *ps++;
|
||||||
}
|
|
||||||
ps += cf;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
width = 1+int((width-1)/factor);
|
else
|
||||||
height = 1+int((height-1)/factor);
|
{
|
||||||
|
ps += colours;
|
||||||
|
}
|
||||||
|
last_w_index = w_index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
last_h_index = h_index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
width = new_width;
|
||||||
|
height = new_height;
|
||||||
size = width*height*colours;
|
size = width*height*colours;
|
||||||
}
|
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
buffer = new JSAMPLE[size];
|
buffer = new JSAMPLE[size];
|
||||||
memcpy( buffer, scale_buffer, size );
|
memcpy( buffer, scale_buffer, size );
|
||||||
|
|
|
@ -168,7 +168,7 @@ public:
|
||||||
|
|
||||||
void Rotate( int angle );
|
void Rotate( int angle );
|
||||||
|
|
||||||
void Scale( int factor );
|
void Scale( unsigned int factor );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ZM_IMAGE_H
|
#endif // ZM_IMAGE_H
|
||||||
|
|
|
@ -26,8 +26,8 @@ int main(void )
|
||||||
int id = 1;
|
int id = 1;
|
||||||
unsigned long idle = 5000;
|
unsigned long idle = 5000;
|
||||||
unsigned long refresh = 50;
|
unsigned long refresh = 50;
|
||||||
unsigned int rate = 1;
|
unsigned int rate = 100;
|
||||||
unsigned int scale = 1;
|
unsigned int scale = 100;
|
||||||
int event = 0;
|
int event = 0;
|
||||||
unsigned int ttl = 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_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_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( "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
|
define( "LEARN_MODE", false ); // Currently unimplemented, do not change
|
||||||
|
|
||||||
require_once( 'zm_db.php' );
|
require_once( 'zm_db.php' );
|
||||||
|
|
|
@ -377,26 +377,19 @@ function zmaCheck( $monitor )
|
||||||
|
|
||||||
function createVideo( $event, $rate, $scale, $overwrite=0 )
|
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 )
|
if ( $overwrite )
|
||||||
$command .= " -o";
|
$command .= " -o";
|
||||||
$result = exec( $command, $output, $status );
|
$result = exec( $command, $output, $status );
|
||||||
return( $status?"":rtrim($result) );
|
return( $status?"":rtrim($result) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function reScale( $dimension, $scale=1 )
|
function reScale( $dimension, $scale=SCALE_SCALE )
|
||||||
{
|
{
|
||||||
if ( $scale == 1 )
|
if ( $scale == SCALE_SCALE )
|
||||||
return( $dimension );
|
return( $dimension );
|
||||||
|
|
||||||
if ( $scale > 0 )
|
return( (int)(($dimension*$scale)/SCALE_SCALE) );
|
||||||
{
|
|
||||||
return( (int)($dimension*$scale) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return( (int)(1+(($dimension-1)/-$scale)) );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -69,22 +69,24 @@ $bw_array = array(
|
||||||
|
|
||||||
$rates = array(
|
$rates = array(
|
||||||
"0" => $zmSlangMax,
|
"0" => $zmSlangMax,
|
||||||
"10" => "10x",
|
"1000" => "10x",
|
||||||
"4" => "4x",
|
"400" => "4x",
|
||||||
"2" => "2x",
|
"200" => "2x",
|
||||||
"1" => $zmSlangReal,
|
"100" => $zmSlangReal,
|
||||||
"-2" => "1/2x",
|
"50" => "1/2x",
|
||||||
"-4" => "1/4x",
|
"25" => "1/4x",
|
||||||
);
|
);
|
||||||
|
|
||||||
$scales = array(
|
$scales = array(
|
||||||
"4" => "4x",
|
"400" => "4x",
|
||||||
"3" => "3x",
|
"300" => "3x",
|
||||||
"2" => "2x",
|
"200" => "2x",
|
||||||
"1" => $zmSlangActual,
|
"150" => "1.5x",
|
||||||
"-2" => "1/2x",
|
"100" => $zmSlangActual,
|
||||||
"-3" => "1/3x",
|
"75" => "3/4x",
|
||||||
"-4" => "1/4x",
|
"50" => "1/2x",
|
||||||
|
"33" => "1/3x",
|
||||||
|
"25" => "1/4x",
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( !isset($user) )
|
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_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_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>
|
<html>
|
||||||
|
@ -135,7 +137,7 @@ preg_match( '/load average: ([\d.]+)/', $uptime, $matches );
|
||||||
if ( canView( 'Stream' ) && $cycle_count > 1 )
|
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
|
<?php
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -47,6 +47,8 @@ while( $row = mysql_fetch_assoc( $result ) )
|
||||||
|
|
||||||
$monitor = $monitors[$mon_idx];
|
$monitor = $monitors[$mon_idx];
|
||||||
$next_mid = $mon_idx==(count($monitors)-1)?$monitors[0]['Id']:$monitors[$mon_idx+1]['Id'];
|
$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
|
// Prompt an image to be generated
|
||||||
chdir( ZM_DIR_IMAGES );
|
chdir( ZM_DIR_IMAGES );
|
||||||
|
@ -104,20 +106,20 @@ if ( $mode == "stream" )
|
||||||
if ( canStreamNative() )
|
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
|
<?php
|
||||||
}
|
}
|
||||||
else
|
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
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -56,9 +56,9 @@ if ( !$result )
|
||||||
$next_event = mysql_fetch_assoc( $result );
|
$next_event = mysql_fetch_assoc( $result );
|
||||||
|
|
||||||
if ( !isset( $rate ) )
|
if ( !isset( $rate ) )
|
||||||
$rate = 1;
|
$rate = RATE_SCALE;
|
||||||
if ( !isset( $scale ) )
|
if ( !isset( $scale ) )
|
||||||
$scale = 1;
|
$scale = SCALE_SCALE;
|
||||||
|
|
||||||
$frames_per_page = EVENT_FRAMES_PER_LINE * EVENT_FRAME_LINES;
|
$frames_per_page = EVENT_FRAMES_PER_LINE * EVENT_FRAME_LINES;
|
||||||
|
|
||||||
|
|
|
@ -40,13 +40,14 @@ $heights = array();
|
||||||
for ( $i = 0; $i < count($monitors); $i++ )
|
for ( $i = 0; $i < count($monitors); $i++ )
|
||||||
{
|
{
|
||||||
$monitor = $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;
|
$row = $i/ZM_WEB_MONTAGE_MAX_COLS;
|
||||||
$col = $i%ZM_WEB_MONTAGE_MAX_COLS;
|
$col = $i%ZM_WEB_MONTAGE_MAX_COLS;
|
||||||
if ( empty( $heights[$row] ) || $frame_height > $heights[$row] )
|
if ( empty( $heights[$row] ) || $frame_height > $heights[$row] )
|
||||||
$heights[$row] = $frame_height;
|
$heights[$row] = $frame_height;
|
||||||
if ( empty( $widths[$col] ) || $monitor['Width'] > $widths[$col] )
|
if ( empty( $widths[$col] ) || $frame_width > $widths[$col] )
|
||||||
$widths[$col] = $monitor['Width'];
|
$widths[$col] = $frame_width;
|
||||||
}
|
}
|
||||||
$row_spec = join( ',', $heights );
|
$row_spec = join( ',', $heights );
|
||||||
$col_spec = join( ',', $widths );
|
$col_spec = join( ',', $widths );
|
||||||
|
|
|
@ -36,6 +36,9 @@ if ( !$result )
|
||||||
die( mysql_error() );
|
die( mysql_error() );
|
||||||
$monitor = mysql_fetch_assoc( $result );
|
$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" )
|
if ( $mode != "stream" )
|
||||||
{
|
{
|
||||||
// Prompt an image to be generated
|
// Prompt an image to be generated
|
||||||
|
@ -86,20 +89,27 @@ if ( $mode == "stream" )
|
||||||
if ( canStreamNative() )
|
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
|
<?php
|
||||||
}
|
}
|
||||||
else
|
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
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -28,10 +28,10 @@ if ( !$result )
|
||||||
die( mysql_error() );
|
die( mysql_error() );
|
||||||
$event = mysql_fetch_assoc( $result );
|
$event = mysql_fetch_assoc( $result );
|
||||||
|
|
||||||
if ( !isset( $scale ) )
|
|
||||||
$scale = 1;
|
|
||||||
if ( !isset( $rate ) )
|
if ( !isset( $rate ) )
|
||||||
$rate = 1;
|
$rate = RATE_SCALE;
|
||||||
|
if ( !isset( $scale ) )
|
||||||
|
$scale = SCALE_SCALE;
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
|
|
|
@ -28,23 +28,23 @@ if ( !$result )
|
||||||
die( mysql_error() );
|
die( mysql_error() );
|
||||||
$monitor = mysql_fetch_assoc( $result );
|
$monitor = mysql_fetch_assoc( $result );
|
||||||
|
|
||||||
if ( empty($scale) )
|
if ( !isset($scale) )
|
||||||
$scale = 1;
|
$scale = SCALE_SCALE;
|
||||||
|
|
||||||
$width_scale = ($scale<1)?1:$scale;
|
$width_scale = ($scale<SCALE_SCALE)?SCALE_SCALE:$scale;
|
||||||
$height_scale = ($scale<1)?(1/abs($scale)):$scale;
|
$height_scale = $scale;
|
||||||
?>
|
?>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>ZM - <?= $monitor['Name'] ?> - <?= $zmSlangWatch ?></title>
|
<title>ZM - <?= $monitor['Name'] ?> - <?= $zmSlangWatch ?></title>
|
||||||
<link rel="stylesheet" href="zm_styles.css" type="text/css">
|
<link rel="stylesheet" href="zm_styles.css" type="text/css">
|
||||||
<script language="JavaScript">
|
<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();
|
//opener.location.reload();
|
||||||
window.focus();
|
window.focus();
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</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=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=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">
|
<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
|
header("Pragma: no-cache"); // HTTP/1.0
|
||||||
|
|
||||||
if ( !isset( $scale ) )
|
if ( !isset( $scale ) )
|
||||||
$scale = 1;
|
$scale = SCALE_SCALE;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<html>
|
<html>
|
||||||
|
|
|
@ -513,6 +513,22 @@ my @options =
|
||||||
type => $types{integer},
|
type => $types{integer},
|
||||||
category => 'web',
|
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",
|
name => "ZM_OPT_FAST_DELETE",
|
||||||
default => "yes",
|
default => "yes",
|
||||||
|
@ -1076,7 +1092,7 @@ my %options_hash = map { ( $_->{name}, $_ ) } @options;
|
||||||
|
|
||||||
foreach my $option ( @options )
|
foreach my $option ( @options )
|
||||||
{
|
{
|
||||||
if ( $option->{default} )
|
if ( defined($option->{default}) )
|
||||||
{
|
{
|
||||||
$option->{value} = $option->{default}
|
$option->{value} = $option->{default}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue