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' ) { ?> -