Skip to content

Commit

Permalink
Fix version checks to fix build on yaketty
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac Connor committed Jun 15, 2017
1 parent 734f099 commit 119f8fc
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 19 deletions.
2 changes: 2 additions & 0 deletions distros/ubuntu1604/zoneminder.dirs
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/zm_ffmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/zm_ffmpeg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions src/zm_ffmpeg_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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))
Expand All @@ -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))
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 );
Expand Down
18 changes: 9 additions & 9 deletions src/zm_videostore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand All @@ -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 );
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down
4 changes: 2 additions & 2 deletions web/skins/classic/views/js/log.js
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -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 );
}
}
);
Expand Down

0 comments on commit 119f8fc

Please sign in to comment.