From 76abad0a96723f592b972b495a0c10139aaaee8b Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 1 Jul 2018 18:19:11 -0400 Subject: [PATCH 01/30] escape {} in regexp --- scripts/ZoneMinder/lib/ZoneMinder/General.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/General.pm b/scripts/ZoneMinder/lib/ZoneMinder/General.pm index 692af30d4..fb9e1e44b 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/General.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/General.pm @@ -654,7 +654,7 @@ sub jsonDecode { $out =~ s/=>null/=>undef/g; $out =~ s/`/'/g; $out =~ s/qx/qq/g; - ( $out ) = $out =~ m/^({.+})$/; # Detaint and check it's a valid object syntax + ( $out ) = $out =~ m/^(\{.+\})$/; # Detaint and check it's a valid object syntax my $result = eval $out; Fatal( $@ ) if ( $@ ); return( $result ); From 5fd1034b0b67baae9307051ff83195f52699b509 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 25 Sep 2018 13:53:50 -0400 Subject: [PATCH 02/30] Add ServerId to perl Logging to DB --- scripts/ZoneMinder/lib/ZoneMinder/Logger.pm | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm b/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm index 48e39e70e..16535d9e3 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Logger.pm @@ -570,7 +570,7 @@ sub logPrint { $this->{databaseLevel} = $oldlevel; } - my $sql = 'INSERT INTO Logs ( TimeKey, Component, Pid, Level, Code, Message, File, Line ) VALUES ( ?, ?, ?, ?, ?, ?, ?, NULL )'; + my $sql = 'INSERT INTO Logs ( TimeKey, Component, ServerId, Pid, Level, Code, Message, File, Line ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, NULL )'; $this->{sth} = $this->{dbh}->prepare_cached($sql) if ! $this->{sth}; if ( !$this->{sth} ) { $this->{databaseLevel} = NOLOG; @@ -578,13 +578,15 @@ sub logPrint { return; } - my $res = $this->{sth}->execute($seconds+($microseconds/1000000.0) - , $this->{id} - , $$ - , $level - , $codes{$level} - , $string - , $this->{fileName} + my $res = $this->{sth}->execute( + $seconds+($microseconds/1000000.0), + $this->{id}, + ($Config{ZM_SERVER_ID} ? $Config{ZM_SERVER_ID} : undef), + $$, + $level, + $codes{$level}, + $string, + $this->{fileName}, ); if ( !$res ) { $this->{databaseLevel} = NOLOG; From f1db5446d13cefb5380139af85c0382f9d430b70 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Wed, 26 Sep 2018 10:02:39 -0400 Subject: [PATCH 03/30] added license --- web/fonts/license.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 web/fonts/license.md diff --git a/web/fonts/license.md b/web/fonts/license.md new file mode 100644 index 000000000..78e2380a6 --- /dev/null +++ b/web/fonts/license.md @@ -0,0 +1,26 @@ + +ZoneMinder uses certain 3rd party media assets/libraries for UI display purposes. Their licenses are listed in this file + +### Material Design icons + +Origin: https://github.com/google/material-design-icons +License: Apache 2.0 (https://github.com/google/material-design-icons/blob/master/LICENSE) + +### Glyphicon halflings font + +Origin: http://www.glyphicons.com/ +License: MIT, As clarified below (http://www.glyphicons.com/license/) + +``` +License for GLYPHICONS Halflings in Bootstrap + +GLYPHICONS Halflings font is also released as an extension of a Bootstrap www.getbootstrap.com for free and it is released under the same license as Bootstrap. While you are not required to include attribution on your Bootstrap-based projects, I would certainly appreciate any form of support, even a nice Tweet is enough. Of course if you want, you can say thank you and support me by buying more icons on GLYPHICONS.com. + +Jan Kovařík +``` + +ZoneMinder uses Bootstrap for UI and qualifies as a Bootstrap-based project. +Bootstrap is MIT licensed (https://github.com/twbs/bootstrap/blob/v4.1.3/LICENSE) + + + From 8afb3d865050674fa1ce5c5d5389c0db6e77f960 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Wed, 26 Sep 2018 10:05:54 -0400 Subject: [PATCH 04/30] formatting --- web/fonts/license.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/fonts/license.md b/web/fonts/license.md index 78e2380a6..b12e0edb7 100644 --- a/web/fonts/license.md +++ b/web/fonts/license.md @@ -4,11 +4,13 @@ ZoneMinder uses certain 3rd party media assets/libraries for UI display purposes ### Material Design icons Origin: https://github.com/google/material-design-icons + License: Apache 2.0 (https://github.com/google/material-design-icons/blob/master/LICENSE) ### Glyphicon halflings font Origin: http://www.glyphicons.com/ + License: MIT, As clarified below (http://www.glyphicons.com/license/) ``` From e27bd11f79f543504910844064455f97289d55ec Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Wed, 26 Sep 2018 10:08:08 -0400 Subject: [PATCH 05/30] wrap --- web/fonts/license.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/web/fonts/license.md b/web/fonts/license.md index b12e0edb7..4e85b607f 100644 --- a/web/fonts/license.md +++ b/web/fonts/license.md @@ -4,19 +4,20 @@ ZoneMinder uses certain 3rd party media assets/libraries for UI display purposes ### Material Design icons Origin: https://github.com/google/material-design-icons - License: Apache 2.0 (https://github.com/google/material-design-icons/blob/master/LICENSE) ### Glyphicon halflings font Origin: http://www.glyphicons.com/ - License: MIT, As clarified below (http://www.glyphicons.com/license/) ``` License for GLYPHICONS Halflings in Bootstrap -GLYPHICONS Halflings font is also released as an extension of a Bootstrap www.getbootstrap.com for free and it is released under the same license as Bootstrap. While you are not required to include attribution on your Bootstrap-based projects, I would certainly appreciate any form of support, even a nice Tweet is enough. Of course if you want, you can say thank you and support me by buying more icons on GLYPHICONS.com. +GLYPHICONS Halflings font is also released as an extension of a Bootstrap www.getbootstrap.com for free and +it is released under the same license as Bootstrap. While you are not required to include attribution on your +Bootstrap-based projects, I would certainly appreciate any form of support, even a nice Tweet is enough. +Of course if you want, you can say thank you and support me by buying more icons on GLYPHICONS.com. Jan Kovařík ``` From d1f93d752b412917ed17fd81f7d55d6518aa8685 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Wed, 26 Sep 2018 10:10:07 -0400 Subject: [PATCH 06/30] wrap again --- web/fonts/license.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/fonts/license.md b/web/fonts/license.md index 4e85b607f..197f20b13 100644 --- a/web/fonts/license.md +++ b/web/fonts/license.md @@ -4,11 +4,13 @@ ZoneMinder uses certain 3rd party media assets/libraries for UI display purposes ### Material Design icons Origin: https://github.com/google/material-design-icons + License: Apache 2.0 (https://github.com/google/material-design-icons/blob/master/LICENSE) ### Glyphicon halflings font Origin: http://www.glyphicons.com/ + License: MIT, As clarified below (http://www.glyphicons.com/license/) ``` From 6bca9415e8bdc8a47c13994a541526aeaf05e875 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Wed, 26 Sep 2018 10:17:16 -0400 Subject: [PATCH 07/30] added note to make sure headers is on --- misc/apache-cors.conf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/misc/apache-cors.conf b/misc/apache-cors.conf index b82b697a7..3bcba88f7 100644 --- a/misc/apache-cors.conf +++ b/misc/apache-cors.conf @@ -4,7 +4,9 @@ # If using VirtualHosts, then this config must be placed inside the appropriate # directive. -#zmNinja header permissions. Tweak to your needs +# Make sure you have enabled headers with sudo a2enmod headers +# zmNinja header permissions. Tweak to your needs + Header always set Access-Control-Allow-Credentials true #zmNinja's WKWebView will set the origin header as localhost:8080 Header always set Access-Control-Allow-Origin "http://localhost:8080" From 7ffb46302fdbb4b6f69539b0664cdcdc2ef994de Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 26 Sep 2018 14:10:49 -0400 Subject: [PATCH 08/30] When events have the same starttime, sort secondly by Id --- web/skins/classic/views/events.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/skins/classic/views/events.php b/web/skins/classic/views/events.php index 50409cf16..b1c58205e 100644 --- a/web/skins/classic/views/events.php +++ b/web/skins/classic/views/events.php @@ -44,7 +44,7 @@ if ( $_REQUEST['filter']['sql'] ) { $countSql .= $_REQUEST['filter']['sql']; $eventsSql .= $_REQUEST['filter']['sql']; } -$eventsSql .= " ORDER BY $sortColumn $sortOrder"; +$eventsSql .= " ORDER BY $sortColumn $sortOrder,Id $sortOrder"; $page = isset($_REQUEST['page']) ? validInt($_REQUEST['page']) : 0; $limit = isset($_REQUEST['limit']) ? validInt($_REQUEST['limit']) : 0; From 940ad3fe68039897503e9631082160567a81505a Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Wed, 26 Sep 2018 14:47:20 -0400 Subject: [PATCH 09/30] made message generic --- misc/apache-cors.conf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/misc/apache-cors.conf b/misc/apache-cors.conf index 3bcba88f7..10455d5a6 100644 --- a/misc/apache-cors.conf +++ b/misc/apache-cors.conf @@ -1,10 +1,12 @@ -# This configuration is only needed for compatibility with zmninja on iOS +# This configuration is only needed for compatibility with zmninja # If not using VirtualHosts, copy or symlink this file into the Apache config folder # If using VirtualHosts, then this config must be placed inside the appropriate # directive. -# Make sure you have enabled headers with sudo a2enmod headers +# Make sure you have enabled/loaded header manipulation modules +# For example, in Debian based distros the command is "sudo a2enmod headers" + # zmNinja header permissions. Tweak to your needs Header always set Access-Control-Allow-Credentials true From 2385c80a4a7b0aa409245c7d3e9925d25d01bb87 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 26 Sep 2018 15:32:54 -0400 Subject: [PATCH 10/30] cleanup code a bit --- src/zm_ffmpeg.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/zm_ffmpeg.cpp b/src/zm_ffmpeg.cpp index ac841f27b..3b3a5060e 100644 --- a/src/zm_ffmpeg.cpp +++ b/src/zm_ffmpeg.cpp @@ -225,8 +225,9 @@ static void zm_log_fps(double d, const char *postfix) { Debug(1, "%3.2f %s", d, postfix); } else if (v % (100 * 1000)) { Debug(1, "%1.0f %s", d, postfix); - } else + } else { Debug(1, "%1.0fk %s", d / 1000, postfix); + } } #if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) @@ -300,7 +301,7 @@ void zm_dump_stream_format(AVFormatContext *ic, int i, int index, int is_output) if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { int fps = st->avg_frame_rate.den && st->avg_frame_rate.num; int tbn = st->time_base.den && st->time_base.num; - int tbc = st->codec->time_base.den && st->codec->time_base.num; + int tbc = codec->time_base.den && codec->time_base.num; if (fps || tbn || tbc) Debug(3, "\n" ); @@ -310,7 +311,7 @@ void zm_dump_stream_format(AVFormatContext *ic, int i, int index, int is_output) if (tbn) zm_log_fps(1 / av_q2d(st->time_base), tbc ? "stream tb numerator , " : "stream tb numerator"); if (tbc) - zm_log_fps(1 / av_q2d(st->codec->time_base), "codec time base:"); + zm_log_fps(1 / av_q2d(codec->time_base), "codec time base:"); } if (st->disposition & AV_DISPOSITION_DEFAULT) From 1419f20dcc1311f2cea38624e0a0624507e8aec4 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 26 Sep 2018 15:33:29 -0400 Subject: [PATCH 11/30] add setting rtsp_transport to udp. It is the default but we print out an error otherwise --- src/zm_ffmpeg_camera.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/zm_ffmpeg_camera.cpp b/src/zm_ffmpeg_camera.cpp index 2622f5dfa..83d837812 100644 --- a/src/zm_ffmpeg_camera.cpp +++ b/src/zm_ffmpeg_camera.cpp @@ -331,6 +331,8 @@ int FfmpegCamera::OpenFfmpeg() { ret = av_dict_set(&opts, "rtsp_transport", "tcp", 0); } else if ( method == "rtpRtspHttp" ) { ret = av_dict_set(&opts, "rtsp_transport", "http", 0); + } else if ( method == "rtpUni" ) { + ret = av_dict_set(&opts, "rtsp_transport", "udp", 0); } else { Warning("Unknown method (%s)", method.c_str() ); } @@ -606,7 +608,8 @@ int FfmpegCamera::OpenFfmpeg() { return -1; } - mConvertContext = sws_getContext(mVideoCodecContext->width, + mConvertContext = sws_getContext( + mVideoCodecContext->width, mVideoCodecContext->height, mVideoCodecContext->pix_fmt, width, height, @@ -722,7 +725,8 @@ int FfmpegCamera::CaptureAndRecord( Image &image, timeval recording, char* event uint32_t video_writer_event_id = monitor->GetVideoWriterEventId(); if ( last_event_id != video_writer_event_id ) { - Debug(2, "Have change of event. last_event(%d), our current (%d)", last_event_id, video_writer_event_id ); + Debug(2, "Have change of event. last_event(%d), our current (%d)", + last_event_id, video_writer_event_id); if ( videoStore ) { Info("Re-starting video storage module"); @@ -731,7 +735,7 @@ int FfmpegCamera::CaptureAndRecord( Image &image, timeval recording, char* event // Also don't know how much it matters for audio. if ( packet.stream_index == mVideoStreamId ) { //Write the packet to our video store - int ret = videoStore->writeVideoFramePacket( &packet ); + int ret = videoStore->writeVideoFramePacket(&packet); if ( ret < 0 ) { //Less than zero and we skipped a frame Warning("Error writing last packet to videostore."); } From 51f0e7e5c8320d7b855ae3bff8ed442539233c2f Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 26 Sep 2018 15:34:01 -0400 Subject: [PATCH 12/30] Add a default timebase if the codec timebase is invalid. Also fix crash when we can't open the .mp4 --- src/zm_videostore.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/zm_videostore.cpp b/src/zm_videostore.cpp index af833e621..a1c52353c 100644 --- a/src/zm_videostore.cpp +++ b/src/zm_videostore.cpp @@ -64,7 +64,7 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, } // Couldn't deduce format from filename, trying from format name - if (!oc) { + if ( !oc ) { avformat_alloc_output_context2(&oc, NULL, format, filename); if (!oc) { Error( @@ -108,7 +108,7 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, Debug(2, "Success creating video out stream"); } - if (!video_out_ctx->codec_tag) { + if ( !video_out_ctx->codec_tag ) { video_out_ctx->codec_tag = av_codec_get_tag(oc->oformat->codec_tag, video_in_ctx->codec_id); Debug(2, "No codec_tag, setting to %d", video_out_ctx->codec_tag); @@ -127,9 +127,10 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, #else video_out_stream = - avformat_new_stream(oc,(AVCodec *)(video_in_ctx->codec)); + avformat_new_stream(oc, NULL); +//(AVCodec *)(video_in_ctx->codec)); //avformat_new_stream(oc,(const AVCodec *)(video_in_ctx->codec)); - if (!video_out_stream) { + if ( !video_out_stream ) { Fatal("Unable to create video out stream\n"); } else { Debug(2, "Success creating video out stream"); @@ -158,6 +159,9 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, // Just copy them from the in, no reason to choose different video_out_ctx->time_base = video_in_ctx->time_base; + if ( ! (video_out_ctx->time_base.num && video_out_ctx->time_base.den) ) { + video_out_ctx->time_base = AV_TIME_BASE_Q; + } video_out_stream->time_base = video_in_stream->time_base; Debug(3, @@ -339,6 +343,9 @@ bool VideoStore::open() { if (ret < 0) { Error("Error occurred when writing out file header to %s: %s\n", filename, av_make_error_string(ret).c_str()); + /* free the stream */ + avio_closep(&oc->pb); + //avformat_free_context(oc); return false; } return true; @@ -412,7 +419,7 @@ VideoStore::~VideoStore() { if (int rc = av_write_trailer(oc)) { Error("Error writing trailer %s", av_err2str(rc)); } else { - Debug(3, "Sucess Writing trailer"); + Debug(3, "Success Writing trailer"); } // When will we not be using a file ? @@ -426,7 +433,7 @@ VideoStore::~VideoStore() { } else { Debug(3, "Not closing avio because we are not writing to a file."); } - } + } // end if ( oc->pb ) // I wonder if we should be closing the file first. // I also wonder if we really need to be doing all the ctx // allocation/de-allocation constantly, or whether we can just re-use it. From dbafffecb8ce5582b56b965b447e7670509cacc5 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 26 Sep 2018 16:20:08 -0400 Subject: [PATCH 13/30] remove extra \ --- distros/ubuntu1204/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/ubuntu1204/rules b/distros/ubuntu1204/rules index aed63c110..f971e9cc3 100755 --- a/distros/ubuntu1204/rules +++ b/distros/ubuntu1204/rules @@ -28,7 +28,7 @@ override_dh_auto_configure: -DZM_CACHEDIR="/var/cache/zoneminder/cache" \ -DZM_DIR_EVENTS="/var/cache/zoneminder/events" \ -DZM_DIR_IMAGES="/var/cache/zoneminder/images" \ - -DZM_PATH_ZMS="/zm/cgi-bin/nph-zms" \ + -DZM_PATH_ZMS="/zm/cgi-bin/nph-zms" override_dh_clean: dh_clean $(MANPAGES1) From 5ef64bf256cef6a776688e560270bbd5b60dfd48 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 26 Sep 2018 16:20:29 -0400 Subject: [PATCH 14/30] fix memleak on old libav distros --- src/zm_ffmpeg.cpp | 5 ++--- src/zm_ffmpeg.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/zm_ffmpeg.cpp b/src/zm_ffmpeg.cpp index 3b3a5060e..d4e9cb9ec 100644 --- a/src/zm_ffmpeg.cpp +++ b/src/zm_ffmpeg.cpp @@ -356,9 +356,8 @@ int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt) { #if LIBAVCODEC_VERSION_CHECK(56, 8, 0, 60, 100) #else unsigned int zm_av_packet_ref( AVPacket *dst, AVPacket *src ) { - dst->size = (src->size + FF_INPUT_BUFFER_PADDING_SIZE)/sizeof(uint64_t) + 1; - dst->data = reinterpret_cast(new uint64_t[dst->size]); - memcpy(dst->data, src->data, src->size ); + av_new_packet(dst,src->size); + memcpy(dst->data, src->data, src->size); dst->flags = src->flags; return 0; } diff --git a/src/zm_ffmpeg.h b/src/zm_ffmpeg.h index 7e3cf9651..a3a88519c 100644 --- a/src/zm_ffmpeg.h +++ b/src/zm_ffmpeg.h @@ -303,8 +303,8 @@ void zm_dump_codecpar ( const AVCodecParameters *par ); #define zm_av_packet_unref( packet ) av_packet_unref( packet ) #define zm_av_packet_ref( dst, src ) av_packet_ref( dst, src ) #else + unsigned int zm_av_packet_ref( AVPacket *dst, AVPacket *src ); #define zm_av_packet_unref( packet ) av_free_packet( packet ) -unsigned int zm_av_packet_ref( AVPacket *dst, AVPacket *src ); #endif #if LIBAVCODEC_VERSION_CHECK(52, 23, 0, 23, 0) #define zm_avcodec_decode_video( context, rawFrame, frameComplete, packet ) avcodec_decode_video2( context, rawFrame, frameComplete, packet ) From 7ac955d00544ddeced9053357739d1e08e2b5c1b Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 26 Sep 2018 16:44:04 -0400 Subject: [PATCH 15/30] further changes to ensure that source .orig tarball is always the same --- utils/do_debian_package.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/utils/do_debian_package.sh b/utils/do_debian_package.sh index f75c82f82..3ebc510fa 100755 --- a/utils/do_debian_package.sh +++ b/utils/do_debian_package.sh @@ -163,8 +163,19 @@ if [ $? -ne 0 ]; then fi; cd "$DIRECTORY.orig"; +# Init submodules git submodule init git submodule update --init --recursive + +# Cleanup +rm -rf .git +rm .gitignore +cd ../ + +tar zcf $DIRECTORY.orig.tar.gz $DIRECTORY.orig +cd $DIRECTORY.orig + +# Generate Changlog if [ "$DISTRO" == "trusty" ] || [ "$DISTRO" == "precise" ]; then mv distros/ubuntu1204 debian else @@ -189,12 +200,6 @@ if [ "$URGENCY" = "" ]; then URGENCY="medium" fi; -rm -rf .git -rm .gitignore -cd ../ -tar zcf $DIRECTORY.orig.tar.gz $DIRECTORY.orig -cd $DIRECTORY.orig - if [ "$SNAPSHOT" == "stable" ]; then cat < debian/changelog zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY From 49a76145046d88109d000461ef15870be0b26c9a Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 26 Sep 2018 18:35:29 -0400 Subject: [PATCH 16/30] revert change that breaks building on newer ffmpeg libs. --- src/zm_ffmpeg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zm_ffmpeg.cpp b/src/zm_ffmpeg.cpp index d4e9cb9ec..79a1d8b26 100644 --- a/src/zm_ffmpeg.cpp +++ b/src/zm_ffmpeg.cpp @@ -301,7 +301,7 @@ void zm_dump_stream_format(AVFormatContext *ic, int i, int index, int is_output) if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { int fps = st->avg_frame_rate.den && st->avg_frame_rate.num; int tbn = st->time_base.den && st->time_base.num; - int tbc = codec->time_base.den && codec->time_base.num; + int tbc = st->codec->time_base.den && st->codec->time_base.num; if (fps || tbn || tbc) Debug(3, "\n" ); @@ -311,7 +311,7 @@ void zm_dump_stream_format(AVFormatContext *ic, int i, int index, int is_output) if (tbn) zm_log_fps(1 / av_q2d(st->time_base), tbc ? "stream tb numerator , " : "stream tb numerator"); if (tbc) - zm_log_fps(1 / av_q2d(codec->time_base), "codec time base:"); + zm_log_fps(1 / av_q2d(st->codec->time_base), "codec time base:"); } if (st->disposition & AV_DISPOSITION_DEFAULT) From 66f11435b990f5399066fc70ed353b992a2998e1 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 27 Sep 2018 13:50:11 -0400 Subject: [PATCH 17/30] perhaps fix memory corruption due to libx264 writing to stderr which may be closed. --- scripts/zmdc.pl.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/zmdc.pl.in b/scripts/zmdc.pl.in index e26247894..ac83fa6d6 100644 --- a/scripts/zmdc.pl.in +++ b/scripts/zmdc.pl.in @@ -482,7 +482,7 @@ sub start { logTerm(); zmDbDisconnect(); - my $fd = 0; + my $fd = 3; # leave stdin,stdout,stderr open. Closing them causes problems with libx264 while( $fd < POSIX::sysconf(&POSIX::_SC_OPEN_MAX) ) { POSIX::close($fd++); } From c5c01d56be35a97fbe8227bdc107cda2f184b9e6 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 27 Sep 2018 14:20:41 -0400 Subject: [PATCH 18/30] fix unsetting fixed width/height/layout. Since they are actually controlled by cookies, the session will overwrite when we try to unset the cookie. Also fix some missing ;'s --- web/skins/classic/views/montage.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/web/skins/classic/views/montage.php b/web/skins/classic/views/montage.php index 97cb733f0..9f0cf8998 100644 --- a/web/skins/classic/views/montage.php +++ b/web/skins/classic/views/montage.php @@ -70,8 +70,8 @@ session_start(); $layout_id = ''; if ( isset($_COOKIE['zmMontageLayout']) ) { $layout_id = $_SESSION['zmMontageLayout'] = $_COOKIE['zmMontageLayout']; -} elseif ( isset($_SESSION['zmMontageLayout']) ) { - $layout_id = $_SESSION['zmMontageLayout']; +#} elseif ( isset($_SESSION['zmMontageLayout']) ) { + #$layout_id = $_SESSION['zmMontageLayout']; } $options = array(); @@ -87,15 +87,15 @@ if ( $Layout and ( $Layout->Name() != 'Freeform' ) ) { if ( isset($_COOKIE['zmMontageWidth']) and $_COOKIE['zmMontageWidth'] ) { $_SESSION['zmMontageWidth'] = $options['width'] = $_COOKIE['zmMontageWidth']; -} elseif ( isset($_SESSION['zmMontageWidth']) and $_SESSION['zmMontageWidth'] ) { - $options['width'] = $_SESSION['zmMontageWidth']; +#} elseif ( isset($_SESSION['zmMontageWidth']) and $_SESSION['zmMontageWidth'] ) { + #$options['width'] = $_SESSION['zmMontageWidth']; } else $options['width'] = ''; if ( isset($_COOKIE['zmMontageHeight']) and $_COOKIE['zmMontageHeight'] ) $_SESSION['zmMontageHeight'] = $options['height'] = $_COOKIE['zmMontageHeight']; -else if ( isset($_SESSION['zmMontageHeight']) and $_SESSION['zmMontageHeight'] ) - $options['height'] = $_SESSION['zmMontageHeight']; +#else if ( isset($_SESSION['zmMontageHeight']) and $_SESSION['zmMontageHeight'] ) + #$options['height'] = $_SESSION['zmMontageHeight']; else $options['height'] = ''; @@ -134,7 +134,7 @@ xhtmlHeaders(__FILE__, translate('Montage'));
-