WIP, rabbit hole too deep

This commit is contained in:
Isaac Connor 2019-08-14 09:44:28 -04:00
parent 0550e69224
commit 95fe689d58
5 changed files with 39 additions and 2 deletions

View File

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

15
db/zm_update-1.35.20.sql Normal file
View File

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

View File

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

View File

@ -34,6 +34,7 @@ typedef struct DecodeContext {
class FfmpegCamera : public Camera {
protected:
std::string mPath;
std::string mSecondPath;
std::string mMethod;
std::string mOptions;
@ -43,6 +44,16 @@ class FfmpegCamera : public Camera {
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,

View File

@ -676,7 +676,10 @@ switch ( $name ) {
{
if ( ZM_HAS_V4L && $monitor->Type() == 'Local' ) {
?>
<tr><td class="text-right pr-3"><?php echo translate('DevicePath') ?></td><td><input type="text" name="newMonitor[Device]" value="<?php echo validHtmlStr($monitor->Device()) ?>"/></td></tr>
<tr>
<td class="text-right pr-3"><?php echo translate('DevicePath') ?></td>
<td><input type="text" name="newMonitor[Device]" value="<?php echo validHtmlStr($monitor->Device()) ?>"/></td>
</tr>
<tr>
<td><?php echo translate('CaptureMethod') ?></td>
<td><?php echo htmlSelect('newMonitor[Method]', $localMethods, $monitor->Method(), array('onchange'=>'submitTab', 'data-tab-name'=>$tab) ); ?></td>
@ -819,6 +822,10 @@ include('_monitor_source_nvsocket.php');
}
if ( $monitor->Type() == 'Ffmpeg' ) {
?>
<tr class="SourceSecondPath">
<td><?php echo translate('SourceSecondPath') ?></td>
<td><input type="text" name="newMonitor[SecondPath]" value="<?php echo validHtmlStr($monitor->SecondPath()) ?>" /></td>
</tr>
<tr class="DecoderHWAccelName">
<td class="text-right pr-3">
<?php echo translate('DecoderHWAccelName'); echo makeHelpLink('OPTIONS_DECODERHWACCELNAME') ?>