diff --git a/src/zm_event.cpp b/src/zm_event.cpp index d34f55d27..89df6bc00 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -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; diff --git a/src/zm_videostore.cpp b/src/zm_videostore.cpp index 8809148a1..99b521c3c 100644 --- a/src/zm_videostore.cpp +++ b/src/zm_videostore.cpp @@ -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; diff --git a/web/skins/classic/js/skin.js.php b/web/skins/classic/js/skin.js.php index 3b9e88264..9f50fe8d0 100644 --- a/web/skins/classic/js/skin.js.php +++ b/web/skins/classic/js/skin.js.php @@ -52,3 +52,7 @@ echo 'false'; var focusWindow = ; var imagePrefix = ""; + + +var auth_hash = ''; + diff --git a/web/skins/classic/views/events.php b/web/skins/classic/views/events.php index 17ead385d..d77441875 100644 --- a/web/skins/classic/views/events.php +++ b/web/skins/classic/views/events.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') );