fix loading starttime of event
This commit is contained in:
parent
0d8e4656dc
commit
24dd3a8c66
|
@ -37,8 +37,7 @@
|
||||||
#include "zm_monitor.h"
|
#include "zm_monitor.h"
|
||||||
|
|
||||||
// sendfile tricks
|
// sendfile tricks
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#include "zm_sendfile.h"
|
#include "zm_sendfile.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,27 +131,31 @@ bool EventStream::loadEventData( int event_id ) {
|
||||||
delete event_data;
|
delete event_data;
|
||||||
event_data = new EventData;
|
event_data = new EventData;
|
||||||
event_data->event_id = event_id;
|
event_data->event_id = event_id;
|
||||||
|
|
||||||
event_data->monitor_id = atoi( dbrow[0] );
|
event_data->monitor_id = atoi( dbrow[0] );
|
||||||
event_data->start_time = atoi(dbrow[2]);
|
|
||||||
event_data->storage_id = dbrow[1] ? atoi( dbrow[1] ) : 0;
|
event_data->storage_id = dbrow[1] ? atoi( dbrow[1] ) : 0;
|
||||||
|
event_data->frame_count = dbrow[2] == NULL ? 0 : atoi(dbrow[2]);
|
||||||
|
event_data->start_time = atoi(dbrow[3]);
|
||||||
|
event_data->duration = atof(dbrow[4]);
|
||||||
|
strncpy( event_data->video_file, dbrow[5], sizeof( event_data->video_file )-1 );
|
||||||
|
|
||||||
Storage * storage = new Storage( event_data->storage_id );
|
Storage * storage = new Storage( event_data->storage_id );
|
||||||
const char *storage_path = storage->Path();
|
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 );
|
struct tm *event_time = localtime( &event_data->start_time );
|
||||||
|
|
||||||
if ( storage_path[0] == '/' )
|
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 );
|
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
|
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 );
|
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] == '/' )
|
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 );
|
snprintf( event_data->path, sizeof(event_data->path), "%s/%ld/%ld", storage_path, event_data->monitor_id, event_data->event_id );
|
||||||
else
|
else
|
||||||
snprintf( event_data->path, sizeof(event_data->path), "%s/%s/%ld/%ld", staticConfig.PATH_WEB.c_str(), storage_path, event_data->monitor_id, event_data->event_id );
|
snprintf( event_data->path, sizeof(event_data->path), "%s/%s/%ld/%ld", staticConfig.PATH_WEB.c_str(), storage_path, event_data->monitor_id, event_data->event_id );
|
||||||
}
|
}
|
||||||
event_data->frame_count = dbrow[2] == NULL ? 0 : atoi(dbrow[2]);
|
|
||||||
event_data->duration = atof(dbrow[4]);
|
|
||||||
strncpy( event_data->video_file, dbrow[5], sizeof( event_data->video_file )-1 );
|
|
||||||
|
|
||||||
updateFrameRate( (double)event_data->frame_count/event_data->duration );
|
updateFrameRate( (double)event_data->frame_count/event_data->duration );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue