Merge branch 'storageareas' of github.com:ConnorTechnology/ZoneMinder into storageareas
This commit is contained in:
commit
5ca04b00b3
|
@ -1491,6 +1491,8 @@ void EventStream::runStream() {
|
|||
|
||||
if ( !paused ) {
|
||||
curr_frame_id += replay_rate>0?1:-1;
|
||||
if ( (mode == MODE_SINGLE) && ((unsigned int)curr_frame_id == event_data->frame_count) )
|
||||
curr_frame_id = 1;
|
||||
if ( send_frame && type != STREAM_MPEG ) {
|
||||
Debug( 3, "dUs: %d", delta_us );
|
||||
usleep( delta_us );
|
||||
|
@ -1498,7 +1500,7 @@ void EventStream::runStream() {
|
|||
} else {
|
||||
usleep( (unsigned long)((1000000 * ZM_RATE_BASE)/((base_fps?base_fps:1)*abs(replay_rate*2))) );
|
||||
}
|
||||
}
|
||||
} // end while ! zm_terminate
|
||||
#if HAVE_LIBAVCODEC
|
||||
if ( type == STREAM_MPEG )
|
||||
delete vid_stream;
|
||||
|
|
|
@ -222,9 +222,6 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in,
|
|||
}
|
||||
}
|
||||
|
||||
//av_dict_set(&opts, "movflags", "frag_custom+dash+delay_moov", 0);
|
||||
//if ((ret = avformat_write_header(ctx, &opts)) < 0) {
|
||||
//}
|
||||
//os->ctx_inited = 1;
|
||||
//avio_flush(ctx->pb);
|
||||
//av_dict_free(&opts);
|
||||
|
@ -232,13 +229,24 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in,
|
|||
if ( audio_output_stream )
|
||||
zm_dump_stream_format( oc, 1, 0, 1 );
|
||||
|
||||
/* Write the stream header, if any. */
|
||||
ret = avformat_write_header(oc, NULL);
|
||||
AVDictionary * opts = NULL;
|
||||
//av_dict_set(&opts, "movflags", "frag_custom+dash+delay_moov", 0);
|
||||
//av_dict_set(&opts, "movflags", "frag_custom+dash+delay_moov", 0);
|
||||
//av_dict_set(&opts, "movflags", "frag_keyframe+empty_moov+default_base_moof", 0);
|
||||
if ((ret = avformat_write_header(oc, &opts)) < 0) {
|
||||
Warning("Unable to set movflags to frag_custom+dash+delay_moov");
|
||||
/* Write the stream header, if any. */
|
||||
ret = avformat_write_header(oc, NULL);
|
||||
} else if (av_dict_count(opts) != 0) {
|
||||
Warning("some options not set\n");
|
||||
}
|
||||
if (ret < 0) {
|
||||
Error("Error occurred when writing output file header to %s: %s\n",
|
||||
filename,
|
||||
av_make_error_string(ret).c_str());
|
||||
}
|
||||
if ( opts )
|
||||
av_dict_free(&opts);
|
||||
|
||||
video_last_pts = 0;
|
||||
video_last_dts = 0;
|
||||
|
|
|
@ -52,3 +52,7 @@ echo 'false';
|
|||
var focusWindow = <?php echo !empty($focusWindow)?'true':'false' ?>;
|
||||
|
||||
var imagePrefix = "<?php echo viewImagePath( "", '&' ) ?>";
|
||||
|
||||
<?php if ( ZM_OPT_USE_AUTH && ZM_AUTH_HASH_LOGINS ) { ?>
|
||||
var auth_hash = '<?php echo $_SESSION['AuthHash']; ?>';
|
||||
<?php } ?>
|
||||
|
|
|
@ -18,16 +18,14 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
//
|
||||
|
||||
if ( !canView( 'Events' ) || (!empty($_REQUEST['execute']) && !canEdit('Events')) )
|
||||
{
|
||||
$view = "error";
|
||||
if ( !canView( 'Events' ) || (!empty($_REQUEST['execute']) && !canEdit('Events')) ) {
|
||||
$view = 'error';
|
||||
return;
|
||||
}
|
||||
|
||||
require_once( 'includes/Event.php' );
|
||||
|
||||
if ( !empty($_REQUEST['execute']) )
|
||||
{
|
||||
if ( !empty($_REQUEST['execute']) ) {
|
||||
executeFilter( $tempFilterName );
|
||||
}
|
||||
|
||||
|
@ -38,16 +36,15 @@ if ( $user['MonitorIds'] ) {
|
|||
$countSql .= $user_monitor_ids;
|
||||
$eventsSql .= $user_monitor_ids;
|
||||
} else {
|
||||
$countSql .= " 1";
|
||||
$eventsSql .= " 1";
|
||||
$countSql .= " 1";
|
||||
$eventsSql .= " 1";
|
||||
}
|
||||
|
||||
parseSort();
|
||||
parseFilter( $_REQUEST['filter'] );
|
||||
$filterQuery = $_REQUEST['filter']['query'];
|
||||
|
||||
if ( $_REQUEST['filter']['sql'] )
|
||||
{
|
||||
if ( $_REQUEST['filter']['sql'] ) {
|
||||
$countSql .= $_REQUEST['filter']['sql'];
|
||||
$eventsSql .= $_REQUEST['filter']['sql'];
|
||||
}
|
||||
|
@ -63,31 +60,28 @@ else
|
|||
$limit = 0;
|
||||
|
||||
$nEvents = dbFetchOne( $countSql, 'EventCount' );
|
||||
if ( !empty($limit) && $nEvents > $limit )
|
||||
{
|
||||
if ( !empty($limit) && $nEvents > $limit ) {
|
||||
$nEvents = $limit;
|
||||
}
|
||||
$pages = (int)ceil($nEvents/ZM_WEB_EVENTS_PER_PAGE);
|
||||
if ( !empty($page) ) {
|
||||
if ( $page < 0 )
|
||||
$page = 1;
|
||||
if ( $page > $pages )
|
||||
$page = $pages;
|
||||
if ( $page < 0 )
|
||||
$page = 1;
|
||||
else if ( $page > $pages )
|
||||
$page = $pages;
|
||||
}
|
||||
|
||||
if ( !empty($page) ) {
|
||||
$limitStart = (($page-1)*ZM_WEB_EVENTS_PER_PAGE);
|
||||
if ( empty( $limit ) )
|
||||
{
|
||||
$limitAmount = ZM_WEB_EVENTS_PER_PAGE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$limitLeft = $limit - $limitStart;
|
||||
$limitAmount = ($limitLeft>ZM_WEB_EVENTS_PER_PAGE)?ZM_WEB_EVENTS_PER_PAGE:$limitLeft;
|
||||
}
|
||||
$eventsSql .= " limit $limitStart, $limitAmount";
|
||||
$limitStart = (($page-1)*ZM_WEB_EVENTS_PER_PAGE);
|
||||
if ( empty( $limit ) ) {
|
||||
$limitAmount = ZM_WEB_EVENTS_PER_PAGE;
|
||||
} else {
|
||||
$limitLeft = $limit - $limitStart;
|
||||
$limitAmount = ($limitLeft>ZM_WEB_EVENTS_PER_PAGE)?ZM_WEB_EVENTS_PER_PAGE:$limitLeft;
|
||||
}
|
||||
$eventsSql .= " limit $limitStart, $limitAmount";
|
||||
} elseif ( !empty( $limit ) ) {
|
||||
$eventsSql .= " limit 0, ".$limit;
|
||||
$eventsSql .= " limit 0, ".$limit;
|
||||
}
|
||||
|
||||
$maxWidth = 0;
|
||||
|
@ -95,20 +89,19 @@ $maxHeight = 0;
|
|||
$archived = false;
|
||||
$unarchived = false;
|
||||
$events = array();
|
||||
foreach ( dbFetchAll( $eventsSql ) as $event_row )
|
||||
{
|
||||
$events[] = $event = new Event( $event_row );
|
||||
foreach ( dbFetchAll( $eventsSql ) as $event_row ) {
|
||||
$events[] = $event = new Event( $event_row );
|
||||
|
||||
# Doesn this code do anything?
|
||||
$scale = max( reScale( SCALE_BASE, $event->DefaultScale(), ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
|
||||
$eventWidth = reScale( $event_row['Width'], $scale );
|
||||
$eventHeight = reScale( $event_row['Height'], $scale );
|
||||
if ( $maxWidth < $eventWidth ) $maxWidth = $eventWidth;
|
||||
if ( $maxHeight < $eventHeight ) $maxHeight = $eventHeight;
|
||||
if ( $event_row['Archived'] )
|
||||
$archived = true;
|
||||
else
|
||||
$unarchived = true;
|
||||
# Doesn this code do anything?
|
||||
$scale = max( reScale( SCALE_BASE, $event->DefaultScale(), ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
|
||||
$eventWidth = reScale( $event_row['Width'], $scale );
|
||||
$eventHeight = reScale( $event_row['Height'], $scale );
|
||||
if ( $maxWidth < $eventWidth ) $maxWidth = $eventWidth;
|
||||
if ( $maxHeight < $eventHeight ) $maxHeight = $eventHeight;
|
||||
if ( $event_row['Archived'] )
|
||||
$archived = true;
|
||||
else
|
||||
$unarchived = true;
|
||||
}
|
||||
|
||||
$maxShortcuts = 5;
|
||||
|
@ -124,16 +117,12 @@ xhtmlHeaders(__FILE__, translate('Events') );
|
|||
<div id="header">
|
||||
<div id="headerButtons">
|
||||
<?php
|
||||
if ( $pages > 1 )
|
||||
{
|
||||
if ( !empty($page) )
|
||||
{
|
||||
if ( $pages > 1 ) {
|
||||
if ( !empty($page) ) {
|
||||
?>
|
||||
<a href="?view=<?php echo $view ?>&page=0<?php echo $filterQuery ?><?php echo $sortQuery ?>&limit=<?php echo $limit ?>"><?php echo translate('ViewAll') ?></a>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
?>
|
||||
<a href="?view=<?php echo $view ?>&page=1<?php echo $filterQuery ?><?php echo $sortQuery ?>&limit=<?php echo $limit ?>"><?php echo translate('ViewPaged') ?></a>
|
||||
<?php
|
||||
|
@ -154,8 +143,7 @@ if ( $pages > 1 )
|
|||
<input type="hidden" name="sort_asc" value="<?php echo validHtmlStr($_REQUEST['sort_asc']) ?>"/>
|
||||
<input type="hidden" name="limit" value="<?php echo $limit ?>"/>
|
||||
<?php
|
||||
if ( $pagination )
|
||||
{
|
||||
if ( $pagination ) {
|
||||
?>
|
||||
<h3 class="pagination"><?php echo $pagination ?></h3>
|
||||
<?php
|
||||
|
@ -170,10 +158,8 @@ if ( $pagination )
|
|||
<tbody>
|
||||
<?php
|
||||
$count = 0;
|
||||
foreach ( $events as $event )
|
||||
{
|
||||
if ( ($count++%ZM_WEB_EVENTS_PER_PAGE) == 0 )
|
||||
{
|
||||
foreach ( $events as $event ) {
|
||||
if ( ($count++%ZM_WEB_EVENTS_PER_PAGE) == 0 ) {
|
||||
?>
|
||||
<tr>
|
||||
<th class="colId"><a href="<?php echo sortHeader( 'Id' ) ?>"><?php echo translate('Id') ?><?php echo sortTag( 'Id' ) ?></a></th>
|
||||
|
@ -191,18 +177,17 @@ foreach ( $events as $event )
|
|||
<th class="colDiskSpace"><a href="<?php echo sortHeader( 'DiskSpace' ) ?>"><?php echo translate('DiskSpace') ?><?php echo sortTag( 'DiskSpace' ) ?></a></th>
|
||||
<?php
|
||||
}
|
||||
if ( ZM_WEB_LIST_THUMBS )
|
||||
{
|
||||
if ( ZM_WEB_LIST_THUMBS ) {
|
||||
?>
|
||||
<th class="colThumbnail"><?php echo translate('Thumbnail') ?></th>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<th class="colMark"><input type="checkbox" name="toggleCheck" value="1" onclick="toggleCheckbox( this, 'markEids' );"<?php if ( !canEdit( 'Events' ) ) { ?> disabled="disabled"<?php } ?>/></th>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
$scale = max( reScale( SCALE_BASE, $event->DefaultScale(), ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
|
||||
$scale = max( reScale( SCALE_BASE, $event->DefaultScale(), ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
|
||||
?>
|
||||
<tr>
|
||||
<td class="colId"><?php echo makePopupLink( '?view=event&eid='.$event->Id().$filterQuery.$sortQuery.'&page=1', 'zmEvent', array( 'event', reScale( $event->Width(), $scale ), reScale( $event->Height(), $scale ) ), $event->Id().($event->Archived()?'*':'') ) ?></td>
|
||||
|
@ -220,16 +205,26 @@ foreach ( $events as $event )
|
|||
<td class="colDiskSpace"><?php echo human_filesize( $event->DiskSpace() ) ?></td>
|
||||
<?php
|
||||
}
|
||||
if ( ZM_WEB_LIST_THUMBS )
|
||||
{
|
||||
if ( $thumbData = $event->createListThumbnail() )
|
||||
{
|
||||
if ( ZM_WEB_LIST_THUMBS ) {
|
||||
if ( $thumbData = $event->createListThumbnail() ) {
|
||||
?>
|
||||
<td class="colThumbnail"><?php echo makePopupLink( '?view=frame&eid='.$event->Id().'&fid='.$thumbData['FrameId'], 'zmImage', array( 'image', reScale( $event->Width(), $scale ), reScale( $event->Height(), $scale ) ), '<img src="?view=image&eid='.$event->Id().'&fid='.$thumbData['FrameId'].'&width='.$thumbData['Width'].'&height='.$thumbData['Height'].'" width="'.$thumbData['Width'].'" height="'.$thumbData['Height'].'" alt="'.$thumbData['FrameId'].'/'.$event->MaxScore().'"/>' ) ?></td>
|
||||
<td class="colThumbnail">
|
||||
<?php
|
||||
|
||||
$imgSrc = '?view=image&eid='.$event->Id().'&fid='.$thumbData['FrameId'].'&width='.$thumbData['Width'].'&height='.$thumbData['Height'];
|
||||
$streamSrc = getStreamSrc( array( "source=event", "mode=jpeg", "event=".$event->Id(), "scale=".$scale, "maxfps=".ZM_WEB_VIDEO_MAXFPS, "replay=single") );
|
||||
|
||||
$imgHtml = '<img id="thumbnail'.$event->id().'" src="'.$imgSrc.'" alt="'. validHtmlStr('Event '.$event->Id()) .'" style="width:'. validInt($thumbData['Width']) .'px;height:'. validInt( $thumbData['Height'] ).'px;" onmouseover="this.src=\''.$streamSrc.'\';" onmouseout="this.src=\''.$imgSrc.'\';"/>';
|
||||
|
||||
echo makePopupLink(
|
||||
'?view=frame&eid='.$event->Id().'&fid='.$thumbData['FrameId'],
|
||||
'zmImage',
|
||||
array( 'image', reScale( $event->Width(), $scale ), reScale( $event->Height(), $scale ) ),
|
||||
$imgHtml
|
||||
);
|
||||
?></td>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
?>
|
||||
<td class="colThumbnail"> </td>
|
||||
<?php
|
||||
|
|
|
@ -94,6 +94,9 @@ function setAlarmState( currentAlarmState ) {
|
|||
}
|
||||
|
||||
var streamCmdParms = "view=request&request=stream&connkey="+connKey;
|
||||
if ( auth_hash )
|
||||
streamCmdParms += '&auth='+auth_hash;
|
||||
|
||||
var streamCmdReq = new Request.JSON( { url: monitorUrl+thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getStreamCmdResponse } );
|
||||
var streamCmdTimer = null;
|
||||
|
||||
|
@ -325,6 +328,8 @@ function streamCmdQuery() {
|
|||
}
|
||||
|
||||
var statusCmdParms = "view=request&request=status&entity=monitor&id="+monitorId+"&element[]=Status&element[]=FrameRate";
|
||||
if ( auth_hash )
|
||||
statusCmdParms += '&auth='+auth_hash;
|
||||
var statusCmdReq = new Request.JSON( { url: monitorUrl+thisUrl, method: 'post', data: statusCmdParms, timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getStatusCmdResponse } );
|
||||
var statusCmdTimer = null;
|
||||
|
||||
|
@ -350,6 +355,8 @@ function statusCmdQuery() {
|
|||
}
|
||||
|
||||
var alarmCmdParms = "view=request&request=alarm&id="+monitorId;
|
||||
if ( auth_hash )
|
||||
alarmCmdParms += '&auth='+auth_hash;
|
||||
var alarmCmdReq = new Request.JSON( { url: monitorUrl+thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getAlarmCmdResponse, onTimeout: streamCmdQuery } );
|
||||
var alarmCmdFirst = true;
|
||||
|
||||
|
@ -390,6 +397,8 @@ function deleteEvent( event, eventId ) {
|
|||
}
|
||||
|
||||
var eventCmdParms = "view=request&request=status&entity=events&id="+monitorId+"&count="+maxDisplayEvents+"&sort=Id%20desc";
|
||||
if ( auth_hash )
|
||||
eventCmdParms += '&auth='+auth_hash;
|
||||
var eventCmdReq = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, data: eventCmdParms, link: 'cancel', onSuccess: getEventCmdResponse, onTimeout: eventCmdQuery } );
|
||||
var eventCmdTimer = null;
|
||||
var eventCmdFirst = true;
|
||||
|
@ -496,6 +505,8 @@ function eventCmdQuery() {
|
|||
}
|
||||
|
||||
var controlParms = "view=request&request=control&id="+monitorId;
|
||||
if ( auth_hash )
|
||||
controlParms += '&auth='+auth_hash;
|
||||
var controlReq = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getControlResponse } );
|
||||
|
||||
function getControlResponse( respObj, respText ) {
|
||||
|
|
Loading…
Reference in New Issue