From 95fe689d58eceaf164009a1578b3ead6bd65b75b Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 14 Aug 2019 09:44:28 -0400 Subject: [PATCH] WIP, rabbit hole too deep --- db/zm_create.sql.in | 1 + db/zm_update-1.35.20.sql | 15 +++++++++++++++ src/zm_ffmpeg_camera.cpp | 2 ++ src/zm_ffmpeg_camera.h | 14 +++++++++++++- web/skins/classic/views/monitor.php | 9 ++++++++- 5 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 db/zm_update-1.35.20.sql diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index f70ccc55d..ae8d500ab 100644 --- a/db/zm_create.sql.in +++ b/db/zm_create.sql.in @@ -468,6 +468,7 @@ CREATE TABLE `Monitors` ( `Port` varchar(8) NOT NULL default '', `SubPath` varchar(64) NOT NULL default '', `Path` varchar(255), + `SecondPath` varchar(255), `Options` varchar(255), `User` varchar(64), `Pass` varchar(64), diff --git a/db/zm_update-1.35.20.sql b/db/zm_update-1.35.20.sql new file mode 100644 index 000000000..275515dbf --- /dev/null +++ b/db/zm_update-1.35.20.sql @@ -0,0 +1,15 @@ +-- +-- Add SecondPath to Monitors +-- + +SET @s = (SELECT IF( + (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE() + AND table_name = 'Monitors' + AND column_name = 'SecondPath' + ) > 0, +"SELECT 'Column SecondPath already exists in Monitors'", +"ALTER TABLE `Monitors` ADD `SecondPath` VARCHAR(255) AFTER `Path`" +)); + +PREPARE stmt FROM @s; +EXECUTE stmt; diff --git a/src/zm_ffmpeg_camera.cpp b/src/zm_ffmpeg_camera.cpp index afc4f79fa..9059ed477 100644 --- a/src/zm_ffmpeg_camera.cpp +++ b/src/zm_ffmpeg_camera.cpp @@ -93,6 +93,7 @@ static enum AVPixelFormat find_fmt_by_hw_type(const enum AVHWDeviceType type) { FfmpegCamera::FfmpegCamera( const Monitor *monitor, const std::string &p_path, + const std::string &p_second_path, const std::string &p_method, const std::string &p_options, int p_width, @@ -121,6 +122,7 @@ FfmpegCamera::FfmpegCamera( p_record_audio ), mPath(p_path), + mSecondPath(p_second_path), mMethod(p_method), mOptions(p_options), hwaccel_name(p_hwaccel_name), diff --git a/src/zm_ffmpeg_camera.h b/src/zm_ffmpeg_camera.h index bac1c42d3..6c268628a 100644 --- a/src/zm_ffmpeg_camera.h +++ b/src/zm_ffmpeg_camera.h @@ -34,6 +34,7 @@ typedef struct DecodeContext { class FfmpegCamera : public Camera { protected: std::string mPath; + std::string mSecondPath; std::string mMethod; std::string mOptions; @@ -42,7 +43,17 @@ class FfmpegCamera : public Camera { std::string hwaccel_device; int frameCount; - + +#if HAVE_LIBAVFORMAT + AVFormatContext *mFormatContext[2]; + int mFormats; + int mFormatIndex; + int mVideoStreamId; + int mAudioStreamId; + AVCodecContext *mVideoCodecContext; + AVCodecContext *mAudioCodecContext; + AVCodec *mVideoCodec; + AVCodec *mAudioCodec; _AVPIXELFORMAT imagePixFormat; bool use_hwaccel; //will default to on if hwaccel specified, will get turned off if there is a failure @@ -69,6 +80,7 @@ class FfmpegCamera : public Camera { FfmpegCamera( const Monitor *monitor, const std::string &path, + const std::string &second_path, const std::string &p_method, const std::string &p_options, int p_width, diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php index d63a57b21..5c6f17a10 100644 --- a/web/skins/classic/views/monitor.php +++ b/web/skins/classic/views/monitor.php @@ -676,7 +676,10 @@ switch ( $name ) { { if ( ZM_HAS_V4L && $monitor->Type() == 'Local' ) { ?> - + + + + Method(), array('onchange'=>'submitTab', 'data-tab-name'=>$tab) ); ?> @@ -819,6 +822,10 @@ include('_monitor_source_nvsocket.php'); } if ( $monitor->Type() == 'Ffmpeg' ) { ?> + + + +