Merge branch 'master' into storageareas

This commit is contained in:
Isaac Connor 2018-09-27 13:54:53 -04:00
commit e0dc8a5f6b
9 changed files with 45 additions and 25 deletions

View File

@ -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)

View File

@ -1,10 +1,14 @@
# 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
# <VirtualHost> directive.
#zmNinja header permissions. Tweak to your needs
# 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
#zmNinja's WKWebView will set the origin header as localhost:8080
Header always set Access-Control-Allow-Origin "http://localhost:8080"

View File

@ -485,7 +485,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++);
}

View File

@ -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)
@ -355,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<uint8_t*>(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;
}

View File

@ -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 )

View File

@ -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.");
}

View File

@ -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.

View File

@ -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 <<EOF > debian/changelog
zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY

View File

@ -44,7 +44,7 @@ if ( $_REQUEST['filter']['sql'] ) {
$countSql .= $_REQUEST['filter']['sql'];
$eventsSql .= $_REQUEST['filter']['sql'];
}
$eventsSql .= " ORDER BY $sortColumn $sortOrder, Id $sortOrder";
$eventsSql .= " ORDER BY $sortColumn $sortOrder,Id $sortOrder";
$page = isset($_REQUEST['page']) ? validInt($_REQUEST['page']) : 0;
$limit = isset($_REQUEST['limit']) ? validInt($_REQUEST['limit']) : 0;