From 119f8fc86ce77183239e55c8af52cc21c47ced30 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 15 Jun 2017 13:02:54 -0400 Subject: [PATCH] Fix version checks to fix build on yaketty --- distros/ubuntu1604/zoneminder.dirs | 2 ++ src/zm_ffmpeg.cpp | 2 +- src/zm_ffmpeg.h | 2 +- src/zm_ffmpeg_camera.cpp | 12 ++++++------ src/zm_videostore.cpp | 18 +++++++++--------- web/skins/classic/views/js/log.js | 4 ++-- 6 files changed, 21 insertions(+), 19 deletions(-) diff --git a/distros/ubuntu1604/zoneminder.dirs b/distros/ubuntu1604/zoneminder.dirs index 4178482c1..56dd56e6b 100644 --- a/distros/ubuntu1604/zoneminder.dirs +++ b/distros/ubuntu1604/zoneminder.dirs @@ -4,3 +4,5 @@ var/cache/zoneminder/events var/cache/zoneminder/images var/cache/zoneminder/temp usr/share/zoneminder/db +etc/zm/ +etc/zm/conf.d diff --git a/src/zm_ffmpeg.cpp b/src/zm_ffmpeg.cpp index 2dab1538d..645b8ce1f 100644 --- a/src/zm_ffmpeg.cpp +++ b/src/zm_ffmpeg.cpp @@ -413,7 +413,7 @@ static void zm_log_fps(double d, const char *postfix) { Debug(1, "%1.0fk %s", d / 1000, postfix); } -#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) void zm_dump_codecpar ( const AVCodecParameters *par ) { Debug(1, "Dumping codecpar codec_type(%d) codec_id(%d) codec_tag(%d) width(%d) height(%d)", par->codec_type, diff --git a/src/zm_ffmpeg.h b/src/zm_ffmpeg.h index c94006edb..61371a426 100644 --- a/src/zm_ffmpeg.h +++ b/src/zm_ffmpeg.h @@ -324,7 +324,7 @@ static av_always_inline av_const int64_t av_clip64_c(int64_t a, int64_t amin, in void zm_dump_stream_format(AVFormatContext *ic, int i, int index, int is_output); void zm_dump_codec ( const AVCodecContext *codec ); -#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) void zm_dump_codecpar ( const AVCodecParameters *par ); #endif diff --git a/src/zm_ffmpeg_camera.cpp b/src/zm_ffmpeg_camera.cpp index 687cd1a9f..b0260bb8d 100644 --- a/src/zm_ffmpeg_camera.cpp +++ b/src/zm_ffmpeg_camera.cpp @@ -167,7 +167,7 @@ int FfmpegCamera::Capture( Image &image ) { Debug( 5, "Got packet from stream %d dts (%d) pts(%d)", packet.stream_index, packet.pts, packet.dts ); // What about audio stream? Maybe someday we could do sound detection... if ( packet.stream_index == mVideoStreamId ) { -#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) ret = avcodec_send_packet( mVideoCodecContext, &packet ); if ( ret < 0 ) { av_strerror( ret, errbuf, AV_ERROR_MAX_STRING_SIZE ); @@ -327,7 +327,7 @@ int FfmpegCamera::OpenFfmpeg() { mVideoStreamId = -1; mAudioStreamId = -1; for (unsigned int i=0; i < mFormatContext->nb_streams; i++ ) { -#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) if ( mFormatContext->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ) { #else #if (LIBAVCODEC_VERSION_CHECK(52, 64, 0, 64, 0) || LIBAVUTIL_VERSION_CHECK(50, 14, 0, 14, 0)) @@ -344,7 +344,7 @@ int FfmpegCamera::OpenFfmpeg() { Debug(2, "Have another video stream." ); } } -#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) if ( mFormatContext->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO ) { #else #if (LIBAVCODEC_VERSION_CHECK(52, 64, 0, 64, 0) || LIBAVUTIL_VERSION_CHECK(50, 14, 0, 14, 0)) @@ -368,7 +368,7 @@ int FfmpegCamera::OpenFfmpeg() { Debug ( 3, "Found video stream at index %d", mVideoStreamId ); Debug ( 3, "Found audio stream at index %d", mAudioStreamId ); -#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) mVideoCodecContext = avcodec_alloc_context3( NULL ); avcodec_parameters_to_context( mVideoCodecContext, mFormatContext->streams[mVideoStreamId]->codecpar ); #else @@ -397,7 +397,7 @@ int FfmpegCamera::OpenFfmpeg() { } if ( mAudioStreamId >= 0 ) { -#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) mAudioCodecContext = avcodec_alloc_context3( NULL ); avcodec_parameters_to_context( mAudioCodecContext, mFormatContext->streams[mAudioStreamId]->codecpar ); #else @@ -755,7 +755,7 @@ else if ( packet.pts && video_last_pts > packet.pts ) { } Debug(4, "about to decode video" ); -#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) ret = avcodec_send_packet( mVideoCodecContext, &packet ); if ( ret < 0 ) { av_strerror( ret, errbuf, AV_ERROR_MAX_STRING_SIZE ); diff --git a/src/zm_videostore.cpp b/src/zm_videostore.cpp index ff949c554..0d6056e3e 100644 --- a/src/zm_videostore.cpp +++ b/src/zm_videostore.cpp @@ -41,7 +41,7 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, video_input_stream = p_video_input_stream; audio_input_stream = p_audio_input_stream; -#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) video_input_context = avcodec_alloc_context3( NULL ); avcodec_parameters_to_context( video_input_context, video_input_stream->codecpar ); zm_dump_codecpar( video_input_stream->codecpar ); @@ -85,7 +85,7 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, oc->metadata = pmetadata; output_format = oc->oformat; -#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) // Since we are not re-encoding, all we have to do is copy the parameters video_output_context = avcodec_alloc_context3( NULL ); @@ -195,7 +195,7 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, if ( audio_input_stream ) { Debug(3, "Have audio stream" ); -#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) audio_input_context = avcodec_alloc_context3( NULL ); ret = avcodec_parameters_to_context( audio_input_context, audio_input_stream->codecpar ); @@ -222,7 +222,7 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, } else { Debug(2, "setting parameters"); -#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) audio_output_context = avcodec_alloc_context3( audio_output_codec ); // Copy params from inputstream to context ret = avcodec_parameters_to_context( audio_output_context, audio_input_stream->codecpar ); @@ -325,7 +325,7 @@ VideoStore::~VideoStore(){ int64_t size; while(1) { -#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) ret = avcodec_receive_packet( audio_output_context, &pkt ); #else ret = avcodec_encode_audio2( audio_output_context, &pkt, NULL, &got_packet ); @@ -397,7 +397,7 @@ bool VideoStore::setup_resampler() { #ifdef HAVE_LIBAVRESAMPLE static char error_buffer[256]; -#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) // Newer ffmpeg wants to keep everything separate... so have to lookup our own decoder, can't reuse the one from the camera. AVCodec *audio_input_codec = avcodec_find_decoder(audio_input_stream->codecpar->codec_id); #else @@ -473,7 +473,7 @@ bool VideoStore::setup_resampler() { // Now copy them to the output stream audio_output_stream = avformat_new_stream( oc, audio_output_codec ); -#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) ret = avcodec_parameters_from_context( audio_output_stream->codecpar, audio_output_context ); if ( ret < 0 ) { Error( "Could not initialize stream parameteres"); @@ -738,7 +738,7 @@ int VideoStore::writeAudioFramePacket( AVPacket *ipkt ) { if ( audio_output_codec ) { #ifdef HAVE_LIBAVRESAMPLE -#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) ret = avcodec_send_packet( audio_input_context, ipkt ); if ( ret < 0 ) { Error("avcodec_send_packet fail %s", av_make_error_string(ret).c_str()); @@ -818,7 +818,7 @@ int VideoStore::writeAudioFramePacket( AVPacket *ipkt ) { * Encode the audio frame and store it in the temporary packet. * The output audio stream encoder is used to do this. */ -#if LIBAVCODEC_VERSION_CHECK(57, 0, 0, 0, 0) +#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) if (( ret = avcodec_send_frame( audio_output_context, output_frame ) ) < 0 ) { Error( "Could not send frame (error '%s')", av_make_error_string(ret).c_str()); diff --git a/web/skins/classic/views/js/log.js b/web/skins/classic/views/js/log.js index 34a0178da..f78912681 100644 --- a/web/skins/classic/views/js/log.js +++ b/web/skins/classic/views/js/log.js @@ -1,5 +1,5 @@ var logParms = "view=request&request=log&task=query"; -var logReq = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: logResponse } ); +var logReq = new Request.JSON( { url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: logResponse } ); var logTimer = undefined; var logTable = undefined; @@ -75,7 +75,7 @@ function logResponse( respObj ) { var color = document.defaultView.getComputedStyle(row.tr, null).getPropertyValue('color'); var colorParts = color.match(/^rgb.*\((\d+),\s*(\d+),\s*(\d+)/); rowOrigColor = '#' + parseInt(colorParts[1]).toString(16) + parseInt(colorParts[2]).toString(16) + parseInt(colorParts[3]).toString(16); - new Fx.Tween( row.tr, { duration: 10000, transition: Fx.Transitions.Sine } ).start( 'color', '#6495ED', rowOrigColor ); + //new Fx.Tween( row.tr, { duration: 10000, transition: Fx.Transitions.Sine } ).start( 'color', '#6495ED', rowOrigColor ); } } );