Skip to content

Instantly share code, notes, and snippets.

@chriswiggins
Forked from kylejohnson/mkv_storage.patch
Created August 16, 2013 02:40
Show Gist options
  • Save chriswiggins/6246802 to your computer and use it in GitHub Desktop.
Save chriswiggins/6246802 to your computer and use it in GitHub Desktop.
diff -u -E -b ZoneMinder-1.24.2.orig/db/zm_create.sql.in ZoneMinder-1.24.2/db/zm_create.sql.in
--- ZoneMinder-1.24.2.orig/db/zm_create.sql.in 2009-05-25 22:08:50.000000000 +0400
+++ ZoneMinder-1.24.2/db/zm_create.sql.in 2010-09-27 16:22:55.000000000 +0400
@@ -190,7 +190,7 @@
`EndTime` datetime default NULL,
`Width` smallint(5) unsigned NOT NULL default '0',
`Height` smallint(5) unsigned NOT NULL default '0',
- `Length` decimal(10,2) NOT NULL default '0.00',
+ `Length` decimal(11,3) NOT NULL default '0.000',
`Frames` int(10) unsigned default NULL,
`AlarmFrames` int(10) unsigned default NULL,
`TotScore` int(10) unsigned NOT NULL default '0',
@@ -240,7 +240,7 @@
`FrameId` int(10) unsigned NOT NULL default '0',
`Type` enum('Normal','Bulk','Alarm') NOT NULL default 'Normal',
`TimeStamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
- `Delta` decimal(8,2) NOT NULL default '0.00',
+ `Delta` decimal(9,3) NOT NULL default '0.000',
`Score` smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (`EventId`,`FrameId`),
KEY `Type` (`Type`),
@@ -545,6 +545,7 @@
INSERT into MonitorPresets VALUES ('','Axis IP, mpeg4, multicast','Remote',NULL,NULL,NULL,'rtsp','rtpMulti','<ip-address>',554,'/mpeg4/media.amp','/trackID=',NULL,NULL,3,NULL,0,NULL,NULL,NULL,100,100);
INSERT into MonitorPresets VALUES ('','Axis IP, mpeg4, RTP/RTSP','Remote',NULL,NULL,NULL,'rtsp','rtpRtsp','<ip-address>',554,'/mpeg4/media.amp','/trackID=',NULL,NULL,3,NULL,0,NULL,NULL,NULL,100,100);
INSERT into MonitorPresets VALUES ('','Axis IP, mpeg4, RTP/RTSP/HTTP','Remote',NULL,NULL,NULL,'rtsp','rtpRtspHttp','<ip-address>',554,'/mpeg4/media.amp','/trackID=',NULL,NULL,3,NULL,0,NULL,NULL,NULL,100,100);
+INSERT into MonitorPresets VALUES ('','Axis M1011, h264, RTP/RTSP','Remote',NULL,NULL,NULL,'rtsp','rtpRtsp','<ip-address>',554,'/axis-media/media.amp','',NULL,NULL,3,NULL,0,NULL,NULL,NULL,100,100);
INSERT INTO MonitorPresets VALUES ('','Panasonic IP, 320x240, mpjpeg','Remote','http','simple',NULL,NULL,NULL,'<ip-address>',80,'/nphMotionJpeg?Resolution=320x240&Quality=Standard',NULL,320,240,3,NULL,0,NULL,NULL,NULL,100,100);
INSERT INTO MonitorPresets VALUES ('','Panasonic IP, 320x240, jpeg','Remote','http','simple',NULL,NULL,NULL,'<ip-address>',80,'/SnapshotJPEG?Resolution=320x240&Quality=Standard',NULL,320,240,3,NULL,0,NULL,NULL,NULL,100,100);
INSERT INTO MonitorPresets VALUES ('','Panasonic IP, 320x240, jpeg, max 5 FPS','Remote','http','simple',NULL,NULL,NULL,'<ip-address>',80,'/SnapshotJPEG?Resolution=320x240&Quality=Standard',NULL,320,240,3,5.0,0,NULL,NULL,NULL,100,100);
@@ -847,4 +848,5 @@
insert into Config set Id = 180, Name = 'ZM_DYN_NEXT_REMINDER', Value = '', Type = 'string', DefaultValue = '', Hint = 'string', Pattern = '(?-xism:^(.+)$)', Format = ' $1 ', Prompt = 'When the earliest time to remind about versions will be', Help = '', Category = 'dynamic', Readonly = '1', Requires = '';
insert into Config set Id = 181, Name = 'ZM_DYN_DONATE_REMINDER_TIME', Value = '0', Type = 'integer', DefaultValue = '0', Hint = 'integer', Pattern = '(?-xism:^(\d+)$)', Format = ' $1 ', Prompt = 'When the earliest time to remind about donations will be', Help = '', Category = 'dynamic', Readonly = '1', Requires = '';
insert into Config set Id = 182, Name = 'ZM_DYN_SHOW_DONATE_REMINDER', Value = '1', Type = 'boolean', DefaultValue = 'yes', Hint = 'yes|no', Pattern = '(?i-xsm:^([yn]))', Format = ' ($1 =~ /^y/) ? \"yes\" : \"no\" ', Prompt = 'Remind about donations or not', Help = '', Category = 'dynamic', Readonly = '1', Requires = '';
+//the following is auto generated
+insert into Config set Id = 183, Name = 'ZM_USE_MKV_STORAGE', Value = '0', Type = 'boolean', DefaultValue = 'no', Hint = 'yes|no', Pattern = '(?i-xsm:^([yn]))', Format = ' ($1 =~ /^y/) ? \"yes\" : \"no\" ', Prompt = 'Use MKV files for storage vs. JPEG', Help = '', Category = 'paths', Readonly = '0', Requires = '';
--- /dev/null 2010-07-12 21:45:26.612011204 +0400
+++ ZoneMinder-1.24.2/db/zm_update-1.24.2.sql 2010-09-28 14:50:44.000000000 +0400
@@ -0,0 +1,20 @@
+--
+-- This updates a 1.24.2 database to the next version
+--
+
+alter table Events modify Length numeric(11,3) default 0.000 not null;
+alter table Frames modify Delta numeric(9,3) default 0.000 not null;
+
+insert into Config set Id = 183, Name = 'ZM_USE_MKV_STORAGE', Value = '0', Type = 'boolean', DefaultValue = 'no', Hint = 'yes|no', Pattern = '(?i-xsm:^([yn]))', Format = ' ($1 =~ /^y/) ? \"yes\" : \"no\" ', Prompt = 'Use MKV files for storage vs. JPEG', Help = '', Category = 'paths', Readonly = '0', Requires = '';
+
+insert into MonitorPresets values ('','Axis M1011, h264, RTP/RTSP','Remote',NULL,NULL,NULL,'rtsp','rtpRtsp','<ip-address>',554,'/axis-media/media.amp','/trackID=',NULL,NULL,3,NULL,0,NULL,NULL,NULL,100,100);
+
+--
+-- These are optional, but we might as well do it now
+--
+optimize table Frames;
+optimize table Events;
+optimize table Filters;
+optimize table Zones;
+optimize table Monitors;
+optimize table Stats;
diff -u -E -b -r ZoneMinder-1.24.2.orig/scripts/zmaudit.pl ZoneMinder-1.24.2/scripts/zmaudit.pl
--- ZoneMinder-1.24.2.orig/scripts/zmaudit.pl 2009-06-24 14:24:11.000000000 +0400
+++ ZoneMinder-1.24.2/scripts/zmaudit.pl 2010-09-28 13:58:39.000000000 +0400
@@ -52,7 +52,7 @@
#
# ==========================================================================
-use lib '/home/stan/Work/Install/lib/perl5/site_perl/5.8.8'; # Include custom perl install path
+# Include from system perl paths only
use ZoneMinder;
use DBI;
use POSIX;
diff -u -E -b -r ZoneMinder-1.24.2.orig/scripts/zmcontrol.pl ZoneMinder-1.24.2/scripts/zmcontrol.pl
--- ZoneMinder-1.24.2.orig/scripts/zmcontrol.pl 2009-06-24 14:24:12.000000000 +0400
+++ ZoneMinder-1.24.2/scripts/zmcontrol.pl 2010-09-28 13:58:39.000000000 +0400
@@ -38,7 +38,7 @@
# ==========================================================================
-use lib '/home/stan/Work/Install/lib/perl5/site_perl/5.8.8'; # Include custom perl install path
+# Include from system perl paths only
use ZoneMinder;
use Getopt::Long;
use POSIX qw/strftime EPIPE/;
diff -u -E -b -r ZoneMinder-1.24.2.orig/scripts/zmdc.pl ZoneMinder-1.24.2/scripts/zmdc.pl
--- ZoneMinder-1.24.2.orig/scripts/zmdc.pl 2009-06-24 14:24:12.000000000 +0400
+++ ZoneMinder-1.24.2/scripts/zmdc.pl 2010-09-28 13:58:39.000000000 +0400
@@ -47,7 +47,7 @@
#
# ==========================================================================
-use lib '/home/stan/Work/Install/lib/perl5/site_perl/5.8.8'; # Include custom perl install path
+# Include from system perl paths only
use ZoneMinder;
use POSIX;
use Socket;
diff -u -E -b -r ZoneMinder-1.24.2.orig/scripts/zmfilter.pl ZoneMinder-1.24.2/scripts/zmfilter.pl
--- ZoneMinder-1.24.2.orig/scripts/zmfilter.pl 2009-06-24 14:24:13.000000000 +0400
+++ ZoneMinder-1.24.2/scripts/zmfilter.pl 2010-09-28 13:58:39.000000000 +0400
@@ -45,7 +45,7 @@
#
# ==========================================================================
-use lib '/home/stan/Work/Install/lib/perl5/site_perl/5.8.8'; # Include custom perl install path
+# Include from system perl paths only
use ZoneMinder;
use DBI;
use POSIX;
diff -u -E -b -r ZoneMinder-1.24.2.orig/scripts/zmpkg.pl ZoneMinder-1.24.2/scripts/zmpkg.pl
--- ZoneMinder-1.24.2.orig/scripts/zmpkg.pl 2009-06-29 19:28:28.000000000 +0400
+++ ZoneMinder-1.24.2/scripts/zmpkg.pl 2010-09-28 13:58:39.000000000 +0400
@@ -42,7 +42,6 @@
#
# ==========================================================================
-use lib '/home/stan/Work/Install/lib/perl5/site_perl/5.8.8'; # Include custom perl install path
use ZoneMinder;
use DBI;
use POSIX;
diff -u -E -b -r ZoneMinder-1.24.2.orig/scripts/zmpkg.pl.in ZoneMinder-1.24.2/scripts/zmpkg.pl.in
--- ZoneMinder-1.24.2.orig/scripts/zmpkg.pl.in 2009-06-29 19:28:22.000000000 +0400
+++ ZoneMinder-1.24.2/scripts/zmpkg.pl.in 2010-07-14 19:17:35.000000000 +0400
@@ -42,7 +42,6 @@
#
# ==========================================================================
-@EXTRA_PERL_LIB@
use ZoneMinder;
use DBI;
use POSIX;
diff -u -E -b -r ZoneMinder-1.24.2.orig/scripts/zmtrigger.pl ZoneMinder-1.24.2/scripts/zmtrigger.pl
--- ZoneMinder-1.24.2.orig/scripts/zmtrigger.pl 2009-06-24 14:24:15.000000000 +0400
+++ ZoneMinder-1.24.2/scripts/zmtrigger.pl 2010-09-28 13:58:40.000000000 +0400
@@ -47,7 +47,7 @@
#
# ==========================================================================
-use lib '/home/stan/Work/Install/lib/perl5/site_perl/5.8.8'; # Include custom perl install path
+# Include from system perl paths only
use ZoneMinder::Trigger::Channel::Inet;
use ZoneMinder::Trigger::Channel::Unix;
use ZoneMinder::Trigger::Channel::Serial;
diff -u -E -b -r ZoneMinder-1.24.2.orig/scripts/zmupdate.pl ZoneMinder-1.24.2/scripts/zmupdate.pl
--- ZoneMinder-1.24.2.orig/scripts/zmupdate.pl 2009-06-30 11:42:12.000000000 +0400
+++ ZoneMinder-1.24.2/scripts/zmupdate.pl 2010-09-28 13:58:40.000000000 +0400
@@ -45,7 +45,7 @@
#
# ==========================================================================
-use lib '/home/stan/Work/Install/lib/perl5/site_perl/5.8.8'; # Include custom perl install path
+# Include from system perl paths only
use ZoneMinder::Base qw(:all);
use ZoneMinder::Config qw(:all);
use ZoneMinder::Debug qw(:all);
diff -u -E -b -r ZoneMinder-1.24.2.orig/scripts/zmvideo.pl ZoneMinder-1.24.2/scripts/zmvideo.pl
--- ZoneMinder-1.24.2.orig/scripts/zmvideo.pl 2009-06-24 14:24:16.000000000 +0400
+++ ZoneMinder-1.24.2/scripts/zmvideo.pl 2010-09-28 13:58:40.000000000 +0400
@@ -42,7 +42,7 @@
#
# ==========================================================================
-use lib '/home/stan/Work/Install/lib/perl5/site_perl/5.8.8'; # Include custom perl install path
+# Include from system perl paths only
use ZoneMinder;
use DBI;
use Data::Dumper;
@@ -230,7 +230,17 @@
$video_size = $size;
}
- my $command = ZM_PATH_FFMPEG." -y -r $frame_rate ".ZM_FFMPEG_INPUT_OPTIONS." -i %0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg -s $video_size ".ZM_FFMPEG_OUTPUT_OPTIONS." '$video_file' > ffmpeg.log 2>&1";
+ my $command;
+ if ( (ZM_USE_MKV_STORAGE eq "yes" or ZM_USE_MKV_STORAGE eq "1") and
+ scalar(stat($event->{Id}.".mkv")) )
+ {
+ $command = ZM_PATH_FFMPEG." -y -r $frame_rate ".ZM_FFMPEG_INPUT_OPTIONS." -i ".$event->{Id}.".mkv -s $video_size ".ZM_FFMPEG_OUTPUT_OPTIONS." '$video_file' > ffmpeg.log 2>&1";
+ }
+ else
+ {
+ $command = ZM_PATH_FFMPEG." -y -r $frame_rate ".ZM_FFMPEG_INPUT_OPTIONS." -i %0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg -s $video_size ".ZM_FFMPEG_OUTPUT_OPTIONS." '$video_file' > ffmpeg.log 2>&1";
+ }
+
Debug( $command."\n" );
my $output = qx($command);
diff -u -E -b -r ZoneMinder-1.24.2.orig/scripts/zmvideo.pl.in ZoneMinder-1.24.2/scripts/zmvideo.pl.in
--- ZoneMinder-1.24.2.orig/scripts/zmvideo.pl.in 2009-06-08 13:18:24.000000000 +0400
+++ ZoneMinder-1.24.2/scripts/zmvideo.pl.in 2010-09-28 10:39:23.000000000 +0400
@@ -230,7 +230,17 @@
$video_size = $size;
}
- my $command = ZM_PATH_FFMPEG." -y -r $frame_rate ".ZM_FFMPEG_INPUT_OPTIONS." -i %0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg -s $video_size ".ZM_FFMPEG_OUTPUT_OPTIONS." '$video_file' > ffmpeg.log 2>&1";
+ my $command;
+ if ( (ZM_USE_MKV_STORAGE eq "yes" or ZM_USE_MKV_STORAGE eq "1") and
+ scalar(stat($event->{Id}.".mkv")) )
+ {
+ $command = ZM_PATH_FFMPEG." -y -r $frame_rate ".ZM_FFMPEG_INPUT_OPTIONS." -i ".$event->{Id}.".mkv -s $video_size ".ZM_FFMPEG_OUTPUT_OPTIONS." '$video_file' > ffmpeg.log 2>&1";
+ }
+ else
+ {
+ $command = ZM_PATH_FFMPEG." -y -r $frame_rate ".ZM_FFMPEG_INPUT_OPTIONS." -i %0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg -s $video_size ".ZM_FFMPEG_OUTPUT_OPTIONS." '$video_file' > ffmpeg.log 2>&1";
+ }
+
Debug( $command."\n" );
my $output = qx($command);
diff -u -E -b -r ZoneMinder-1.24.2.orig/scripts/zmwatch.pl ZoneMinder-1.24.2/scripts/zmwatch.pl
--- ZoneMinder-1.24.2.orig/scripts/zmwatch.pl 2009-06-24 14:24:16.000000000 +0400
+++ ZoneMinder-1.24.2/scripts/zmwatch.pl 2010-09-28 13:58:40.000000000 +0400
@@ -45,7 +45,7 @@
#
# ==========================================================================
-use lib '/home/stan/Work/Install/lib/perl5/site_perl/5.8.8'; # Include custom perl install path
+# Include from system perl paths only
use ZoneMinder;
use POSIX;
use DBI;
diff -u -E -b -r ZoneMinder-1.24.2.orig/scripts/zmx10.pl ZoneMinder-1.24.2/scripts/zmx10.pl
--- ZoneMinder-1.24.2.orig/scripts/zmx10.pl 2009-06-24 14:24:16.000000000 +0400
+++ ZoneMinder-1.24.2/scripts/zmx10.pl 2010-09-28 13:58:40.000000000 +0400
@@ -44,7 +44,7 @@
#
# ==========================================================================
-use lib '/home/stan/Work/Install/lib/perl5/site_perl/5.8.8'; # Include custom perl install path
+# Include from system perl paths only
use ZoneMinder;
use POSIX;
use Socket;
diff -u -E -b -r ZoneMinder-1.24.2.orig/scripts/ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm ZoneMinder-1.24.2/scripts/ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm
--- ZoneMinder-1.24.2.orig/scripts/ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm 2009-06-24 14:24:19.000000000 +0400
+++ ZoneMinder-1.24.2/scripts/ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm 2010-09-28 13:58:41.000000000 +0400
@@ -1662,6 +1662,14 @@
readonly => 1,
category => "dynamic",
},
+ {
+ name => "ZM_USE_MKV_STORAGE",
+ default => "no",
+ description => "Use a .mkv storage for events vs. JPEG",
+ help => "",
+ type => $types{boolean},
+ category => "paths",
+ },
);
our %options_hash = map { ( $_->{name}, $_ ) } @options;
diff -u -E -b -r ZoneMinder-1.24.2.orig/scripts/ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm.in ZoneMinder-1.24.2/scripts/ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm.in
--- ZoneMinder-1.24.2.orig/scripts/ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm.in 2009-05-25 22:04:00.000000000 +0400
+++ ZoneMinder-1.24.2/scripts/ZoneMinder/lib/ZoneMinder/ConfigAdmin.pm.in 2010-09-21 19:01:37.000000000 +0400
@@ -1662,6 +1662,14 @@
readonly => 1,
category => "dynamic",
},
+ {
+ name => "ZM_USE_MKV_STORAGE",
+ default => "no",
+ description => "Use a .mkv storage for events vs. JPEG",
+ help => "",
+ type => $types{boolean},
+ category => "paths",
+ },
);
our %options_hash = map { ( $_->{name}, $_ ) } @options;
diff -u -E -b -r ZoneMinder-1.24.2.orig/web/includes/config.php ZoneMinder-1.24.2/web/includes/config.php
--- ZoneMinder-1.24.2.orig/web/includes/config.php 2009-06-24 14:24:22.000000000 +0400
+++ ZoneMinder-1.24.2/web/includes/config.php 2010-09-28 13:58:41.000000000 +0400
@@ -21,7 +21,7 @@
//
// This section contains options substituted by the zmconfig.pl utility, do not edit these directly
//
-define( "ZM_CONFIG", "/home/stan/Work/Install/etc/zm.conf" ); // Path to config file
+define( "ZM_CONFIG", "/etc/zm/zm.conf" ); // Path to config file
$cfg = fopen( ZM_CONFIG, "r") or die("Could not open config file.");
while ( !feof($cfg) )
diff -u -E -b -r ZoneMinder-1.24.2.orig/web/lang/ru_ru.php ZoneMinder-1.24.2/web/lang/ru_ru.php
--- ZoneMinder-1.24.2.orig/web/lang/ru_ru.php 2009-05-25 22:04:00.000000000 +0400
+++ ZoneMinder-1.24.2/web/lang/ru_ru.php 2010-07-23 14:13:04.000000000 +0400
@@ -73,7 +73,7 @@
$SLANG = array(
'24BitColour' => '24 ������ ����',
'8BitGrey' => '256 �������� ������',
- 'Action' => 'Action',
+ 'Action' => '��������',
'Actual' => '��������������',
'AddNewControl' => 'Add New Control',
'AddNewMonitor' => '�������� �������',
@@ -82,11 +82,11 @@
'Alarm' => '�������',
'AlarmBrFrames' => '�����<br/>�������',
'AlarmFrame' => '���� �������',
- 'AlarmFrameCount' => 'Alarm Frame Count',
+ 'AlarmFrameCount' => '������� ������ �������',
'AlarmLimits' => '����.&nbsp;����&nbsp;����.',
'AlarmMaximumFPS' => 'Alarm Maximum FPS',
'AlarmPx' => '���&nbsp;����.',
- 'AlarmRGBUnset' => 'You must set an alarm RGB colour',
+ 'AlarmRGBUnset' => '�� ������ ������� RGB ���� �������',
'Alert' => '���������',
'All' => '���',
'Apply' => '���������',
@@ -94,36 +94,36 @@
'ArchArchived' => '������ � ������',
'ArchUnarchived' => '������ �� � ������',
'Archive' => '�����',
- 'Archived' => 'Archived',
+ 'Archived' => '������������',
'Area' => 'Area',
'AreaUnits' => 'Area (px/%)',
'AttrAlarmFrames' => '���-�� ������ �������',
'AttrArchiveStatus' => '������ ���������',
'AttrAvgScore' => '����. ������',
- 'AttrCause' => 'Cause',
+ 'AttrCause' => '�������',
'AttrDate' => '����',
'AttrDateTime' => '����/�����',
'AttrDiskBlocks' => 'Disk Blocks',
- 'AttrDiskPercent' => 'Disk Percent',
+ 'AttrDiskPercent' => '������� ���������� �����',
'AttrDuration' => '������������',
'AttrFrames' => '���-�� ������',
'AttrId' => 'Id',
'AttrMaxScore' => '����. ������',
'AttrMonitorId' => 'Id ��������',
'AttrMonitorName' => '�������� ��������',
- 'AttrName' => 'Name',
+ 'AttrName' => '���',
'AttrNotes' => 'Notes',
- 'AttrSystemLoad' => 'System Load',
+ 'AttrSystemLoad' => '�������� �������',
'AttrTime' => '�����',
'AttrTotalScore' => '����. ������',
'AttrWeekday' => '���� ������',
- 'Auto' => 'Auto',
+ 'Auto' => '����',
'AutoStopTimeout' => 'Auto Stop Timeout',
- 'Available' => 'Available', // Added - 2009-03-31
+ 'Available' => '��������', // Added - 2009-03-31
'AvgBrScore' => '����.<br/>������',
- 'Background' => 'Background',
- 'BackgroundFilter' => 'Run filter in background',
- 'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more',
+ 'Background' => '���',
+ 'BackgroundFilter' => '��������� ������ � ����',
+ 'BadAlarmFrameCount' => '���-�� ������ ������� ������ ���� 1 ��� ������',
'BadAlarmMaxFPS' => 'Alarm Maximum FPS must be a positive integer or floating point value',
'BadChannel' => 'Channel must be set to an integer of zero or more',
'BadDevice' => 'Device must be set to a valid value',
@@ -196,18 +196,18 @@
'Cancel' => '��������',
'CancelForcedAlarm' => '�������� ������������� �������',
'CaptureHeight' => '������ �� Y',
- 'CaptureMethod' => 'Capture Method', // Added - 2009-02-08
- 'CapturePalette' => '����� �������',
+ 'CaptureMethod' => '����� �������', // Added - 2009-02-08
+ 'CapturePalette' => '������� �������',
'CaptureWidth' => '������ �� X',
- 'Cause' => 'Cause',
+ 'Cause' => '�������',
'CheckMethod' => '����� �������� �������',
- 'ChooseDetectedCamera' => 'Choose Detected Camera', // Added - 2009-03-31
+ 'ChooseDetectedCamera' => '�������� ��������������� ������', // Added - 2009-03-31
'ChooseFilter' => '������� ������',
'ChoosePreset' => 'Choose Preset',
'Close' => '�������',
'Colour' => '����',
- 'Command' => 'Command',
- 'Config' => 'Config',
+ 'Command' => '�������',
+ 'Config' => '������������',
'ConfiguredFor' => '�������� ��',
'ConfirmDeleteEvents' => 'Are you sure you wish to delete the selected events?',
'ConfirmPassword' => '����������� ������',
@@ -215,7 +215,7 @@
'ConjOr' => '���',
'Console' => '������',
'ContactAdmin' => '���������� ���������� � ������ ��������������.',
- 'Continue' => 'Continue',
+ 'Continue' => '����������',
'Contrast' => '��������',
'Control' => 'Control',
'ControlAddress' => 'Control Address',
@@ -224,10 +224,10 @@
'ControlDevice' => 'Control Device',
'ControlType' => 'Control Type',
'Controllable' => 'Controllable',
- 'Cycle' => 'Cycle',
+ 'Cycle' => '����',
'CycleWatch' => '����������� ��������',
'Day' => '����',
- 'Debug' => 'Debug',
+ 'Debug' => '�������',
'DefaultRate' => 'Default Rate',
'DefaultScale' => 'Default Scale',
'DefaultView' => 'Default View',
@@ -236,16 +236,16 @@
'DeleteAndPrev' => '������� &amp; ����.',
'DeleteSavedFilter' => '������� ����������� ������',
'Description' => '��������',
- 'DetectedCameras' => 'Detected Cameras', // Added - 2009-03-31
- 'Device' => 'Device', // Added - 2009-02-08
+ 'DetectedCameras' => '��������������� ������', // Added - 2009-03-31
+ 'Device' => '����������', // Added - 2009-02-08
'DeviceChannel' => '�����',
'DeviceFormat' => '������',
'DeviceNumber' => '����� ����������',
- 'DevicePath' => 'Device Path',
- 'Devices' => 'Devices',
+ 'DevicePath' => '���� � ����������',
+ 'Devices' => '����������',
'Dimensions' => '�������',
- 'DisableAlarms' => 'Disable Alarms',
- 'Disk' => 'Disk',
+ 'DisableAlarms' => '��������� �������',
+ 'Disk' => '����',
'Donate' => 'Please Donate',
'DonateAlready' => 'No, I\'ve already donated',
'DonateEnticement' => 'You\'ve been running ZoneMinder for a while now and hopefully are finding it a useful addition to your home or workplace security. Although ZoneMinder is, and will remain, free and open source, it costs money to develop and support. If you would like to help support future development and new features then please consider donating. Donating is, of course, optional but very much appreciated and you can donate as much or as little as you like.<br><br>If you would like to donate please select the option below or go to http://www.zoneminder.com/donate.html in your browser.<br><br>Thank you for using ZoneMinder and don\'t forget to visit the forums on ZoneMinder.com for support or suggestions about how to make your ZoneMinder experience even better.',
@@ -255,12 +255,12 @@
'DonateRemindNever' => 'No, I don\'t want to donate, never remind',
'DonateRemindWeek' => 'Not yet, remind again in 1 week',
'DonateYes' => 'Yes, I\'d like to donate now',
- 'Download' => 'Download',
- 'DuplicateMonitorName' => 'Duplicate Monitor Name', // Added - 2009-03-31
+ 'Download' => '��������',
+ 'DuplicateMonitorName' => '������������� ��� ��������', // Added - 2009-03-31
'Duration' => '������������',
'Edit' => '��������������',
'Email' => 'Email',
- 'EnableAlarms' => 'Enable Alarms',
+ 'EnableAlarms' => '��������� �������',
'Enabled' => '��������',
'EnterNewFilterName' => '������� ����� �������� �������',
'Error' => '������',
@@ -269,25 +269,25 @@
'Etc' => '� �.�.',
'Event' => '�������',
'EventFilter' => '������ �������',
- 'EventId' => 'Event Id',
- 'EventName' => 'Event Name',
- 'EventPrefix' => 'Event Prefix',
+ 'EventId' => 'Id �������',
+ 'EventName' => '��� �������',
+ 'EventPrefix' => '������� �������',
'Events' => '�������',
'Exclude' => '���������',
- 'Execute' => 'Execute',
- 'Export' => 'Export',
- 'ExportDetails' => 'Export Event Details',
- 'ExportFailed' => 'Export Failed',
- 'ExportFormat' => 'Export File Format',
+ 'Execute' => '���������',
+ 'Export' => '�������',
+ 'ExportDetails' => '�������������� ������ �������',
+ 'ExportFailed' => '������� �� ������',
+ 'ExportFormat' => '������ ����� ��������',
'ExportFormatTar' => 'Tar',
'ExportFormatZip' => 'Zip',
- 'ExportFrames' => 'Export Frame Details',
- 'ExportImageFiles' => 'Export Image Files',
- 'ExportMiscFiles' => 'Export Other Files (if present)',
- 'ExportOptions' => 'Export Options',
- 'ExportSucceeded' => 'Export Succeeded', // Added - 2009-02-08
- 'ExportVideoFiles' => 'Export Video Files (if present)',
- 'Exporting' => 'Exporting',
+ 'ExportFrames' => '�������������� ���������� ������',
+ 'ExportImageFiles' => '�������������� ����� ��������',
+ 'ExportMiscFiles' => '�������������� ������ ����� (���� ����)',
+ 'ExportOptions' => '��������� ��������',
+ 'ExportSucceeded' => '������� ��������', // Added - 2009-02-08
+ 'ExportVideoFiles' => '�������������� ����� ����� (���� ����)',
+ 'Exporting' => '�����������',
'FPS' => '�/c',
'FPSReportInterval' => '������ ���������� ��������� ��������',
'FTP' => 'FTP',
@@ -295,23 +295,23 @@
'FastForward' => 'Fast Forward',
'Feed' => 'Feed',
'Ffmpeg' => 'Ffmpeg', // Added - 2009-02-08
- 'File' => 'File',
- 'FilterArchiveEvents' => 'Archive all matches',
- 'FilterDeleteEvents' => 'Delete all matches',
- 'FilterEmailEvents' => 'Email details of all matches',
- 'FilterExecuteEvents' => 'Execute command on all matches',
+ 'File' => '����',
+ 'FilterArchiveEvents' => '������������ �����������',
+ 'FilterDeleteEvents' => '������� �����������',
+ 'FilterEmailEvents' => 'Email ������ �� �����������',
+ 'FilterExecuteEvents' => '��������� ������� �� �����������',
'FilterMessageEvents' => 'Message details of all matches',
'FilterPx' => '��� �������',
'FilterUnset' => 'You must specify a filter width and height',
- 'FilterUploadEvents' => 'Upload all matches',
- 'FilterVideoEvents' => 'Create video for all matches',
- 'Filters' => 'Filters',
+ 'FilterUploadEvents' => '��������� �����������',
+ 'FilterVideoEvents' => '������� ����� �� �����������',
+ 'Filters' => '�������',
'First' => '������',
- 'FlippedHori' => 'Flipped Horizontally',
- 'FlippedVert' => 'Flipped Vertically',
- 'Focus' => 'Focus',
+ 'FlippedHori' => '�������� �� �����������',
+ 'FlippedVert' => '�������� �� ���������',
+ 'Focus' => '�����',
'ForceAlarm' => '�������� �������',
- 'Format' => 'Format',
+ 'Format' => '������',
'Frame' => '����',
'FrameId' => 'Id �����',
'FrameRate' => '��������',
@@ -319,14 +319,14 @@
'Frames' => '�����',
'Func' => '����.',
'Function' => '�������',
- 'Gain' => 'Gain',
- 'General' => 'General',
+ 'Gain' => '��������',
+ 'General' => '�����',
'GenerateVideo' => '������������ �����',
'GeneratingVideo' => '������������ �����',
'GoToZoneMinder' => '������� �� ZoneMinder.com',
'Grey' => '�/�',
- 'Group' => 'Group',
- 'Groups' => 'Groups',
+ 'Group' => '������',
+ 'Groups' => '������',
'HasFocusSpeed' => 'Has Focus Speed',
'HasGainSpeed' => 'Has Gain Speed',
'HasHomePreset' => 'Has Home Preset',
@@ -344,25 +344,25 @@
'Hour' => '���',
'Hue' => '�������',
'Id' => 'Id',
- 'Idle' => 'Idle',
+ 'Idle' => '��������',
'Ignore' => '������������',
'Image' => '�����������',
'ImageBufferSize' => '������ ������ �����������',
- 'Images' => 'Images',
+ 'Images' => '�����������',
'In' => 'In',
'Include' => '��������',
'Inverted' => '�������������',
'Iris' => 'Iris',
'KeyString' => 'Key String',
- 'Label' => 'Label',
+ 'Label' => '�����',
'Language' => '����',
'Last' => '���������',
'Layout' => 'Layout', // Added - 2009-02-08
- 'LimitResultsPost' => 'results only;', // This is used at the end of the phrase 'Limit to first N results only'
- 'LimitResultsPre' => 'Limit to first', // This is used at the beginning of the phrase 'Limit to first N results only'
- 'LinkedMonitors' => 'Linked Monitors',
- 'List' => 'List',
- 'Load' => 'Load',
+ 'LimitResultsPost' => '�����������', // This is used at the end of the phrase 'Limit to first N results only'
+ 'LimitResultsPre' => '������ � ������', // This is used at the beginning of the phrase 'Limit to first N results only'
+ 'LinkedMonitors' => '��������� ��������',
+ 'List' => '������',
+ 'Load' => '��������',
'Local' => '���������',
'LoggedInAs' => '������������',
'LoggingIn' => '���� � �������',
@@ -425,9 +425,9 @@
'MinPanStep' => 'Min Pan Step',
'MinPixelThresLtMax' => '������ ����� ���-�� �������� ������ ���� ���� �������� ������ ���-�� ��������',
'MinPixelThresUnset' => 'You must specify a minimum pixel threshold',
- 'MinTiltRange' => 'Min Tilt Range',
- 'MinTiltSpeed' => 'Min Tilt Speed',
- 'MinTiltStep' => 'Min Tilt Step',
+ 'MinTiltRange' => '���. �������� ���� �������',
+ 'MinTiltSpeed' => '���. �������� ���. ���� �������',
+ 'MinTiltStep' => '���. ��� ���. ���� �������',
'MinWhiteRange' => 'Min White Bal. Range',
'MinWhiteSpeed' => 'Min White Bal. Speed',
'MinWhiteStep' => 'Min White Bal. Step',
@@ -438,41 +438,41 @@
'Monitor' => '�������',
'MonitorIds' => 'Id&nbsp;���������',
'MonitorPreset' => 'Monitor Preset',
- 'MonitorPresetIntro' => 'Select an appropriate preset from the list below.<br><br>Please note that this may overwrite any values you already have configured for this monitor.<br><br>',
+ 'MonitorPresetIntro' => '�������� ������ ������� ������������� �� ������.<br><br>���������� �������� ��������, ��� ��� ����� ������������ ��� ������������� ���� ������� ��� ������� ��������.<br><br>',
'MonitorProbe' => 'Monitor Probe', // Added - 2009-03-31
- 'MonitorProbeIntro' => 'The list below shows detected analog and network cameras and whether they are already being used or available for selection.<br/><br/>Select the desired entry from the list below.<br/><br/>Please note that not all cameras may be detected and that choosing a camera here may overwrite any values you already have configured for the current monitor.<br/><br/>', // Added - 2009-03-31
+ 'MonitorProbeIntro' => '������ ���������� ������������ ���������� � ������� ������, ���������� �� ���� ������������ �� ��� ��� ��� ����� ���� �������.<br/><br/>Select the desired entry from the list below.<br/><br/>Please note that not all cameras may be detected and that choosing a camera here may overwrite any values you already have configured for the current monitor.<br/><br/>', // Added - 2009-03-31
'Monitors' => '��������',
- 'Montage' => 'Montage',
+ 'Montage' => '�����������',
'Month' => '�����',
- 'Move' => 'Move',
+ 'Move' => '�����������',
'MustBeGe' => '������ ���� ������ ��� �����',
'MustBeLe' => '������ ���� ������ ��� �����',
'MustConfirmPassword' => '�� ������ ����������� ������',
'MustSupplyPassword' => '�� ������ ������ ������',
'MustSupplyUsername' => '�� ������ ������ ��� ������������',
'Name' => '���',
- 'Near' => 'Near',
+ 'Near' => '�����',
'Network' => '����',
'New' => '���.',
- 'NewGroup' => 'New Group',
- 'NewLabel' => 'New Label',
+ 'NewGroup' => '����� ������',
+ 'NewLabel' => '����� �����',
'NewPassword' => '����� ������',
'NewState' => '����� ���������',
'NewUser' => '����� ������������',
'Next' => '����.',
'No' => '���',
- 'NoDetectedCameras' => 'No Detected Cameras', // Added - 2009-03-31
+ 'NoDetectedCameras' => '������ �� ����������', // Added - 2009-03-31
'NoFramesRecorded' => '��� ������� �� ������� ������',
- 'NoGroup' => 'No Group',
+ 'NoGroup' => '��� ������',
'NoSavedFilters' => '��� ����������� ��������',
'NoStatisticsRecorded' => '���������� �� ����� �������/����� �� ��������',
'None' => '�����������',
'NoneAvailable' => '�� ��������',
'Normal' => '����������',
- 'Notes' => 'Notes',
- 'NumPresets' => 'Num Presets',
- 'Off' => 'Off',
- 'On' => 'On',
+ 'Notes' => '�������',
+ 'NumPresets' => '���-�� ��������� ���������',
+ 'Off' => '����.',
+ 'On' => '���.',
'OpEq' => '�����',
'OpGt' => '������',
'OpGtEq' => '������ ���� �����',
@@ -483,44 +483,44 @@
'OpNe' => '�� �����',
'OpNotIn' => '�� � ������',
'OpNotMatches' => '�� ���������',
- 'Open' => 'Open',
+ 'Open' => '�������',
'OptionHelp' => 'OptionHelp',
'OptionRestartWarning' => '��� ��������� ����������� ������ ����� ����������� ���������.',
'Options' => '�����',
'OrEnterNewName' => '��� ������� ����� ���',
- 'Order' => 'Order',
+ 'Order' => '�������',
'Orientation' => '����������',
'Out' => 'Out',
'OverwriteExisting' => '������������ ������������',
'Paged' => '�� ���������',
- 'Pan' => 'Pan',
- 'PanLeft' => 'Pan Left',
- 'PanRight' => 'Pan Right',
- 'PanTilt' => 'Pan/Tilt',
+ 'Pan' => '�������',
+ 'PanLeft' => '��������� �����',
+ 'PanRight' => '��������� ������',
+ 'PanTilt' => '�������/������',
'Parameter' => '�������',
'Password' => '������',
'PasswordsDifferent' => '������ �� ���������',
'Paths' => '����',
- 'Pause' => 'Pause',
- 'Phone' => 'Phone',
+ 'Pause' => '�����',
+ 'Phone' => '�������',
'PhoneBW' => '���������� �����',
'PixelDiff' => 'Pixel Diff',
'Pixels' => '� ��������',
- 'Play' => 'Play',
- 'PlayAll' => 'Play All',
+ 'Play' => '���������',
+ 'PlayAll' => '��������� ���',
'PleaseWait' => '���������� ���������',
'Point' => 'Point',
'PostEventImageBuffer' => '����� ����� �������',
'PreEventImageBuffer' => '����� �� �������',
- 'PreserveAspect' => 'Preserve Aspect Ratio',
- 'Preset' => 'Preset',
- 'Presets' => 'Presets',
+ 'PreserveAspect' => '��������� ����������� ������',
+ 'Preset' => '�������������',
+ 'Presets' => '�������� ���������',
'Prev' => '����.',
'Probe' => 'Probe', // Added - 2009-03-31
- 'Protocol' => 'Protocol',
+ 'Protocol' => '��������',
'Rate' => '��������',
'Real' => '��������',
- 'Record' => 'Record',
+ 'Record' => '������',
'RefImageBlendPct' => '������������ �������� �����, %',
'Refresh' => '��������',
'Remote' => '���������',
@@ -529,22 +529,22 @@
'RemoteHostPort' => '��������� ����',
'RemoteHostSubPath' => 'Remote Host SubPath', // Added - 2009-02-08
'RemoteImageColours' => '��������� �� ��������� �����',
- 'RemoteMethod' => 'Remote Method', // Added - 2009-02-08
- 'RemoteProtocol' => 'Remote Protocol', // Added - 2009-02-08
+ 'RemoteMethod' => '��������� �����', // Added - 2009-02-08
+ 'RemoteProtocol' => '��������� ������', // Added - 2009-02-08
'Rename' => '�������������',
- 'Replay' => 'Replay',
- 'ReplayAll' => 'All Events',
+ 'Replay' => '���������',
+ 'ReplayAll' => '��� �������',
'ReplayGapless' => 'Gapless Events',
- 'ReplaySingle' => 'Single Event',
- 'Reset' => 'Reset',
+ 'ReplaySingle' => '���� �������',
+ 'Reset' => '��������',
'ResetEventCounts' => '�������� ������� �������',
'Restart' => '�������������',
'Restarting' => '���������������',
- 'RestrictedCameraIds' => 'Id ����������� �����',
- 'RestrictedMonitors' => 'Restricted Monitors',
+ 'RestrictedCameraIds' => 'Id ����������� �����',
+ 'RestrictedMonitors' => '����������� ��������',
'ReturnDelay' => 'Return Delay',
'ReturnLocation' => 'Return Location',
- 'Rewind' => 'Rewind',
+ 'Rewind' => '����������',
'RotateLeft' => '��������� �����',
'RotateRight' => '��������� ������',
'RunMode' => '����� ������',
@@ -557,26 +557,26 @@
'Score' => '������',
'Secs' => '���.',
'Sectionlength' => '����� ������ (� ������)',
- 'Select' => 'Select',
- 'SelectMonitors' => 'Select Monitors',
- 'SelfIntersecting' => 'Polygon edges must not intersect',
- 'Set' => 'Set',
+ 'Select' => '�������',
+ 'SelectMonitors' => '������� ��������',
+ 'SelfIntersecting' => '������� ��������� �� ������ ������������',
+ 'Set' => '����������',
'SetNewBandwidth' => '��������� ����� ������ ������',
- 'SetPreset' => 'Set Preset',
+ 'SetPreset' => '���������� �������������',
'Settings' => '���������',
'ShowFilterWindow' => '�������� ���� �������',
- 'ShowTimeline' => 'Show Timeline',
+ 'ShowTimeline' => '�������� ��������� �����',
'SignalCheckColour' => 'Signal Check Colour',
- 'Size' => 'Size',
+ 'Size' => '������',
'Sleep' => 'Sleep',
- 'SortAsc' => 'Asc',
- 'SortBy' => 'Sort by',
- 'SortDesc' => 'Desc',
+ 'SortAsc' => '�����������',
+ 'SortBy' => '����������� ��',
+ 'SortDesc' => '��������',
'Source' => '��������',
'SourceColours' => 'Source Colours', // Added - 2009-02-08
'SourcePath' => 'Source Path', // Added - 2009-02-08
'SourceType' => '��� ���������',
- 'Speed' => 'Speed',
+ 'Speed' => '��������',
'SpeedHigh' => 'High Speed',
'SpeedLow' => 'Low Speed',
'SpeedMedium' => 'Medium Speed',
@@ -585,19 +585,19 @@
'State' => '���������',
'Stats' => '����������',
'Status' => '������',
- 'Step' => 'Step',
- 'StepBack' => 'Step Back',
- 'StepForward' => 'Step Forward',
- 'StepLarge' => 'Large Step',
- 'StepMedium' => 'Medium Step',
+ 'Step' => '���',
+ 'StepBack' => '��� �����',
+ 'StepForward' => '��� ������',
+ 'StepLarge' => '������� ���',
+ 'StepMedium' => '������� ���',
'StepNone' => 'No Step',
- 'StepSmall' => 'Small Step',
+ 'StepSmall' => '����� ���',
'Stills' => '����-�����',
'Stop' => '����������',
'Stopped' => '����������',
'Stream' => '�����',
'StreamReplayBuffer' => 'Stream Replay Image Buffer',
- 'Submit' => 'Submit',
+ 'Submit' => '���������',
'System' => '�������',
'Tele' => 'Tele',
'Thumbnail' => 'Thumbnail',
@@ -610,7 +610,7 @@
'TimestampLabelFormat' => '������ �����',
'TimestampLabelX' => 'X-���������� �����',
'TimestampLabelY' => 'Y-���������� �����',
- 'Today' => 'Today',
+ 'Today' => '�������',
'Tools' => '�����������',
'TotalBrScore' => '����.<br/>������',
'TrackDelay' => 'Track Delay',
@@ -620,10 +620,10 @@
'TurboTiltSpeed' => 'Turbo Tilt Speed',
'Type' => '���',
'Unarchive' => '��.&nbsp;��&nbsp;������',
- 'Undefined' => 'Undefined', // Added - 2009-02-08
+ 'Undefined' => '������������', // Added - 2009-02-08
'Units' => '��. ���������',
- 'Unknown' => 'Unknown',
- 'Update' => 'Update',
+ 'Unknown' => '����������',
+ 'Update' => '��������',
'UpdateAvailable' => '�������� ���������� ZoneMinder',
'UpdateNotNecessary' => '���������� �� ���������',
'UseFilter' => '������������ ������',
@@ -640,16 +640,16 @@
'VersionRemindNever' => '�� �������� � ����� �������',
'VersionRemindWeek' => '��������� ����� ������',
'Video' => '�����',
- 'VideoFormat' => 'Video Format',
+ 'VideoFormat' => '������ �����',
'VideoGenFailed' => '������ ��������� �����!',
- 'VideoGenFiles' => 'Existing Video Files',
- 'VideoGenNoFiles' => 'No Video Files Found',
+ 'VideoGenFiles' => '������������ ����� �����',
+ 'VideoGenNoFiles' => '����� ����� �� �������',
'VideoGenParms' => '��������� ��������� �����',
- 'VideoGenSucceeded' => 'Video Generation Succeeded!',
+ 'VideoGenSucceeded' => '�������� ����� ���������!',
'VideoSize' => '������ �����������',
'View' => '��������',
'ViewAll' => '�����. ���',
- 'ViewEvent' => 'View Event',
+ 'ViewEvent' => '�����. �������',
'ViewPaged' => '�����. �����������',
'Wake' => 'Wake',
'WarmupFrames' => '����� ���������',
@@ -679,9 +679,9 @@
'ZoneMinMaxPixelThres' => 'Min/Max Pixel Threshold (0-255)',
'ZoneOverloadFrames' => 'Overload Frame Ignore Count',
'Zones' => '����',
- 'Zoom' => 'Zoom',
- 'ZoomIn' => 'Zoom In',
- 'ZoomOut' => 'Zoom Out',
+ 'Zoom' => '�������',
+ 'ZoomIn' => '���������',
+ 'ZoomOut' => '���������',
);
// Complex replacements with formatting and/or placements, must be passed through sprintf
diff -u -E -b -r ZoneMinder-1.24.2.orig/web/skins/classic/includes/functions.php ZoneMinder-1.24.2/web/skins/classic/includes/functions.php
--- ZoneMinder-1.24.2.orig/web/skins/classic/includes/functions.php 2009-03-27 19:01:29.000000000 +0300
+++ ZoneMinder-1.24.2/web/skins/classic/includes/functions.php 2010-07-22 18:55:47.000000000 +0400
@@ -59,9 +59,8 @@
<?php
}
?>
- <script type="text/javascript" src="tools/mootools/mootools-1.2.1-core-nc.js"></script>
- <script type="text/javascript" src="tools/mootools/mootools-1.2-more-nc.js"></script>
- <script type="text/javascript" src="js/mootools.ext.js"></script>
+ <script type="text/javascript" src="/javascript/mootools/mootools.js"></script>
+ <script type="text/javascript" src="/javascript/mootools/mootools-more.js"></script>
<?php
if ( $skinJsPhpFile )
{
diff -u -E -b -r ZoneMinder-1.24.2.orig/web/skins/classic/views/css/montage_3wide.css ZoneMinder-1.24.2/web/skins/classic/views/css/montage_3wide.css
--- ZoneMinder-1.24.2.orig/web/skins/classic/views/css/montage_3wide.css 2009-03-20 15:07:08.000000000 +0300
+++ ZoneMinder-1.24.2/web/skins/classic/views/css/montage_3wide.css 2010-07-26 14:53:23.000000000 +0400
@@ -7,7 +7,6 @@
#monitors .monitorFrame {
padding: 1px;
float: left;
- width: 33%;
}
#monitors .monitor {
@@ -15,23 +14,39 @@
}
#monitorFrame0, #monitorFrame3, #monitorFrame6, #monitorFrame9, #monitorFrame12, #monitorFrame15 {
+ text-align: center;
+ width: 32%;
clear: both;
}
#monitor0, #monitor3, #monitor6, #monitor9, #monitor12, #monitor15 {
+ margin-left: 0;
+ margin-right: auto;
float: right;
}
#monitorFrame1, #monitorFrame4, #monitorFrame7, #monitorFrame10, #monitorFrame13, #monitorFrame16 {
text-align: center;
+ width: 32%;
}
#monitor1, #monitor4, #monitor7, #monitor10, #monitor13, #monitor16 {
+ margin-left: auto;
+ margin-right: auto;
}
#monitorFrame2, #monitorFrame5, #monitorFrame8, #monitorFrame11, #monitorFrame14, #monitorFrame17 {
+ text-align: center;
+ width: 32%;
}
#monitor2, #monitor5, #monitor8, #monitor11, #monitor14, #monitor17 {
float: left;
+ margin-left: auto;
+ margin-right: 0;
+}
+
+#monitors .imageFeed img.idle, #monitors .imageFeed img.alert, #monitors .imageFeed img.alarm {
+ width: 100%;
+ height: 100%;
}
diff -u -E -b -r ZoneMinder-1.24.2.orig/web/skins/classic/views/css/montage_4wide.css ZoneMinder-1.24.2/web/skins/classic/views/css/montage_4wide.css
--- ZoneMinder-1.24.2.orig/web/skins/classic/views/css/montage_4wide.css 2009-03-20 15:07:08.000000000 +0300
+++ ZoneMinder-1.24.2/web/skins/classic/views/css/montage_4wide.css 2010-07-26 14:53:05.000000000 +0400
@@ -7,7 +7,6 @@
#monitors .monitorFrame {
padding: 1px;
float: left;
- width: 24.5%;
}
#monitors .monitor {
@@ -15,30 +14,50 @@
}
#monitorFrame0, #monitorFrame4, #monitorFrame8, #monitorFrame12, #monitorFrame16, #monitorFrame20 {
+ text-align: center;
+ width: 24%;
clear: both;
}
#monitor0, #monitor4, #monitor8, #monitor12, #monitor16, #monitor20 {
+ margin-left: 0;
+ margin-right: auto;
float: right;
}
#monitorFrame1, #monitorFrame5, #monitorFrame9, #monitorFrame13, #monitorFrame17, #monitorFrame21 {
text-align: center;
+ width: 24%;
}
#monitor1, #monitor5, #monitor9, #monitor13, #monitor17, #monitor21 {
+ margin-left: auto;
+ margin-right: auto;
}
#monitorFrame2, #monitorFrame6, #monitorFrame10, #monitorFrame14, #monitorFrame18, #monitorFrame22 {
text-align: center;
+ width: 24%;
}
#monitor2, #monitor6, #monitor10, #monitor14, #monitor18, #monitor22 {
+ margin-left: auto;
+ margin-right: auto;
}
#monitorFrame3, #monitorFrame7, #monitorFrame11, #monitorFrame15, #monitorFrame19, #monitorFrame23 {
+ text-align: center;
+ width: 24%;
}
#monitor3, #monitor7, #monitor11, #monitor15, #monitor19, #monitor23 {
float: left;
+ margin-left: auto;
+ margin-right: 0;
}
+
+#monitors .imageFeed img.idle, #monitors .imageFeed img.alert, #monitors .imageFeed img.alarm {
+ width: 100%;
+ height: 100%;
+}
+
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_config_defines.h ZoneMinder-1.24.2/src/zm_config_defines.h
--- ZoneMinder-1.24.2.orig/src/zm_config_defines.h 2009-05-25 22:04:00.000000000 +0400
+++ ZoneMinder-1.24.2/src/zm_config_defines.h 2010-09-20 15:09:20.000000000 +0400
@@ -184,9 +184,10 @@
#define ZM_DYN_NEXT_REMINDER 180
#define ZM_DYN_DONATE_REMINDER_TIME 181
#define ZM_DYN_SHOW_DONATE_REMINDER 182
+#define ZM_USE_MKV_STORAGE 183
-#define ZM_MAX_CFG_ID 182
+#define ZM_MAX_CFG_ID 183
#define ZM_CFG_DECLARE_LIST \
const char *lang_default;\
@@ -372,6 +373,7 @@
const char *dyn_next_reminder;\
int dyn_donate_reminder_time;\
bool dyn_show_donate_reminder;\
+ bool use_mkv_storage;\
#define ZM_CFG_ASSIGN_LIST \
@@ -558,5 +560,6 @@
dyn_next_reminder = (const char *)config.Item( ZM_DYN_NEXT_REMINDER );\
dyn_donate_reminder_time = (int)config.Item( ZM_DYN_DONATE_REMINDER_TIME );\
dyn_show_donate_reminder = (bool)config.Item( ZM_DYN_SHOW_DONATE_REMINDER );\
+ use_mkv_storage = (bool)config.Item( ZM_USE_MKV_STORAGE ); \
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_debug.c ZoneMinder-1.24.2/src/zm_debug.c
--- ZoneMinder-1.24.2.orig/src/zm_debug.c 2009-03-20 15:07:00.000000000 +0300
+++ ZoneMinder-1.24.2/src/zm_debug.c 2010-09-28 13:48:22.000000000 +0400
@@ -61,7 +61,7 @@
zm_dbg_level--;
}
}
- Info( "Debug Level Changed to %d", zm_dbg_level );
+ Debug(1, "Debug Level Changed to %d", zm_dbg_level );
}
int zmGetDebugEnv()
@@ -221,7 +221,7 @@
zmDebugPrepareLog();
- Info( "Debug Level = %d, Debug Log = %s", zm_dbg_level, zm_dbg_log[0]?zm_dbg_log:"<none>" );
+ Debug(1, "Debug Level = %d, Debug Log = %s", zm_dbg_level, zm_dbg_log[0]?zm_dbg_log:"<none>" );
{
struct sigaction action;
@@ -289,7 +289,7 @@
zmDebugPrepareLog();
- Info( "New Debug Level = %d, New Debug Log = %s", zm_dbg_level, zm_dbg_log[0]?zm_dbg_log:"<none>" );
+ Debug(1, "New Debug Level = %d, New Debug Log = %s", zm_dbg_level, zm_dbg_log[0]?zm_dbg_log:"<none>" );
}
return( 0 );
@@ -461,3 +461,9 @@
exit( -1 );
}
}
+
+void zm_av_log (void* ptr, int level, const char* fmt, va_list vl)
+{
+ return;
+}
+
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_debug.h ZoneMinder-1.24.2/src/zm_debug.h
--- ZoneMinder-1.24.2.orig/src/zm_debug.h 2009-03-20 15:07:00.000000000 +0300
+++ ZoneMinder-1.24.2/src/zm_debug.h 2010-09-28 13:56:39.000000000 +0400
@@ -22,6 +22,8 @@
#include <sys/types.h>
#include <limits.h>
+#include <stdarg.h>
+#include <stdlib.h>
#ifndef TRUE
#define TRUE 1
@@ -115,6 +117,8 @@
extern int zm_dbg_flush;
extern int zm_dbg_add_log_id;
+void zm_av_log (void* ptr, int level, const char* fmt, va_list vl);
+
#ifdef __cplusplus
} /* extern "C" */
#endif
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_event.cpp ZoneMinder-1.24.2/src/zm_event.cpp
--- ZoneMinder-1.24.2.orig/src/zm_event.cpp 2009-05-08 17:47:19.000000000 +0400
+++ ZoneMinder-1.24.2/src/zm_event.cpp 2010-09-29 11:05:53.000000000 +0400
@@ -17,6 +17,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
+#include "zm.h"
#include <fcntl.h>
#include <sys/socket.h>
#include <arpa/inet.h>
@@ -28,7 +29,6 @@
#include <arpa/inet.h>
#include <glob.h>
-#include "zm.h"
#include "zm_db.h"
#include "zm_time.h"
#include "zm_mpeg.h"
@@ -146,6 +146,19 @@
Fatal( "Can't fopen %s: %s", id_file, strerror(errno));
}
last_db_frame = 0;
+#if HAVE_LIBAVFORMAT
+ if ( config.use_mkv_storage )
+ {
+ char fname[PATH_MAX];
+ snprintf(fname, sizeof(fname), "file:%s/%d.mkv", path, id);
+ mVideoStream = new VideoStream(fname, "matroska", 300000, monitor->GetFPS(),
+ monitor->Colours(), monitor->Width(), monitor->Height());
+ if (mVideoStream)
+ mVideoStream->OpenStream();
+ else
+ Fatal( "Can't initialize .mkv video stream" );
+ }
+#endif
}
Event::~Event()
@@ -153,11 +166,11 @@
if ( frames > last_db_frame )
{
struct DeltaTimeval delta_time;
- DELTA_TIMEVAL( delta_time, end_time, start_time, DT_PREC_2 );
+ DELTA_TIMEVAL( delta_time, end_time, start_time, DT_PREC_3 );
Debug( 1, "Adding closing frame %d to DB", frames );
static char sql[BUFSIZ];
- snprintf( sql, sizeof(sql), "insert into Frames ( EventId, FrameId, TimeStamp, Delta ) values ( %d, %d, from_unixtime( %ld ), %s%ld.%02ld )", id, frames, end_time.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec );
+ snprintf( sql, sizeof(sql), "insert into Frames ( EventId, FrameId, TimeStamp, Delta ) values ( %d, %d, from_unixtime( %ld ), %s%ld.%03ld )", id, frames, end_time.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec );
if ( mysql_query( &dbconn, sql ) )
{
Error( "Can't insert frame: %s", mysql_error( &dbconn ) );
@@ -168,14 +181,21 @@
static char sql[BUFSIZ];
struct DeltaTimeval delta_time;
- DELTA_TIMEVAL( delta_time, end_time, start_time, DT_PREC_2 );
+ DELTA_TIMEVAL( delta_time, end_time, start_time, DT_PREC_3 );
- snprintf( sql, sizeof(sql), "update Events set Name='%s%d', EndTime = from_unixtime( %ld ), Length = %s%ld.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d where Id = %d", monitor->EventPrefix(), id, end_time.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, frames, alarm_frames, tot_score, (int)(alarm_frames?(tot_score/alarm_frames):0), max_score, id );
+ snprintf( sql, sizeof(sql), "update Events set Name='%s%d', EndTime = from_unixtime( %ld ), Length = %s%ld.%03ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d where Id = %d", monitor->EventPrefix(), id, end_time.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, frames, alarm_frames, tot_score, (int)(alarm_frames?(tot_score/alarm_frames):0), max_score, id );
if ( mysql_query( &dbconn, sql ) )
{
Error( "Can't update event: %s", mysql_error( &dbconn ) );
exit( mysql_errno( &dbconn ) );
}
+#if HAVE_LIBAVFORMAT
+ if ( config.use_mkv_storage )
+ {
+ if ( mVideoStream )
+ delete mVideoStream;
+ }
+#endif
}
void Event::createNotes( std::string &notes )
@@ -332,24 +352,70 @@
{
if ( !config.opt_frame_server || !SendFrameImage( image, alarm_frame) )
{
+#if HAVE_LIBAVFORMAT
+ if ( config.use_mkv_storage)
+ {
+ if (!mVideoStream)
+ {
+ char fname[PATH_MAX];
+ snprintf(fname, sizeof(fname), "file:%s/%d.mkv", path, id);
+ mVideoStream = new VideoStream(fname, "matroska", 300000, monitor->GetFPS(),
+ monitor->Colours(), monitor->Width(), monitor->Height());
+ if (mVideoStream)
+ mVideoStream->OpenStream();
+ else
+ Fatal( "Can't initialize .mkv video stream" );
+ }
+ int delta = (int)mVideoStream->RescaleTS(
+ (int64_t)timestamp.tv_sec * 1000000 + timestamp.tv_usec -
+ (int64_t)start_time.tv_sec * 1000000 - start_time.tv_usec);
+ mVideoStream->EncodeFrame(image->Buffer(), image->Size(), 1, delta, 1);
+ }
+ else
+#endif
+ {
if ( alarm_frame && (config.jpeg_alarm_file_quality > config.jpeg_file_quality) )
image->WriteJpeg( event_file, config.jpeg_alarm_file_quality );
else
image->WriteJpeg( event_file );
}
}
+ }
else
{
Image ts_image( *image );
monitor->TimestampImage( &ts_image, &timestamp );
if ( !config.opt_frame_server || !SendFrameImage( &ts_image, alarm_frame) )
{
+#if HAVE_LIBAVFORMAT
+ if ( config.use_mkv_storage )
+ {
+ if (!mVideoStream)
+ {
+ char fname[PATH_MAX];
+ snprintf(fname, sizeof(fname), "file:%s/%d.mkv", path, id);
+ mVideoStream = new VideoStream(fname, "matroska", 300000, monitor->GetFPS(),
+ monitor->Colours(), monitor->Width(), monitor->Height());
+ if (mVideoStream)
+ mVideoStream->OpenStream();
+ else
+ Fatal( "Can't initialize .mkv video stream" );
+ }
+ int delta = (int)mVideoStream->RescaleTS(
+ (uint64_t)timestamp.tv_sec * 1000000 + timestamp.tv_usec -
+ (uint64_t)start_time.tv_sec * 1000000 - start_time.tv_usec);
+ mVideoStream->EncodeFrame(ts_image.Buffer(), ts_image.Size(), 1, delta, 1);
+ }
+ else
+#endif
+ {
if ( alarm_frame && (config.jpeg_alarm_file_quality > config.jpeg_file_quality) )
ts_image.WriteJpeg( event_file, config.jpeg_alarm_file_quality );
else
ts_image.WriteJpeg( event_file );
}
}
+ }
return( true );
}
@@ -488,10 +554,10 @@
WriteFrameImage( images[i], *(timestamps[i]), event_file );
struct DeltaTimeval delta_time;
- DELTA_TIMEVAL( delta_time, *(timestamps[i]), start_time, DT_PREC_2 );
+ DELTA_TIMEVAL( delta_time, *(timestamps[i]), start_time, DT_PREC_3 );
int sql_len = strlen(sql);
- snprintf( sql+sql_len, sizeof(sql)-sql_len, "( %d, %d, from_unixtime(%ld), %s%ld.%02ld ), ", id, frames, timestamps[i]->tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec );
+ snprintf( sql+sql_len, sizeof(sql)-sql_len, "( %d, %d, from_unixtime(%ld), %s%ld.%03ld ), ", id, frames, timestamps[i]->tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec );
}
Debug( 1, "Adding %d frames to DB", n_frames );
@@ -516,7 +582,7 @@
WriteFrameImage( image, timestamp, event_file );
struct DeltaTimeval delta_time;
- DELTA_TIMEVAL( delta_time, timestamp, start_time, DT_PREC_2 );
+ DELTA_TIMEVAL( delta_time, timestamp, start_time, DT_PREC_3 );
bool db_frame = (score>=0) || ((frames%config.bulk_frame_interval)==0) || !frames;
@@ -526,7 +592,7 @@
Debug( 1, "Adding frame %d to DB", frames );
static char sql[BUFSIZ];
- snprintf( sql, sizeof(sql), "insert into Frames ( EventId, FrameId, Type, TimeStamp, Delta, Score ) values ( %d, %d, '%s', from_unixtime( %ld ), %s%ld.%02ld, %d )", id, frames, frame_type, timestamp.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, score );
+ snprintf( sql, sizeof(sql), "insert into Frames ( EventId, FrameId, Type, TimeStamp, Delta, Score ) values ( %d, %d, '%s', from_unixtime( %ld ), %s%ld.%03ld, %d )", id, frames, frame_type, timestamp.tv_sec, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, score );
if ( mysql_query( &dbconn, sql ) )
{
Error( "Can't insert frame: %s", mysql_error( &dbconn ) );
@@ -537,7 +603,7 @@
// We are writing a bulk frame
if ( score < 0 )
{
- snprintf( sql, sizeof(sql), "update Events set Length = %s%ld.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d where Id = %d", delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, frames, alarm_frames, tot_score, (int)(alarm_frames?(tot_score/alarm_frames):0), max_score, id );
+ snprintf( sql, sizeof(sql), "update Events set Length = %s%ld.%03ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d where Id = %d", delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, frames, alarm_frames, tot_score, (int)(alarm_frames?(tot_score/alarm_frames):0), max_score, id );
if ( mysql_query( &dbconn, sql ) )
{
Error( "Can't update event: %s", mysql_error( &dbconn ) );
@@ -683,7 +749,7 @@
{
static char sql[BUFSIZ];
- snprintf( sql, sizeof(sql), "select M.Id, M.Name, E.Frames, unix_timestamp( StartTime ) as StartTimestamp, max(F.Delta)-min(F.Delta) as Duration from Events as E inner join Monitors as M on E.MonitorId = M.Id inner join Frames as F on E.Id = F.EventId where E.Id = %d group by E.Id", event_id );
+ snprintf( sql, sizeof(sql), "select M.Id, M.Name, E.Frames, unix_timestamp( StartTime ) as StartTimestamp, max(F.Delta)-min(F.Delta) as Duration, E.Width, E.Height from Events as E inner join Monitors as M on E.MonitorId = M.Id inner join Frames as F on E.Id = F.EventId where E.Id = %d group by E.Id", event_id );
if ( mysql_query( &dbconn, sql ) )
{
@@ -727,6 +793,8 @@
}
event_data->frame_count = atoi(dbrow[2]);
event_data->duration = atof(dbrow[4]);
+ event_data->width = atoi(dbrow[5]);
+ event_data->height = atoi(dbrow[6]);
updateFrameRate( (double)event_data->frame_count/event_data->duration );
@@ -757,6 +825,7 @@
id = atoi(dbrow[0]);
timestamp = atoi(dbrow[1]);
delta = atof(dbrow[2]);
+
int id_diff = id - last_id;
double frame_delta = (delta-last_delta)/id_diff;
if ( id_diff > 1 )
@@ -770,6 +839,7 @@
}
}
event_data->frames[id-1].timestamp = timestamp;
+ event_data->frames[id-1].abs_delta = delta;
event_data->frames[id-1].offset = (time_t)(event_data->frames[id-1].timestamp-event_data->start_time);
event_data->frames[id-1].delta = id>1?frame_delta:0.0;
event_data->frames[id-1].in_db = true;
@@ -993,6 +1063,28 @@
Debug( 1, "Got SCALE command, to %d", scale );
break;
}
+ case CMD_GET_IMAGE:
+ {
+ int new_event = ((unsigned char)msg->msg_data[1]<<24)|((unsigned char)msg->msg_data[2]<<16)|((unsigned char)msg->msg_data[3]<<8)|(unsigned char)msg->msg_data[4];
+ int new_frame_id = ((unsigned char)msg->msg_data[5]<<24)|((unsigned char)msg->msg_data[6]<<16)|((unsigned char)msg->msg_data[7]<<8)|(unsigned char)msg->msg_data[8];
+ if (!config.use_mkv_storage)
+ break;
+ if ( new_event != event_data->event_id )
+ {
+ if (in_stream)
+ {
+ delete in_stream;
+ in_stream = NULL;
+ }
+ loadEventData( new_event );
+ }
+ curr_frame_id = new_frame_id;
+ paused = true;
+ replay_rate = ZM_RATE_BASE;
+ forceSend = true;
+ step = 0;
+ break;
+ }
case CMD_PREV :
{
Debug( 1, "Got PREV command" );
@@ -1089,6 +1181,13 @@
if ( forceEventChange || mode != MODE_SINGLE )
{
//Info( "SQL:%s", sql );
+#if HAVE_LIBAVCODEC
+ if (in_stream)
+ {
+ delete in_stream;
+ in_stream = NULL;
+ }
+#endif
if ( mysql_query( &dbconn, sql ) )
{
Error( "Can't run query: %s", mysql_error( &dbconn ) );
@@ -1155,7 +1254,41 @@
#if HAVE_LIBAVCODEC
if ( type == STREAM_MPEG )
{
- Image image( filepath );
+ if ( config.use_mkv_storage )
+ {
+ char fname[PATH_MAX];
+ struct stat statbuf;
+
+ snprintf(fname, sizeof(fname), "%s/%ld.mkv", event_data->path, event_data->event_id);
+ if ( stat( fname, &statbuf ) )
+ image.ReadJpeg( filepath );
+ else
+ {
+ if (in_stream && in_stream->GetEventId() != event_data->event_id)
+ {
+ delete in_stream;
+ in_stream = NULL;
+ }
+ if (!in_stream)
+ {
+ snprintf(fname, sizeof(fname), "file:%s/%ld.mkv", event_data->path, event_data->event_id);
+ in_stream = new InVideoStream(-1, (const std::string)fname,
+ event_data->width, event_data->height,
+ 3, 0, 0, 0, 0, 1);
+ in_stream->SetEventId(event_data->event_id);
+ in_stream->OpenStream();
+ }
+ int frame_id = (curr_frame_id<=0) ? 0 : curr_frame_id-1;
+ if ( in_stream->GetImage( image, frame_id,
+ event_data->frames[frame_id].abs_delta ) )
+ {
+ Error("Unable fetch %d frame from '%s'", curr_frame_id, fname);
+ return( false );
+ }
+ }
+ }
+ else
+ image.ReadJpeg( filepath );
Image *send_image = prepareImage( &image );
@@ -1184,6 +1317,43 @@
if ( send_raw )
{
+#if HAVE_LIBAVCODEC
+ if ( config.use_mkv_storage )
+ {
+ char fname[PATH_MAX];
+ struct stat statbuf;
+
+ snprintf(fname, sizeof(fname), "%s/%ld.mkv", event_data->path, event_data->event_id);
+ if ( stat( fname, &statbuf ) )
+ goto no_mkv;
+ if (in_stream && in_stream->GetEventId() != event_data->event_id)
+ {
+ delete in_stream;
+ in_stream = NULL;
+ }
+ if (!in_stream)
+ {
+ snprintf(fname, sizeof(fname), "file:%s/%ld.mkv", event_data->path, event_data->event_id);
+ in_stream = new InVideoStream(-1, (const std::string)fname,
+ event_data->width, event_data->height,
+ 3, 0, 0, 0, 0, 1);
+ in_stream->SetEventId(event_data->event_id);
+ in_stream->OpenStream();
+ }
+ int frame_id = (curr_frame_id<=0) ? 0 : curr_frame_id-1;
+ if ( in_stream->GetImage( image, frame_id,
+ event_data->frames[frame_id].abs_delta ) )
+ {
+ Error("Unable fetch %d frame from '%s'", curr_frame_id, fname);
+ return( false );
+ }
+ Image *send_image = prepareImage( &image );
+ send_image->EncodeJpeg( img_buffer, &img_buffer_size );
+ }
+ else
+#endif
+ {
+no_mkv:
FILE *fdj = fopen( filepath, "r" );
if ( !fdj )
{
@@ -1193,9 +1363,46 @@
img_buffer_size = fread( img_buffer, 1, sizeof(temp_img_buffer), fdj );
fclose( fdj );
}
+ }
+ else
+ {
+#if HAVE_LIBAVCODEC
+ if ( config.use_mkv_storage )
+ {
+ char fname[PATH_MAX];
+ struct stat statbuf;
+
+ snprintf(fname, sizeof(fname), "%s/%ld.mkv", event_data->path, event_data->event_id);
+ if ( stat( fname, &statbuf ) )
+ image.ReadJpeg( filepath );
else
{
- Image image( filepath );
+ if (in_stream && in_stream->GetEventId() != event_data->event_id)
+ {
+ delete in_stream;
+ in_stream = NULL;
+ }
+ if (!in_stream)
+ {
+ snprintf(fname, sizeof(fname), "file:%s/%ld.mkv", event_data->path, event_data->event_id);
+ in_stream = new InVideoStream(-1, (const std::string)fname,
+ event_data->width, event_data->height,
+ 3, 0, 0, 0, 0, 1);
+ in_stream->SetEventId(event_data->event_id);
+ in_stream->OpenStream();
+ }
+ int frame_id = (curr_frame_id<=0) ? 0 : curr_frame_id-1;
+ if ( in_stream->GetImage( image, frame_id,
+ event_data->frames[frame_id].abs_delta ) )
+ {
+ Error("Unable fetch %d frame from '%s'", curr_frame_id, fname);
+ return( false );
+ }
+ }
+ }
+ else
+#endif
+ image.ReadJpeg( filepath );
Image *send_image = prepareImage( &image );
@@ -1310,12 +1517,8 @@
if ( !sendTextFrame( frame_text ) )
zm_terminate = true;
}
- //else
- //{
usleep( STREAM_PAUSE_WAIT );
- //curr_stream_time += (replay_rate>0?1:-1) * ((1.0L * replay_rate * STREAM_PAUSE_WAIT)/(ZM_RATE_BASE * 1000000));
curr_stream_time += (1.0L * replay_rate * STREAM_PAUSE_WAIT)/(ZM_RATE_BASE * 1000000);
- //}
continue;
}
}
@@ -1351,7 +1554,7 @@
}
}
- if ( send_frame )
+ if ( send_frame || forceSend )
if ( !sendFrame( delta_us ) )
zm_terminate = true;
@@ -1360,20 +1563,30 @@
if ( !paused )
{
curr_frame_id += replay_rate>0?1:-1;
- if ( send_frame && type != STREAM_MPEG )
- {
- Debug( 3, "dUs: %d", delta_us );
- usleep( delta_us );
- }
+ usleep((unsigned long)((1000000 * ZM_RATE_BASE)/((base_fps?base_fps:1)*abs(replay_rate))));
}
else
{
+ if (!forceSend)
usleep( STREAM_PAUSE_WAIT );
+ else
+ forceSend = false;
}
}
#if HAVE_LIBAVCODEC
if ( type == STREAM_MPEG )
+ {
+ if (vid_stream)
+ {
delete vid_stream;
+ vid_stream = NULL;
+ }
+ if (in_stream)
+ {
+ delete in_stream;
+ in_stream = NULL;
+ }
+ }
#endif // HAVE_LIBAVCODEC
closeComms();
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_event.h ZoneMinder-1.24.2/src/zm_event.h
--- ZoneMinder-1.24.2.orig/src/zm_event.h 2009-03-20 15:07:00.000000000 +0300
+++ ZoneMinder-1.24.2/src/zm_event.h 2010-09-28 19:10:10.000000000 +0400
@@ -93,6 +93,11 @@
protected:
int last_db_frame;
+#if HAVE_LIBAVFORMAT
+protected:
+ VideoStream *mVideoStream;
+#endif // HAVE_LIBAVFORMAT
+
protected:
static void Initialise()
{
@@ -115,7 +120,6 @@
public:
Event( Monitor *p_monitor, struct timeval p_start_time, const std::string &p_cause, const StringSetMap &p_noteSetMap );
~Event();
-
int Id() const { return( id ); }
const std::string &Cause() { return( cause ); }
int Frames() const { return( frames ); }
@@ -195,6 +199,7 @@
time_t timestamp;
time_t offset;
double delta;
+ double abs_delta;
bool in_db;
};
@@ -207,6 +212,9 @@
double duration;
char path[PATH_MAX];
int n_frames;
+ int width;
+ int height;
+ int colours;
FrameData *frames;
};
@@ -218,12 +226,18 @@
protected:
StreamMode mode;
bool forceEventChange;
+ bool forceSend;
protected:
int curr_frame_id;
double curr_stream_time;
EventData *event_data;
+ Image image;
+
+#if HAVE_LIBAVCODEC
+ InVideoStream *in_stream;
+#endif
protected:
bool loadEventData( int event_id );
@@ -245,6 +259,9 @@
curr_stream_time = 0.0;
event_data = 0;
+ in_stream = NULL;
+ image.Empty();
+ forceSend = false;
}
void setStreamStart( int init_event_id, int init_frame_id=0 )
{
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_ffmpeg_camera.cpp ZoneMinder-1.24.2/src/zm_ffmpeg_camera.cpp
--- ZoneMinder-1.24.2.orig/src/zm_ffmpeg_camera.cpp 2009-05-25 22:04:00.000000000 +0400
+++ ZoneMinder-1.24.2/src/zm_ffmpeg_camera.cpp 2010-09-28 13:48:59.000000000 +0400
@@ -31,7 +31,7 @@
{
Initialise();
}
-
+ frameCount = 0;
mFormatContext = NULL;
mVideoStreamId = -1;
mCodecContext = NULL;
@@ -39,18 +39,21 @@
mConvertContext = NULL;
mRawFrame = NULL;
mFrame = NULL;
+ pts = 0;
}
FfmpegCamera::~FfmpegCamera()
{
+ if (mFrame)
av_free( mFrame );
+ if (mRawFrame)
av_free( mRawFrame );
-
+ if (mCodecContext)
avcodec_close( mCodecContext );
- av_free( mCodecContext );
av_close_input_file( mFormatContext );
- av_free( mFormatContext );
-
+ // mFormatContext needn't bee freed as this was done
+ // in av_close_input_file
+// av_free( mFormatContext );
if ( capture )
{
Terminate();
@@ -66,7 +69,10 @@
if ( zm_dbg_level > ZM_DBG_INF )
av_log_set_level( AV_LOG_DEBUG );
else
+ {
av_log_set_level( AV_LOG_QUIET );
+ av_log_set_callback(zm_av_log);
+ }
av_register_all();
}
@@ -140,15 +146,16 @@
int FfmpegCamera::Capture( Image &image )
{
- static int frameCount = 0;
AVPacket packet;
- int frameComplete = false;
+ frameComplete = false;
while ( !frameComplete && (av_read_frame( mFormatContext, &packet ) >= 0) )
{
Debug( 5, "Got packet from stream %d", packet.stream_index );
+ pts = packet.pts;
if ( packet.stream_index == mVideoStreamId )
{
- if ( avcodec_decode_video( mCodecContext, mRawFrame, &frameComplete, packet.data, packet.size) < 0 )
+ if ( avcodec_decode_video2( mCodecContext, mRawFrame, &frameComplete, &packet ) < 0 )
+// if ( avcodec_decode_video( mCodecContext, mRawFrame, &frameComplete, packet.data, packet.size) < 0 )
Fatal( "Unable to decode frame at frame %d", frameCount );
Debug( 3, "Decoded video packet at frame %d", frameCount );
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_ffmpeg_camera.h ZoneMinder-1.24.2/src/zm_ffmpeg_camera.h
--- ZoneMinder-1.24.2.orig/src/zm_ffmpeg_camera.h 2009-03-20 15:07:00.000000000 +0300
+++ ZoneMinder-1.24.2/src/zm_ffmpeg_camera.h 2010-09-27 17:07:31.000000000 +0400
@@ -46,6 +46,9 @@
#endif // HAVE_LIBAVFORMAT
Buffer mBuffer;
+ int frameCount;
+ int frameComplete;
+ uint64_t pts;
public:
FfmpegCamera( int p_id, const std::string &path, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture );
@@ -60,6 +63,7 @@
int PreCapture();
int Capture( Image &image );
int PostCapture();
+ int IsComplete() { return (frameComplete); };
};
#endif // ZM_FFMPEG_CAMERA_H
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_ffmpeg.h ZoneMinder-1.24.2/src/zm_ffmpeg.h
--- ZoneMinder-1.24.2.orig/src/zm_ffmpeg.h 2009-03-20 19:09:46.000000000 +0300
+++ ZoneMinder-1.24.2/src/zm_ffmpeg.h 2010-09-15 16:13:51.000000000 +0400
@@ -19,7 +19,7 @@
#ifndef ZM_FFMPEG_H
#define ZM_FFMPEG_H
-
+#include <stdint.h>
#if HAVE_LIBAVCODEC
#ifdef __cplusplus
@@ -27,8 +27,10 @@
#endif
#if HAVE_LIBAVUTIL_AVUTIL_H
#include <libavutil/avutil.h>
+#include <libavutil/base64.h>
#elif HAVE_FFMPEG_AVUTIL_H
#include <ffmpeg/avutil.h>
+#include <ffmpeg/base64.h>
#else
#error "No location for avutils.h found"
#endif
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm.h ZoneMinder-1.24.2/src/zm.h
--- ZoneMinder-1.24.2.orig/src/zm.h 2009-03-20 15:07:00.000000000 +0300
+++ ZoneMinder-1.24.2/src/zm.h 2010-09-16 11:22:37.000000000 +0400
@@ -20,6 +20,8 @@
#ifndef ZM_H
#define ZM_H
+#define __STDC_CONSTANT_MACROS
+#include <stdint.h>
extern "C"
{
#include "zm_debug.h"
@@ -34,14 +36,14 @@
#endif
}
-typedef unsigned char U8;
-typedef unsigned short U16;
-typedef unsigned long U32;
-typedef unsigned long long U64;
-
-typedef signed char S8;
-typedef signed short S16;
-typedef signed long S32;
-typedef signed long long S64;
+typedef uint8_t U8;
+typedef uint16_t U16;
+typedef uint32_t U32;
+typedef uint64_t U64;
+
+typedef int8_t S8;
+typedef int16_t S16;
+typedef int32_t S32;
+typedef int64_t S64;
#endif // ZM_H
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_image.cpp ZoneMinder-1.24.2/src/zm_image.cpp
--- ZoneMinder-1.24.2.orig/src/zm_image.cpp 2009-05-25 22:04:00.000000000 +0400
+++ ZoneMinder-1.24.2/src/zm_image.cpp 2010-07-14 19:17:36.000000000 +0400
@@ -461,7 +461,7 @@
return( false );
}
- jpeg_mem_src( cinfo, inbuffer, inbuffer_size );
+ zm_jpeg_mem_src( cinfo, inbuffer, inbuffer_size );
jpeg_read_header( cinfo, TRUE );
@@ -523,7 +523,7 @@
jpeg_create_compress( cinfo );
}
- jpeg_mem_dest( cinfo, outbuffer, outbuffer_size );
+ zm_jpeg_mem_dest( cinfo, outbuffer, outbuffer_size );
cinfo->image_width = width; /* image width and height, in pixels */
cinfo->image_height = height;
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_jpeg.c ZoneMinder-1.24.2/src/zm_jpeg.c
--- ZoneMinder-1.24.2.orig/src/zm_jpeg.c 2009-03-20 15:07:00.000000000 +0300
+++ ZoneMinder-1.24.2/src/zm_jpeg.c 2010-09-28 13:56:27.000000000 +0400
@@ -173,7 +173,7 @@
* for closing it after finishing compression.
*/
-void jpeg_mem_dest (j_compress_ptr cinfo, JOCTET *outbuffer, int *outbuffer_size )
+void zm_jpeg_mem_dest (j_compress_ptr cinfo, JOCTET *outbuffer, int *outbuffer_size )
{
mem_dest_ptr dest;
@@ -350,7 +350,7 @@
* for closing it after finishing decompression.
*/
-void jpeg_mem_src( j_decompress_ptr cinfo, const JOCTET *inbuffer, int inbuffer_size )
+void zm_jpeg_mem_src( j_decompress_ptr cinfo, const JOCTET *inbuffer, int inbuffer_size )
{
mem_src_ptr src;
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_jpeg.h ZoneMinder-1.24.2/src/zm_jpeg.h
--- ZoneMinder-1.24.2.orig/src/zm_jpeg.h 2009-03-20 15:07:00.000000000 +0300
+++ ZoneMinder-1.24.2/src/zm_jpeg.h 2010-07-14 19:17:36.000000000 +0400
@@ -36,5 +36,5 @@
void zm_jpeg_emit_message( j_common_ptr cinfo, int msg_level );
// Prototypes for memory compress/decompression object */
-void jpeg_mem_src(j_decompress_ptr cinfo, const JOCTET *inbuffer, int inbuffer_size );
-void jpeg_mem_dest(j_compress_ptr cinfo, JOCTET *outbuffer, int *outbuffer_size );
+void zm_jpeg_mem_src(j_decompress_ptr cinfo, const JOCTET *inbuffer, int inbuffer_size );
+void zm_jpeg_mem_dest(j_compress_ptr cinfo, JOCTET *outbuffer, int *outbuffer_size );
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_monitor.cpp ZoneMinder-1.24.2/src/zm_monitor.cpp
--- ZoneMinder-1.24.2.orig/src/zm_monitor.cpp 2009-06-24 14:22:23.000000000 +0400
+++ ZoneMinder-1.24.2/src/zm_monitor.cpp 2010-09-28 14:04:04.000000000 +0400
@@ -17,12 +17,12 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
+#include "zm.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <arpa/inet.h>
#include <glob.h>
-#include "zm.h"
#include "zm_db.h"
#include "zm_time.h"
#include "zm_mpeg.h"
@@ -351,13 +351,15 @@
struct stat map_stat;
if ( fstat( map_fd, &map_stat ) < 0 )
Fatal( "Can't stat memory map file %s: %s", mem_file, strerror(errno) );
- if ( map_stat.st_size == 0 )
+ if ( map_stat.st_size == 0 || map_stat.st_size != mem_size)
{
// Allocate the size
if ( ftruncate( map_fd, mem_size ) < 0 )
- Fatal( "Can't extend memory map file %s to %d bytes: %s", mem_file, mem_size, strerror(errno) );
+ Fatal( "Can't extend/truncate memory map file %s to %d bytes: %s", mem_file, mem_size, strerror(errno) );
+ if ( fstat( map_fd, &map_stat ) < 0 )
+ Fatal( "Can't stat memory map file %s: %s", mem_file, strerror(errno) );
}
- else if ( map_stat.st_size != mem_size )
+ if ( map_stat.st_size != mem_size )
{
Error( "Got unexpected memory map file size %ld, expected %d", map_stat.st_size, mem_size );
}
@@ -1033,7 +1035,7 @@
if ( image_count && !(image_count%fps_report_interval) )
{
fps = double(fps_report_interval)/(now.tv_sec-last_fps_time);
- Info( "%s: %d - Processing at %.2f fps", name, image_count, fps );
+ Debug(1, "%s: %d - Processing at %.2f fps", name, image_count, fps );
last_fps_time = now.tv_sec;
}
@@ -1248,10 +1250,10 @@
{
if ( state == IDLE || state == TAPE || event_close_mode == CLOSE_TIME )
{
- if ( state == IDLE || state == TAPE )
- Info( "%s: %03d - Closing event %d, section end", name, image_count, event->Id() )
- else
- Info( "%s: %03d - Closing event %d, section end forced ", name, image_count, event->Id() );
+// if ( state == IDLE || state == TAPE )
+// Info( "%s: %03d - Closing event %d, section end", name, image_count, event->Id() )
+// else
+// Info( "%s: %03d - Closing event %d, section end forced ", name, image_count, event->Id() );
closeEvent();
last_section_mod = 0;
}
@@ -1269,7 +1271,7 @@
event = new Event( this, *timestamp, "Continuous", noteSetMap );
shared_data->last_event = event->Id();
- Info( "%s: %03d - Opening new event %d, section start", name, image_count, event->Id() );
+ Debug(1, "%s: %03d - Opening new event %d, section start", name, image_count, event->Id() );
//if ( config.overlap_timed_events )
if ( false )
@@ -1292,7 +1294,7 @@
{
if ( Event::PreAlarmCount() >= (alarm_frame_count-1) )
{
- Info( "%s: %03d - Gone into alarm state", name, image_count );
+ Debug(1, "%s: %03d - Gone into alarm state", name, image_count );
shared_data->state = state = ALARM;
if ( signal_change || (function != MOCORD && state != ALERT) )
{
@@ -1305,7 +1307,7 @@
event = new Event( this, *(image_buffer[pre_index].timestamp), cause, noteSetMap );
shared_data->last_event = event->Id();
- Info( "%s: %03d - Opening new event %d, alarm start", name, image_count, event->Id() );
+ Debug(1, "%s: %03d - Opening new event %d, alarm start", name, image_count, event->Id() );
for ( int i = 0; i < pre_event_count; i++ )
{
@@ -1323,13 +1325,13 @@
}
else if ( state != PREALARM )
{
- Info( "%s: %03d - Gone into prealarm state", name, image_count );
+ Debug(1, "%s: %03d - Gone into prealarm state", name, image_count );
shared_data->state = state = PREALARM;
}
}
else if ( state == ALERT )
{
- Info( "%s: %03d - Gone back into alarm state", name, image_count );
+ Debug(1, "%s: %03d - Gone back into alarm state", name, image_count );
shared_data->state = state = ALARM;
}
last_alarm_count = image_count;
@@ -1338,18 +1340,18 @@
{
if ( state == ALARM )
{
- Info( "%s: %03d - Gone into alert state", name, image_count );
+ Debug(1, "%s: %03d - Gone into alert state", name, image_count );
shared_data->state = state = ALERT;
}
else if ( state == ALERT )
{
if ( image_count-last_alarm_count > post_event_count )
{
- Info( "%s: %03d - Left alarm state (%d) - %d(%d) images", name, image_count, event->Id(), event->Frames(), event->AlarmFrames() );
+ Debug(1, "%s: %03d - Left alarm state (%d) - %d(%d) images", name, image_count, event->Id(), event->Frames(), event->AlarmFrames() );
if ( function != MOCORD || event_close_mode == CLOSE_ALARM || event->Cause() == "Signal" )
{
shared_data->state = state = IDLE;
- Info( "%s: %03d - Closing event %d, alarm end%s", name, image_count, event->Id(), (function==MOCORD)?", section truncated":"" );
+ Debug(1, "%s: %03d - Closing event %d, alarm end%s", name, image_count, event->Id(), (function==MOCORD)?", section truncated":"" );
closeEvent();
}
else
@@ -1458,7 +1460,7 @@
int section_mod = timestamp->tv_sec%section_length;
if ( section_mod < last_section_mod )
{
- Info( "%s: %03d - Closing event %d, section end2", name, image_count, event->Id() );
+ Debug(1, "%s: %03d - Closing event %d, section end2", name, image_count, event->Id() );
closeEvent();
last_section_mod = 0;
}
@@ -1474,7 +1476,7 @@
{
if ( event )
{
- Info( "%s: %03d - Closing event %d, trigger off", name, image_count, event->Id() );
+ Debug(1, "%s: %03d - Closing event %d, trigger off", name, image_count, event->Id() );
closeEvent();
}
shared_data->state = state = IDLE;
@@ -2537,7 +2539,7 @@
fps = double(fps_report_interval)/(now-last_fps_time);
//Info( "%d -> %d -> %d", fps_report_interval, now, last_fps_time );
//Info( "%d -> %d -> %lf -> %lf", now-last_fps_time, fps_report_interval/(now-last_fps_time), double(fps_report_interval)/(now-last_fps_time), fps );
- Info( "%s: %d - Capturing at %.2lf fps", name, image_count, fps );
+ Debug(1, "%s: %d - Capturing at %.2lf fps", name, image_count, fps );
last_fps_time = now;
}
@@ -2776,7 +2778,7 @@
shared_data->alarm_x = alarm_centre.X();
shared_data->alarm_y = alarm_centre.Y();
- Info( "Got alarm centre at %d,%d, at count %d", shared_data->alarm_x, shared_data->alarm_y, image_count );
+ Debug(1, "Got alarm centre at %d,%d, at count %d", shared_data->alarm_x, shared_data->alarm_y, image_count );
}
else
{
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_mpeg.cpp ZoneMinder-1.24.2/src/zm_mpeg.cpp
--- ZoneMinder-1.24.2.orig/src/zm_mpeg.cpp 2009-05-25 22:04:00.000000000 +0400
+++ ZoneMinder-1.24.2/src/zm_mpeg.cpp 2010-09-28 13:49:38.000000000 +0400
@@ -31,12 +31,21 @@
{ "asf", "video/x-ms-asf" },
{ "swf", "application/x-shockwave-flash" },
{ "mp4", "video/mp4" },
- { "move", "video/quicktime" }
+ { "move", "video/quicktime" },
+ { "matroska", "video/x-matroska"}
};
void VideoStream::Initialise()
{
+
av_register_all();
+ if ( zm_dbg_level > ZM_DBG_INF )
+ av_log_set_level( AV_LOG_DEBUG );
+ else
+ {
+ av_log_set_level( AV_LOG_QUIET );
+ av_log_set_callback(zm_av_log);
+ }
initialised = true;
}
@@ -46,11 +55,11 @@
format = p_format;
/* auto detect the output format from the name. default is mpeg. */
- of = guess_format( format, NULL, NULL);
+ of = av_guess_format( format, NULL, NULL);
if ( !of )
{
Warning( "Could not deduce output format from file extension: using mpeg" );
- of = guess_format("mpeg", NULL, NULL);
+ of = av_guess_format("mpeg", NULL, NULL);
}
if ( !of )
{
@@ -288,7 +297,7 @@
av_free(ofc);
}
-double VideoStream::EncodeFrame( uint8_t *buffer, int buffer_size, bool add_timestamp, unsigned int timestamp )
+double VideoStream::EncodeFrame( uint8_t *buffer, int buffer_size, bool add_timestamp, unsigned int timestamp, bool force_ts )
{
#ifdef HAVE_LIBSWSCALE
static struct SwsContext *img_convert_ctx = 0;
@@ -361,11 +370,14 @@
AVPacket pkt;
av_init_packet(&pkt);
+ if (!force_ts)
#if ZM_FFMPEG_049
pkt.pts = c->coded_frame->pts;
#else
pkt.pts= av_rescale_q( c->coded_frame->pts, c->time_base, ost->time_base );
#endif
+ else
+ pkt.pts = timestamp;
if(c->coded_frame->key_frame)
pkt.flags |= PKT_FLAG_KEY;
pkt.stream_index = ost->index;
@@ -383,4 +395,34 @@
return( pts );
}
+
+InVideoStream::InVideoStream( int p_id, const std::string &p_path, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture ) :
+ FfmpegCamera( p_id, p_path, p_width, p_height, p_colours, p_brightness, p_contrast, p_hue, p_colour, p_capture )
+{
+ prev_frame = 0;
+}
+
+int InVideoStream::GetImage ( Image &image, int frame_id, double abs_delta)
+{
+ if (mVideoStreamId == -1)
+ return -1;
+ if ( frame_id - prev_frame != 1 && !(prev_frame == 0 && frame_id == 0) )
+ {
+ uint64_t ts = (uint64_t)(abs_delta /
+ av_q2d(mFormatContext->streams[mVideoStreamId]->time_base));
+ // Seek for last KEY frame with TS <= our timestamp
+ if ( av_seek_frame(mFormatContext, mVideoStreamId, ts, AVSEEK_FLAG_BACKWARD) < 0)
+ {
+ // Do nothing - last captured frame will be presented
+ prev_frame = frame_id;
+ return (0);
+ }
+ Capture ( image );
+ while ( IsComplete() && pts < ts )
+ Capture ( image );
+ }
+ prev_frame = frame_id;
+ return Capture( image );
+}
+
#endif // HAVE_LIBAVCODEC
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_mpeg.h ZoneMinder-1.24.2/src/zm_mpeg.h
--- ZoneMinder-1.24.2.orig/src/zm_mpeg.h 2009-05-08 17:47:19.000000000 +0400
+++ ZoneMinder-1.24.2/src/zm_mpeg.h 2010-09-28 17:19:29.000000000 +0400
@@ -62,9 +62,32 @@
~VideoStream();
const char *MimeType() const;
void OpenStream();
- double EncodeFrame( uint8_t *buffer, int buffer_size, bool add_timestamp=false, unsigned int timestamp=0 );
+ int64_t RescaleTS(int64_t usec_ts) {
+ if (!ost)
+ return usec_ts / 1000;
+ return (int64_t)(((double)usec_ts/1000000) / av_q2d(ost->time_base));
+ };
+ double EncodeFrame( uint8_t *buffer, int buffer_size, bool add_timestamp=false, unsigned int timestamp=0, bool force_ts = 0 );
};
+#include "zm_ffmpeg_camera.h"
+
+class InVideoStream : FfmpegCamera
+{
+protected:
+ int prev_frame;
+ int event_id;
+
+public:
+ InVideoStream( int p_id, const std::string &path, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture );
+ int GetEventId() { return event_id; };
+ void SetEventId( int event ) { event_id = event; };
+
+ int OpenStream() { return PrimeCapture(); };
+ int GetImage ( Image &image, int frame_id, double abs_delta);
+};
+
+
#endif // HAVE_LIBAVCODEC
#endif // ZM_MPEG_H
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_remote_camera_rtsp.cpp ZoneMinder-1.24.2/src/zm_remote_camera_rtsp.cpp
--- ZoneMinder-1.24.2.orig/src/zm_remote_camera_rtsp.cpp 2009-06-07 15:55:44.000000000 +0400
+++ ZoneMinder-1.24.2/src/zm_remote_camera_rtsp.cpp 2010-09-28 14:05:58.000000000 +0400
@@ -68,7 +68,10 @@
if ( zm_dbg_level > ZM_DBG_INF )
av_log_set_level( AV_LOG_DEBUG );
else
+ {
av_log_set_level( AV_LOG_QUIET );
+ av_log_set_callback(zm_av_log);
+ }
av_register_all();
@@ -133,6 +136,7 @@
Fatal( "Unable to locate video stream" );
// Get a pointer to the codec context for the video stream
+ stream = formatContext->streams[videoStream];
codecContext = formatContext->streams[videoStream]->codec;
// Find the decoder for the video stream
@@ -172,9 +176,9 @@
//break;
if ( rtspThread->getFrame( buffer ) )
{
- Debug( 3, "Read frame %d bytes", buffer.size() );
- Debug( 4, "Address %p", buffer.head() );
- Hexdump( 4, buffer.head(), 16 );
+// Debug( 3, "Read frame %d bytes", buffer.size() );
+// Debug( 4, "Address %p", buffer.head() );
+// Hexdump( 4, buffer.head(), 16 );
static AVFrame *tmp_picture = NULL;
@@ -201,11 +205,16 @@
if ( !buffer.size() )
return( -1 );
+ AVPacket packet;
+ av_init_packet( &packet );
int initialFrameCount = frameCount;
while ( buffer.size() > 0 )
{
int got_picture = false;
- int len = avcodec_decode_video( codecContext, picture, &got_picture, buffer.head(), buffer.size() );
+ packet.data = buffer.head();
+ packet.size = buffer.size();
+
+ int len = avcodec_decode_video2( codecContext, picture, &got_picture, &packet );
if ( len < 0 )
{
if ( frameCount > initialFrameCount )
@@ -214,12 +223,12 @@
return( 0 );
}
Error( "Error while decoding frame %d", frameCount );
- Hexdump( ZM_DBG_ERR, buffer.head(), buffer.size()>256?256:buffer.size() );
+ Hexdump( ZM_DBG_ERR, packet.data, packet.size>256?256:packet.size );
buffer.clear();
continue;
//return( -1 );
}
- Debug( 2, "Frame: %d - %d/%d", frameCount, len, buffer.size() );
+ Debug( 2, "Frame: %d - %d/%d", frameCount, len, packet.size );
//if ( buffer.size() < 400 )
//Hexdump( 0, buffer.head(), buffer.size() );
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_remote_camera_rtsp.h ZoneMinder-1.24.2/src/zm_remote_camera_rtsp.h
--- ZoneMinder-1.24.2.orig/src/zm_remote_camera_rtsp.h 2009-05-28 12:47:59.000000000 +0400
+++ ZoneMinder-1.24.2/src/zm_remote_camera_rtsp.h 2010-07-12 17:06:36.000000000 +0400
@@ -47,6 +47,7 @@
RtspThread *rtspThread;
AVFormatContext *formatContext;
+ AVStream *stream;
AVCodec *codec;
AVCodecContext *codecContext;
AVFrame *picture;
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_rtp_ctrl.cpp ZoneMinder-1.24.2/src/zm_rtp_ctrl.cpp
--- ZoneMinder-1.24.2.orig/src/zm_rtp_ctrl.cpp 2009-05-28 12:47:59.000000000 +0400
+++ ZoneMinder-1.24.2/src/zm_rtp_ctrl.cpp 2010-09-29 11:34:34.000000000 +0400
@@ -1,5 +1,5 @@
//
-// ZoneMinder RTCP Class Implementation, $Date: 2009-05-28 09:47:59 +0100 (Thu, 28 May 2009) $, $Revision: 2905 $
+// ZoneMinder RTCP Class Implementation, $Date$, $Revision$
// Copyright (C) 2001-2008 Philip Coombes
//
// This program is free software; you can redistribute it and/or
@@ -59,12 +59,12 @@
{
U32 ssrc = ntohl(rtcpPacket->body.sr.ssrcN);
- Debug( 5, "RTCP Got SR (%lx)", ssrc );
+ Debug( 5, "RTCP Got SR (%x)", ssrc );
if ( mRtpSource.getSsrc() )
{
if ( ssrc != mRtpSource.getSsrc() )
{
- Warning( "Discarding packet for unrecognised ssrc %lx", ssrc );
+ Warning( "Discarding packet for unrecognised ssrc %x", ssrc );
return( -1 );
}
}
@@ -91,13 +91,13 @@
ssize_t contentLen = packetLen - sizeof(rtcpPacket->header);
while ( contentLen )
{
- Debug( 5, "RTCP CL: %d", contentLen );
+ Debug( 5, "RTCP CL: %zd", contentLen );
U32 ssrc = ntohl(rtcpPacket->body.sdes.srcN);
- Debug( 5, "RTCP Got SDES (%lx), %d items", ssrc, count );
+ Debug( 5, "RTCP Got SDES (%x), %d items", ssrc, count );
if ( mRtpSource.getSsrc() && (ssrc != mRtpSource.getSsrc()) )
{
- Warning( "Discarding packet for unrecognised ssrc %lx", ssrc );
+ Warning( "Discarding packet for unrecognised ssrc %x", ssrc );
return( -1 );
}
@@ -170,11 +170,11 @@
mRtpSource.updateRtcpStats();
- Debug( 5, "Ssrc = %ld", mRtspThread.getSsrc() );
- Debug( 5, "Ssrc_1 = %ld", mRtpSource.getSsrc() );
- Debug( 5, "Last Seq = %ld", mRtpSource.getMaxSeq() );
- Debug( 5, "Jitter = %ld", mRtpSource.getJitter() );
- Debug( 5, "Last SR = %ld", mRtpSource.getLastSrTimestamp() );
+ Debug( 5, "Ssrc = %d", mRtspThread.getSsrc() );
+ Debug( 5, "Ssrc_1 = %d", mRtpSource.getSsrc() );
+ Debug( 5, "Last Seq = %d", mRtpSource.getMaxSeq() );
+ Debug( 5, "Jitter = %d", mRtpSource.getJitter() );
+ Debug( 5, "Last SR = %d", mRtpSource.getLastSrTimestamp() );
rtcpPacket->body.rr.ssrcN = htonl(mRtspThread.getSsrc());
rtcpPacket->body.rr.rr[0].ssrcN = htonl(mRtpSource.getSsrc());
@@ -262,7 +262,7 @@
int RtpCtrlThread::run()
{
- Debug( 2, "Starting control thread %lx on port %d", mRtpSource.getSsrc(), mRtpSource.getLocalCtrlPort() );
+ Debug( 2, "Starting control thread %x on port %d", mRtpSource.getSsrc(), mRtpSource.getLocalCtrlPort() );
SockAddrInet localAddr, remoteAddr;
bool sendReports;
@@ -307,7 +307,7 @@
if ( UdpInetSocket *socket = dynamic_cast<UdpInetSocket *>(*iter) )
{
ssize_t nBytes = socket->recv( buffer, sizeof(buffer) );
- Debug( 4, "Read %d bytes on sd %d", nBytes, socket->getReadDesc() );
+ Debug( 4, "Read %zd bytes on sd %d", nBytes, socket->getReadDesc() );
if ( nBytes )
{
@@ -318,7 +318,7 @@
unsigned char *bufferPtr = buffer;
bufferPtr += generateRr( bufferPtr, sizeof(buffer)-(bufferPtr-buffer) );
bufferPtr += generateSdes( bufferPtr, sizeof(buffer)-(bufferPtr-buffer) );
- Debug( 4, "Sending %d bytes on sd %d", bufferPtr-buffer, rtpCtrlServer.getWriteDesc() );
+ Debug( 4, "Sending %zd bytes on sd %d", bufferPtr-buffer, rtpCtrlServer.getWriteDesc() );
if ( (nBytes = rtpCtrlServer.send( buffer, bufferPtr-buffer )) < 0 )
Error( "Unable to send: %s", strerror( errno ) );
//Debug( 4, "Sent %d bytes on sd %d", nBytes, rtpCtrlServer.getWriteDesc() );
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_rtp_data.cpp ZoneMinder-1.24.2/src/zm_rtp_data.cpp
--- ZoneMinder-1.24.2.orig/src/zm_rtp_data.cpp 2009-03-20 15:07:00.000000000 +0300
+++ ZoneMinder-1.24.2/src/zm_rtp_data.cpp 2010-09-28 14:06:58.000000000 +0400
@@ -63,7 +63,7 @@
int RtpDataThread::run()
{
- Debug( 2, "Starting data thread %ld on port %d", mRtpSource.getSsrc(), mRtpSource.getLocalDataPort() );
+ Debug( 2, "Starting data thread %d on port %d", mRtpSource.getSsrc(), mRtpSource.getLocalDataPort() );
SockAddrInet localAddr;
UdpInetServer rtpDataSocket;
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_rtp_data.h ZoneMinder-1.24.2/src/zm_rtp_data.h
--- ZoneMinder-1.24.2.orig/src/zm_rtp_data.h 2009-03-20 15:07:00.000000000 +0300
+++ ZoneMinder-1.24.2/src/zm_rtp_data.h 2010-07-04 22:09:44.000000000 +0400
@@ -23,21 +23,23 @@
#include "zm_thread.h"
#include "zm_buffer.h"
+#include <stdint.h>
+
class RtspThread;
class RtpSource;
struct RtpDataHeader
{
- U8 cc:4; // CSRC count
- U8 x:1; // header extension flag
- U8 p:1; // padding flag
- U8 version:2; // protocol version
- U8 pt:7; // payload type
- U8 m:1; // marker bit
- U16 seqN; // sequence number, network order
- U32 timestampN; // timestamp, network order
- U32 ssrcN; // synchronization source, network order
- U32 csrc[]; // optional CSRC list
+ uint8_t cc:4; // CSRC count
+ uint8_t x:1; // header extension flag
+ uint8_t p:1; // padding flag
+ uint8_t version:2; // protocol version
+ uint8_t pt:7; // payload type
+ uint8_t m:1; // marker bit
+ uint16_t seqN; // sequence number, network order
+ uint32_t timestampN; // timestamp, network order
+ uint32_t ssrcN; // synchronization source, network order
+ uint32_t csrc[]; // optional CSRC list
};
class RtpDataThread : public Thread
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_rtp_source.cpp ZoneMinder-1.24.2/src/zm_rtp_source.cpp
--- ZoneMinder-1.24.2.orig/src/zm_rtp_source.cpp 2009-03-20 15:07:00.000000000 +0300
+++ ZoneMinder-1.24.2/src/zm_rtp_source.cpp 2010-09-29 11:28:43.000000000 +0400
@@ -76,6 +76,7 @@
// other initialization
mJitter = 0;
mTransit = 0;
+ prevM = false;
}
bool RtpSource::updateSeq( U16 seq )
@@ -91,7 +92,7 @@
// packet is in sequence
if ( seq == mMaxSeq + 1)
{
- Debug( 3, "Sequence in probation %ld, in sequence", mProbation );
+ Debug( 3, "Sequence in probation %d, in sequence", mProbation );
mProbation--;
mMaxSeq = seq;
if ( mProbation == 0 )
@@ -103,7 +104,7 @@
}
else
{
- Warning( "Sequence in probation %ld, out of sequence", mProbation );
+ Warning( "Sequence in probation %d, out of sequence", mProbation );
mProbation = MIN_SEQUENTIAL - 1;
mMaxSeq = seq;
return( false );
@@ -154,6 +155,7 @@
return( false );
}
mReceivedPackets++;
+ return (true);
return( uDelta==1?true:false );
}
@@ -163,10 +165,10 @@
{
Debug( 5, "Delta rtp = %.6f", tvDiffSec( mBaseTimeReal ) );
U32 localTimeRtp = mBaseTimeRtp + U32( tvDiffSec( mBaseTimeReal ) * mRtpFactor );
- Debug( 5, "Local RTP time = %lx", localTimeRtp );
+ Debug( 5, "Local RTP time = %x", localTimeRtp );
Debug( 5, "Packet RTP time = %x", ntohl(header->timestampN) );
U32 packetTransit = localTimeRtp - ntohl(header->timestampN);
- Debug( 5, "Packet transit RTP time = %lx", packetTransit );
+ Debug( 5, "Packet transit RTP time = %x", packetTransit );
if ( mTransit > 0 )
{
@@ -184,14 +186,14 @@
{
mJitter = 0;
}
- Debug( 5, "RTP Jitter: %ld", mJitter );
+ Debug( 5, "RTP Jitter: %d", mJitter );
}
void RtpSource::updateRtcpData( U32 ntpTimeSecs, U32 ntpTimeFrac, U32 rtpTime )
{
struct timeval ntpTime = tvMake( ntpTimeSecs, suseconds_t((USEC_PER_SEC*(ntpTimeFrac>>16))/(1<<16)) );
- Debug( 5, "ntpTime: %ld.%06ld, rtpTime: %lx", ntpTime.tv_sec, ntpTime.tv_usec, rtpTime );
+ Debug( 5, "ntpTime: %ld.%06ld, rtpTime: %x", ntpTime.tv_sec, ntpTime.tv_usec, rtpTime );
if ( mBaseTimeNtp.tv_sec == 0 )
{
@@ -201,19 +203,19 @@
}
else if ( !mRtpClock )
{
- Debug( 5, "lastSrNtpTime: %ld.%06ld, rtpTime: %lx", mLastSrTimeNtp.tv_sec, mLastSrTimeNtp.tv_usec, rtpTime );
- Debug( 5, "ntpTime: %ld.%06ld, rtpTime: %lx", ntpTime.tv_sec, ntpTime.tv_usec, rtpTime );
+ Debug( 5, "lastSrNtpTime: %ld.%06ld, rtpTime: %x", mLastSrTimeNtp.tv_sec, mLastSrTimeNtp.tv_usec, rtpTime );
+ Debug( 5, "ntpTime: %ld.%06ld, rtpTime: %x", ntpTime.tv_sec, ntpTime.tv_usec, rtpTime );
double diffNtpTime = tvDiffSec( mBaseTimeNtp, ntpTime );
U32 diffRtpTime = rtpTime - mBaseTimeRtp;
//Debug( 5, "Real-diff: %.6f", diffRealTime );
Debug( 5, "NTP-diff: %.6f", diffNtpTime );
- Debug( 5, "RTP-diff: %ld", diffRtpTime );
+ Debug( 5, "RTP-diff: %d", diffRtpTime );
mRtpFactor = (U32)(diffRtpTime / diffNtpTime);
- Debug( 5, "RTPfactor: %ld", mRtpFactor );
+ Debug( 5, "RTPfactor: %d", mRtpFactor );
}
mLastSrTimeNtpSecs = ntpTimeSecs;
mLastSrTimeNtpFrac = ntpTimeFrac;
@@ -226,21 +228,21 @@
U32 extendedMax = mCycles + mMaxSeq;
mExpectedPackets = extendedMax - mBaseSeq + 1;
- Debug( 5, "Expected packets = %ld", mExpectedPackets );
+ Debug( 5, "Expected packets = %d", mExpectedPackets );
// The number of packets lost is defined to be the number of packets
// expected less the number of packets actually received:
mLostPackets = mExpectedPackets - mReceivedPackets;
- Debug( 5, "Lost packets = %ld", mLostPackets );
+ Debug( 5, "Lost packets = %d", mLostPackets );
U32 expectedInterval = mExpectedPackets - mExpectedPrior;
- Debug( 5, "Expected interval = %ld", expectedInterval );
+ Debug( 5, "Expected interval = %d", expectedInterval );
mExpectedPrior = mExpectedPackets;
U32 receivedInterval = mReceivedPackets - mReceivedPrior;
- Debug( 5, "Received interval = %ld", receivedInterval );
+ Debug( 5, "Received interval = %d", receivedInterval );
mReceivedPrior = mReceivedPackets;
U32 lostInterval = expectedInterval - receivedInterval;
- Debug( 5, "Lost interval = %ld", lostInterval );
+ Debug( 5, "Lost interval = %d", lostInterval );
if ( expectedInterval == 0 || lostInterval <= 0 )
mLostFraction = 0;
@@ -253,15 +255,57 @@
{
const RtpDataHeader *rtpHeader;
rtpHeader = (RtpDataHeader *)packet;
+ bool fragmentEnd = false;
+
+ // Each RTP packet delivers only one NAL. It can be either the Single NAL
+ // ( in that case it must be in one packet ) or the Fragmentation NALs
+ // that delivers large single NAL...
if ( updateSeq( ntohs(rtpHeader->seqN) ) )
{
Hexdump( 4, packet+sizeof(RtpDataHeader), 16 );
+ if ( ((packet[sizeof(RtpDataHeader)] & 0x1f) == 28 &&
+ (packet[sizeof(RtpDataHeader)+1] & 0x80)) ||
+ ((packet[sizeof(RtpDataHeader)] & 0x1f) != 28 &&
+ prevM && rtpHeader->m) )
+ mFrameGood = true; // This means that if packet is in sequence
+ // and is single NAL with mark set (and prev packet
+ // was NAL with mark set or it is Fragmentation NAL with
+ // Start bit set then we assume that sequence
+ // was restored and we can handle packet
if ( mFrameGood )
+ {
+ // check if there fragmentation NAL
+ if ( (packet[sizeof(RtpDataHeader)] & 0x1f) == 28 )
+ {
+ // is this NAL the first NAL in fragmentation sequence
+ if ( packet[sizeof(RtpDataHeader)+1] & 0x80 )
+ {
+ // if there is any data in frame then we must
+ // discard it because that frame was incomplete
+ if ( mFrame.size() )
+ mFrame.clear();
+ // Now we will form new header of frame
+ mFrame.append("\x0\x0\x1\x0",4);
+ *(mFrame+3) = (packet[sizeof(RtpDataHeader)+1] & 0x1f) |
+ (packet[sizeof(RtpDataHeader)] & 0x60);
+ }
+ else
+ if ( packet[sizeof(RtpDataHeader)+1] & 0x40 )
+ fragmentEnd = true;
+ mFrame.append(packet+sizeof(RtpDataHeader)+2, packetLen-sizeof(RtpDataHeader)-2);
+ }
+ else
+ {
+// mframe.clear();
+ if ( !mFrame.size() )
+ mFrame.append("\x0\x0\x1",3);
mFrame.append( packet+sizeof(RtpDataHeader), packetLen-sizeof(RtpDataHeader) );
+ }
+ }
Hexdump( 4, mFrame.head(), 16 );
- if ( rtpHeader->m )
+ if ( rtpHeader->m || fragmentEnd )
{
if ( mFrameGood )
{
@@ -297,10 +341,13 @@
mFrameGood = false;
mFrame.clear();
}
- if ( rtpHeader->m )
+ if ( rtpHeader->m || fragmentEnd )
{
mFrameGood = true;
+ prevM = true;
}
+ else
+ prevM = false;
updateJitter( rtpHeader );
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_rtp_source.h ZoneMinder-1.24.2/src/zm_rtp_source.h
--- ZoneMinder-1.24.2.orig/src/zm_rtp_source.h 2009-05-28 12:47:59.000000000 +0400
+++ ZoneMinder-1.24.2/src/zm_rtp_source.h 2010-09-29 11:26:34.000000000 +0400
@@ -24,6 +24,7 @@
#include "zm_thread.h"
#include <sys/time.h>
+#include <stdint.h>
#include <string>
struct RtpDataHeader;
@@ -83,14 +84,15 @@
Buffer mFrame;
int mFrameCount;
bool mFrameGood;
+ bool prevM;
ThreadData<bool> mFrameReady;
ThreadData<bool> mFrameProcessed;
private:
- void init( U16 seq );
+ void init( uint16_t seq );
public:
- RtpSource( int id, const std::string &localHost, int localPortBase, const std::string &remoteHost, int remotePortBase, U32 ssrc, U16 seq, U32 rtpClock, U32 rtpTime );
+ RtpSource( int id, const std::string &localHost, int localPortBase, const std::string &remoteHost, int remotePortBase, uint32_t ssrc, uint16_t seq, uint32_t rtpClock, uint32_t rtpTime );
bool updateSeq( U16 seq );
void updateJitter( const RtpDataHeader *header );
void updateRtcpData( U32 ntpTimeSecs, U32 ntpTimeFrac, U32 rtpTime );
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_rtsp.cpp ZoneMinder-1.24.2/src/zm_rtsp.cpp
--- ZoneMinder-1.24.2.orig/src/zm_rtsp.cpp 2009-05-28 12:47:59.000000000 +0400
+++ ZoneMinder-1.24.2/src/zm_rtsp.cpp 2010-09-29 11:07:23.000000000 +0400
@@ -69,7 +69,7 @@
{
if ( mRtspSocket.recv( response ) < 0 )
Error( "Recv failed; %s", strerror(errno) );
- Debug( 2, "Received RTSP response: %s (%d bytes)", response.c_str(), response.size() );
+ Debug( 2, "Received RTSP response: %s (%zd bytes)", response.c_str(), response.size() );
float respVer = 0;
int respCode = -1;
char respText[BUFSIZ];
@@ -184,7 +184,7 @@
mSsrc = rand();
- Debug( 2, "RTSP Local SSRC is %lx", mSsrc );
+ Debug( 2, "RTSP Local SSRC is %x", mSsrc );
if ( mMethod == RTP_RTSP_HTTP )
mHttpSession = stringtf( "%d", rand() );
@@ -572,13 +572,15 @@
{
if ( buffer[0] == '$' )
{
+ if ( buffer.size() < 4 )
+ break;
unsigned char channel = buffer[1];
unsigned short len = ntohs( *((unsigned short *)(buffer+2)) );
Debug( 4, "Got %d bytes left, expecting %d byte packet on channel %d", buffer.size(), len, channel );
if ( buffer.size() < (len+4) )
{
- Debug( 4, "Missing %d bytes, rereading", (len+4)-nBytes );
+ Debug( 4, "Missing %d bytes, rereading", (len+4)-buffer.size() );
break;
}
if ( channel == remoteChannels[0] )
@@ -590,8 +592,10 @@
}
else if ( channel == remoteChannels[1] )
{
- len = ntohs( *((unsigned short *)(buffer+2)) );
- Debug( 4, "Got %d bytes on control channel %d", nBytes, channel );
+// len = ntohs( *((unsigned short *)(buffer+2)) );
+// Debug( 4, "Got %d bytes on control channel %d", nBytes, channel );
+ Debug( 4, "Got %d bytes on control channel %d, packet length is %d", buffer.size(), channel, len );
+ Hexdump( 4, (char *)buffer, 16 );
rtpCtrlThread.recvPackets( buffer+4, len );
}
else
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_rtsp.h ZoneMinder-1.24.2/src/zm_rtsp.h
--- ZoneMinder-1.24.2.orig/src/zm_rtsp.h 2009-05-28 12:47:59.000000000 +0400
+++ ZoneMinder-1.24.2/src/zm_rtsp.h 2010-09-29 11:07:03.000000000 +0400
@@ -66,9 +66,9 @@
AVFormatContext *mFormatContext;
- U16 mSeq;
- U32 mSession;
- U32 mSsrc;
+ uint16_t mSeq;
+ uint32_t mSession;
+ uint32_t mSsrc;
int mRemotePorts[2];
int mRemoteChannels[2];
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_sdp.cpp ZoneMinder-1.24.2/src/zm_sdp.cpp
--- ZoneMinder-1.24.2.orig/src/zm_sdp.cpp 2009-05-28 12:45:49.000000000 +0400
+++ ZoneMinder-1.24.2/src/zm_sdp.cpp 2010-07-16 15:44:30.000000000 +0400
@@ -105,6 +105,7 @@
mClock( 0 ),
mWidth( 0 ),
mHeight( 0 ),
+ mSprops( "" ),
mConnInfo( 0 )
{
}
@@ -234,6 +235,13 @@
else if ( attr3Tokens[0] == "config" )
{
}
+ else if ( attr3Tokens[0] == "sprop-parameter-sets" )
+ {
+ size_t t = attr2Tokens[i].find("=");
+ char *c = (char *)attr2Tokens[i].c_str() + t + 1;
+ Debug(4, "sprop-parameter-sets value %s", c);
+ currMedia->setSprops(std::string(c));
+ }
else
{
Debug( 3, "Ignoring SDP fmtp attribute '%s' for media '%s'", attr3Tokens[0].c_str(), currMedia->getType().c_str() )
@@ -349,6 +357,58 @@
stream->codec->width = mediaDesc->getWidth();
if ( mediaDesc->getHeight() )
stream->codec->height = mediaDesc->getHeight();
+ if ( stream->codec->codec_id == CODEC_ID_H264 && mediaDesc->getSprops().size())
+ {
+ uint8_t start_sequence[]= { 0, 0, 1 };
+ stream->codec->extradata_size= 0;
+ stream->codec->extradata= NULL;
+ char pvalue[1024], *value = pvalue;
+
+ strcpy(pvalue, mediaDesc->getSprops().c_str());
+
+ while (*value) {
+ char base64packet[1024];
+ uint8_t decoded_packet[1024];
+ uint32_t packet_size;
+ char *dst = base64packet;
+
+ while (*value && *value != ','
+ && (dst - base64packet) < sizeof(base64packet) - 1) {
+ *dst++ = *value++;
+ }
+ *dst++ = '\0';
+
+ if (*value == ',')
+ value++;
+
+ packet_size= av_base64_decode(decoded_packet, (const char *)base64packet, (int)sizeof(decoded_packet));
+ Hexdump(4, (char *)decoded_packet, packet_size);
+ if (packet_size) {
+ uint8_t *dest =
+ (uint8_t *)av_malloc(packet_size + sizeof(start_sequence) +
+ stream->codec->extradata_size +
+ FF_INPUT_BUFFER_PADDING_SIZE);
+ if(dest) {
+ if(stream->codec->extradata_size) {
+ // av_realloc?
+ memcpy(dest, stream->codec->extradata, stream->codec->extradata_size);
+ av_free(stream->codec->extradata);
+ }
+
+ memcpy(dest+stream->codec->extradata_size, start_sequence, sizeof(start_sequence));
+ memcpy(dest+stream->codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size);
+ memset(dest+stream->codec->extradata_size+sizeof(start_sequence)+
+ packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+
+ stream->codec->extradata= dest;
+ stream->codec->extradata_size+= sizeof(start_sequence)+packet_size;
+// } else {
+// av_log(codec, AV_LOG_ERROR, "Unable to allocate memory for extradata!");
+// return AVERROR(ENOMEM);
+ }
+ }
+ }
+ }
}
return( formatContext );
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_sdp.h ZoneMinder-1.24.2/src/zm_sdp.h
--- ZoneMinder-1.24.2.orig/src/zm_sdp.h 2009-05-28 12:45:49.000000000 +0400
+++ ZoneMinder-1.24.2/src/zm_sdp.h 2010-07-12 12:46:29.000000000 +0400
@@ -94,6 +94,7 @@
int mClock;
int mWidth;
int mHeight;
+ std::string mSprops;
ConnInfo *mConnInfo;
@@ -162,6 +163,14 @@
return( mHeight );
}
+ void setSprops(const std::string props)
+ {
+ mSprops = props;
+ }
+ const std::string getSprops() const
+ {
+ return ( mSprops );
+ }
const double getFrameRate() const
{
return( mFrameRate );
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_stream.cpp ZoneMinder-1.24.2/src/zm_stream.cpp
--- ZoneMinder-1.24.2.orig/src/zm_stream.cpp 2009-05-08 17:47:19.000000000 +0400
+++ ZoneMinder-1.24.2/src/zm_stream.cpp 2010-09-23 15:51:43.000000000 +0400
@@ -27,6 +27,13 @@
StreamBase::~StreamBase()
{
+#if HAVE_LIBAVCODEC
+ if ( vid_stream )
+ {
+ delete vid_stream;
+ vid_stream = NULL;
+ }
+#endif
closeComms();
}
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_stream.h ZoneMinder-1.24.2/src/zm_stream.h
--- ZoneMinder-1.24.2.orig/src/zm_stream.h 2009-05-08 13:17:10.000000000 +0400
+++ ZoneMinder-1.24.2/src/zm_stream.h 2010-09-28 18:24:21.000000000 +0400
@@ -57,7 +57,7 @@
} DataMsg;
typedef enum { MSG_CMD=1, MSG_DATA_WATCH, MSG_DATA_EVENT } MsgType;
- typedef enum { CMD_NONE=0, CMD_PAUSE, CMD_PLAY, CMD_STOP, CMD_FASTFWD, CMD_SLOWFWD, CMD_SLOWREV, CMD_FASTREV, CMD_ZOOMIN, CMD_ZOOMOUT, CMD_PAN, CMD_SCALE, CMD_PREV, CMD_NEXT, CMD_SEEK, CMD_VARPLAY, CMD_QUERY=99 } MsgCommand;
+ typedef enum { CMD_NONE=0, CMD_PAUSE, CMD_PLAY, CMD_STOP, CMD_FASTFWD, CMD_SLOWFWD, CMD_SLOWREV, CMD_FASTREV, CMD_ZOOMIN, CMD_ZOOMOUT, CMD_PAN, CMD_SCALE, CMD_PREV, CMD_NEXT, CMD_SEEK, CMD_VARPLAY, CMD_GET_IMAGE, CMD_QUERY=99 } MsgCommand;
protected:
Monitor *monitor;
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_user.cpp ZoneMinder-1.24.2/src/zm_user.cpp
--- ZoneMinder-1.24.2.orig/src/zm_user.cpp 2009-03-20 15:07:00.000000000 +0300
+++ ZoneMinder-1.24.2/src/zm_user.cpp 2010-09-13 19:40:49.000000000 +0400
@@ -104,10 +104,25 @@
User *zmLoadUser( const char *username, const char *password )
{
char sql[BUFSIZ] = "";
+ char l_passwd[1024];
+ int i, j = 0;
+ memset(l_passwd, 0, sizeof(l_passwd));
if ( password )
{
- snprintf( sql, sizeof(sql), "select Username, Password, Enabled, Stream+0, Events+0, Control+0, Monitors+0, System+0, MonitorIds from Users where Username = '%s' and Password = password('%s') and Enabled = 1", username, password );
+ for(i=0,j=0; i<strlen(password); i++,j++)
+ {
+ if (password[i] == '%' && i+2 < strlen(password) &&
+ isdigit(password[i+1]) && isdigit(password[i+2]))
+ {
+ l_passwd[j] = ((password[i+1] - 0x30) << 4) |
+ (password[i+2] - 0x30);
+ i += 2;
+ }
+ else
+ l_passwd[j] = password[i];
+ }
+ snprintf( sql, sizeof(sql), "select Username, Password, Enabled, Stream+0, Events+0, Control+0, Monitors+0, System+0, MonitorIds from Users where Username = '%s' and Password = password('%s') and Enabled = 1", username, l_passwd );
}
else
{
@@ -137,7 +152,7 @@
MYSQL_ROW dbrow = mysql_fetch_row( result );
User *user = new User( dbrow );
- Info( "Authenticated user '%s'", user->getUsername() );
+ Debug(1, "Authenticated user '%s'", user->getUsername() );
mysql_free_result( result );
@@ -222,7 +237,7 @@
{
// We have a match
User *user = new User( dbrow );
- Info( "Authenticated user '%s'", user->getUsername() );
+ Debug(1, "Authenticated user '%s'", user->getUsername() );
return( user );
}
}
diff -u -E -b ZoneMinder-1.24.2.orig/src/zm_utils.cpp ZoneMinder-1.24.2/src/zm_utils.cpp
--- ZoneMinder-1.24.2.orig/src/zm_utils.cpp 2009-05-28 12:47:59.000000000 +0400
+++ ZoneMinder-1.24.2/src/zm_utils.cpp 2010-07-14 19:17:35.000000000 +0400
@@ -21,6 +21,7 @@
#include "zm_utils.h"
#include <stdarg.h>
+#include <stdio.h>
const std::string stringtf( const char *format, ... )
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment