diff --git a/scripts/zmvideo.pl.in b/scripts/zmvideo.pl.in index 830870797..846a8b676 100644 --- a/scripts/zmvideo.pl.in +++ b/scripts/zmvideo.pl.in @@ -266,4 +266,5 @@ if ( $concat_name ) { #unlink $input_file_list; #print( STDOUT $event->{MonitorId}.'/'.$event->{Id}.'/'.$video_file."\n" ); #print( STDOUT $event_path . '/' . $video_file ."\n" ); +#print( STDOUT $video_file."\n" ); exit( 0 ); diff --git a/src/zm_camera.cpp b/src/zm_camera.cpp index f6c93c041..031511f04 100644 --- a/src/zm_camera.cpp +++ b/src/zm_camera.cpp @@ -32,7 +32,7 @@ Camera::Camera( int p_id, SourceType p_type, int p_width, int p_height, int p_co colour( p_colour ), contrast( p_contrast ), capture( p_capture ), - record_audio( p_record_audio ) + record_audio( p_record_audio ) { pixels = width * height; imagesize = pixels * colours; @@ -47,8 +47,7 @@ Camera::Camera( int p_id, SourceType p_type, int p_width, int p_height, int p_co } } -Camera::~Camera() -{ +Camera::~Camera() { } Monitor *Camera::getMonitor() { diff --git a/src/zm_camera.h b/src/zm_camera.h index 4d58d4ff1..a96f14625 100644 --- a/src/zm_camera.h +++ b/src/zm_camera.h @@ -80,9 +80,9 @@ public: virtual int Contrast( int/*p_contrast*/=-1 ) { return( -1 ); } bool CanCapture() const { return( capture ); } - + bool SupportsNativeVideo() const { return( (type == FFMPEG_SRC )||(type == REMOTE_SRC)); } - + virtual int PrimeCapture() { return( 0 ); } virtual int PreCapture()=0; virtual int Capture( Image &image )=0; diff --git a/src/zm_curl_camera.cpp b/src/zm_curl_camera.cpp index 8c1c7625e..b9f20d8ad 100644 --- a/src/zm_curl_camera.cpp +++ b/src/zm_curl_camera.cpp @@ -31,27 +31,23 @@ size_t content_length_match_len; size_t content_type_match_len; cURLCamera::cURLCamera( int p_id, const std::string &p_path, const std::string &p_user, const std::string &p_pass, int p_width, int p_height, int p_colours, int p_brightness, int p_contrast, int p_hue, int p_colour, bool p_capture, bool p_record_audio ) : - Camera( p_id, CURL_SRC, p_width, p_height, p_colours, ZM_SUBPIX_ORDER_DEFAULT_FOR_COLOUR(p_colours), p_brightness, p_contrast, p_hue, p_colour, p_capture, p_record_audio ), - mPath( p_path ), mUser( p_user ), mPass ( p_pass ), bTerminate( false ), bReset( false ), mode ( MODE_UNSET ) + Camera( p_id, CURL_SRC, p_width, p_height, p_colours, ZM_SUBPIX_ORDER_DEFAULT_FOR_COLOUR(p_colours), p_brightness, p_contrast, p_hue, p_colour, p_capture, p_record_audio ), + mPath( p_path ), mUser( p_user ), mPass ( p_pass ), bTerminate( false ), bReset( false ), mode ( MODE_UNSET ) { - if ( capture ) - { + if ( capture ) { Initialise(); } } -cURLCamera::~cURLCamera() -{ - if ( capture ) - { +cURLCamera::~cURLCamera() { + if ( capture ) { Terminate(); } } -void cURLCamera::Initialise() -{ +void cURLCamera::Initialise() { content_length_match_len = strlen(content_length_match); content_type_match_len = strlen(content_type_match); @@ -88,8 +84,7 @@ void cURLCamera::Initialise() } } -void cURLCamera::Terminate() -{ +void cURLCamera::Terminate() { /* Signal the thread to terminate */ bTerminate = true; @@ -108,20 +103,17 @@ void cURLCamera::Terminate() } -int cURLCamera::PrimeCapture() -{ +int cURLCamera::PrimeCapture() { //Info( "Priming capture from %s", mPath.c_str() ); return 0; } -int cURLCamera::PreCapture() -{ +int cURLCamera::PreCapture() { // Nothing to do here return( 0 ); } -int cURLCamera::Capture( Image &image ) -{ +int cURLCamera::Capture( Image &image ) { bool frameComplete = false; /* MODE_STREAM specific variables */ @@ -305,22 +297,19 @@ int cURLCamera::Capture( Image &image ) return 0; } -int cURLCamera::PostCapture() -{ +int cURLCamera::PostCapture() { // Nothing to do here return( 0 ); } -int cURLCamera::CaptureAndRecord( Image &image, bool recording, char* event_directory ) -{ +int cURLCamera::CaptureAndRecord( Image &image, bool recording, char* event_directory ) { Error("Capture and Record not implemented for the cURL camera type"); - // Nothing to do here - return( 0 ); + // Nothing to do here + return( 0 ); } -size_t cURLCamera::data_callback(void *buffer, size_t size, size_t nmemb, void *userdata) -{ +size_t cURLCamera::data_callback(void *buffer, size_t size, size_t nmemb, void *userdata) { lock(); /* Append the data we just received to our buffer */ @@ -341,8 +330,7 @@ size_t cURLCamera::data_callback(void *buffer, size_t size, size_t nmemb, void * -size_t cURLCamera::header_callback( void *buffer, size_t size, size_t nmemb, void *userdata) -{ +size_t cURLCamera::header_callback( void *buffer, size_t size, size_t nmemb, void *userdata) { std::string header; header.assign((const char*)buffer, size*nmemb); @@ -382,8 +370,7 @@ size_t cURLCamera::header_callback( void *buffer, size_t size, size_t nmemb, voi return size*nmemb; } -void* cURLCamera::thread_func() -{ +void* cURLCamera::thread_func() { long tRet; double dSize; @@ -529,8 +516,7 @@ int cURLCamera::unlock() { return nRet; } -int cURLCamera::progress_callback(void *userdata, double dltotal, double dlnow, double ultotal, double ulnow) -{ +int cURLCamera::progress_callback(void *userdata, double dltotal, double dlnow, double ultotal, double ulnow) { /* Signal the curl thread to terminate */ if(bTerminate) return -10; @@ -539,18 +525,15 @@ int cURLCamera::progress_callback(void *userdata, double dltotal, double dlnow, } /* These functions call the functions in the class for the correct object */ -size_t data_callback_dispatcher(void *buffer, size_t size, size_t nmemb, void *userdata) -{ +size_t data_callback_dispatcher(void *buffer, size_t size, size_t nmemb, void *userdata) { return ((cURLCamera*)userdata)->data_callback(buffer,size,nmemb,userdata); } -size_t header_callback_dispatcher(void *buffer, size_t size, size_t nmemb, void *userdata) -{ +size_t header_callback_dispatcher(void *buffer, size_t size, size_t nmemb, void *userdata) { return ((cURLCamera*)userdata)->header_callback(buffer,size,nmemb,userdata); } -int progress_callback_dispatcher(void *userdata, double dltotal, double dlnow, double ultotal, double ulnow) -{ +int progress_callback_dispatcher(void *userdata, double dltotal, double dlnow, double ultotal, double ulnow) { return ((cURLCamera*)userdata)->progress_callback(userdata,dltotal,dlnow,ultotal,ulnow); } @@ -558,6 +541,4 @@ void* thread_func_dispatcher(void* object) { return ((cURLCamera*)object)->thread_func(); } - - #endif // HAVE_LIBCURL diff --git a/src/zm_curl_camera.h b/src/zm_curl_camera.h index 7dead3f66..dd37401e1 100644 --- a/src/zm_curl_camera.h +++ b/src/zm_curl_camera.h @@ -39,8 +39,7 @@ // Class representing 'curl' cameras, i.e. those which are // accessed using the curl library // -class cURLCamera : public Camera -{ +class cURLCamera : public Camera { protected: typedef enum {MODE_UNSET, MODE_SINGLE, MODE_STREAM} mode_t; @@ -79,8 +78,7 @@ public: int PreCapture(); int Capture( Image &image ); int PostCapture(); - int CaptureAndRecord( Image &image, bool recording, char* event_directory); - + int CaptureAndRecord( Image &image, bool recording, char* event_directory); size_t data_callback(void *buffer, size_t size, size_t nmemb, void *userdata); size_t header_callback(void *buffer, size_t size, size_t nmemb, void *userdata); diff --git a/src/zm_event.cpp b/src/zm_event.cpp index eeda5c9dc..fe9081436 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -74,8 +74,7 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string createNotes( notes ); bool untimedEvent = false; - if ( !start_time.tv_sec ) - { + if ( !start_time.tv_sec ) { untimedEvent = true; gettimeofday( &start_time, 0 ); } @@ -86,14 +85,12 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string struct tm *stime = localtime( &start_time.tv_sec ); snprintf( sql, sizeof(sql), "insert into Events ( MonitorId, StorageId, Name, StartTime, Width, Height, Cause, Notes, Videoed ) values ( %d, %d, 'New Event', from_unixtime( %ld ), %d, %d, '%s', '%s', %d )", monitor->Id(), storage->Id(), start_time.tv_sec, monitor->Width(), monitor->Height(), cause.c_str(), notes.c_str(), videoEvent ); - if ( mysql_query( &dbconn, sql ) ) - { + if ( mysql_query( &dbconn, sql ) ) { Error( "Can't insert event: %s. sql was (%s)", mysql_error( &dbconn ), sql ); exit( mysql_errno( &dbconn ) ); } id = mysql_insert_id( &dbconn ); - if ( untimedEvent ) - { + if ( untimedEvent ) { Warning( "Event %d has zero time, setting to current", id ); } end_time.tv_sec = 0; @@ -102,8 +99,7 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string tot_score = 0; max_score = 0; - if ( config.use_deep_storage ) - { + if ( config.use_deep_storage ) { char *path_ptr = path; path_ptr += snprintf( path_ptr, sizeof(path), "%s/%d", storage->Path(), monitor->Id() ); @@ -118,17 +114,14 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string char date_path[PATH_MAX] = ""; char time_path[PATH_MAX] = ""; char *time_path_ptr = time_path; - for ( unsigned int i = 0; i < sizeof(dt_parts)/sizeof(*dt_parts); i++ ) - { + for ( unsigned int i = 0; i < sizeof(dt_parts)/sizeof(*dt_parts); i++ ) { path_ptr += snprintf( path_ptr, sizeof(path)-(path_ptr-path), "/%02d", dt_parts[i] ); struct stat statbuf; errno = 0; if ( stat( path, &statbuf ) ) { - if ( errno == ENOENT || errno == ENOTDIR ) - { - if ( mkdir( path, 0755 ) ) - { + if ( errno == ENOENT || errno == ENOTDIR ) { + if ( mkdir( path, 0755 ) ) { Fatal( "Can't mkdir %s: %s", path, strerror(errno)); } } else { @@ -151,18 +144,14 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string fclose( id_fp ); else Fatal( "Can't fopen %s: %s", id_file, strerror(errno)); - } - else - { + } else { snprintf( path, sizeof(path), "%s/%d/%d", storage->Path(), monitor->Id(), id ); struct stat statbuf; errno = 0; stat( path, &statbuf ); - if ( errno == ENOENT || errno == ENOTDIR ) - { - if ( mkdir( path, 0755 ) ) - { + if ( errno == ENOENT || errno == ENOTDIR ) { + if ( mkdir( path, 0755 ) ) { Error( "Can't mkdir %s: %s", path, strerror(errno)); } } @@ -187,7 +176,6 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string snprintf( timecodes_name, sizeof(timecodes_name), "%d-%s", id, "video.timecodes" ); snprintf( timecodes_file, sizeof(timecodes_file), video_file_format, path, timecodes_name ); - /* X264 MP4 video writer */ if(monitor->GetOptVideoWriter() == 1) { #if ZM_HAVE_VIDEOWRITER_X264MP4 @@ -220,18 +208,15 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string } -Event::~Event() -{ - if ( frames > last_db_frame ) - { +Event::~Event() { + if ( frames > last_db_frame ) { struct DeltaTimeval delta_time; DELTA_TIMEVAL( delta_time, end_time, start_time, DT_PREC_2 ); Debug( 1, "Adding closing frame %d to DB", frames ); static char sql[ZM_SQL_SML_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 ); - if ( mysql_query( &dbconn, sql ) ) - { + if ( mysql_query( &dbconn, sql ) ) { Error( "Can't insert frame: %s", mysql_error( &dbconn ) ); exit( mysql_errno( &dbconn ) ); } @@ -266,16 +251,13 @@ Event::~Event() } } -void Event::createNotes( std::string ¬es ) -{ +void Event::createNotes( std::string ¬es ) { notes.clear(); - for ( StringSetMap::const_iterator mapIter = noteSetMap.begin(); mapIter != noteSetMap.end(); mapIter++ ) - { + for ( StringSetMap::const_iterator mapIter = noteSetMap.begin(); mapIter != noteSetMap.end(); mapIter++ ) { notes += mapIter->first; notes += ": "; const StringSet &stringSet = mapIter->second; - for ( StringSet::const_iterator setIter = stringSet.begin(); setIter != stringSet.end(); setIter++ ) - { + for ( StringSet::const_iterator setIter = stringSet.begin(); setIter != stringSet.end(); setIter++ ) { if ( setIter != stringSet.begin() ) notes += ", "; notes += *setIter; @@ -285,25 +267,20 @@ void Event::createNotes( std::string ¬es ) int Event::sd = -1; -bool Event::OpenFrameSocket( int monitor_id ) -{ - if ( sd > 0 ) - { +bool Event::OpenFrameSocket( int monitor_id ) { + if ( sd > 0 ) { close( sd ); } sd = socket( AF_UNIX, SOCK_STREAM, 0); - if ( sd < 0 ) - { + if ( sd < 0 ) { Error( "Can't create socket: %s", strerror(errno) ); return( false ); } int socket_buffer_size = config.frame_socket_size; - if ( socket_buffer_size > 0 ) - { - if ( setsockopt( sd, SOL_SOCKET, SO_SNDBUF, &socket_buffer_size, sizeof(socket_buffer_size) ) < 0 ) - { + if ( socket_buffer_size > 0 ) { + if ( setsockopt( sd, SOL_SOCKET, SO_SNDBUF, &socket_buffer_size, sizeof(socket_buffer_size) ) < 0 ) { Error( "Can't get socket buffer size to %d, error = %s", socket_buffer_size, strerror(errno) ); close( sd ); sd = -1; @@ -312,16 +289,14 @@ bool Event::OpenFrameSocket( int monitor_id ) } int flags; - if ( (flags = fcntl( sd, F_GETFL )) < 0 ) - { + if ( (flags = fcntl( sd, F_GETFL )) < 0 ) { Error( "Can't get socket flags, error = %s", strerror(errno) ); close( sd ); sd = -1; return( false ); } flags |= O_NONBLOCK; - if ( fcntl( sd, F_SETFL, flags ) < 0 ) - { + if ( fcntl( sd, F_SETFL, flags ) < 0 ) { Error( "Can't set socket flags, error = %s", strerror(errno) ); close( sd ); sd = -1; @@ -336,8 +311,7 @@ bool Event::OpenFrameSocket( int monitor_id ) strncpy( addr.sun_path, sock_path, sizeof(addr.sun_path) ); addr.sun_family = AF_UNIX; - if ( connect( sd, (struct sockaddr *)&addr, strlen(addr.sun_path)+sizeof(addr.sun_family)+1) < 0 ) - { + if ( connect( sd, (struct sockaddr *)&addr, strlen(addr.sun_path)+sizeof(addr.sun_family)+1) < 0 ) { Warning( "Can't connect to frame server: %s", strerror(errno) ); close( sd ); sd = -1; @@ -348,19 +322,15 @@ bool Event::OpenFrameSocket( int monitor_id ) return( true ); } -bool Event::ValidateFrameSocket( int monitor_id ) -{ - if ( sd < 0 ) - { +bool Event::ValidateFrameSocket( int monitor_id ) { + if ( sd < 0 ) { return( OpenFrameSocket( monitor_id ) ); } return( true ); } -bool Event::SendFrameImage( const Image *image, bool alarm_frame ) -{ - if ( !ValidateFrameSocket( monitor->Id() ) ) - { +bool Event::SendFrameImage( const Image *image, bool alarm_frame ) { + if ( !ValidateFrameSocket( monitor->Id() ) ) { return( false ); } @@ -386,23 +356,16 @@ bool Event::SendFrameImage( const Image *image, bool alarm_frame ) ssize_t writev_size = sizeof(frame_header)+jpg_buffer_size; ssize_t writev_result = writev( sd, iovecs, sizeof(iovecs)/sizeof(*iovecs)); - if ( writev_result != writev_size ) - { - if ( writev_result < 0 ) - { - if ( errno == EAGAIN ) - { + if ( writev_result != writev_size ) { + if ( writev_result < 0 ) { + if ( errno == EAGAIN ) { Warning( "Blocking write detected" ); - } - else - { + } else { Error( "Can't write frame: %s", strerror(errno) ); close( sd ); sd = -1; } - } - else - { + } else { Error( "Incomplete frame write: %zd of %zd bytes written", writev_result, writev_size ); close( sd ); sd = -1; @@ -414,8 +377,7 @@ bool Event::SendFrameImage( const Image *image, bool alarm_frame ) return( true ); } -bool Event::WriteFrameImage( Image *image, struct timeval timestamp, const char *event_file, bool alarm_frame ) -{ +bool Event::WriteFrameImage( Image *image, struct timeval timestamp, const char *event_file, bool alarm_frame ) { Image* ImgToWrite; Image* ts_image = NULL; @@ -424,12 +386,10 @@ bool Event::WriteFrameImage( Image *image, struct timeval timestamp, const char ts_image = new Image(*image); monitor->TimestampImage( ts_image, ×tamp ); ImgToWrite=ts_image; - } - else + } else ImgToWrite=image; - if ( !config.opt_frame_server || !SendFrameImage(ImgToWrite, alarm_frame) ) - { + if ( !config.opt_frame_server || !SendFrameImage(ImgToWrite, alarm_frame) ) { int thisquality = ( alarm_frame && (config.jpeg_alarm_file_quality > config.jpeg_file_quality) ) ? config.jpeg_alarm_file_quality : 0 ; // quality to use, zero is default ImgToWrite->WriteJpeg( event_file, thisquality, (monitor->Exif() ? timestamp : (timeval){0,0}) ); // exif is only timestamp at present this switches on or off for write } @@ -437,8 +397,7 @@ bool Event::WriteFrameImage( Image *image, struct timeval timestamp, const char return( true ); } -bool Event::WriteFrameVideo( const Image *image, const struct timeval timestamp, VideoWriter* videow ) -{ +bool Event::WriteFrameVideo( const Image *image, const struct timeval timestamp, VideoWriter* videow ) { const Image* frameimg = image; Image ts_image; @@ -471,56 +430,43 @@ bool Event::WriteFrameVideo( const Image *image, const struct timeval timestamp, return( true ); } -void Event::updateNotes( const StringSetMap &newNoteSetMap ) -{ +void Event::updateNotes( const StringSetMap &newNoteSetMap ) { bool update = false; //Info( "Checking notes, %d <> %d", noteSetMap.size(), newNoteSetMap.size() ); - if ( newNoteSetMap.size() > 0 ) - { - if ( noteSetMap.size() == 0 ) - { + if ( newNoteSetMap.size() > 0 ) { + if ( noteSetMap.size() == 0 ) { noteSetMap = newNoteSetMap; update = true; - } - else - { - for ( StringSetMap::const_iterator newNoteSetMapIter = newNoteSetMap.begin(); newNoteSetMapIter != newNoteSetMap.end(); newNoteSetMapIter++ ) - { + } else { + for ( StringSetMap::const_iterator newNoteSetMapIter = newNoteSetMap.begin(); newNoteSetMapIter != newNoteSetMap.end(); newNoteSetMapIter++ ) { const std::string &newNoteGroup = newNoteSetMapIter->first; const StringSet &newNoteSet = newNoteSetMapIter->second; //Info( "Got %d new strings", newNoteSet.size() ); - if ( newNoteSet.size() > 0 ) - { + if ( newNoteSet.size() > 0 ) { StringSetMap::iterator noteSetMapIter = noteSetMap.find( newNoteGroup ); - if ( noteSetMapIter == noteSetMap.end() ) - { + if ( noteSetMapIter == noteSetMap.end() ) { //Info( "Can't find note group %s, copying %d strings", newNoteGroup.c_str(), newNoteSet.size() ); noteSetMap.insert( StringSetMap::value_type( newNoteGroup, newNoteSet ) ); update = true; - } - else - { + } else { StringSet ¬eSet = noteSetMapIter->second; //Info( "Found note group %s, got %d strings", newNoteGroup.c_str(), newNoteSet.size() ); - for ( StringSet::const_iterator newNoteSetIter = newNoteSet.begin(); newNoteSetIter != newNoteSet.end(); newNoteSetIter++ ) - { + for ( StringSet::const_iterator newNoteSetIter = newNoteSet.begin(); newNoteSetIter != newNoteSet.end(); newNoteSetIter++ ) { const std::string &newNote = *newNoteSetIter; StringSet::iterator noteSetIter = noteSet.find( newNote ); - if ( noteSetIter == noteSet.end() ) - { + if ( noteSetIter == noteSet.end() ) { noteSet.insert( newNote ); update = true; } } } } - } - } - } + } // end for + } // end if ( noteSetMap.size() == 0 + } // end if newNoteSetupMap.size() > 0 - if ( update ) - { + if ( update ) { std::string notes; createNotes( notes ); @@ -532,19 +478,16 @@ void Event::updateNotes( const StringSetMap &newNoteSetMap ) char notesStr[ZM_SQL_MED_BUFSIZ] = ""; unsigned long notesLen = 0; - if ( !stmt ) - { + if ( !stmt ) { const char *sql = "update Events set Notes = ? where Id = ?"; stmt = mysql_stmt_init( &dbconn ); - if ( mysql_stmt_prepare( stmt, sql, strlen(sql) ) ) - { + if ( mysql_stmt_prepare( stmt, sql, strlen(sql) ) ) { Fatal( "Unable to prepare sql '%s': %s", sql, mysql_stmt_error(stmt) ); } /* Get the parameter count from the statement */ - if ( mysql_stmt_param_count( stmt ) != 2 ) - { + if ( mysql_stmt_param_count( stmt ) != 2 ) { Fatal( "Unexpected parameter count %ld in sql '%s'", mysql_stmt_param_count( stmt ), sql ); } @@ -564,8 +507,7 @@ void Event::updateNotes( const StringSetMap &newNoteSetMap ) bind[1].length= 0; /* Bind the buffers */ - if ( mysql_stmt_bind_param( stmt, bind ) ) - { + if ( mysql_stmt_bind_param( stmt, bind ) ) { Fatal( "Unable to bind sql '%s': %s", sql, mysql_stmt_error(stmt) ); } } @@ -573,8 +515,7 @@ void Event::updateNotes( const StringSetMap &newNoteSetMap ) strncpy( notesStr, notes.c_str(), sizeof(notesStr) ); notesLen = notes.length(); - if ( mysql_stmt_execute( stmt ) ) - { + if ( mysql_stmt_execute( stmt ) ) { Fatal( "Unable to execute sql '%s': %s", sql, mysql_stmt_error(stmt) ); } #else @@ -583,30 +524,25 @@ void Event::updateNotes( const StringSetMap &newNoteSetMap ) mysql_real_escape_string( &dbconn, escapedNotes, notes.c_str(), notes.length() ); snprintf( sql, sizeof(sql), "update Events set Notes = '%s' where Id = %d", escapedNotes, id ); - if ( mysql_query( &dbconn, sql ) ) - { + if ( mysql_query( &dbconn, sql ) ) { Error( "Can't insert event: %s", mysql_error( &dbconn ) ); } #endif } } -void Event::AddFrames( int n_frames, Image **images, struct timeval **timestamps ) -{ +void Event::AddFrames( int n_frames, Image **images, struct timeval **timestamps ) { for (int i = 0; i < n_frames; i += ZM_SQL_BATCH_SIZE) { AddFramesInternal(n_frames, i, images, timestamps); } } -void Event::AddFramesInternal( int n_frames, int start_frame, Image **images, struct timeval **timestamps ) -{ +void Event::AddFramesInternal( int n_frames, int start_frame, Image **images, struct timeval **timestamps ) { static char sql[ZM_SQL_LGE_BUFSIZ]; strncpy( sql, "insert into Frames ( EventId, FrameId, TimeStamp, Delta ) values ", sizeof(sql) ); int frameCount = 0; - for ( int i = start_frame; i < n_frames && i - start_frame < ZM_SQL_BATCH_SIZE; i++ ) - { - if ( !timestamps[i]->tv_sec ) - { + for ( int i = start_frame; i < n_frames && i - start_frame < ZM_SQL_BATCH_SIZE; i++ ) { + if ( !timestamps[i]->tv_sec ) { Debug( 1, "Not adding pre-capture frame %d, zero timestamp", i ); continue; } @@ -640,27 +576,21 @@ void Event::AddFramesInternal( int n_frames, int start_frame, Image **images, st frameCount++; } - if ( frameCount ) - { + if ( frameCount ) { Debug( 1, "Adding %d/%d frames to DB", frameCount, n_frames ); *(sql+strlen(sql)-2) = '\0'; - if ( mysql_query( &dbconn, sql ) ) - { + if ( mysql_query( &dbconn, sql ) ) { Error( "Can't insert frames: %s", mysql_error( &dbconn ) ); exit( mysql_errno( &dbconn ) ); } last_db_frame = frames; - } - else - { + } else { Debug( 1, "No valid pre-capture frames to add" ); } } -void Event::AddFrame( Image *image, struct timeval timestamp, int score, Image *alarm_image ) -{ - if ( !timestamp.tv_sec ) - { +void Event::AddFrame( Image *image, struct timeval timestamp, int score, Image *alarm_image ) { + if ( !timestamp.tv_sec ) { Debug( 1, "Not adding new frame, zero timestamp" ); return; } @@ -694,25 +624,21 @@ void Event::AddFrame( Image *image, struct timeval timestamp, int score, Image * score = 0; bool db_frame = (strcmp(frame_type,"Bulk") != 0) || ((frames%config.bulk_frame_interval)==0) || !frames; - if ( db_frame ) - { + if ( db_frame ) { Debug( 1, "Adding frame %d of type \"%s\" to DB", frames, frame_type ); static char sql[ZM_SQL_MED_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 ); - if ( mysql_query( &dbconn, sql ) ) - { + if ( mysql_query( &dbconn, sql ) ) { Error( "Can't insert frame: %s", mysql_error( &dbconn ) ); exit( mysql_errno( &dbconn ) ); } last_db_frame = frames; // We are writing a Bulk frame - if ( !strcmp( frame_type,"Bulk") ) - { + if ( !strcmp( frame_type,"Bulk") ) { 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 ); - if ( mysql_query( &dbconn, sql ) ) - { + if ( mysql_query( &dbconn, sql ) ) { Error( "Can't update event: %s", mysql_error( &dbconn ) ); exit( mysql_errno( &dbconn ) ); } @@ -722,16 +648,14 @@ void Event::AddFrame( Image *image, struct timeval timestamp, int score, Image * end_time = timestamp; // We are writing an Alarm frame - if ( !strcmp( frame_type,"Alarm") ) - { + if ( !strcmp( frame_type,"Alarm") ) { alarm_frames++; tot_score += score; if ( score > (int)max_score ) max_score = score; - if ( alarm_image ) - { + if ( alarm_image ) { snprintf( event_file, sizeof(event_file), analyse_file_format, path, frames ); Debug( 1, "Writing analysis frame %d", frames ); @@ -798,15 +722,13 @@ bool EventStream::loadInitialEventData( int monitor_id, time_t event_time ) } MYSQL_RES *result = mysql_store_result( &dbconn ); - if ( !result ) - { + if ( !result ) { Error( "Can't use query result: %s", mysql_error( &dbconn ) ); exit( mysql_errno( &dbconn ) ); } MYSQL_ROW dbrow = mysql_fetch_row( result ); - if ( mysql_errno( &dbconn ) ) - { + if ( mysql_errno( &dbconn ) ) { Error( "Can't fetch row: %s", mysql_error( &dbconn ) ); exit( mysql_errno( &dbconn ) ); } @@ -817,17 +739,13 @@ bool EventStream::loadInitialEventData( int monitor_id, time_t event_time ) loadEventData( init_event_id ); - if ( event_time ) - { + if ( event_time ) { curr_stream_time = event_time; curr_frame_id = 1; - if ( event_time >= event_data->start_time ) - { - for (unsigned int i = 0; i < event_data->frame_count; i++ ) - { + if ( event_time >= event_data->start_time ) { + for (unsigned int i = 0; i < event_data->frame_count; i++ ) { //Info( "eft %d > et %d", event_data->frames[i].timestamp, event_time ); - if ( event_data->frames[i].timestamp >= event_time ) - { + if ( event_data->frames[i].timestamp >= event_time ) { curr_frame_id = i+1; Debug( 3, "Set cst:%.2f", curr_stream_time ); Debug( 3, "Set cfid:%d", curr_frame_id ); @@ -840,51 +758,42 @@ bool EventStream::loadInitialEventData( int monitor_id, time_t event_time ) return( true ); } -bool EventStream::loadInitialEventData( int init_event_id, unsigned int init_frame_id ) -{ +bool EventStream::loadInitialEventData( int init_event_id, unsigned int init_frame_id ) { loadEventData( init_event_id ); - if ( init_frame_id ) - { + if ( init_frame_id ) { curr_stream_time = event_data->frames[init_frame_id-1].timestamp; curr_frame_id = init_frame_id; - } - else - { + } else { curr_stream_time = event_data->start_time; } return( true ); } -bool EventStream::loadEventData( int event_id ) -{ +bool EventStream::loadEventData( int event_id ) { static char sql[ZM_SQL_MED_BUFSIZ]; snprintf( sql, sizeof(sql), "select M.Id, M.Name, E.StorageId, E.Frames, unix_timestamp( StartTime ) as StartTimestamp, max(F.Delta)-min(F.Delta) as Duration,E.DefaultVideo 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 ) ) - { + if ( mysql_query( &dbconn, sql ) ) { Error( "Can't run query: %s", mysql_error( &dbconn ) ); exit( mysql_errno( &dbconn ) ); } MYSQL_RES *result = mysql_store_result( &dbconn ); - if ( !result ) - { + if ( !result ) { Error( "Can't use query result: %s", mysql_error( &dbconn ) ); exit( mysql_errno( &dbconn ) ); } - if ( !mysql_num_rows( result ) ) - { + if ( !mysql_num_rows( result ) ) { Fatal( "Unable to load event %d, not found in DB", event_id ); } MYSQL_ROW dbrow = mysql_fetch_row( result ); - if ( mysql_errno( &dbconn ) ) - { + if ( mysql_errno( &dbconn ) ) { Error( "Can't fetch row: %s", mysql_error( &dbconn ) ); exit( mysql_errno( &dbconn ) ); } @@ -899,16 +808,13 @@ bool EventStream::loadEventData( int event_id ) Storage * storage = new Storage( event_data->storage_id ); const char *storage_path = storage->Path(); - if ( config.use_deep_storage ) - { + if ( config.use_deep_storage ) { struct tm *event_time = localtime( &event_data->start_time ); if ( storage_path[0] == '/' ) snprintf( event_data->path, sizeof(event_data->path), "%s/%ld/%02d/%02d/%02d/%02d/%02d/%02d", storage_path, event_data->monitor_id, event_time->tm_year-100, event_time->tm_mon+1, event_time->tm_mday, event_time->tm_hour, event_time->tm_min, event_time->tm_sec ); else snprintf( event_data->path, sizeof(event_data->path), "%s/%s/%ld/%02d/%02d/%02d/%02d/%02d/%02d", staticConfig.PATH_WEB.c_str(), storage_path, event_data->monitor_id, event_time->tm_year-100, event_time->tm_mon+1, event_time->tm_mday, event_time->tm_hour, event_time->tm_min, event_time->tm_sec ); - } - else - { + } else { if ( storage_path[0] == '/' ) snprintf( event_data->path, sizeof(event_data->path), "%s/%ld/%ld", storage_path, event_data->monitor_id, event_data->event_id ); else @@ -923,15 +829,13 @@ bool EventStream::loadEventData( int event_id ) mysql_free_result( result ); snprintf( sql, sizeof(sql), "select FrameId, unix_timestamp( `TimeStamp` ), Delta from Frames where EventId = %d order by FrameId asc", event_id ); - if ( mysql_query( &dbconn, sql ) ) - { + if ( mysql_query( &dbconn, sql ) ) { Error( "Can't run query: %s", mysql_error( &dbconn ) ); exit( mysql_errno( &dbconn ) ); } result = mysql_store_result( &dbconn ); - if ( !result ) - { + if ( !result ) { Error( "Can't use query result: %s", mysql_error( &dbconn ) ); exit( mysql_errno( &dbconn ) ); } @@ -942,17 +846,14 @@ bool EventStream::loadEventData( int event_id ) int id, last_id = 0; time_t timestamp, last_timestamp = event_data->start_time; double delta, last_delta = 0.0; - while ( ( dbrow = mysql_fetch_row( result ) ) ) - { + while ( ( dbrow = mysql_fetch_row( result ) ) ) { 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 ) - { - for ( int i = last_id+1; i < id; i++ ) - { + if ( id_diff > 1 ) { + for ( int i = last_id+1; i < id; i++ ) { event_data->frames[i-1].timestamp = (time_t)(last_timestamp + ((i-last_id)*frame_delta)); event_data->frames[i-1].offset = (time_t)(event_data->frames[i-1].timestamp-event_data->start_time); event_data->frames[i-1].delta = frame_delta; @@ -967,8 +868,7 @@ bool EventStream::loadEventData( int event_id ) last_delta = delta; last_timestamp = timestamp; } - if ( mysql_errno( &dbconn ) ) - { + if ( mysql_errno( &dbconn ) ) { Error( "Can't fetch row: %s", mysql_error( &dbconn ) ); exit( mysql_errno( &dbconn ) ); } @@ -980,8 +880,7 @@ bool EventStream::loadEventData( int event_id ) mysql_free_result( result ); - if ( forceEventChange || mode == MODE_ALL_GAPLESS ) - { + if ( forceEventChange || mode == MODE_ALL_GAPLESS ) { if ( replay_rate > 0 ) curr_stream_time = event_data->frames[0].timestamp; else @@ -992,12 +891,10 @@ bool EventStream::loadEventData( int event_id ) return( true ); } -void EventStream::processCommand( const CmdMsg *msg ) -{ +void EventStream::processCommand( const CmdMsg *msg ) { Debug( 2, "Got message, type %d, msg %d", msg->msg_type, msg->msg_data[0] ) // Check for incoming command - switch( (MsgCommand)msg->msg_data[0] ) - { + switch( (MsgCommand)msg->msg_data[0] ) { case CMD_PAUSE : { Debug( 1, "Got PAUSE command" ); @@ -1256,8 +1153,7 @@ void EventStream::processCommand( const CmdMsg *msg ) DataMsg status_msg; status_msg.msg_type = MSG_DATA_EVENT; memcpy( &status_msg.msg_data, &status_data, sizeof(status_data) ); - if ( sendto( sd, &status_msg, sizeof(status_msg), MSG_DONTWAIT, (sockaddr *)&rem_addr, sizeof(rem_addr) ) < 0 ) - { + if ( sendto( sd, &status_msg, sizeof(status_msg), MSG_DONTWAIT, (sockaddr *)&rem_addr, sizeof(rem_addr) ) < 0 ) { //if ( errno != EAGAIN ) { Error( "Can't sendto on sd %d: %s", sd, strerror(errno) ); @@ -1271,49 +1167,39 @@ void EventStream::processCommand( const CmdMsg *msg ) updateFrameRate( (double)event_data->frame_count/event_data->duration ); } -void EventStream::checkEventLoaded() -{ +void EventStream::checkEventLoaded() { bool reload_event = false; static char sql[ZM_SQL_SML_BUFSIZ]; - if ( curr_frame_id <= 0 ) - { + if ( curr_frame_id <= 0 ) { snprintf( sql, sizeof(sql), "select Id from Events where MonitorId = %ld and Id < %ld order by Id desc limit 1", event_data->monitor_id, event_data->event_id ); reload_event = true; - } - else if ( (unsigned int)curr_frame_id > event_data->frame_count ) - { + } else if ( (unsigned int)curr_frame_id > event_data->frame_count ) { snprintf( sql, sizeof(sql), "select Id from Events where MonitorId = %ld and Id > %ld order by Id asc limit 1", event_data->monitor_id, event_data->event_id ); reload_event = true; } - if ( reload_event ) - { - if ( forceEventChange || mode != MODE_SINGLE ) - { + if ( reload_event ) { + if ( forceEventChange || mode != MODE_SINGLE ) { //Info( "SQL:%s", sql ); - if ( mysql_query( &dbconn, sql ) ) - { + if ( mysql_query( &dbconn, sql ) ) { Error( "Can't run query: %s", mysql_error( &dbconn ) ); exit( mysql_errno( &dbconn ) ); } MYSQL_RES *result = mysql_store_result( &dbconn ); - if ( !result ) - { + if ( !result ) { Error( "Can't use query result: %s", mysql_error( &dbconn ) ); exit( mysql_errno( &dbconn ) ); } MYSQL_ROW dbrow = mysql_fetch_row( result ); - if ( mysql_errno( &dbconn ) ) - { + if ( mysql_errno( &dbconn ) ) { Error( "Can't fetch row: %s", mysql_error( &dbconn ) ); exit( mysql_errno( &dbconn ) ); } - if ( dbrow ) - { + if ( dbrow ) { int event_id = atoi(dbrow[0]); Debug( 1, "Loading new event %d", event_id ); @@ -1325,9 +1211,7 @@ void EventStream::checkEventLoaded() else curr_frame_id = 1; Debug( 2, "New frame id = %d", curr_frame_id ); - } - else - { + } else { if ( curr_frame_id <= 0 ) curr_frame_id = 1; else @@ -1336,9 +1220,7 @@ void EventStream::checkEventLoaded() } mysql_free_result( result ); forceEventChange = false; - } - else - { + } else { if ( curr_frame_id <= 0 ) curr_frame_id = 1; else @@ -1359,8 +1241,7 @@ Image * EventStream::getImage( ) { return image; } -bool EventStream::sendFrame( int delta_us ) -{ +bool EventStream::sendFrame( int delta_us ) { Debug( 2, "Sending frame %d", curr_frame_id ); static char filepath[PATH_MAX]; @@ -1370,21 +1251,18 @@ bool EventStream::sendFrame( int delta_us ) snprintf( filepath, sizeof(filepath), Event::capture_file_format, event_data->path, curr_frame_id ); #if HAVE_LIBAVCODEC - if ( type == STREAM_MPEG ) - { + if ( type == STREAM_MPEG ) { Image image( filepath ); Image *send_image = prepareImage( &image ); - if ( !vid_stream ) - { + if ( !vid_stream ) { vid_stream = new VideoStream( "pipe:", format, bitrate, effective_fps, send_image->Colours(), send_image->SubpixelOrder(), send_image->Width(), send_image->Height() ); fprintf( stdout, "Content-type: %s\r\n\r\n", vid_stream->MimeType() ); vid_stream->OpenStream(); } /* double pts = */ vid_stream->EncodeFrame( send_image->Buffer(), send_image->Size(), config.mpeg_timed_frames, delta_us*1000 ); - } - else + } else #endif // HAVE_LIBAVCODEC { static unsigned char temp_img_buffer[ZM_MAX_IMAGE_SIZE]; @@ -1399,11 +1277,9 @@ bool EventStream::sendFrame( int delta_us ) if ( type != STREAM_JPEG ) send_raw = false; - if ( send_raw ) - { + if ( send_raw ) { fdj = fopen( filepath, "rb" ); - if ( !fdj ) - { + if ( !fdj ) { Error( "Can't open %s: %s", filepath, strerror(errno) ); return( false ); } @@ -1415,15 +1291,12 @@ bool EventStream::sendFrame( int delta_us ) #else img_buffer_size = fread( img_buffer, 1, sizeof(temp_img_buffer), fdj ); #endif - } - else - { + } else { Image image( filepath ); Image *send_image = prepareImage( &image ); - switch( type ) - { + switch( type ) { case STREAM_JPEG : send_image->EncodeJpeg( img_buffer, &img_buffer_size ); break; @@ -1447,8 +1320,7 @@ bool EventStream::sendFrame( int delta_us ) } } - switch( type ) - { + switch( type ) { case STREAM_JPEG : fprintf( stdout, "Content-Type: image/jpeg\r\n" ); break; @@ -1485,8 +1357,7 @@ bool EventStream::sendFrame( int delta_us ) fclose(fdj); /* Close the file handle */ } else { fprintf( stdout, "Content-Length: %d\r\n\r\n", img_buffer_size ); - if ( fwrite( img_buffer, img_buffer_size, 1, stdout ) != 1 ) - { + if ( fwrite( img_buffer, img_buffer_size, 1, stdout ) != 1 ) { Error( "Unable to send stream frame: %s", strerror(errno) ); return( false ); } @@ -1499,8 +1370,7 @@ bool EventStream::sendFrame( int delta_us ) return( true ); } -void EventStream::runStream() -{ +void EventStream::runStream() { Event::Initialise(); openComms(); @@ -1512,15 +1382,13 @@ void EventStream::runStream() if ( type == STREAM_JPEG ) fprintf( stdout, "Content-Type: multipart/x-mixed-replace;boundary=ZoneMinderFrame\r\n\r\n" ); - if ( !event_data ) - { + if ( !event_data ) { sendTextFrame( "No event data found" ); exit( 0 ); } unsigned int delta_us = 0; - while( !zm_terminate ) - { + while( !zm_terminate ) { gettimeofday( &now, NULL ); while(checkCommandQueue()); @@ -1536,27 +1404,21 @@ void EventStream::runStream() //Info( "cst:%.2f", curr_stream_time ); //Info( "cfid:%d", curr_frame_id ); //Info( "fdt:%d", frame_data->timestamp ); - if ( !paused ) - { + if ( !paused ) { bool in_event = true; double time_to_event = 0; - if ( replay_rate > 0 ) - { + if ( replay_rate > 0 ) { time_to_event = event_data->frames[0].timestamp - curr_stream_time; if ( time_to_event > 0 ) in_event = false; - } - else if ( replay_rate < 0 ) - { + } else if ( replay_rate < 0 ) { time_to_event = curr_stream_time - event_data->frames[event_data->frame_count-1].timestamp; if ( time_to_event > 0 ) in_event = false; } - if ( !in_event ) - { + if ( !in_event ) { double actual_delta_time = TV_2_FLOAT( now ) - last_frame_sent; - if ( actual_delta_time > 1 ) - { + if ( actual_delta_time > 1 ) { static char frame_text[64]; snprintf( frame_text, sizeof(frame_text), "Time to next event = %d seconds", (int)time_to_event ); if ( !sendTextFrame( frame_text ) ) @@ -1574,11 +1436,9 @@ void EventStream::runStream() // Figure out if we should send this frame bool send_frame = false; - if ( !paused ) - { + if ( !paused ) { // If we are streaming and this frame is due to be sent - if ( ((curr_frame_id-1)%frame_mod) == 0 ) - { + if ( ((curr_frame_id-1)%frame_mod) == 0 ) { delta_us = (unsigned int)(frame_data->delta * 1000000); // if effective > base we should speed up frame delivery delta_us = (unsigned int)((delta_us * base_fps)/effective_fps); @@ -1586,19 +1446,14 @@ void EventStream::runStream() delta_us = max(delta_us, 1000000 / maxfps); send_frame = true; } - } - else if ( step != 0 ) - { + } else if ( step != 0 ) { // We are paused and are just stepping forward or backward one frame step = 0; send_frame = true; - } - else - { + } else { // We are paused, and doing nothing double actual_delta_time = TV_2_FLOAT( now ) - last_frame_sent; - if ( actual_delta_time > MAX_STREAM_DELAY ) - { + if ( actual_delta_time > MAX_STREAM_DELAY ) { // Send keepalive Debug( 2, "Sending keepalive frame" ); send_frame = true; @@ -1611,17 +1466,13 @@ void EventStream::runStream() curr_stream_time = frame_data->timestamp; - if ( !paused ) - { + if ( !paused ) { curr_frame_id += replay_rate>0?1:-1; - if ( send_frame && type != STREAM_MPEG ) - { + if ( send_frame && type != STREAM_MPEG ) { Debug( 3, "dUs: %d", delta_us ); usleep( delta_us ); } - } - else - { + } else { usleep( (unsigned long)((1000000 * ZM_RATE_BASE)/((base_fps?base_fps:1)*abs(replay_rate*2))) ); } } diff --git a/src/zm_event.h b/src/zm_event.h index 576e0e869..df73ccefb 100644 --- a/src/zm_event.h +++ b/src/zm_event.h @@ -47,163 +47,149 @@ class Monitor; // // Class describing events, i.e. captured periods of activity. // -class Event -{ +class Event { friend class EventStream; protected: - static bool initialised; - static char capture_file_format[PATH_MAX]; - static char analyse_file_format[PATH_MAX]; - static char general_file_format[PATH_MAX]; - static char video_file_format[PATH_MAX]; + static bool initialised; + static char capture_file_format[PATH_MAX]; + static char analyse_file_format[PATH_MAX]; + static char general_file_format[PATH_MAX]; + static char video_file_format[PATH_MAX]; protected: - static int sd; + static int sd; public: - typedef std::set StringSet; - typedef std::map StringSetMap; + typedef std::set StringSet; + typedef std::map StringSetMap; protected: - typedef enum { NORMAL, BULK, ALARM } FrameType; + typedef enum { NORMAL, BULK, ALARM } FrameType; - struct PreAlarmData - { - Image *image; - struct timeval timestamp; - unsigned int score; - Image *alarm_frame; - }; + struct PreAlarmData { + Image *image; + struct timeval timestamp; + unsigned int score; + Image *alarm_frame; + }; - static int pre_alarm_count; - static PreAlarmData pre_alarm_data[MAX_PRE_ALARM_FRAMES]; + static int pre_alarm_count; + static PreAlarmData pre_alarm_data[MAX_PRE_ALARM_FRAMES]; protected: - unsigned int id; - Monitor *monitor; - struct timeval start_time; - struct timeval end_time; - std::string cause; - StringSetMap noteSetMap; - bool videoEvent; - int frames; - int alarm_frames; - unsigned int tot_score; - unsigned int max_score; - char path[PATH_MAX]; - VideoWriter* videowriter; - FILE* timecodes_fd; - char video_name[PATH_MAX]; - char video_file[PATH_MAX]; - char timecodes_name[PATH_MAX]; - char timecodes_file[PATH_MAX]; + unsigned int id; + Monitor *monitor; + struct timeval start_time; + struct timeval end_time; + std::string cause; + StringSetMap noteSetMap; + bool videoEvent; + int frames; + int alarm_frames; + unsigned int tot_score; + unsigned int max_score; + char path[PATH_MAX]; + VideoWriter* videowriter; + FILE* timecodes_fd; + char video_name[PATH_MAX]; + char video_file[PATH_MAX]; + char timecodes_name[PATH_MAX]; + char timecodes_file[PATH_MAX]; protected: - int last_db_frame; + int last_db_frame; protected: - static void Initialise() - { - if ( initialised ) - return; + static void Initialise() { + if ( initialised ) + return; - snprintf( capture_file_format, sizeof(capture_file_format), "%%s/%%0%dd-capture.jpg", config.event_image_digits ); - snprintf( analyse_file_format, sizeof(analyse_file_format), "%%s/%%0%dd-analyse.jpg", config.event_image_digits ); - snprintf( general_file_format, sizeof(general_file_format), "%%s/%%0%dd-%%s", config.event_image_digits ); - snprintf( video_file_format, sizeof(video_file_format), "%%s/%%s"); + snprintf( capture_file_format, sizeof(capture_file_format), "%%s/%%0%dd-capture.jpg", config.event_image_digits ); + snprintf( analyse_file_format, sizeof(analyse_file_format), "%%s/%%0%dd-analyse.jpg", config.event_image_digits ); + snprintf( general_file_format, sizeof(general_file_format), "%%s/%%0%dd-%%s", config.event_image_digits ); + snprintf( video_file_format, sizeof(video_file_format), "%%s/%%s"); - initialised = true; - } + initialised = true; + } - void createNotes( std::string ¬es ); + void createNotes( std::string ¬es ); public: - static bool OpenFrameSocket( int ); - static bool ValidateFrameSocket( int ); + static bool OpenFrameSocket( int ); + static bool ValidateFrameSocket( int ); public: - Event( Monitor *p_monitor, struct timeval p_start_time, const std::string &p_cause, const StringSetMap &p_noteSetMap, bool p_videoEvent=false ); - ~Event(); + Event( Monitor *p_monitor, struct timeval p_start_time, const std::string &p_cause, const StringSetMap &p_noteSetMap, bool p_videoEvent=false ); + ~Event(); - int Id() const { return( id ); } - const std::string &Cause() { return( cause ); } - int Frames() const { return( frames ); } - int AlarmFrames() const { return( alarm_frames ); } + int Id() const { return( id ); } + const std::string &Cause() { return( cause ); } + int Frames() const { return( frames ); } + int AlarmFrames() const { return( alarm_frames ); } - const struct timeval &StartTime() const { return( start_time ); } - const struct timeval &EndTime() const { return( end_time ); } - struct timeval &EndTime() { return( end_time ); } + const struct timeval &StartTime() const { return( start_time ); } + const struct timeval &EndTime() const { return( end_time ); } + struct timeval &EndTime() { return( end_time ); } - bool SendFrameImage( const Image *image, bool alarm_frame=false ); - bool WriteFrameImage( Image *image, struct timeval timestamp, const char *event_file, bool alarm_frame=false ); - bool WriteFrameVideo( const Image *image, const struct timeval timestamp, VideoWriter* videow ); + bool SendFrameImage( const Image *image, bool alarm_frame=false ); + bool WriteFrameImage( Image *image, struct timeval timestamp, const char *event_file, bool alarm_frame=false ); + bool WriteFrameVideo( const Image *image, const struct timeval timestamp, VideoWriter* videow ); - void updateNotes( const StringSetMap &stringSetMap ); + void updateNotes( const StringSetMap &stringSetMap ); - void AddFrames( int n_frames, Image **images, struct timeval **timestamps ); - void AddFrame( Image *image, struct timeval timestamp, int score=0, Image *alarm_frame=NULL ); + void AddFrames( int n_frames, Image **images, struct timeval **timestamps ); + void AddFrame( Image *image, struct timeval timestamp, int score=0, Image *alarm_frame=NULL ); private: - void AddFramesInternal( int n_frames, int start_frame, Image **images, struct timeval **timestamps ); + void AddFramesInternal( int n_frames, int start_frame, Image **images, struct timeval **timestamps ); public: - static const char *getSubPath( struct tm *time ) - { - static char subpath[PATH_MAX] = ""; - snprintf( subpath, sizeof(subpath), "%02d/%02d/%02d/%02d/%02d/%02d", time->tm_year-100, time->tm_mon+1, time->tm_mday, time->tm_hour, time->tm_min, time->tm_sec ); - return( subpath ); - } - static const char *getSubPath( time_t *time ) - { - return( Event::getSubPath( localtime( time ) ) ); - } + static const char *getSubPath( struct tm *time ) { + static char subpath[PATH_MAX] = ""; + snprintf( subpath, sizeof(subpath), "%02d/%02d/%02d/%02d/%02d/%02d", time->tm_year-100, time->tm_mon+1, time->tm_mday, time->tm_hour, time->tm_min, time->tm_sec ); + return( subpath ); + } + static const char *getSubPath( time_t *time ) { + return( Event::getSubPath( localtime( time ) ) ); + } - char* getEventFile(void){ - return video_file; - } + char* getEventFile(void) { + return video_file; + } public: - static int PreAlarmCount() - { - return( pre_alarm_count ); - } - static void EmptyPreAlarmFrames() - { - if ( pre_alarm_count > 0 ) - { - for ( int i = 0; i < MAX_PRE_ALARM_FRAMES; i++ ) - { - delete pre_alarm_data[i].image; - delete pre_alarm_data[i].alarm_frame; + static int PreAlarmCount() { + return( pre_alarm_count ); + } + static void EmptyPreAlarmFrames() { + if ( pre_alarm_count > 0 ) { + for ( int i = 0; i < MAX_PRE_ALARM_FRAMES; i++ ) { + delete pre_alarm_data[i].image; + delete pre_alarm_data[i].alarm_frame; + } + memset( pre_alarm_data, 0, sizeof(pre_alarm_data) ); } - memset( pre_alarm_data, 0, sizeof(pre_alarm_data) ); + pre_alarm_count = 0; } - pre_alarm_count = 0; - } - static void AddPreAlarmFrame( Image *image, struct timeval timestamp, int score=0, Image *alarm_frame=NULL ) - { - pre_alarm_data[pre_alarm_count].image = new Image( *image ); - pre_alarm_data[pre_alarm_count].timestamp = timestamp; - pre_alarm_data[pre_alarm_count].score = score; - if ( alarm_frame ) - { - pre_alarm_data[pre_alarm_count].alarm_frame = new Image( *alarm_frame ); + static void AddPreAlarmFrame( Image *image, struct timeval timestamp, int score=0, Image *alarm_frame=NULL ) { + pre_alarm_data[pre_alarm_count].image = new Image( *image ); + pre_alarm_data[pre_alarm_count].timestamp = timestamp; + pre_alarm_data[pre_alarm_count].score = score; + if ( alarm_frame ) { + pre_alarm_data[pre_alarm_count].alarm_frame = new Image( *alarm_frame ); + } + pre_alarm_count++; } - pre_alarm_count++; - } - void SavePreAlarmFrames() - { - for ( int i = 0; i < pre_alarm_count; i++ ) - { - AddFrame( pre_alarm_data[i].image, pre_alarm_data[i].timestamp, pre_alarm_data[i].score, pre_alarm_data[i].alarm_frame ); + void SavePreAlarmFrames() { + for ( int i = 0; i < pre_alarm_count; i++ ) { + AddFrame( pre_alarm_data[i].image, pre_alarm_data[i].timestamp, pre_alarm_data[i].score, pre_alarm_data[i].alarm_frame ); + } + EmptyPreAlarmFrames(); } - EmptyPreAlarmFrames(); - } }; -class EventStream : public StreamBase -{ +class EventStream : public StreamBase { public: typedef enum { MODE_SINGLE, MODE_ALL, MODE_ALL_GAPLESS } StreamMode; @@ -216,8 +202,7 @@ class EventStream : public StreamBase bool in_db; }; - struct EventData - { + struct EventData { unsigned long event_id; unsigned long monitor_id; unsigned long storage_id; @@ -255,8 +240,7 @@ class EventStream : public StreamBase bool sendFrame( int delta_us ); public: - EventStream() - { + EventStream() { mode = DEFAULT_MODE; forceEventChange = false; @@ -266,18 +250,15 @@ class EventStream : public StreamBase event_data = 0; } - void setStreamStart( int init_event_id, unsigned int init_frame_id=0 ) - { + void setStreamStart( int init_event_id, unsigned int init_frame_id=0 ) { loadInitialEventData( init_event_id, init_frame_id ); loadMonitor( event_data->monitor_id ); } - void setStreamStart( int monitor_id, time_t event_time ) - { + void setStreamStart( int monitor_id, time_t event_time ) { loadInitialEventData( monitor_id, event_time ); loadMonitor( monitor_id ); } - void setStreamMode( StreamMode p_mode ) - { + void setStreamMode( StreamMode p_mode ) { mode = p_mode; } void runStream(); diff --git a/src/zm_ffmpeg.cpp b/src/zm_ffmpeg.cpp index 2c4356abc..ac6cd60bd 100644 --- a/src/zm_ffmpeg.cpp +++ b/src/zm_ffmpeg.cpp @@ -200,230 +200,246 @@ int SWScale::Convert(const uint8_t* in_buffer, const size_t in_buffer_size, uint (uint8_t*)in_buffer, in_pf, width, height, 1) <= 0) { #else - if(avpicture_fill( (AVPicture*)input_avframe, (uint8_t*)in_buffer, - in_pf, width, height ) <= 0) - { + if(avpicture_fill( (AVPicture*)input_avframe, (uint8_t*)in_buffer, + in_pf, width, height ) <= 0) + { #endif - Error("Failed filling input frame with input buffer"); - return -7; - } - - if(!avpicture_fill( (AVPicture*)output_avframe, out_buffer, out_pf, width, height ) ) { - Error("Failed filling output frame with output buffer"); - return -8; - } - - /* Do the conversion */ - if(!sws_scale(swscale_ctx, input_avframe->data, input_avframe->linesize, 0, height, output_avframe->data, output_avframe->linesize ) ) { - Error("swscale conversion failed"); - return -10; - } - - return 0; + Error("Failed filling input frame with input buffer"); + return -7; } - int SWScale::Convert(const Image* img, uint8_t* out_buffer, const size_t out_buffer_size, enum _AVPIXELFORMAT in_pf, enum _AVPIXELFORMAT out_pf, unsigned int width, unsigned int height) { - if(img->Width() != width) { - Error("Source image width differs. Source: %d Output: %d",img->Width(), width); - return -12; - } - - if(img->Height() != height) { - Error("Source image height differs. Source: %d Output: %d",img->Height(), height); - return -13; - } - - return Convert(img->Buffer(),img->Size(),out_buffer,out_buffer_size,in_pf,out_pf,width,height); + if(!avpicture_fill( (AVPicture*)output_avframe, out_buffer, out_pf, width, height ) ) { + Error("Failed filling output frame with output buffer"); + return -8; } - int SWScale::ConvertDefaults(const Image* img, uint8_t* out_buffer, const size_t out_buffer_size) { - - if(!gotdefaults) { - Error("Defaults are not set"); - return -24; - } - - return Convert(img,out_buffer,out_buffer_size,default_input_pf,default_output_pf,default_width,default_height); + /* Do the conversion */ + if(!sws_scale(swscale_ctx, input_avframe->data, input_avframe->linesize, 0, height, output_avframe->data, output_avframe->linesize ) ) { + Error("swscale conversion failed"); + return -10; } - int SWScale::ConvertDefaults(const uint8_t* in_buffer, const size_t in_buffer_size, uint8_t* out_buffer, const size_t out_buffer_size) { + return 0; +} - if(!gotdefaults) { - Error("Defaults are not set"); - return -24; - } - - return Convert(in_buffer,in_buffer_size,out_buffer,out_buffer_size,default_input_pf,default_output_pf,default_width,default_height); +int SWScale::Convert(const Image* img, uint8_t* out_buffer, const size_t out_buffer_size, enum _AVPIXELFORMAT in_pf, enum _AVPIXELFORMAT out_pf, unsigned int width, unsigned int height) { + if(img->Width() != width) { + Error("Source image width differs. Source: %d Output: %d",img->Width(), width); + return -12; } + + if(img->Height() != height) { + Error("Source image height differs. Source: %d Output: %d",img->Height(), height); + return -13; + } + + return Convert(img->Buffer(),img->Size(),out_buffer,out_buffer_size,in_pf,out_pf,width,height); +} + +int SWScale::ConvertDefaults(const Image* img, uint8_t* out_buffer, const size_t out_buffer_size) { + + if(!gotdefaults) { + Error("Defaults are not set"); + return -24; + } + + return Convert(img,out_buffer,out_buffer_size,default_input_pf,default_output_pf,default_width,default_height); +} + +int SWScale::ConvertDefaults(const uint8_t* in_buffer, const size_t in_buffer_size, uint8_t* out_buffer, const size_t out_buffer_size) { + + if(!gotdefaults) { + Error("Defaults are not set"); + return -24; + } + + return Convert(in_buffer,in_buffer_size,out_buffer,out_buffer_size,default_input_pf,default_output_pf,default_width,default_height); +} #endif // HAVE_LIBSWSCALE && HAVE_LIBAVUTIL #endif // HAVE_LIBAVCODEC || HAVE_LIBAVUTIL || HAVE_LIBSWSCALE #if HAVE_LIBAVUTIL - int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, AVRational out_tb){ - int64_t a, b, this_thing; +int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, AVRational out_tb){ + int64_t a, b, this_thing; - av_assert0(in_ts != AV_NOPTS_VALUE); - av_assert0(duration >= 0); + av_assert0(in_ts != AV_NOPTS_VALUE); + av_assert0(duration >= 0); - if (*last == AV_NOPTS_VALUE || !duration || in_tb.num*(int64_t)out_tb.den <= out_tb.num*(int64_t)in_tb.den) { + if (*last == AV_NOPTS_VALUE || !duration || in_tb.num*(int64_t)out_tb.den <= out_tb.num*(int64_t)in_tb.den) { simple_round: - *last = av_rescale_q(in_ts, in_tb, fs_tb) + duration; - return av_rescale_q(in_ts, in_tb, out_tb); - } - - a = av_rescale_q_rnd(2*in_ts-1, in_tb, fs_tb, AV_ROUND_DOWN) >>1; - b = (av_rescale_q_rnd(2*in_ts+1, in_tb, fs_tb, AV_ROUND_UP )+1)>>1; - if (*last < 2*a - b || *last > 2*b - a) - goto simple_round; - - this_thing = av_clip64(*last, a, b); - *last = this_thing + duration; - - return av_rescale_q(this_thing, fs_tb, out_tb); + *last = av_rescale_q(in_ts, in_tb, fs_tb) + duration; + return av_rescale_q(in_ts, in_tb, out_tb); } + + a = av_rescale_q_rnd(2*in_ts-1, in_tb, fs_tb, AV_ROUND_DOWN) >>1; + b = (av_rescale_q_rnd(2*in_ts+1, in_tb, fs_tb, AV_ROUND_UP )+1)>>1; + if (*last < 2*a - b || *last > 2*b - a) + goto simple_round; + + this_thing = av_clip64(*last, a, b); + *last = this_thing + duration; + + return av_rescale_q(this_thing, fs_tb, out_tb); +} #endif - int hacked_up_context2_for_older_ffmpeg(AVFormatContext **avctx, AVOutputFormat *oformat, const char *format, const char *filename) { - AVFormatContext *s = avformat_alloc_context(); - int ret = 0; +int hacked_up_context2_for_older_ffmpeg(AVFormatContext **avctx, AVOutputFormat *oformat, const char *format, const char *filename) { + AVFormatContext *s = avformat_alloc_context(); + int ret = 0; - *avctx = NULL; - if (!s) { - av_log(s, AV_LOG_ERROR, "Out of memory\n"); - ret = AVERROR(ENOMEM); - return ret; + *avctx = NULL; + if (!s) { + av_log(s, AV_LOG_ERROR, "Out of memory\n"); + ret = AVERROR(ENOMEM); + return ret; + } + + if (!oformat) { + if (format) { + oformat = av_guess_format(format, NULL, NULL); + if (!oformat) { + av_log(s, AV_LOG_ERROR, "Requested output format '%s' is not a suitable output format\n", format); + ret = AVERROR(EINVAL); + } + } else { + oformat = av_guess_format(NULL, filename, NULL); + if (!oformat) { + ret = AVERROR(EINVAL); + av_log(s, AV_LOG_ERROR, "Unable to find a suitable output format for '%s'\n", filename); + } } + } - if (!oformat) { - if (format) { - oformat = av_guess_format(format, NULL, NULL); - if (!oformat) { - av_log(s, AV_LOG_ERROR, "Requested output format '%s' is not a suitable output format\n", format); - ret = AVERROR(EINVAL); + if (!oformat) { + if (format) { + oformat = av_guess_format(format, NULL, NULL); + if (!oformat) { + av_log(s, AV_LOG_ERROR, "Requested output format '%s' is not a suitable output format\n", format); + ret = AVERROR(EINVAL); + } + } else { + oformat = av_guess_format(NULL, filename, NULL); + if (!oformat) { + ret = AVERROR(EINVAL); + av_log(s, AV_LOG_ERROR, "Unable to find a suitable output format for '%s'\n", filename); + } + } + } + + if (ret) { + avformat_free_context(s); + return ret; + } else { + s->oformat = oformat; + if (s->oformat->priv_data_size > 0) { + s->priv_data = av_mallocz(s->oformat->priv_data_size); + if (s->priv_data) { + if (s->oformat->priv_class) { + *(const AVClass**)s->priv_data= s->oformat->priv_class; + av_opt_set_defaults(s->priv_data); } } else { - oformat = av_guess_format(NULL, filename, NULL); - if (!oformat) { - ret = AVERROR(EINVAL); - av_log(s, AV_LOG_ERROR, "Unable to find a suitable output format for '%s'\n", filename); - } + av_log(s, AV_LOG_ERROR, "Out of memory\n"); + ret = AVERROR(ENOMEM); + return ret; } + s->priv_data = NULL; } - if (ret) { - avformat_free_context(s); - return ret; - } else { - s->oformat = oformat; - if (s->oformat->priv_data_size > 0) { - s->priv_data = av_mallocz(s->oformat->priv_data_size); - if (s->priv_data) { - if (s->oformat->priv_class) { - *(const AVClass**)s->priv_data= s->oformat->priv_class; - av_opt_set_defaults(s->priv_data); - } - } else { - av_log(s, AV_LOG_ERROR, "Out of memory\n"); - ret = AVERROR(ENOMEM); - return ret; - } - s->priv_data = NULL; - } + if (filename) strncpy(s->filename, filename, sizeof(s->filename)); + *avctx = s; + return 0; + } +} - if (filename) strncpy(s->filename, filename, sizeof(s->filename)); - *avctx = s; - return 0; - } +static void zm_log_fps(double d, const char *postfix) +{ + uint64_t v = lrintf(d * 100); + if (!v) { + Debug(3, "%1.4f %s", d, postfix); + } else if (v % 100) { + Debug(3, "%3.2f %s", d, postfix); + } else if (v % (100 * 1000)) { + Debug(3, "%1.0f %s", d, postfix); + } else + Debug(3, "%1.0fk %s", d / 1000, postfix); +} + +/* "user interface" functions */ +void zm_dump_stream_format(AVFormatContext *ic, int i, int index, int is_output) { + char buf[256]; + int flags = (is_output ? ic->oformat->flags : ic->iformat->flags); + AVStream *st = ic->streams[i]; + AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); + + avcodec_string(buf, sizeof(buf), st->codec, is_output); + Debug(3, " Stream #%d:%d", index, i); + + /* the pid is an important information, so we display it */ + /* XXX: add a generic system */ + if (flags & AVFMT_SHOW_IDS) + Debug(3, "[0x%x]", st->id); + if (lang) + Debug(3, "(%s)", lang->value); + av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", st->codec_info_nb_frames, + st->time_base.num, st->time_base.den); + Debug(3, ": %s", buf); + + if (st->sample_aspect_ratio.num && // default + av_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio)) { + AVRational display_aspect_ratio; + av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, + st->codec->width * (int64_t)st->sample_aspect_ratio.num, + st->codec->height * (int64_t)st->sample_aspect_ratio.den, + 1024 * 1024); + Debug(3, ", SAR %d:%d DAR %d:%d", + st->sample_aspect_ratio.num, st->sample_aspect_ratio.den, + display_aspect_ratio.num, display_aspect_ratio.den); } - static void zm_log_fps(double d, const char *postfix) - { - uint64_t v = lrintf(d * 100); - if (!v) { - Debug(3, "%1.4f %s", d, postfix); - } else if (v % 100) { - Debug(3, "%3.2f %s", d, postfix); - } else if (v % (100 * 1000)) { - Debug(3, "%1.0f %s", d, postfix); - } else - Debug(3, "%1.0fk %s", d / 1000, postfix); + if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { + int fps = st->avg_frame_rate.den && st->avg_frame_rate.num; + int tbr = st->r_frame_rate.den && st->r_frame_rate.num; + int tbn = st->time_base.den && st->time_base.num; + int tbc = st->codec->time_base.den && st->codec->time_base.num; + + if (fps || tbr || tbn || tbc) + Debug(3, "\n" ); + + if (fps) + zm_log_fps(av_q2d(st->avg_frame_rate), tbr || tbn || tbc ? "fps, " : "fps"); + if (tbr) + zm_log_fps(av_q2d(st->r_frame_rate), tbn || tbc ? "tbr, " : "tbr"); + if (tbn) + zm_log_fps(1 / av_q2d(st->time_base), tbc ? "tbn, " : "tbn"); + if (tbc) + zm_log_fps(1 / av_q2d(st->codec->time_base), "tbc"); } - /* "user interface" functions */ - void zm_dump_stream_format(AVFormatContext *ic, int i, int index, int is_output) { - char buf[256]; - int flags = (is_output ? ic->oformat->flags : ic->iformat->flags); - AVStream *st = ic->streams[i]; - AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); + if (st->disposition & AV_DISPOSITION_DEFAULT) + Debug(3, " (default)"); + if (st->disposition & AV_DISPOSITION_DUB) + Debug(3, " (dub)"); + if (st->disposition & AV_DISPOSITION_ORIGINAL) + Debug(3, " (original)"); + if (st->disposition & AV_DISPOSITION_COMMENT) + Debug(3, " (comment)"); + if (st->disposition & AV_DISPOSITION_LYRICS) + Debug(3, " (lyrics)"); + if (st->disposition & AV_DISPOSITION_KARAOKE) + Debug(3, " (karaoke)"); + if (st->disposition & AV_DISPOSITION_FORCED) + Debug(3, " (forced)"); + if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) + Debug(3, " (hearing impaired)"); + if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) + Debug(3, " (visual impaired)"); + if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS) + Debug(3, " (clean effects)"); + Debug(3, "\n"); - avcodec_string(buf, sizeof(buf), st->codec, is_output); - Debug(3, " Stream #%d:%d", index, i); + //dump_metadata(NULL, st->metadata, " "); - /* the pid is an important information, so we display it */ - /* XXX: add a generic system */ - if (flags & AVFMT_SHOW_IDS) - Debug(3, "[0x%x]", st->id); - if (lang) - Debug(3, "(%s)", lang->value); - av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", st->codec_info_nb_frames, - st->time_base.num, st->time_base.den); - Debug(3, ": %s", buf); - - if (st->sample_aspect_ratio.num && // default - av_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio)) { - AVRational display_aspect_ratio; - av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, - st->codec->width * (int64_t)st->sample_aspect_ratio.num, - st->codec->height * (int64_t)st->sample_aspect_ratio.den, - 1024 * 1024); - Debug(3, ", SAR %d:%d DAR %d:%d", - st->sample_aspect_ratio.num, st->sample_aspect_ratio.den, - display_aspect_ratio.num, display_aspect_ratio.den); - } - - if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { - int fps = st->avg_frame_rate.den && st->avg_frame_rate.num; - int tbr = st->r_frame_rate.den && st->r_frame_rate.num; - int tbn = st->time_base.den && st->time_base.num; - int tbc = st->codec->time_base.den && st->codec->time_base.num; - - if (fps || tbr || tbn || tbc) - Debug(3, "\n" ); - - if (fps) - zm_log_fps(av_q2d(st->avg_frame_rate), tbr || tbn || tbc ? "fps, " : "fps"); - if (tbr) - zm_log_fps(av_q2d(st->r_frame_rate), tbn || tbc ? "tbr, " : "tbr"); - if (tbn) - zm_log_fps(1 / av_q2d(st->time_base), tbc ? "tbn, " : "tbn"); - if (tbc) - zm_log_fps(1 / av_q2d(st->codec->time_base), "tbc"); - } - - if (st->disposition & AV_DISPOSITION_DEFAULT) - Debug(3, " (default)"); - if (st->disposition & AV_DISPOSITION_DUB) - Debug(3, " (dub)"); - if (st->disposition & AV_DISPOSITION_ORIGINAL) - Debug(3, " (original)"); - if (st->disposition & AV_DISPOSITION_COMMENT) - Debug(3, " (comment)"); - if (st->disposition & AV_DISPOSITION_LYRICS) - Debug(3, " (lyrics)"); - if (st->disposition & AV_DISPOSITION_KARAOKE) - Debug(3, " (karaoke)"); - if (st->disposition & AV_DISPOSITION_FORCED) - Debug(3, " (forced)"); - if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) - Debug(3, " (hearing impaired)"); - if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) - Debug(3, " (visual impaired)"); - if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS) - Debug(3, " (clean effects)"); - Debug(3, "\n"); - - //dump_metadata(NULL, st->metadata, " "); - - //dump_sidedata(NULL, st, " "); - } + //dump_sidedata(NULL, st, " "); +} diff --git a/src/zm_ffmpeg_camera.cpp b/src/zm_ffmpeg_camera.cpp index f6553296d..e270eadd3 100644 --- a/src/zm_ffmpeg_camera.cpp +++ b/src/zm_ffmpeg_camera.cpp @@ -63,7 +63,7 @@ FfmpegCamera::FfmpegCamera( int p_id, const std::string &p_path, const std::stri wasRecording = false; videoStore = NULL; -#if HAVE_LIBSWSCALE +#if HAVE_LIBSWSCALE mConvertContext = NULL; #endif /* Has to be located inside the constructor so other components such as zma will receive correct colours and subpixel order */ @@ -274,9 +274,7 @@ int FfmpegCamera::OpenFfmpeg() { Warning( "Error trying to set option %d '%s' to '%s'", i, parts[0].c_str(), parts[1].c_str() ); } - } - else - { + } else { Warning( "Unable to parse ffmpeg option %d '%s', expecting key=value", i, opVect[i].c_str() ); } } @@ -356,7 +354,7 @@ int FfmpegCamera::OpenFfmpeg() { if ( mVideoStreamId == -1 ) Fatal( "Unable to locate video stream in %s", mPath.c_str() ); if ( mAudioStreamId == -1 ) - Debug( 2, "Unable to locate audio stream in %s", mPath.c_str() ); + Debug( 3, "Unable to locate audio stream in %s", mPath.c_str() ); Debug ( 3, "Found video stream at index %d", mVideoStreamId ); Debug ( 3, "Found audio stream at index %d", mAudioStreamId ); @@ -523,12 +521,11 @@ void *FfmpegCamera::ReopenFfmpegThreadCallback(void *ctx){ } //Function to handle capture and store -int FfmpegCamera::CaptureAndRecord( Image &image, bool recording, char* event_file ) -{ +int FfmpegCamera::CaptureAndRecord( Image &image, bool recording, char* event_file ) { if (!mCanCapture){ return -1; } - + // If the reopen thread has a value, but mCanCapture != 0, then we have just reopened the connection to the ffmpeg device, and we can clean up the thread. if (mReopenThread != 0) { void *retval = 0; @@ -568,9 +565,9 @@ int FfmpegCamera::CaptureAndRecord( Image &image, bool recording, char* event_fi (avResult == AVERROR_EOF || (mFormatContext->pb && mFormatContext->pb->eof_reached)) || // Check for Connection failure. (avResult == -110) - ) { - Info( "av_read_frame returned \"%s\". Reopening stream.", errbuf); - ReopenFfmpeg(); + ) { + Info( "av_read_frame returned \"%s\". Reopening stream.", errbuf); + ReopenFfmpeg(); } Error( "Unable to read packet from stream %d: error %d \"%s\".", packet.stream_index, avResult, errbuf ); @@ -581,9 +578,9 @@ int FfmpegCamera::CaptureAndRecord( Image &image, bool recording, char* event_fi #if LIBAVCODEC_VERSION_CHECK(52, 23, 0, 23, 0) if ( avcodec_decode_video2( mCodecContext, mRawFrame, &frameComplete, &packet ) < 0 ) #else - if ( avcodec_decode_video( mCodecContext, mRawFrame, &frameComplete, packet.data, packet.size ) < 0 ) + if ( avcodec_decode_video( mCodecContext, mRawFrame, &frameComplete, packet.data, packet.size ) < 0 ) #endif - Fatal( "Unable to decode frame at frame %d", frameCount ); + Fatal( "Unable to decode frame at frame %d", frameCount ); Debug( 4, "Decoded video packet at frame %d", frameCount ); diff --git a/src/zm_ffmpeg_camera.h b/src/zm_ffmpeg_camera.h index b203a4d12..745485f9a 100644 --- a/src/zm_ffmpeg_camera.h +++ b/src/zm_ffmpeg_camera.h @@ -41,6 +41,7 @@ class FfmpegCamera : public Camera int frameCount; #if HAVE_LIBAVFORMAT +<<<<<<< HEAD AVFormatContext *mFormatContext; int mVideoStreamId; int mAudioStreamId; diff --git a/src/zm_local_camera.cpp b/src/zm_local_camera.cpp index c955c52de..554ddcd46 100644 --- a/src/zm_local_camera.cpp +++ b/src/zm_local_camera.cpp @@ -287,25 +287,25 @@ AVFrame **LocalCamera::capturePictures = 0; LocalCamera *LocalCamera::last_camera = NULL; LocalCamera::LocalCamera( - int p_id, - const std::string &p_device, - int p_channel, - int p_standard, - bool p_v4l_multi_buffer, - unsigned int p_v4l_captures_per_frame, - const std::string &p_method, - int p_width, - int p_height, - int p_colours, - int p_palette, - int p_brightness, - int p_contrast, - int p_hue, - int p_colour, - bool p_capture, - bool p_record_audio, - unsigned int p_extras) : - Camera( p_id, LOCAL_SRC, p_width, p_height, p_colours, ZM_SUBPIX_ORDER_DEFAULT_FOR_COLOUR(p_colours), p_brightness, p_contrast, p_hue, p_colour, p_capture, p_record_audio ), + int p_id, + const std::string &p_device, + int p_channel, + int p_standard, + bool p_v4l_multi_buffer, + unsigned int p_v4l_captures_per_frame, + const std::string &p_method, + int p_width, + int p_height, + int p_colours, + int p_palette, + int p_brightness, + int p_contrast, + int p_hue, + int p_colour, + bool p_capture, + bool p_record_audio, + unsigned int p_extras) : + Camera( p_id, LOCAL_SRC, p_width, p_height, p_colours, ZM_SUBPIX_ORDER_DEFAULT_FOR_COLOUR(p_colours), p_brightness, p_contrast, p_hue, p_colour, p_capture, p_record_audio ), device( p_device ), channel( p_channel ), standard( p_standard ), diff --git a/src/zm_local_camera.h b/src/zm_local_camera.h index d41f8f44d..6c8ffb266 100644 --- a/src/zm_local_camera.h +++ b/src/zm_local_camera.h @@ -36,6 +36,11 @@ #include #endif // HAVE_LINUX_VIDEODEV2_H +// Required on systems with v4l1 but without v4l2 headers +#ifndef VIDEO_MAX_FRAME +#define VIDEO_MAX_FRAME 32 +#endif + #include "zm_ffmpeg.h" // diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 1d23ac336..8ece6fe97 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -75,7 +75,12 @@ std::vector split(const std::string &s, char delim) { +<<<<<<< HEAD Monitor::MonitorLink::MonitorLink( int p_id, const char *p_name ) : id( p_id ) { +======= +Monitor::MonitorLink::MonitorLink( int p_id, const char *p_name ) : id( p_id ) +{ +>>>>>>> feature-h264-videostorage strncpy( name, p_name, sizeof(name) ); #if ZM_MEM_MAPPED @@ -232,7 +237,12 @@ bool Monitor::MonitorLink::inAlarm() { bool Monitor::MonitorLink::hasAlarmed() { +<<<<<<< HEAD if ( shared_data->state == ALARM ) { +======= + if ( shared_data->state == ALARM ) + { +>>>>>>> feature-h264-videostorage return( true ); } else if ( shared_data->last_event != (unsigned int)last_event ) { last_event = shared_data->last_event; @@ -1303,10 +1313,10 @@ bool Monitor::Analyse() if ( read_margin < 0 ) read_margin += image_buffer_count; int step = 1; - // Isn't read_margin always > 0 here? + // Isn't read_margin always > 0 here? if ( read_margin > 0 ) { - // TODO explain this so... 90% of image buffer / 50% of read margin? + // TODO explain this so... 90% of image buffer / 50% of read margin? step = (9*image_buffer_count)/(5*read_margin); } @@ -1401,10 +1411,11 @@ bool Monitor::Analyse() { bool signal = shared_data->signal; bool signal_change = (signal != last_signal); - Debug(3, "Motion detection is enabled signal(%d) signal_change(%d)", signal, signal_change); + + Debug(3, "Motion detection is enabled signal(%d) signal_change(%d)", signal, signal_change); //Set video recording flag for event start constructor and easy reference in code - // TODO: Use enum instead of the # 2. Makes for easier reading + // TODO: Use enum instead of the # 2. Makes for easier reading bool videoRecording = ((GetOptVideoWriter() == 2) && camera->SupportsNativeVideo()); if ( trigger_data->trigger_state != TRIGGER_OFF ) @@ -1561,7 +1572,7 @@ bool Monitor::Analyse() //set up video store data snprintf(video_store_data->event_file, sizeof(video_store_data->event_file), "%s", event->getEventFile()); video_store_data->recording = true; - + Info( "%s: %03d - Opening new event %d, section start", name, image_count, event->Id() ); /* To prevent cancelling out an existing alert\prealarm\alarm state */ @@ -2326,7 +2337,7 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c int videowriter = atoi(dbrow[col]); col++; std::string encoderparams = dbrow[col]; col++; bool record_audio = (*dbrow[col] != '0'); col++; - + int brightness = atoi(dbrow[col]); col++; int contrast = atoi(dbrow[col]); col++; int hue = atoi(dbrow[col]); col++; @@ -4412,14 +4423,14 @@ void Monitor::SingleImageZip( int scale) fwrite( img_buffer, img_buffer_size, 1, stdout ); } unsigned int Monitor::Colours() const { return( camera->Colours() ); } - unsigned int Monitor::SubpixelOrder() const { return( camera->SubpixelOrder() ); } - int Monitor::PrimeCapture() { - return( camera->PrimeCapture() ); - } - int Monitor::PreCapture() { - return( camera->PreCapture() ); - } - int Monitor::PostCapture() { - return( camera->PostCapture() ); - } - Monitor::Orientation Monitor::getOrientation()const { return orientation; } +unsigned int Monitor::SubpixelOrder() const { return( camera->SubpixelOrder() ); } +int Monitor::PrimeCapture() { + return( camera->PrimeCapture() ); +} +int Monitor::PreCapture() { + return( camera->PreCapture() ); +} +int Monitor::PostCapture() { + return( camera->PostCapture() ); +} +Monitor::Orientation Monitor::getOrientation()const { return orientation; } diff --git a/src/zm_monitor.h b/src/zm_monitor.h index 3f2fbad85..61687b8d9 100644 --- a/src/zm_monitor.h +++ b/src/zm_monitor.h @@ -505,9 +505,9 @@ public: class MonitorStream : public StreamBase { protected: typedef struct SwapImage { - bool valid; + bool valid; struct timeval timestamp; - char file_name[PATH_MAX]; + char file_name[PATH_MAX]; } SwapImage; private: diff --git a/src/zm_remote_camera.cpp b/src/zm_remote_camera.cpp index 388607f6b..b162204fd 100644 --- a/src/zm_remote_camera.cpp +++ b/src/zm_remote_camera.cpp @@ -22,20 +22,20 @@ #include "zm_utils.h" RemoteCamera::RemoteCamera( - int p_id, - const std::string &p_protocol, - const std::string &p_host, - const std::string &p_port, - 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, - bool p_record_audio + int p_id, + const std::string &p_protocol, + const std::string &p_host, + const std::string &p_port, + 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, + bool p_record_audio ) : Camera( p_id, REMOTE_SRC, p_width, p_height, p_colours, ZM_SUBPIX_ORDER_DEFAULT_FOR_COLOUR(p_colours), p_brightness, p_contrast, p_hue, p_colour, p_capture, p_record_audio ), protocol( p_protocol ), diff --git a/src/zm_remote_camera_http.cpp b/src/zm_remote_camera_http.cpp index 3a6b5a57d..101de92f0 100644 --- a/src/zm_remote_camera_http.cpp +++ b/src/zm_remote_camera_http.cpp @@ -31,8 +31,35 @@ #include // FIONREAD and friends #endif -RemoteCameraHttp::RemoteCameraHttp( int p_id, const std::string &p_method, const std::string &p_host, const std::string &p_port, 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, bool p_record_audio ) : - RemoteCamera( p_id, "http", p_host, p_port, p_path, p_width, p_height, p_colours, p_brightness, p_contrast, p_hue, p_colour, p_capture, p_record_audio ) +RemoteCameraHttp::RemoteCameraHttp( + int p_id, + const std::string &p_method, + const std::string &p_host, + const std::string &p_port, + 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, + bool p_record_audio ) : + RemoteCamera( + p_id, + "http", + p_host, + p_port, + p_path, + p_width, + p_height, + p_colours, + p_brightness, + p_contrast, + p_hue, + p_colour, + p_capture, + p_record_audio ) { sd = -1; diff --git a/src/zm_remote_camera_rtsp.cpp b/src/zm_remote_camera_rtsp.cpp index 0f79c459b..e20473582 100644 --- a/src/zm_remote_camera_rtsp.cpp +++ b/src/zm_remote_camera_rtsp.cpp @@ -117,7 +117,7 @@ void RemoteCameraRtsp::Initialise() int max_size = width*height*colours; // This allocates a buffer able to hold a raw fframe, which is a little artbitrary. Might be nice to get some - // decent data on how large a buffer is really needed. I think in ffmpeg there are now some functions to do that. + // decent data on how large a buffer is really needed. I think in ffmpeg there are now some functions to do that. buffer.size( max_size ); if ( logDebugging() ) @@ -172,41 +172,41 @@ int RemoteCameraRtsp::PrimeCapture() // Find first video stream present mVideoStreamId = -1; - mAudioStreamId = -1; + mAudioStreamId = -1; // Find the first video stream. for ( unsigned int i = 0; i < mFormatContext->nb_streams; i++ ) { #if (LIBAVCODEC_VERSION_CHECK(52, 64, 0, 64, 0) || LIBAVUTIL_VERSION_CHECK(50, 14, 0, 14, 0)) - if ( mFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO ) + if ( mFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO ) #else - if ( mFormatContext->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO ) + if ( mFormatContext->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO ) #endif { - if ( mVideoStreamId == -1 ) { - mVideoStreamId = i; - continue; - } else { - Debug(2, "Have another video stream." ); - } + if ( mVideoStreamId == -1 ) { + mVideoStreamId = i; + continue; + } else { + Debug(2, "Have another video stream." ); + } } #if (LIBAVCODEC_VERSION_CHECK(52, 64, 0, 64, 0) || LIBAVUTIL_VERSION_CHECK(50, 14, 0, 14, 0)) - if ( mFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO ) + if ( mFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO ) #else - if ( mFormatContext->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO ) + if ( mFormatContext->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO ) #endif - { - if ( mAudioStreamId == -1 ) { - mAudioStreamId = i; - } else { - Debug(2, "Have another audio stream." ); - } - } - + { + if ( mAudioStreamId == -1 ) { + mAudioStreamId = i; + } else { + Debug(2, "Have another audio stream." ); + } } + } // end foreach stream + if ( mVideoStreamId == -1 ) Fatal( "Unable to locate video stream" ); - if ( mAudioStreamId == -1 ) - Debug( 3, "Unable to locate audio stream" ); + if ( mAudioStreamId == -1 ) + Debug( 3, "Unable to locate audio stream" ); // Get a pointer to the codec context for the video stream mCodecContext = mFormatContext->streams[mVideoStreamId]->codec; @@ -331,17 +331,17 @@ int RemoteCameraRtsp::Capture( Image &image ) { } av_init_packet( &packet ); - + while ( !frameComplete && buffer.size() > 0 ) { packet.data = buffer.head(); packet.size = buffer.size(); // So I think this is the magic decode step. Result is a raw image? - #if LIBAVCODEC_VERSION_CHECK(52, 23, 0, 23, 0) +#if LIBAVCODEC_VERSION_CHECK(52, 23, 0, 23, 0) int len = avcodec_decode_video2( mCodecContext, mRawFrame, &frameComplete, &packet ); - #else +#else int len = avcodec_decode_video( mCodecContext, mRawFrame, &frameComplete, packet.data, packet.size ); - #endif +#endif if ( len < 0 ) { Error( "Error while decoding frame %d", frameCount ); Hexdump( Logger::ERROR, buffer.head(), buffer.size()>256?256:buffer.size() ); @@ -350,8 +350,8 @@ int RemoteCameraRtsp::Capture( Image &image ) { } Debug( 2, "Frame: %d - %d/%d", frameCount, len, buffer.size() ); //if ( buffer.size() < 400 ) - //Hexdump( 0, buffer.head(), buffer.size() ); - + //Hexdump( 0, buffer.head(), buffer.size() ); + buffer -= len; } // At this point, we either have a frame or ran out of buffer. What happens if we run out of buffer? @@ -395,17 +395,6 @@ int RemoteCameraRtsp::Capture( Image &image ) { return (0) ; } -//int RemoteCameraRtsp::ReadData(void *opaque, uint8_t *buf, int bufSize) { - - //if ( buffer.size() > bufSize ) { - //buf = buffer.head(); - //buffer -= bufSize; - //} else { - //Error("Implement me"); - //return -1; - //} -//} - //Function to handle capture and store int RemoteCameraRtsp::CaptureAndRecord( Image &image, bool recording, char* event_file ) { AVPacket packet; @@ -457,7 +446,7 @@ int RemoteCameraRtsp::CaptureAndRecord( Image &image, bool recording, char* even av_init_packet( &packet ); // Why are we checking for it being the video stream? Because it might be audio or something else. - // Um... we just initialized packet... we can't be testing for what it is yet.... + // Um... we just initialized packet... we can't be testing for what it is yet.... if ( packet.stream_index == mVideoStreamId ) { while ( !frameComplete && buffer.size() > 0 ) { @@ -495,7 +484,7 @@ int RemoteCameraRtsp::CaptureAndRecord( Image &image, bool recording, char* even imagePixFormat, width, height); #endif - //Video recording + //Video recording if ( recording && !wasRecording ) { //Instantiate the video storage module @@ -533,7 +522,7 @@ int RemoteCameraRtsp::CaptureAndRecord( Image &image, bool recording, char* even } #if HAVE_LIBSWSCALE -// Why are we re-scaling after writing out the packet? + // Why are we re-scaling after writing out the packet? if(mConvertContext == NULL) { mConvertContext = sws_getContext( mCodecContext->width, mCodecContext->height, mCodecContext->pix_fmt, width, height, imagePixFormat, SWS_BICUBIC, NULL, NULL, NULL ); @@ -549,7 +538,7 @@ int RemoteCameraRtsp::CaptureAndRecord( Image &image, bool recording, char* even frameCount++; - } /* frame complete */ + } /* frame complete */ } else if ( packet.stream_index == mAudioStreamId ) { Debug( 4, "Got audio packet" ); if ( videoStore && recording ) { @@ -563,10 +552,8 @@ int RemoteCameraRtsp::CaptureAndRecord( Image &image, bool recording, char* even #else av_free_packet( &packet ); #endif - return 0; + return 0; } - } else { - Debug( 4, "Not storing audio" ); } } } // end if video or audio packet diff --git a/src/zm_videostore.cpp b/src/zm_videostore.cpp index dfcd27036..6b35404b5 100644 --- a/src/zm_videostore.cpp +++ b/src/zm_videostore.cpp @@ -33,11 +33,11 @@ extern "C"{ } VideoStore::VideoStore(const char *filename_in, const char *format_in, - AVStream *input_st, - AVStream *inpaud_st, - int64_t nStartTime, - Monitor::Orientation orientation -) { + AVStream *input_st, + AVStream *inpaud_st, + int64_t nStartTime, + Monitor::Orientation orientation + ) { AVDictionary *pmetadata = NULL; int dsr; @@ -96,6 +96,7 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, if (oc->oformat->flags & AVFMT_GLOBALHEADER) { video_st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER; } + if ( orientation ) { if ( orientation == Monitor::ROTATE_90 ) { dsr = av_dict_set( &video_st->metadata, "rotate", "90", 0); @@ -112,7 +113,6 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, } if (inpaud_st) { - audio_st = avformat_new_stream(oc, (AVCodec *)inpaud_st->codec->codec); if (!audio_st) { Error("Unable to create audio out stream\n"); @@ -222,6 +222,9 @@ void VideoStore::dumpPacket( AVPacket *pkt ){ int VideoStore::writeVideoFramePacket(AVPacket *ipkt, AVStream *input_st){//, AVPacket *lastKeyframePkt){ + Debug(3, "before ost_tbcket %d", startTime ); + zm_dump_stream_format( oc, ipkt->stream_index, 0, 1 ); + Debug(3, "before ost_tbcket %d", startTime ); int64_t ost_tb_start_time = av_rescale_q(startTime, AV_TIME_BASE_Q, video_st->time_base); AVPacket opkt, safepkt; @@ -285,7 +288,6 @@ int VideoStore::writeVideoFramePacket(AVPacket *ipkt, AVStream *input_st){//, AV } } - av_free_packet(&opkt); return 0; @@ -310,7 +312,6 @@ int VideoStore::writeAudioFramePacket(AVPacket *ipkt, AVStream *input_st){ av_init_packet(&opkt); Debug(3, "after init packet" ); - //Scale the PTS of the outgoing packet to be the correct time base if (ipkt->pts != AV_NOPTS_VALUE) { Debug(3, "Rescaling output pts"); diff --git a/version b/version index b0f33908d..ee0286daa 100644 --- a/version +++ b/version @@ -1 +1,5 @@ +<<<<<<< HEAD 1.30.3 +======= +1.30.0 +>>>>>>> feature-h264-videostorage diff --git a/web/ajax/log.php b/web/ajax/log.php index a250c952d..66dcfc2b5 100644 --- a/web/ajax/log.php +++ b/web/ajax/log.php @@ -394,7 +394,7 @@ tr.log-dbg td { } $exportFile = "zm-log.$exportExt"; - $exportPath = "temp/zm-log-$exportKey.$exportExt"; + $exportPath = ZM_PATH_SWAP."/zm-log-$exportKey.$exportExt"; header( "Pragma: public" ); header( "Expires: 0" ); diff --git a/web/includes/functions.php b/web/includes/functions.php index b9e089d9e..fc84ef217 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -962,13 +962,18 @@ function zmaCheck( $monitor ) { } function getImageSrc( $event, $frame, $scale=SCALE_BASE, $captureOnly=false, $overwrite=false ) { +<<<<<<< HEAD $Storage = new Storage( $event['StorageId'] ); $Event = new Event( $event ); $eventPath = $Event->Path(); +======= + $eventPath = getEventPath( $event ); +>>>>>>> feature-h264-videostorage if ( !is_array($frame) ) $frame = array( 'FrameId'=>$frame, 'Type'=>'' ); +<<<<<<< HEAD if ( file_exists( $eventPath.'/snapshot.jpg' ) ) { $captImage = "snapshot.jpg"; @@ -987,6 +992,21 @@ function getImageSrc( $event, $frame, $scale=SCALE_BASE, $captureOnly=false, $ov Error("Can't create frame images from video becuase there is no video file for this event (".$Event->DefaultVideo() ); } } +======= + if ( file_exists( $eventPath.'/snapshot.jpg' ) ) { + $captImage = "snapshot.jpg"; + } else { + $captImage = sprintf( "%0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg", $frame['FrameId'] ); + if ( ! file_exists( $eventPath.'/'.$captImage ) ) { + # Generate the frame JPG + if ( $event['DefaultVideo'] ) { + $command ='ffmpeg -v 0 -i '.$eventPath.'/'.$Event->DefaultVideo().' -vf "select=gte(n\\,'.$frame['FrameId'].'),setpts=PTS-STARTPTS" '.$eventPath.'/'.$captImage; + system( $command, $output, $retval ); + } else { + Error("Can't create frame images from video because there is no video file for this event " ); + } + } +>>>>>>> feature-h264-videostorage } $captPath = $eventPath.'/'.$captImage; @@ -1000,7 +1020,10 @@ function getImageSrc( $event, $frame, $scale=SCALE_BASE, $captureOnly=false, $ov $analImage = sprintf( "%0".ZM_EVENT_IMAGE_DIGITS."d-analyse.jpg", $frame['FrameId'] ); $analPath = $eventPath.'/'.$analImage; +<<<<<<< HEAD +======= +>>>>>>> feature-h264-videostorage $thumbAnalPath = ZM_DIR_IMAGES.'/'.$event['Id'].'-'.$analImage; //echo "AI:$analImage, AP:$analPath, TAP:$thumbAnalPath
"; @@ -1031,21 +1054,24 @@ function getImageSrc( $event, $frame, $scale=SCALE_BASE, $captureOnly=false, $ov $thumbPath = $thumbCaptPath; } +<<<<<<< HEAD $imageFile = $imagePath; +======= +>>>>>>> feature-h264-videostorage $thumbFile = $thumbPath; if ( $overwrite || !file_exists( $thumbFile ) || !filesize( $thumbFile ) ) { // Get new dimensions - list( $imageWidth, $imageHeight ) = getimagesize( $imageFile ); + list( $imageWidth, $imageHeight ) = getimagesize( $imagePath ); $thumbWidth = $imageWidth * $fraction; $thumbHeight = $imageHeight * $fraction; // Resample $thumbImage = imagecreatetruecolor( $thumbWidth, $thumbHeight ); - $image = imagecreatefromjpeg( $imageFile ); + $image = imagecreatefromjpeg( $imagePath ); imagecopyresampled( $thumbImage, $image, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imageWidth, $imageHeight ); - if ( !imagejpeg( $thumbImage, $thumbFile ) ) + if ( !imagejpeg( $thumbImage, $thumbPath ) ) Error( "Can't create thumbnail '$thumbPath'" ); } } @@ -1054,7 +1080,7 @@ function getImageSrc( $event, $frame, $scale=SCALE_BASE, $captureOnly=false, $ov 'eventPath' => $eventPath, 'imagePath' => $imagePath, 'thumbPath' => $thumbPath, - 'imageFile' => $imageFile, + 'imageFile' => $imagePath, 'thumbFile' => $thumbFile, 'imageClass' => $alarmFrame?"alarm":"normal", 'isAnalImage' => $isAnalImage, diff --git a/web/lang/cs_cz.php b/web/lang/cs_cz.php index b4f26145b..015b62921 100644 --- a/web/lang/cs_cz.php +++ b/web/lang/cs_cz.php @@ -71,60 +71,60 @@ // Simple String Replacements $SLANG = array( - '24BitColour' => '24 bit barevn', - '32BitColour' => '32 bit barevn', // Added - 2011-06-15 - '8BitGrey' => '8 bit ed kla', + '24BitColour' => '24 bit barevná', + '32BitColour' => '32 bit barevná', // Added - 2011-06-15 + '8BitGrey' => '8 bit šedá škála', 'Action' => 'Akce', - 'Actual' => 'Skuten', - 'AddNewControl' => 'Pidat nov zen', - 'AddNewMonitor' => 'Pidat kameru', - 'AddNewUser' => 'Pidat uivatele', - 'AddNewZone' => 'Pidat znu', + 'Actual' => 'Skutečná', + 'AddNewControl' => 'Přidat nové řízení', + 'AddNewMonitor' => 'Přidat kameru', + 'AddNewUser' => 'Přidat uživatele', + 'AddNewZone' => 'Přidat zónu', 'Alarm' => 'Alarm', - 'AlarmBrFrames' => 'Alarm
Snmky', - 'AlarmFrame' => 'Alarm snmek', - 'AlarmFrameCount' => 'Poet alarm snmk', + 'AlarmBrFrames' => 'Alarm
Snímky', + 'AlarmFrame' => 'Alarm snímek', + 'AlarmFrameCount' => 'Počet alarm snímků', 'AlarmLimits' => 'Limity alarmu', 'AlarmMaximumFPS' => 'Alarm Maximum FPS', 'AlarmPx' => 'Alarm Px', 'AlarmRGBUnset' => 'You must set an alarm RGB colour', 'AlarmRefImageBlendPct'=> 'Alarm Reference Image Blend %ge', // Added - 2015-04-18 'Alert' => 'Pozor', - 'All' => 'Vechny', + 'All' => 'Všechny', 'AnalysisFPS' => 'Analysis FPS', // Added - 2015-07-22 'AnalysisUpdateDelay' => 'Analysis Update Delay', // Added - 2015-07-23 - 'Apply' => 'Pout', - 'ApplyingStateChange' => 'Aplikuji zmnu stavu', - 'ArchArchived' => 'Pouze archivovan', - 'ArchUnarchived' => 'Pouze nearchivovan', + 'Apply' => 'Použít', + 'ApplyingStateChange' => 'Aplikuji změnu stavu', + 'ArchArchived' => 'Pouze archivované', + 'ArchUnarchived' => 'Pouze nearchivované', 'Archive' => 'Archiv', - 'Archived' => 'Archivovn', + 'Archived' => 'Archivován', 'Area' => 'Area', 'AreaUnits' => 'Area (px/%)', - 'AttrAlarmFrames' => 'Alarm snmky', + 'AttrAlarmFrames' => 'Alarm snímky', 'AttrArchiveStatus' => 'Archiv status', - 'AttrAvgScore' => 'Prm. skre', - 'AttrCause' => 'Pina', + 'AttrAvgScore' => 'Prům. skóre', + 'AttrCause' => 'Příčina', 'AttrDate' => 'Datum', - 'AttrDateTime' => 'Datum/as', + 'AttrDateTime' => 'Datum/Čas', 'AttrDiskBlocks' => 'Bloky disku', - 'AttrDiskPercent' => 'Zaplnn disku', - 'AttrDuration' => 'Prbh', - 'AttrFrames' => 'Snmky', + 'AttrDiskPercent' => 'Zaplnění disku', + 'AttrDuration' => 'Průběh', + 'AttrFrames' => 'Snímky', 'AttrId' => 'Id', - 'AttrMaxScore' => 'Max. skre', + 'AttrMaxScore' => 'Max. skóre', 'AttrMonitorId' => 'Kamera Id', - 'AttrMonitorName' => 'Jmno kamery', - 'AttrName' => 'Jmno', + 'AttrMonitorName' => 'Jméno kamery', + 'AttrName' => 'Jméno', 'AttrNotes' => 'Notes', 'AttrSystemLoad' => 'System Load', - 'AttrTime' => 'as', - 'AttrTotalScore' => 'Celkov skre', - 'AttrWeekday' => 'Den v tdnu', + 'AttrTime' => 'Čas', + 'AttrTotalScore' => 'Celkové skóre', + 'AttrWeekday' => 'Den v týdnu', 'Auto' => 'Auto', - 'AutoStopTimeout' => 'asov limit pro vypren', + 'AutoStopTimeout' => 'Časový limit pro vypršení', 'Available' => 'Available', // Added - 2009-03-31 - 'AvgBrScore' => 'Prm.
Skre', + 'AvgBrScore' => 'Prům.
Skóre', 'Background' => 'Background', 'BackgroundFilter' => 'Run filter in background', 'BadAlarmFrameCount' => 'Alarm frame count must be an integer of one or more', @@ -144,7 +144,7 @@ $SLANG = array( 'BadLabelY' => 'Label Y co-ordinate must be set to an integer of zero or more', 'BadMaxFPS' => 'Maximum FPS must be a positive integer or floating point value', 'BadMotionFrameSkip' => 'Motion Frame skip count must be an integer of zero or more', - 'BadNameChars' => 'Jmna moho obsahovat pouze alfanumerick znaky a podtrtko i pomlku', + 'BadNameChars' => 'Jména moho obsahovat pouze alfanumerické znaky a podtržítko či pomlčku', 'BadPalette' => 'Palette must be set to a valid value', // Added - 2009-03-31 'BadPath' => 'Path must be set to a valid value', 'BadPort' => 'Port must be set to a valid number', @@ -157,161 +157,161 @@ $SLANG = array( 'BadWarmupCount' => 'Warmup frames must be an integer of zero or more', 'BadWebColour' => 'Web colour must be a valid web colour string', 'BadWidth' => 'Width must be set to a valid value', - 'Bandwidth' => 'Rychlost st', + 'Bandwidth' => 'Rychlost sítě', 'BandwidthHead' => 'Bandwidth', // This is the end of the bandwidth status on the top of the console, different in many language due to phrasing - 'BlobPx' => 'Znaka Px', - 'BlobSizes' => 'Velikost znaky', - 'Blobs' => 'Znaky', - 'Brightness' => 'Svtlost', + 'BlobPx' => 'Značka Px', + 'BlobSizes' => 'Velikost značky', + 'Blobs' => 'Značky', + 'Brightness' => 'Světlost', 'Buffer' => 'Buffer', // Added - 2015-04-18 'Buffers' => 'Bufery', 'CSSDescription' => 'Change the default css for this computer', // Added - 2015-04-18 - 'CanAutoFocus' => 'Um automaticky zaostit', - 'CanAutoGain' => 'Um automatick zisk', - 'CanAutoIris' => 'Um auto iris', - 'CanAutoWhite' => 'Um automaticky vyvit blou', - 'CanAutoZoom' => 'Um automaticky zoomovat', - 'CanFocus' => 'Um zaostit', - 'CanFocusAbs' => 'Um zaostit absolutn', - 'CanFocusCon' => 'Um prbn zaostit', - 'CanFocusRel' => 'Um relativn zaostit', - 'CanGain' => 'Um zisk', - 'CanGainAbs' => 'Um absolutn zisk', - 'CanGainCon' => 'Um prbn zisk', - 'CanGainRel' => 'Um relativn zisk', - 'CanIris' => 'Um iris', - 'CanIrisAbs' => 'Um absolutn iris', - 'CanIrisCon' => 'Um prbn iris', - 'CanIrisRel' => 'Um relativn iris', - 'CanMove' => 'Um pohyb', - 'CanMoveAbs' => 'Um absoultn pohyb', - 'CanMoveCon' => 'Um prbn pohyb', - 'CanMoveDiag' => 'Um diagonln pohyb', - 'CanMoveMap' => 'Um mapovan pohyb', - 'CanMoveRel' => 'Um relativn pohyb', - 'CanPan' => 'Um oten', - 'CanReset' => 'Um reset', - 'CanSetPresets' => 'Um navolit pedvolby', - 'CanSleep' => 'Me spt', - 'CanTilt' => 'Um nklon', + 'CanAutoFocus' => 'Umí automaticky zaostřit', + 'CanAutoGain' => 'Umí automatický zisk', + 'CanAutoIris' => 'Umí auto iris', + 'CanAutoWhite' => 'Umí automaticky vyvážit bílou', + 'CanAutoZoom' => 'Umí automaticky zoomovat', + 'CanFocus' => 'Umí zaostřit', + 'CanFocusAbs' => 'Umí zaostřit absolutně', + 'CanFocusCon' => 'Umí průběžně zaostřit', + 'CanFocusRel' => 'Umí relativně zaostřit', + 'CanGain' => 'Umí zisk', + 'CanGainAbs' => 'Umí absolutní zisk', + 'CanGainCon' => 'Umí průběžný zisk', + 'CanGainRel' => 'Umí relativní zisk', + 'CanIris' => 'Umí iris', + 'CanIrisAbs' => 'Umí absolutní iris', + 'CanIrisCon' => 'Umí průběžný iris', + 'CanIrisRel' => 'Umí relativní iris', + 'CanMove' => 'Umí pohyb', + 'CanMoveAbs' => 'Umí absoultní pohyb', + 'CanMoveCon' => 'Umí průběžný pohyb', + 'CanMoveDiag' => 'Umí diagonální pohyb', + 'CanMoveMap' => 'Umí mapovaný pohyb', + 'CanMoveRel' => 'Umí relativní pohyb', + 'CanPan' => 'Umí otáčení', + 'CanReset' => 'Umí reset', + 'CanSetPresets' => 'Umí navolit předvolby', + 'CanSleep' => 'Může spát', + 'CanTilt' => 'Umí náklon', 'CanWake' => 'Lze vzbudit', - 'CanWhite' => 'Um vyven bl', - 'CanWhiteAbs' => 'Um absolutn vyven bl', - 'CanWhiteBal' => 'Um vyven bl', - 'CanWhiteCon' => 'Um prbn vyven bl', - 'CanWhiteRel' => 'Um relativn vyven bl', - 'CanZoom' => 'Um zoom', - 'CanZoomAbs' => 'Um absolutn zoom', - 'CanZoomCon' => 'Um prbn zoom', - 'CanZoomRel' => 'Um relativn zoom', - 'Cancel' => 'Zruit', - 'CancelForcedAlarm' => 'Zastavit sputn alarm', - 'CaptureHeight' => 'Vka zdrojovho snmku', + 'CanWhite' => 'Umí vyvážení bílé', + 'CanWhiteAbs' => 'Umí absolutní vyvážení bílé', + 'CanWhiteBal' => 'Umí vyvážení bílé', + 'CanWhiteCon' => 'Umí průběžné vyvážení bílé', + 'CanWhiteRel' => 'Umí relativní vyvážení bílé', + 'CanZoom' => 'Umí zoom', + 'CanZoomAbs' => 'Umí absolutní zoom', + 'CanZoomCon' => 'Umí průběžný zoom', + 'CanZoomRel' => 'Umí relativní zoom', + 'Cancel' => 'Zrušit', + 'CancelForcedAlarm' => 'Zastavit spuštěný alarm', + 'CaptureHeight' => 'Výška zdrojového snímku', 'CaptureMethod' => 'Capture Method', // Added - 2009-02-08 - 'CapturePalette' => 'Paleta zdrojovho snmku', + 'CapturePalette' => 'Paleta zdrojového snímku', 'CaptureResolution' => 'Capture Resolution', // Added - 2015-04-18 - 'CaptureWidth' => 'ka zdrojovho snmku', - 'Cause' => 'Pina', - 'CheckMethod' => 'Metoda znakovn alarmem', + 'CaptureWidth' => 'Šířka zdrojového snímku', + 'Cause' => 'Příčina', + 'CheckMethod' => 'Metoda značkování alarmem', 'ChooseDetectedCamera' => 'Choose Detected Camera', // Added - 2009-03-31 'ChooseFilter' => 'Vybrat filtr', 'ChooseLogFormat' => 'Choose a log format', // Added - 2011-06-17 'ChooseLogSelection' => 'Choose a log selection', // Added - 2011-06-17 'ChoosePreset' => 'Choose Preset', 'Clear' => 'Clear', // Added - 2011-06-16 - 'Close' => 'Zavt', + 'Close' => 'Zavřít', 'Colour' => 'Barva', - 'Command' => 'Pkaz', + 'Command' => 'Příkaz', 'Component' => 'Component', // Added - 2011-06-16 - 'Config' => 'Nastaven', + 'Config' => 'Nastavení', 'ConfiguredFor' => 'Nastaveno pro', 'ConfirmDeleteEvents' => 'Are you sure you wish to delete the selected events?', 'ConfirmPassword' => 'Potvrdit heslo', 'ConjAnd' => 'a', 'ConjOr' => 'nebo', 'Console' => 'Konzola', - 'ContactAdmin' => 'Pro detailn info kontaktujte Vaeho administrtora.', - 'Continue' => 'Pokraovat', + 'ContactAdmin' => 'Pro detailní info kontaktujte Vašeho administrátora.', + 'Continue' => 'Pokračovat', 'Contrast' => 'Kontrast', - 'Control' => 'zen', - 'ControlAddress' => 'Adresa zen', - 'ControlCap' => 'Schopnosti zen', - 'ControlCaps' => 'Typy zen', - 'ControlDevice' => 'Zazen zen', - 'ControlType' => 'Typ zen', - 'Controllable' => 'diteln', + 'Control' => 'Řízení', + 'ControlAddress' => 'Adresa řízení', + 'ControlCap' => 'Schopnosti řízení', + 'ControlCaps' => 'Typy řízení', + 'ControlDevice' => 'Zařízení řízení', + 'ControlType' => 'Typ řízení', + 'Controllable' => 'Říditelná', 'Current' => 'Current', // Added - 2015-04-18 'Cycle' => 'Cyklus', - 'CycleWatch' => 'Cyklick prohlen', + 'CycleWatch' => 'Cyklické prohlížení', 'DateTime' => 'Date/Time', // Added - 2011-06-16 'Day' => 'Den', 'Debug' => 'Debug', 'DefaultRate' => 'Default Rate', - 'DefaultScale' => 'Pednastaven velikost', + 'DefaultScale' => 'Přednastavená velikost', 'DefaultView' => 'Default View', 'Deinterlacing' => 'Deinterlacing', // Added - 2015-04-18 'Delay' => 'Delay', // Added - 2015-04-18 'Delete' => 'Smazat', - 'DeleteAndNext' => 'Smazat & Dal', - 'DeleteAndPrev' => 'Smazat & Pedchoz', + 'DeleteAndNext' => 'Smazat & Další', + 'DeleteAndPrev' => 'Smazat & Předchozí', 'DeleteSavedFilter' => 'Smazat filtr', 'Description' => 'Popis', 'DetectedCameras' => 'Detected Cameras', // Added - 2009-03-31 'DetectedProfiles' => 'Detected Profiles', // Added - 2015-04-18 'Device' => 'Device', // Added - 2009-02-08 - 'DeviceChannel' => 'Kanl zazen', - 'DeviceFormat' => 'Formt zazen', - 'DeviceNumber' => 'slo zarzen', - 'DevicePath' => 'Cesta k zazen', + 'DeviceChannel' => 'Kanál zařízení', + 'DeviceFormat' => 'Formát zařízení', + 'DeviceNumber' => 'Číslo zarízení', + 'DevicePath' => 'Cesta k zařízení', 'Devices' => 'Devices', - 'Dimensions' => 'Rozmry', - 'DisableAlarms' => 'Zakzat alarmy', + 'Dimensions' => 'Rozměry', + 'DisableAlarms' => 'Zakázat alarmy', 'Disk' => 'Disk', 'Display' => 'Display', // Added - 2011-01-30 'Displaying' => 'Displaying', // Added - 2011-06-16 'DoNativeMotionDetection'=> 'Do Native Motion Detection', - 'Donate' => 'Prosm podpote', - 'DonateAlready' => 'Ne, u jsem podpoil', - 'DonateEnticement' => 'Ji njakou dobu pouvte software ZoneMinder k ochran svho majetku a pedpokldm, e jej shledvte uitenm. Pestoe je ZoneMinder, znovu pipomnm, zdarma a voln en software, stoj jeho vvoj a podpora njak penze. Pokud byste chtl/a podpoit budouc vvoj a nov monosti softwaru, prosm zvate darovn finann pomoci. Darovn je, samozejm, dobrovoln, ale zato velmi cenn mete pispt jakou stkou chcete.

Pokud mte zjem podpoit n tm, prosm, vyberte ne uvedenou monost, nebo navtivte http://www.zoneminder.com/donate.html.

Dkuji Vm e jste si vybral/a software ZoneMinder a nezapomete navtvit frum na ZoneMinder.com pro podporu a nvrhy jak udlat ZoneMinder jet lepm ne je dnes.', - 'DonateRemindDay' => 'Nyn ne, pipomenout za 1 den', - 'DonateRemindHour' => 'Nyn ne, pipomenout za hodinu', - 'DonateRemindMonth' => 'Nyn ne, pipomenout za msc', - 'DonateRemindNever' => 'Ne, nechci podpoit ZoneMinder, nepipomnat', - 'DonateRemindWeek' => 'Nyn ne, pipomenout za tden', - 'DonateYes' => 'Ano, chcit podpoit ZoneMinder nyn', - 'Download' => 'Sthnout', + 'Donate' => 'Prosím podpořte', + 'DonateAlready' => 'Ne, už jsem podpořil', + 'DonateEnticement' => 'Již nějakou dobu používáte software ZoneMinder k ochraně svého majetku a předpokládám, že jej shledáváte užitečným. Přestože je ZoneMinder, znovu připomínám, zdarma a volně šířený software, stojí jeho vývoj a podpora nějaké peníze. Pokud byste chtěl/a podpořit budoucí vývoj a nové možnosti softwaru, prosím zvažte darování finanční pomoci. Darování je, samozřejmě, dobrovolné, ale zato velmi ceněné můžete přispět jakou částkou chcete.

Pokud máte zájem podpořit náš tým, prosím, vyberte níže uvedenou možnost, nebo navštivte http://www.zoneminder.com/donate.html.

Děkuji Vám že jste si vybral/a software ZoneMinder a nezapomeňte navštívit fórum na ZoneMinder.com pro podporu a návrhy jak udělat ZoneMinder ještě lepším než je dnes.', + 'DonateRemindDay' => 'Nyní ne, připomenout za 1 den', + 'DonateRemindHour' => 'Nyní ne, připomenout za hodinu', + 'DonateRemindMonth' => 'Nyní ne, připomenout za měsíc', + 'DonateRemindNever' => 'Ne, nechci podpořit ZoneMinder, nepřipomínat', + 'DonateRemindWeek' => 'Nyní ne, připomenout za týden', + 'DonateYes' => 'Ano, chcit podpořit ZoneMinder nyní', + 'Download' => 'Stáhnout', 'DuplicateMonitorName' => 'Duplicate Monitor Name', // Added - 2009-03-31 - 'Duration' => 'Prbh', + 'Duration' => 'Průběh', 'Edit' => 'Editovat', 'Email' => 'Email', 'EnableAlarms' => 'Povolit alarmy', 'Enabled' => 'Povoleno', - 'EnterNewFilterName' => 'Zadejte nov jmno filtru', + 'EnterNewFilterName' => 'Zadejte nové jméno filtru', 'Error' => 'Chyba', - 'ErrorBrackets' => 'Chyba, zkontrolujte prosm zvorky', - 'ErrorValidValue' => 'Chyba, zkontrolujte e podmnky maj sprvn hodnoty', + 'ErrorBrackets' => 'Chyba, zkontrolujte prosím závorky', + 'ErrorValidValue' => 'Chyba, zkontrolujte že podmínky mají správné hodnoty', 'Etc' => 'atd', - 'Event' => 'Zznam', - 'EventFilter' => 'Filtr zznam', - 'EventId' => 'Id zznamu', - 'EventName' => 'Jmno zznamu', - 'EventPrefix' => 'Prefix zznamu', - 'Events' => 'Zznamy', + 'Event' => 'Záznam', + 'EventFilter' => 'Filtr záznamů', + 'EventId' => 'Id záznamu', + 'EventName' => 'Jméno záznamu', + 'EventPrefix' => 'Prefix záznamu', + 'Events' => 'Záznamy', 'Exclude' => 'Vyjmout', 'Execute' => 'Execute', 'Export' => 'Exportovat', - 'ExportDetails' => 'Exportovat detaily zznamu', - 'ExportFailed' => 'Chyba pi exportu', - 'ExportFormat' => 'Formt exportovanho souboru', + 'ExportDetails' => 'Exportovat detaily záznamu', + 'ExportFailed' => 'Chyba při exportu', + 'ExportFormat' => 'Formát exportovaného souboru', 'ExportFormatTar' => 'Tar', 'ExportFormatZip' => 'Zip', - 'ExportFrames' => 'Exportovat detaily snmku', - 'ExportImageFiles' => 'Exportovat obrazov soubory', + 'ExportFrames' => 'Exportovat detaily snímku', + 'ExportImageFiles' => 'Exportovat obrazové soubory', 'ExportLog' => 'Export Log', // Added - 2011-06-17 - 'ExportMiscFiles' => 'Exportovat ostatn soubory (jestli existuj)', - 'ExportOptions' => 'Monosti exportu', + 'ExportMiscFiles' => 'Exportovat ostatní soubory (jestli existují)', + 'ExportOptions' => 'Možnosti exportu', 'ExportSucceeded' => 'Export Succeeded', // Added - 2009-02-08 - 'ExportVideoFiles' => 'Exportovat video soubory (jestli existuj)', + 'ExportVideoFiles' => 'Exportovat video soubory (jestli existují)', 'Exporting' => 'Exportuji', 'FPS' => 'fps', 'FPSReportInterval' => 'FPS Interval pro report', @@ -322,159 +322,159 @@ $SLANG = array( 'Ffmpeg' => 'Ffmpeg', // Added - 2009-02-08 'File' => 'Soubor', 'Filter' => 'Filter', // Added - 2015-04-18 - 'FilterArchiveEvents' => 'Archivovat vechny nalezen', - 'FilterDeleteEvents' => 'Smazat vechny nalezen', - 'FilterEmailEvents' => 'Poslat email s detaily nalezench', - 'FilterExecuteEvents' => 'Spustit pkaz na vech nalezench', + 'FilterArchiveEvents' => 'Archivovat všechny nalezené', + 'FilterDeleteEvents' => 'Smazat všechny nalezené', + 'FilterEmailEvents' => 'Poslat email s detaily nalezených', + 'FilterExecuteEvents' => 'Spustit příkaz na všech nalezených', 'FilterLog' => 'Filter log', // Added - 2015-04-18 - 'FilterMessageEvents' => 'Podat zprvu o vech nalezench', + 'FilterMessageEvents' => 'Podat zprávu o všech nalezených', 'FilterPx' => 'Filtr Px', 'FilterUnset' => 'You must specify a filter width and height', - 'FilterUploadEvents' => 'Uploadovat nalezen', + 'FilterUploadEvents' => 'Uploadovat nalezené', 'FilterVideoEvents' => 'Create video for all matches', 'Filters' => 'Filtry', - 'First' => 'Prvn', - 'FlippedHori' => 'Peklopen vodorovn', - 'FlippedVert' => 'Peklopen svisle', + 'First' => 'První', + 'FlippedHori' => 'Překlopený vodorovně', + 'FlippedVert' => 'Překlopený svisle', 'FnMocord' => 'Mocord', // Added 2013.08.16. 'FnModect' => 'Modect', // Added 2013.08.16. 'FnMonitor' => 'Monitor', // Added 2013.08.16. 'FnNodect' => 'Nodect', // Added 2013.08.16. 'FnNone' => 'None', // Added 2013.08.16. 'FnRecord' => 'Record', // Added 2013.08.16. - 'Focus' => 'Zaosten', + 'Focus' => 'Zaostření', 'ForceAlarm' => 'Spustit alarm', - 'Format' => 'Formt', - 'Frame' => 'Snmek', - 'FrameId' => 'Snmek Id', - 'FrameRate' => 'Rychlost snmk', - 'FrameSkip' => 'Vynechat snmek', - 'Frames' => 'Snmky', + 'Format' => 'Formát', + 'Frame' => 'Snímek', + 'FrameId' => 'Snímek Id', + 'FrameRate' => 'Rychlost snímků', + 'FrameSkip' => 'Vynechat snímek', + 'Frames' => 'Snímky', 'Func' => 'Funkce', 'Function' => 'Funkce', 'Gain' => 'Zisk', 'General' => 'General', 'GenerateVideo' => 'Generovat video', 'GeneratingVideo' => 'Generuji video', - 'GoToZoneMinder' => 'Jt na ZoneMinder.com', - 'Grey' => 'ed', + 'GoToZoneMinder' => 'Jít na ZoneMinder.com', + 'Grey' => 'Šedá', 'Group' => 'Group', 'Groups' => 'Skupiny', - 'HasFocusSpeed' => 'M rychlost zaosten', - 'HasGainSpeed' => 'M rychlost zisku', - 'HasHomePreset' => 'M Home volbu', - 'HasIrisSpeed' => 'M rychlost irisu', - 'HasPanSpeed' => 'M rychlost oten', - 'HasPresets' => 'M pedvolby', - 'HasTiltSpeed' => 'M rychlost nklonu', - 'HasTurboPan' => 'M Turbo oten', - 'HasTurboTilt' => 'M Turbo nklon', - 'HasWhiteSpeed' => 'M rychlost vyven bl', - 'HasZoomSpeed' => 'M rychlost zoomu', - 'High' => 'Rychl', - 'HighBW' => 'Rychl B/W', - 'Home' => 'Dom', + 'HasFocusSpeed' => 'Má rychlost zaostření', + 'HasGainSpeed' => 'Má rychlost zisku', + 'HasHomePreset' => 'Má Home volbu', + 'HasIrisSpeed' => 'Má rychlost irisu', + 'HasPanSpeed' => 'Má rychlost otáčení', + 'HasPresets' => 'Má předvolby', + 'HasTiltSpeed' => 'Má rychlost náklonu', + 'HasTurboPan' => 'Má Turbo otáčení', + 'HasTurboTilt' => 'Má Turbo náklon', + 'HasWhiteSpeed' => 'Má rychlost vyvážení bílé', + 'HasZoomSpeed' => 'Má rychlost zoomu', + 'High' => 'Rychlá', + 'HighBW' => 'Rychlá B/W', + 'Home' => 'Domů', 'Hour' => 'Hodina', - 'Hue' => 'Odstn', + 'Hue' => 'Odstín', 'Id' => 'Id', - 'Idle' => 'Pipraven', + 'Idle' => 'Připraven', 'Ignore' => 'Ignorovat', 'Image' => 'Obraz', - 'ImageBufferSize' => 'Velikost buferu snmk', + 'ImageBufferSize' => 'Velikost buferu snímků', 'Images' => 'Images', - 'In' => 'Dovnit', - 'Include' => 'Vloit', - 'Inverted' => 'Pevrcen', + 'In' => 'Dovnitř', + 'Include' => 'Vložit', + 'Inverted' => 'Převráceně', 'Iris' => 'Iris', 'KeyString' => 'Key String', 'Label' => 'Label', 'Language' => 'Jazyk', - 'Last' => 'Posledn', + 'Last' => 'Poslední', 'Layout' => 'Layout', // Added - 2009-02-08 'Level' => 'Level', // Added - 2011-06-16 'Libvlc' => 'Libvlc', - 'LimitResultsPost' => 'vsledk', // This is used at the end of the phrase 'Limit to first N results only' - 'LimitResultsPre' => 'Zobrazit pouze prvnch', // This is used at the beginning of the phrase 'Limit to first N results only' + 'LimitResultsPost' => 'výsledků', // This is used at the end of the phrase 'Limit to first N results only' + 'LimitResultsPre' => 'Zobrazit pouze prvních', // This is used at the beginning of the phrase 'Limit to first N results only' 'Line' => 'Line', // Added - 2011-06-16 'LinkedMonitors' => 'Linked Monitors', 'List' => 'Seznam', 'Load' => 'Load', - 'Local' => 'Lokln', + 'Local' => 'Lokální', 'Log' => 'Log', // Added - 2011-06-16 - 'LoggedInAs' => 'Pihlen jako', + 'LoggedInAs' => 'Přihlášen jako', 'Logging' => 'Logging', // Added - 2011-06-16 - 'LoggingIn' => 'Pihlauji', - 'Login' => 'Pihlsit', - 'Logout' => 'Odhlsit', + 'LoggingIn' => 'Přihlašuji', + 'Login' => 'Přihlásit', + 'Logout' => 'Odhlásit', 'Logs' => 'Logs', // Added - 2011-06-17 - 'Low' => 'Pomal', - 'LowBW' => 'Pomal B/W', - 'Main' => 'Hlavn', + 'Low' => 'Pomalá', + 'LowBW' => 'Pomalá B/W', + 'Main' => 'Hlavní', 'Man' => 'Man', - 'Manual' => 'Manul', - 'Mark' => 'Oznait', + 'Manual' => 'Manuál', + 'Mark' => 'Označit', 'Max' => 'Max', 'MaxBandwidth' => 'Max bandwidth', - 'MaxBrScore' => 'Max.
skre', - 'MaxFocusRange' => 'Max rozsah zaosten', - 'MaxFocusSpeed' => 'Max rychlost zaosten', - 'MaxFocusStep' => 'Max krok zaosten', + 'MaxBrScore' => 'Max.
skóre', + 'MaxFocusRange' => 'Max rozsah zaostření', + 'MaxFocusSpeed' => 'Max rychlost zaostření', + 'MaxFocusStep' => 'Max krok zaostření', 'MaxGainRange' => 'Max rozsah zisku', 'MaxGainSpeed' => 'Max rychlost zisku', 'MaxGainStep' => 'Max krok zisku', 'MaxIrisRange' => 'Max rozsah iris', 'MaxIrisSpeed' => 'Max rychlost iris', 'MaxIrisStep' => 'Max krok iris', - 'MaxPanRange' => 'Max rozsah oten', - 'MaxPanSpeed' => 'Max rychlost oten', - 'MaxPanStep' => 'Max krok oten', - 'MaxTiltRange' => 'Max rozsah nklonu', - 'MaxTiltSpeed' => 'Max rychlost nklonu', - 'MaxTiltStep' => 'Max krok nklonu', - 'MaxWhiteRange' => 'Max rozsah vyven bl', - 'MaxWhiteSpeed' => 'Max rychlost vyven bl', - 'MaxWhiteStep' => 'Max krok vyven bl', + 'MaxPanRange' => 'Max rozsah otáčení', + 'MaxPanSpeed' => 'Max rychlost otáčení', + 'MaxPanStep' => 'Max krok otáčení', + 'MaxTiltRange' => 'Max rozsah náklonu', + 'MaxTiltSpeed' => 'Max rychlost náklonu', + 'MaxTiltStep' => 'Max krok náklonu', + 'MaxWhiteRange' => 'Max rozsah vyvážení bílé', + 'MaxWhiteSpeed' => 'Max rychlost vyvážení bílé', + 'MaxWhiteStep' => 'Max krok vyvážení bílé', 'MaxZoomRange' => 'Max rozsah zoomu', 'MaxZoomSpeed' => 'Max rychlost zoomu', 'MaxZoomStep' => 'Max krok zoomu', 'MaximumFPS' => 'Maximum FPS', - 'Medium' => 'Stedn', - 'MediumBW' => 'Stedn B/W', + 'Medium' => 'Střední', + 'MediumBW' => 'Střední B/W', 'Message' => 'Message', // Added - 2011-06-16 'MinAlarmAreaLtMax' => 'Minimum alarm area should be less than maximum', 'MinAlarmAreaUnset' => 'You must specify the minimum alarm pixel count', - 'MinBlobAreaLtMax' => 'Minimum znakovan oblasti by mlo bt men ne maximum', + 'MinBlobAreaLtMax' => 'Minimum značkované oblasti by mělo být menší než maximum', 'MinBlobAreaUnset' => 'You must specify the minimum blob pixel count', 'MinBlobLtMinFilter' => 'Minimum blob area should be less than or equal to minimum filter area', - 'MinBlobsLtMax' => 'Minimum znaek by mlo bt men ne maximum', + 'MinBlobsLtMax' => 'Minimum značek by mělo být menší než maximum', 'MinBlobsUnset' => 'You must specify the minimum blob count', 'MinFilterAreaLtMax' => 'Minimum filter area should be less than maximum', 'MinFilterAreaUnset' => 'You must specify the minimum filter pixel count', 'MinFilterLtMinAlarm' => 'Minimum filter area should be less than or equal to minimum alarm area', - 'MinFocusRange' => 'Min rozsah zaosten', - 'MinFocusSpeed' => 'Min rychlost zaosten', - 'MinFocusStep' => 'Min krok zaosten', + 'MinFocusRange' => 'Min rozsah zaostření', + 'MinFocusSpeed' => 'Min rychlost zaostření', + 'MinFocusStep' => 'Min krok zaostření', 'MinGainRange' => 'Min rozsah zisku', 'MinGainSpeed' => 'Min rychlost zisku', 'MinGainStep' => 'Min krok zisku', 'MinIrisRange' => 'Min rozsah iris', 'MinIrisSpeed' => 'Min rychlost iris', 'MinIrisStep' => 'Min krok iris', - 'MinPanRange' => 'Min rozsah oten', - 'MinPanSpeed' => 'Min rychlost oten', - 'MinPanStep' => 'Min krok oten', - 'MinPixelThresLtMax' => 'Minimln prh pixelu by ml bt men ne maximumln', + 'MinPanRange' => 'Min rozsah otáčení', + 'MinPanSpeed' => 'Min rychlost otáčení', + 'MinPanStep' => 'Min krok otáčení', + 'MinPixelThresLtMax' => 'Minimální práh pixelu by měl být menší než maximumální', 'MinPixelThresUnset' => 'You must specify a minimum pixel threshold', - 'MinTiltRange' => 'Min rozsah nklonu', - 'MinTiltSpeed' => 'Min rychlost nklonu', - 'MinTiltStep' => 'Min krok nklonu', - 'MinWhiteRange' => 'Min rozsah vyven bl', - 'MinWhiteSpeed' => 'Min rychlost vyven bl', - 'MinWhiteStep' => 'Min krok vyven bl', + 'MinTiltRange' => 'Min rozsah náklonu', + 'MinTiltSpeed' => 'Min rychlost náklonu', + 'MinTiltStep' => 'Min krok náklonu', + 'MinWhiteRange' => 'Min rozsah vyvážení bílé', + 'MinWhiteSpeed' => 'Min rychlost vyvážení bílé', + 'MinWhiteStep' => 'Min krok vyvážení bílé', 'MinZoomRange' => 'Min rozsah zoomu', 'MinZoomSpeed' => 'Min rychlost zoomu', 'MinZoomStep' => 'Min krok zoomu', - 'Misc' => 'Ostatn', + 'Misc' => 'Ostatní', 'Mode' => 'Mode', // Added - 2015-04-18 'Monitor' => 'Kamera', 'MonitorIds' => 'Id kamer', @@ -483,8 +483,8 @@ $SLANG = array( '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.

Select the desired entry from the list below.

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.

', // Added - 2009-03-31 'Monitors' => 'Kamery', - 'Montage' => 'Sestih', - 'Month' => 'Msc', + 'Montage' => 'Sestřih', + 'Month' => 'Měsíc', 'More' => 'More', // Added - 2011-06-16 'MotionFrameSkip' => 'Motion Frame Skip', 'Move' => 'Pohyb', @@ -493,64 +493,64 @@ $SLANG = array( 'Mtg3widgrx' => '3-wide grid, scaled, enlarge on alarm', // Added 2013.08.15. 'Mtg4widgrd' => '4-wide grid', // Added 2013.08.15. 'MtgDefault' => 'Default', // Added 2013.08.15. - 'MustBeGe' => 'mus bt vt nebo rovno ne', - 'MustBeLe' => 'mus bt men nebo rovno ne', - 'MustConfirmPassword' => 'Muste potvrdit heslo', - 'MustSupplyPassword' => 'Muste zadat heslo', - 'MustSupplyUsername' => 'Muste zadat uivatelsk jmno', - 'Name' => 'Jmno', - 'Near' => 'Blzko', - 'Network' => 'S', - 'New' => 'Nov', - 'NewGroup' => 'Nov skupina', + 'MustBeGe' => 'musí být větší nebo rovno než', + 'MustBeLe' => 'musí být menší nebo rovno než', + 'MustConfirmPassword' => 'Musíte potvrdit heslo', + 'MustSupplyPassword' => 'Musíte zadat heslo', + 'MustSupplyUsername' => 'Musíte zadat uživatelské jméno', + 'Name' => 'Jméno', + 'Near' => 'Blízko', + 'Network' => 'Síť', + 'New' => 'Nový', + 'NewGroup' => 'Nová skupina', 'NewLabel' => 'New Label', - 'NewPassword' => 'Nov heslo', - 'NewState' => 'Nov stav', - 'NewUser' => 'Nov uivatel', - 'Next' => 'Dal', + 'NewPassword' => 'Nové heslo', + 'NewState' => 'Nový stav', + 'NewUser' => 'Nový uživatel', + 'Next' => 'Další', 'No' => 'Ne', 'NoDetectedCameras' => 'No Detected Cameras', // Added - 2009-03-31 - 'NoFramesRecorded' => 'Pro tento snmek nejsou dn zznamy', + 'NoFramesRecorded' => 'Pro tento snímek nejsou žádné záznamy', 'NoGroup' => 'No Group', - 'NoSavedFilters' => 'dn uloen filtry', - 'NoStatisticsRecorded' => 'Pro tento zznam/snmek nejsou zaznamenny dn statistiky', - 'None' => 'Zakzat', - 'NoneAvailable' => 'dn nen dostupn', - 'Normal' => 'Normaln', - 'Notes' => 'Poznmky', - 'NumPresets' => 'Poet pedvoleb', + 'NoSavedFilters' => 'Žádné uložené filtry', + 'NoStatisticsRecorded' => 'Pro tento záznam/snímek nejsou zaznamenány žádné statistiky', + 'None' => 'Zakázat', + 'NoneAvailable' => 'Žádná není dostupná', + 'Normal' => 'Normalní', + 'Notes' => 'Poznámky', + 'NumPresets' => 'Počet předvoleb', 'Off' => 'Off', 'On' => 'On', 'OnvifCredentialsIntro'=> 'Please supply user name and password for the selected camera.
If no user has been created for the camera then the user given here will be created with the given password.

', // Added - 2015-04-18 'OnvifProbe' => 'ONVIF', // Added - 2015-04-18 'OnvifProbeIntro' => 'The list below shows detected ONVIF cameras and whether they are already being used or available for selection.

Select the desired entry from the list below.

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.

', // Added - 2015-04-18 'OpEq' => 'rovno', - 'OpGt' => 'vt', - 'OpGtEq' => 'vt nebo rovno', + 'OpGt' => 'větší', + 'OpGtEq' => 'větší nebo rovno', 'OpIn' => 'nin set', - 'OpLt' => 'men', - 'OpLtEq' => 'men nebo rovno', + 'OpLt' => 'menší', + 'OpLtEq' => 'menší nebo rovno', 'OpMatches' => 'obsahuje', - 'OpNe' => 'nerovn se', + 'OpNe' => 'nerovná se', 'OpNotIn' => 'nnot in set', 'OpNotMatches' => 'neobsahuje', - 'Open' => 'Otevt', - 'OptionHelp' => 'MonostHelp', - 'OptionRestartWarning' => 'Tyto zmny se neprojev\ndokud systm b. Jakmile\ndokonte provdn zmn prosm\nrestartujte ZoneMinder.', - 'Options' => 'Monosti', - 'OrEnterNewName' => 'nebo vlote nov jmno', - 'Order' => 'Poad', + 'Open' => 'Otevřít', + 'OptionHelp' => 'MožnostHelp', + 'OptionRestartWarning' => 'Tyto změny se neprojeví\ndokud systém běží. Jakmile\ndokončíte provádění změn prosím\nrestartujte ZoneMinder.', + 'Options' => 'Možnosti', + 'OrEnterNewName' => 'nebo vložte nové jméno', + 'Order' => 'Pořadí', 'Orientation' => 'Orientace', 'Out' => 'Ven', - 'OverwriteExisting' => 'Pepsat existujc', - 'Paged' => 'Strkov', - 'Pan' => 'Oten', + 'OverwriteExisting' => 'Přepsat existující', + 'Paged' => 'Strákově', + 'Pan' => 'Otáčení', 'PanLeft' => 'Posunout vlevo', 'PanRight' => 'Posunout vpravo', - 'PanTilt' => 'Oten/Nklon', + 'PanTilt' => 'Otáčení/Náklon', 'Parameter' => 'Parametr', 'Password' => 'Heslo', - 'PasswordsDifferent' => 'Hesla se neshoduj', + 'PasswordsDifferent' => 'Hesla se neshodují', 'Paths' => 'Cesty', 'Pause' => 'Pause', 'Phone' => 'Modem', @@ -559,27 +559,27 @@ $SLANG = array( 'PixelDiff' => 'Pixel Diff', 'Pixels' => 'pixely', 'Play' => 'Play', - 'PlayAll' => 'Pehrt ve', - 'PleaseWait' => 'Prosm ekejte', + 'PlayAll' => 'Přehrát vše', + 'PleaseWait' => 'Prosím čekejte', 'Plugins' => 'Plugins', 'Point' => 'Point', - 'PostEventImageBuffer' => 'Pozznamov bufer', - 'PreEventImageBuffer' => 'Pedzznamov bufer', + 'PostEventImageBuffer' => 'Pozáznamový bufer', + 'PreEventImageBuffer' => 'Předzáznamový bufer', 'PreserveAspect' => 'Preserve Aspect Ratio', - 'Preset' => 'Pedvolba', - 'Presets' => 'Pedvolby', - 'Prev' => 'Zpt', + 'Preset' => 'Předvolba', + 'Presets' => 'Předvolby', + 'Prev' => 'Zpět', 'Probe' => 'Probe', // Added - 2009-03-31 'ProfileProbe' => 'Stream Probe', // Added - 2015-04-18 'ProfileProbeIntro' => 'The list below shows the existing stream profiles of the selected camera .

Select the desired entry from the list below.

Please note that ZoneMinder cannot configure additional profiles and that choosing a camera here may overwrite any values you already have configured for the current monitor.

', // Added - 2015-04-18 'Progress' => 'Progress', // Added - 2015-04-18 'Protocol' => 'Protocol', 'Rate' => 'Rychlost', - 'Real' => 'Skuten', - 'Record' => 'Nahrvat', + 'Real' => 'Skutečná', + 'Record' => 'Nahrávat', 'RefImageBlendPct' => 'Reference Image Blend %ge', 'Refresh' => 'Obnovit', - 'Remote' => 'Sov', + 'Remote' => 'Síťová', 'RemoteHostName' => 'Adresa', 'RemoteHostPath' => 'Cesta', 'RemoteHostPort' => 'Port', @@ -587,59 +587,59 @@ $SLANG = array( 'RemoteImageColours' => 'Barvy', 'RemoteMethod' => 'Remote Method', // Added - 2009-02-08 'RemoteProtocol' => 'Remote Protocol', // Added - 2009-02-08 - 'Rename' => 'Pejmenovat', + 'Rename' => 'Přejmenovat', 'Replay' => 'Replay', 'ReplayAll' => 'All Events', 'ReplayGapless' => 'Gapless Events', 'ReplaySingle' => 'Single Event', 'Reset' => 'Reset', - 'ResetEventCounts' => 'Resetovat poty zznam', + 'ResetEventCounts' => 'Resetovat počty záznamů', 'Restart' => 'Restartovat', 'Restarting' => 'Restartuji', - 'RestrictedCameraIds' => 'Povolen id kamer', + 'RestrictedCameraIds' => 'Povolené id kamer', 'RestrictedMonitors' => 'Restricted Monitors', - 'ReturnDelay' => 'Prodleva vracen', - 'ReturnLocation' => 'Lokace vrcen', + 'ReturnDelay' => 'Prodleva vracení', + 'ReturnLocation' => 'Lokace vrácení', 'Rewind' => 'Rewind', - 'RotateLeft' => 'Otoit vlevo', - 'RotateRight' => 'Otoit vpravo', + 'RotateLeft' => 'Otočit vlevo', + 'RotateRight' => 'Otočit vpravo', 'RunLocalUpdate' => 'Please run zmupdate.pl to update', // Added - 2011-05-25 - 'RunMode' => 'Reim', + 'RunMode' => 'Režim', 'RunState' => 'Stav', - 'Running' => 'B', - 'Save' => 'Uloit', - 'SaveAs' => 'Uloit jako', - 'SaveFilter' => 'Uloit filtr', + 'Running' => 'Běží', + 'Save' => 'Uložit', + 'SaveAs' => 'Uložit jako', + 'SaveFilter' => 'Uložit filtr', 'Scale' => 'Velikost', - 'Score' => 'Skre', - 'Secs' => 'Dlka(s)', - 'Sectionlength' => 'Dlka sekce', + 'Score' => 'Skóre', + 'Secs' => 'Délka(s)', + 'Sectionlength' => 'Délka sekce', 'Select' => 'Vybrat', 'SelectFormat' => 'Select Format', // Added - 2011-06-17 'SelectLog' => 'Select Log', // Added - 2011-06-17 'SelectMonitors' => 'Select Monitors', 'SelfIntersecting' => 'Polygon edges must not intersect', 'Set' => 'Nastavit', - 'SetNewBandwidth' => 'Nastavit novou rychlost st', - 'SetPreset' => 'Nastavit pedvolbu', - 'Settings' => 'Nastaven', + 'SetNewBandwidth' => 'Nastavit novou rychlost sítě', + 'SetPreset' => 'Nastavit předvolbu', + 'Settings' => 'Nastavení', 'ShowFilterWindow' => 'Zobrazit filtr', - 'ShowTimeline' => 'Zobrazit asovou linii ', + 'ShowTimeline' => 'Zobrazit časovou linii ', 'SignalCheckColour' => 'Signal Check Colour', 'Size' => 'Velikost', 'SkinDescription' => 'Change the default skin for this computer', // Added - 2011-01-30 - 'Sleep' => 'Spt', - 'SortAsc' => 'Vzestupn', - 'SortBy' => 'adit dle', - 'SortDesc' => 'Sestupn', + 'Sleep' => 'Spát', + 'SortAsc' => 'Vzestupně', + 'SortBy' => 'Řadit dle', + 'SortDesc' => 'Sestupně', 'Source' => 'Zdroj', 'SourceColours' => 'Source Colours', // Added - 2009-02-08 'SourcePath' => 'Source Path', // Added - 2009-02-08 'SourceType' => 'Typ zdroje', 'Speed' => 'Rychlost', - 'SpeedHigh' => 'Vysok rychlost', - 'SpeedLow' => 'Nzk rychlost', - 'SpeedMedium' => 'Stedn rychlost', + 'SpeedHigh' => 'Vysoká rychlost', + 'SpeedLow' => 'Nízká rychlost', + 'SpeedMedium' => 'Střední rychlost', 'SpeedTurbo' => 'Turbo rychlost', 'Start' => 'Start', 'State' => 'Stav', @@ -648,11 +648,11 @@ $SLANG = array( 'Step' => 'Krok', 'StepBack' => 'Step Back', 'StepForward' => 'Step Forward', - 'StepLarge' => 'Velk krok', - 'StepMedium' => 'Stedn krok', - 'StepNone' => 'dn krok', - 'StepSmall' => 'Mal krok', - 'Stills' => 'Snmky', + 'StepLarge' => 'Velký krok', + 'StepMedium' => 'Střední krok', + 'StepNone' => 'Žádný krok', + 'StepSmall' => 'Malý krok', + 'Stills' => 'Snímky', 'Stop' => 'Zastavit', 'Stopped' => 'Zastaven', 'Stream' => 'Stream', @@ -661,87 +661,87 @@ $SLANG = array( 'System' => 'System', 'SystemLog' => 'System Log', // Added - 2011-06-16 'TargetColorspace' => 'Target colorspace', // Added - 2015-04-18 - 'Tele' => 'Piblit', + 'Tele' => 'Přiblížit', 'Thumbnail' => 'Miniatura', - 'Tilt' => 'Nklon', - 'Time' => 'as', - 'TimeDelta' => 'Delta asu', - 'TimeStamp' => 'asov raztko', - 'Timeline' => 'asov linie', + 'Tilt' => 'Náklon', + 'Time' => 'Čas', + 'TimeDelta' => 'Delta času', + 'TimeStamp' => 'Časové razítko', + 'Timeline' => 'Časová linie', 'TimelineTip1' => 'Pass your mouse over the graph to view a snapshot image and event details.', // Added 2013.08.15. 'TimelineTip2' => 'Click on the coloured sections of the graph, or the image, to view the event.', // Added 2013.08.15. 'TimelineTip3' => 'Click on the background to zoom in to a smaller time period based around your click.', // Added 2013.08.15. 'TimelineTip4' => 'Use the controls below to zoom out or navigate back and forward through the time range.', // Added 2013.08.15. - 'Timestamp' => 'Raztko', - 'TimestampLabelFormat' => 'Formt asovho raztka', - 'TimestampLabelX' => 'asov raztko X', - 'TimestampLabelY' => 'asov raztko Y', + 'Timestamp' => 'Razítko', + 'TimestampLabelFormat' => 'Formát časového razítka', + 'TimestampLabelX' => 'Časové razítko X', + 'TimestampLabelY' => 'Časové razítko Y', 'Today' => 'Dnes', - 'Tools' => 'Nstroje', + 'Tools' => 'Nástroje', 'Total' => 'Total', // Added - 2011-06-16 - 'TotalBrScore' => 'Celkov
skre', - 'TrackDelay' => 'Prodleva drhy', - 'TrackMotion' => 'Pohyb po drze', + 'TotalBrScore' => 'Celkové
skóre', + 'TrackDelay' => 'Prodleva dráhy', + 'TrackMotion' => 'Pohyb po dráze', 'Triggers' => 'Trigery', - 'TurboPanSpeed' => 'Rychlost Turbo oten', - 'TurboTiltSpeed' => 'Rychlost Turbo nklonu', + 'TurboPanSpeed' => 'Rychlost Turbo otáčení', + 'TurboTiltSpeed' => 'Rychlost Turbo náklonu', 'Type' => 'Typ', 'Unarchive' => 'Vyjmout z archivu', 'Undefined' => 'Undefined', // Added - 2009-02-08 'Units' => 'Jednotky', - 'Unknown' => 'Neznm', + 'Unknown' => 'Neznámý', 'Update' => 'Update', - 'UpdateAvailable' => 'Je dostupn nov update ZoneMinder.', - 'UpdateNotNecessary' => 'Update nen poteba.', + 'UpdateAvailable' => 'Je dostupný nový update ZoneMinder.', + 'UpdateNotNecessary' => 'Update není potřeba.', 'Updated' => 'Updated', // Added - 2011-06-16 'Upload' => 'Upload', // Added - 2011-08-23 - 'UseFilter' => 'Pout filtr', - 'UseFilterExprsPost' => ' vraz', // This is used at the end of the phrase 'use N filter expressions' - 'UseFilterExprsPre' => 'Pout ', // This is used at the beginning of the phrase 'use N filter expressions' + 'UseFilter' => 'Použít filtr', + 'UseFilterExprsPost' => ' výrazů', // This is used at the end of the phrase 'use N filter expressions' + 'UseFilterExprsPre' => 'Použít ', // This is used at the beginning of the phrase 'use N filter expressions' 'UsedPlugins' => 'Used Plugins', - 'User' => 'Uivatel', - 'Username' => 'Uivatelsk jmno', - 'Users' => 'Uivatel', + 'User' => 'Uživatel', + 'Username' => 'Uživatelské jméno', + 'Users' => 'Uživatelé', 'V4L' => 'V4L', // Added - 2015-04-18 'V4LCapturesPerFrame' => 'Captures Per Frame', // Added - 2015-04-18 'V4LMultiBuffer' => 'Multi Buffering', // Added - 2015-04-18 'Value' => 'Hodnota', 'Version' => 'Verze', 'VersionIgnore' => 'Ignorovat tuto verzi', - 'VersionRemindDay' => 'Pipomenout za 1 den', - 'VersionRemindHour' => 'Pipomenout za hodinu', - 'VersionRemindNever' => 'Nepipomnat nov veze', - 'VersionRemindWeek' => 'Pipomenout za tden', + 'VersionRemindDay' => 'Připomenout za 1 den', + 'VersionRemindHour' => 'Připomenout za hodinu', + 'VersionRemindNever' => 'Nepřipomínat nové veze', + 'VersionRemindWeek' => 'Připomenout za týden', 'Video' => 'Video', - 'VideoFormat' => 'Video formt', - 'VideoGenFailed' => 'Chyba pi generovn videa!', - 'VideoGenFiles' => 'Existujc video soubory', - 'VideoGenNoFiles' => 'dn video soubory nenalezeny', - 'VideoGenParms' => 'Parametry generovn videa', - 'VideoGenSucceeded' => 'Video vygenerovno spn!', + 'VideoFormat' => 'Video formát', + 'VideoGenFailed' => 'Chyba při generování videa!', + 'VideoGenFiles' => 'Existující video soubory', + 'VideoGenNoFiles' => 'Žádné video soubory nenalezeny', + 'VideoGenParms' => 'Parametry generování videa', + 'VideoGenSucceeded' => 'Video vygenerováno úspěšně!', 'VideoSize' => 'Velikost videa', 'View' => 'Zobrazit', - 'ViewAll' => 'Zobrazit vechny', - 'ViewEvent' => 'Zobrazit zznam', - 'ViewPaged' => 'Zobrazit strkov', + 'ViewAll' => 'Zobrazit všechny', + 'ViewEvent' => 'Zobrazit záznam', + 'ViewPaged' => 'Zobrazit strákově', 'Wake' => 'Vzbudit', - 'WarmupFrames' => 'Zahvac snmky', + 'WarmupFrames' => 'Zahřívací snímky', 'Watch' => 'Sledovat', 'Web' => 'Web', - 'WebColour' => 'Webov barva', - 'Week' => 'Tden', - 'White' => 'Bl', - 'WhiteBalance' => 'Vyven bl', - 'Wide' => 'Oddlit', + 'WebColour' => 'Webová barva', + 'Week' => 'Týden', + 'White' => 'Bílá', + 'WhiteBalance' => 'Vyvážení bílé', + 'Wide' => 'Oddálit', 'X' => 'X', 'X10' => 'X10', - 'X10ActivationString' => 'X10 aktivan etzec', - 'X10InputAlarmString' => 'X10 input alarm etzec', - 'X10OutputAlarmString' => 'X10 output alarm etzec', + 'X10ActivationString' => 'X10 aktivační řetězec', + 'X10InputAlarmString' => 'X10 input alarm řetězec', + 'X10OutputAlarmString' => 'X10 output alarm řetězec', 'Y' => 'Y', 'Yes' => 'Ano', - 'YouNoPerms' => 'K tomuto zdroji nemte oprvnn.', - 'Zone' => 'Zna', + 'YouNoPerms' => 'K tomuto zdroji nemáte oprávnění.', + 'Zone' => 'Zóna', 'ZoneAlarmColour' => 'Barva alarmu (Red/Green/Blue)', 'ZoneArea' => 'Zone Area', 'ZoneExtendAlarmFrames' => 'Extend Alarm Frame Count', @@ -753,21 +753,21 @@ $SLANG = array( 'ZoneMinMaxPixelThres' => 'Min/Max Pixel Threshold (0-255)', 'ZoneMinderLog' => 'ZoneMinder Log', // Added - 2011-06-17 'ZoneOverloadFrames' => 'Overload Frame Ignore Count', - 'Zones' => 'Zny', + 'Zones' => 'Zóny', 'Zoom' => 'Zoom', - 'ZoomIn' => 'Zvtit', - 'ZoomOut' => 'Zmenit', + 'ZoomIn' => 'Zvětšit', + 'ZoomOut' => 'Zmenšit', ); // Complex replacements with formatting and/or placements, must be passed through sprintf $CLANG = array( - 'CurrentLogin' => 'Prv je pihlen \'%1$s\'', + 'CurrentLogin' => 'Právě je přihlášen \'%1$s\'', 'EventCount' => '%1$s %2$s', // For example '37 Events' (from Vlang below) - 'LastEvents' => 'Poslednch %1$s %2$s', // For example 'Last 37 Events' (from Vlang below) - 'LatestRelease' => 'Posledn verze je v%1$s, vy mte v%2$s.', + 'LastEvents' => 'Posledních %1$s %2$s', // For example 'Last 37 Events' (from Vlang below) + 'LatestRelease' => 'Poslední verze je v%1$s, vy máte v%2$s.', 'MonitorCount' => '%1$s %2$s', // For example '4 Monitors' (from Vlang below) 'MonitorFunction' => 'Funkce %1$s kamery', - 'RunningRecentVer' => 'Pouvte posledn verzi ZoneMinder, v%s.', + 'RunningRecentVer' => 'Používáte poslední verzi ZoneMinder, v%s.', 'VersionMismatch' => 'Version mismatch, system is version %1$s, database is %2$s.', // Added - 2011-05-25 ); @@ -805,7 +805,7 @@ $CLANG = array( // Variable arrays expressing plurality, see the zmVlang description above $VLANG = array( - 'Event' => array( 0=>'Zznam', 1=>'Zznam', 2=>'Zznamy', 5=>'Zznam' ), + 'Event' => array( 0=>'Záznamů', 1=>'Záznam', 2=>'Záznamy', 5=>'Záznamů' ), 'Monitor' => array( 0=>'Kamer', 1=>'Kamera', 2=>'Kamery', 5=>'Kamer' ), ); diff --git a/web/skins/classic/views/event.php b/web/skins/classic/views/event.php index 3a9e36be6..5deb2c754 100644 --- a/web/skins/classic/views/event.php +++ b/web/skins/classic/views/event.php @@ -125,29 +125,29 @@ if ( canEdit( 'Events' ) ) if ( canView( 'Events' ) ) { ?> -
+
-
class="hidden">
+
class="hidden">
-
class="hidden">
-
- -
- class="hidden">
+
+ +
+ -
- -
+
+ +
@@ -166,7 +166,7 @@ addVideoTimingTrack(document.getElementById('videoobj'), LabelFormat, monitorNam else { ?> -
+
-
- + -
-
+ + Frame <?php echo $frame->EventId().FrameId() ?>"> +<<<<<<< HEAD "> <?php echo $frame->EventId().FrameId() ?>" class=""/> +======= +"> + +<?php echo $frame['EventId']." class=""/> +>>>>>>> feature-h264-videostorage

diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php index b3b11fce3..bbc94a9dc 100644 --- a/web/skins/classic/views/monitor.php +++ b/web/skins/classic/views/monitor.php @@ -58,6 +58,7 @@ if ( ! empty($_REQUEST['mid']) ) { } else { $nextId = getTableAutoInc( 'Monitors' ); +<<<<<<< HEAD if ( ! empty( $_REQUEST['dupId'] ) ) { $monitor = new Monitor( $_REQUEST['dupId'] ); if ( ZM_OPT_X10 ) @@ -151,6 +152,105 @@ if ( ZM_OPT_X10 && empty($x10Monitor) ) { function fourcc( $a, $b, $c, $d ) { return( ord($a) | (ord($b) << 8) | (ord($c) << 16) | (ord($d) << 24) ); +======= + $monitor = getMonitorObject($_REQUEST['dupId']); + $clonedName = $monitor['Name']; + $monitor['Name'] = translate('Monitor').'-'.$nextId; + $monitor['Id']='0'; +} + +if ( ZM_OPT_X10 && empty($x10Monitor) ) +{ + $x10Monitor = array( + 'Activation' => '', + 'AlarmInput' => '', + 'AlarmOutput' => '', + ); +} + +function getMonitorObject( $mid = null) +{ + if ($mid !== null) + { + $monitor = dbFetchMonitor($mid); + } + else + { + $monitor = array( + 'Id' => 0, + 'Name' => "willbereplaced", + 'Function' => "Monitor", + 'Enabled' => true, + 'LinkedMonitors' => "", + 'Type' => "", + 'Device' => "/dev/video0", + 'Channel' => "0", + 'Format' => 0x000000ff, + 'Protocol' => "", + 'Method' => "", + 'Host' => "", + 'Path' => "", + 'Options' => "", + 'Port' => "80", + 'User' => "", + 'Pass' => "", + 'Colours' => 3, + 'Palette' => 0, + 'Width' => "320", + 'Height' => "240", + 'Orientation' => "0", + 'Deinterlacing' => 0, + 'RTSPDescribe' => 0, + 'SaveJPEGs' => "3", + 'VideoWriter' => "0", + 'EncoderParameters' => "# Lines beginning with # are a comment \n# For changing quality, use the crf option\n# 1 is best, 51 is worst quality\n#crf=23\n", + 'RecordAudio' => "0", + 'LabelFormat' => '%N - %d/%m/%y %H:%M:%S', + 'LabelX' => 0, + 'LabelY' => 0, + 'LabelSize' => 1, + 'ImageBufferCount' => 50, + 'WarmupCount' => 25, + 'PreEventCount' => 25, + 'PostEventCount' => 25, + 'StreamReplayBuffer' => 1000, + 'AlarmFrameCount' => 1, + 'Controllable' => 0, + 'ControlId' => "", + 'ControlType' => 0, + 'ControlDevice' => "", + 'ControlAddress' => "", + 'AutoStopTimeout' => "", + 'TrackMotion' => 0, + 'TrackDelay' => "", + 'ReturnLocation' => -1, + 'ReturnDelay' => "", + 'SectionLength' => 600, + 'FrameSkip' => 0, + 'MotionFrameSkip' => 0, + 'EventPrefix' => 'Event-', + 'AnalysisFPS' => "", + 'AnalysisUpdateDelay' => 0, + 'MaxFPS' => "", + 'AlarmMaxFPS' => "", + 'FPSReportInterval' => 1000, + 'RefBlendPerc' => 6, + 'AlarmRefBlendPerc' => 6, + 'DefaultView' => 'Events', + 'DefaultRate' => '100', + 'DefaultScale' => '100', + 'SignalCheckColour' => '#0000c0', + 'WebColour' => 'red', + 'Exif' => '0', + 'Triggers' => "", + 'V4LMultiBuffer' => '', + 'V4LCapturesPerFrame' => 1, + 'ServerId' => $Server['Id'], + ); + } + return ($monitor); +} +>>>>>>> feature-h264-videostorage }