Skip to content

Commit 28044f4

Browse files
Merge branch 'master' into ai_server
2 parents 54b1241 + 7bf2fb8 commit 28044f4

File tree

15 files changed

+164
-47
lines changed

15 files changed

+164
-47
lines changed

db/zm_create.sql.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ CREATE TABLE `Monitors` (
563563
`DecoderHWAccelDevice` varchar(255),
564564
`SaveJPEGs` TINYINT NOT NULL DEFAULT '3' ,
565565
`VideoWriter` TINYINT NOT NULL DEFAULT '0',
566-
`OutputCodec` int(10) unsigned NOT NULL default 0,
566+
`OutputCodecName` varchar(32) NOT NULL default 'auto',
567567
`Encoder` varchar(32),
568568
`EncoderHWAccelName` varchar(64),
569569
`EncoderHWAccelDevice` varchar(255),

db/zm_update-1.37.70.sql

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/* Change OutputCodec from int to varchar(32) */
2+
SELECT 'Checking for OutputCodecName in Monitors';
3+
SET @s = (SELECT IF(
4+
(SELECT COUNT(*)
5+
FROM INFORMATION_SCHEMA.COLUMNS
6+
WHERE table_name = 'Monitors'
7+
AND table_schema = DATABASE()
8+
AND column_name = 'OutputCodecName'
9+
) > 0,
10+
"SELECT 'Column OutputCodecName already exists in Monitors'",
11+
"ALTER TABLE `Monitors` ADD COLUMN `OutputCodecName` varchar(32) NOT NULL default '' AFTER `VideoWriter`"
12+
));
13+
PREPARE stmt FROM @s;
14+
EXECUTE stmt;
15+
16+
UPDATE Monitors SET OutputCodecName='auto' where OutputCodec=0 AND OutputCodecName='';
17+
UPDATE Monitors SET OutputCodecName='h264' where OutputCodec=27 AND OutputCodecName='';
18+
UPDATE Monitors SET OutputCodecName='hevc' where OutputCodec=173 AND OutputCodecName='';
19+
UPDATE Monitors SET OutputCodecName='vp9' where OutputCodec=167 AND OutputCodecName='';
20+
UPDATE Monitors SET OutputCodecName='av1' where OutputCodec=225 or OutputCodec=226 AND OutputCodecName='';
21+

distros/redhat/zoneminder.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
%global zmtargetdistro %{?rhel:el%{rhel}}%{!?rhel:fc%{fedora}}
1919

2020
Name: zoneminder
21-
Version: 1.37.69
21+
Version: 1.37.70
2222
Release: 1%{?dist}
2323
Summary: A camera monitoring and analysis tool
2424
Group: System Environment/Daemons

eslint.config.js

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
"use strict";
2+
3+
const {
4+
defineConfig,
5+
globalIgnores,
6+
} = require("eslint/config");
7+
8+
const globals = require("globals");
9+
const html = require("eslint-plugin-html");
10+
const phpMarkup = require("eslint-plugin-php-markup");
11+
const js = require("@eslint/js");
12+
13+
const {
14+
FlatCompat,
15+
} = require("@eslint/eslintrc");
16+
17+
const compat = new FlatCompat({
18+
baseDirectory: __dirname,
19+
recommendedConfig: js.configs.recommended,
20+
allConfig: js.configs.all
21+
});
22+
23+
module.exports = defineConfig([{
24+
languageOptions: {
25+
globals: {
26+
...globals.browser,
27+
},
28+
},
29+
30+
extends: compat.extends("google"),
31+
32+
plugins: {
33+
html,
34+
"php-markup": phpMarkup,
35+
},
36+
37+
"rules": {
38+
"no-invalid-this": "off",
39+
"camelcase": "off",
40+
"comma-dangle": "off",
41+
"guard-for-in": "off",
42+
"max-len": "off",
43+
44+
"new-cap": ["error", {
45+
capIsNewExceptions: ["Error", "Warning", "Debug", "Polygon_calcArea", "Play", "Stop", "Panzoom"],
46+
newIsCapExceptionPattern: "^Asset..",
47+
}],
48+
49+
"no-array-constructor": "off",
50+
51+
"no-unused-vars": ["error", {
52+
"vars": "local",
53+
"args": "none",
54+
"ignoreRestSiblings": false,
55+
}],
56+
57+
"no-var": "off",
58+
"prefer-rest-params": "off",
59+
"quotes": "off",
60+
"require-jsdoc": "off",
61+
"spaced-comment": "off",
62+
},
63+
64+
"settings": {
65+
"php/php-extensions": [".php"],
66+
67+
"php/markup-replacement": {
68+
"php": "",
69+
"=": "0",
70+
},
71+
72+
"php/keep-eol": false,
73+
"php/remove-whitespace": false,
74+
"php/remove-empty-line": false,
75+
"php/remove-php-lint": false,
76+
},
77+
}, {
78+
files: ["**/*.*php"],
79+
80+
"rules": {
81+
"eol-last": "off",
82+
"indent": "off",
83+
},
84+
}, globalIgnores([
85+
"**/*.min.js",
86+
"web/api/lib",
87+
"web/includes/csrf/",
88+
"web/js/videojs.zoomrotate.js",
89+
"web/js/video-stream.js",
90+
"web/js/video-rtc.js",
91+
"web/js/fontfaceobserver.standalone.js",
92+
"web/skins/classic/js/bootstrap-4.5.0.js",
93+
"web/skins/classic/js/bootstrap.bundle.min.js",
94+
"web/skins/classic/js/bootstrap-table-1.23.5",
95+
"web/skins/classic/js/chosen",
96+
"web/skins/classic/js/dateTimePicker",
97+
"web/skins/classic/js/jquery-*.js",
98+
"web/skins/classic/js/jquery-ui-*",
99+
"web/skins/classic/js/jquery.js",
100+
"web/skins/classic/js/moment.js",
101+
"web/skins/classic/js/video.js",
102+
"web/skins/classic/assets",
103+
"web/js/janus.js",
104+
"web/js/ajaxQueue.js",
105+
"web/js/hls-1.5.20/",
106+
"web/js/noUiSlider-15.8.1/",
107+
"web/js/dms.js",
108+
"web/skins/classic/includes/export_functions.php",
109+
"web/skins/classic/views/events.php",
110+
])]);

src/zm_event.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ int Event::OpenJpegCodec(AVFrame *frame) {
172172
mJpegCodecContext = nullptr;
173173
}
174174

175-
std::list<const CodecData *>codec_data = get_encoder_data(AV_CODEC_ID_MJPEG, "");
175+
std::list<const CodecData *>codec_data = get_encoder_data("mjpeg", "");
176176
if (!codec_data.size()) {
177177
Error("No codecs for mjpeg found");
178178
return -1;

src/zm_ffmpeg.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ int ni_get_cardno(const AVCodecContext *ctx) {
109109
}
110110
#endif
111111

112-
std::list<const CodecData*> get_encoder_data(int wanted_codec, const std::string &wanted_encoder) {
112+
std::list<const CodecData*> get_encoder_data(const std::string &wanted_codec, const std::string &wanted_encoder) {
113113
std::list<const CodecData*> results;
114114

115115
for (unsigned int i = 0; i < sizeof(enc_codecs) / sizeof(*enc_codecs); i++) {
@@ -120,12 +120,10 @@ std::list<const CodecData*> get_encoder_data(int wanted_codec, const std::string
120120
continue;
121121
}
122122
}
123-
if (wanted_codec and (enc_codecs[i].codec_id != wanted_codec)) {
124-
Debug(4, "Not the right codec id %d %s != %d %s for %s",
125-
chosen_codec_data->codec_id,
126-
avcodec_get_name(chosen_codec_data->codec_id),
127-
wanted_codec,
128-
avcodec_get_name((AVCodecID)wanted_codec),
123+
if ((!wanted_codec.empty() and wanted_codec != "auto") and (enc_codecs[i].codec_codec != wanted_codec)) {
124+
Debug(4, "Not the right codec id %s != %s for %s",
125+
chosen_codec_data->codec_codec,
126+
wanted_codec.c_str(),
129127
chosen_codec_data->codec_name
130128
);
131129
continue;

src/zm_ffmpeg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ struct CodecData {
348348
const char *hwdevice_default;
349349
const char *options_defaults;
350350
};
351-
std::list<const CodecData*> get_encoder_data(int wanted_codec, const std::string &wanted_coder) ;
351+
std::list<const CodecData*> get_encoder_data(const std::string & wanted_codec, const std::string &wanted_coder) ;
352352
std::list<const CodecData*> get_decoder_data(int wanted_codec, const std::string &wanted_coder) ;
353353
int setup_hwaccel(AVCodecContext *codec_ctx, const CodecData *codec_data,AVBufferRef * &hw_device_ctx, const std::string &device, int width, int height);
354354
#ifdef HAVE_QUADRA

src/zm_monitor.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ std::string load_monitor_sql =
104104
"`Deinterlacing`, "
105105
"`Decoder`, `DecoderHWAccelName`, `DecoderHWAccelDevice`, `RTSPDescribe`, "
106106
"`SaveJPEGs`, `VideoWriter`, `EncoderParameters`, "
107-
"`OutputCodec`, `Encoder`, `EncoderHWAccelName`, `EncoderHWAccelDevice`, `OutputContainer`, "
107+
"`OutputCodecName`, `Encoder`, `EncoderHWAccelName`, `EncoderHWAccelDevice`, `OutputContainer`, "
108108
"`RecordAudio`, WallClockTimestamps,"
109109
"`Brightness`, `Contrast`, `Hue`, `Colour`, "
110110
"`EventPrefix`, `LabelFormat`, `LabelX`, `LabelY`, `LabelSize`,"
@@ -194,7 +194,7 @@ Monitor::Monitor() :
194194
colours(0),
195195
videowriter(DISABLED),
196196
encoderparams(""),
197-
output_codec(0),
197+
output_codec(""),
198198
encoder(""),
199199
encoder_hwaccel_name(""),
200200
encoder_hwaccel_device(""),
@@ -348,7 +348,7 @@ std::string TriggerState_Strings[] = {"Cancel", "On", "Off"};
348348
"Device, Channel, Format, V4LMultiBuffer, V4LCapturesPerFrame, " // V4L Settings
349349
"Protocol, Method, Options, User, Pass, Host, Port, Path, SecondPath, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, RTSPDescribe, "
350350
"SaveJPEGs, VideoWriter, EncoderParameters,"
351-
"OutputCodec, Encoder, OutputContainer, RecordAudio, WallClockTimestamps,"
351+
"OutputCodecName, Encoder, OutputContainer, RecordAudio, WallClockTimestamps,"
352352
"Brightness, Contrast, Hue, Colour, "
353353
"EventPrefix, LabelFormat, LabelX, LabelY, LabelSize,"
354354
"ImageBufferCount, `MaxImageBufferCount`, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, "
@@ -565,8 +565,8 @@ void Monitor::Load(MYSQL_ROW dbrow, bool load_zones = true, Purpose p = QUERY) {
565565
encoderparams = dbrow[col] ? dbrow[col] : "";
566566
col++;
567567

568-
/*"`OutputCodec`, `Encoder`, `OutputContainer`, " */
569-
output_codec = dbrow[col] ? atoi(dbrow[col]) : 0;
568+
/*"`OutputCodecName`, `Encoder`, `OutputContainer`, " */
569+
output_codec = dbrow[col] ? dbrow[col] : "auto";
570570
col++;
571571
encoder = dbrow[col] ? dbrow[col] : "";
572572
col++;

src/zm_monitor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ class Monitor : public std::enable_shared_from_this<Monitor> {
609609
int colours;
610610
VideoWriter videowriter;
611611
std::string encoderparams;
612-
int output_codec;
612+
std::string output_codec;
613613
std::string encoder;
614614
std::string encoder_hwaccel_name;
615615
std::string encoder_hwaccel_device;
@@ -965,7 +965,7 @@ class Monitor : public std::enable_shared_from_this<Monitor> {
965965
const std::string &GetEncoderOptions() const { return encoderparams; }
966966
const std::string &EncoderHWAccelName() const { return encoder_hwaccel_name; }
967967
const std::string &EncoderHWAccelDevice() const { return encoder_hwaccel_device; }
968-
int OutputCodec() const { return output_codec; }
968+
const std::string &OutputCodec() const { return output_codec; }
969969
const std::string &Encoder() const { return encoder; }
970970
const std::string &OutputContainer() const { return output_container; }
971971

src/zm_stream.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ bool StreamBase::initContexts(int in_width, int in_height, AVPixelFormat format,
5151

5252
if (mJpegCodecContext) avcodec_free_context(&mJpegCodecContext);
5353

54-
std::list<const CodecData *>codec_data = get_encoder_data(AV_CODEC_ID_MJPEG, "");
54+
std::list<const CodecData *>codec_data = get_encoder_data("mjpeg", "");
5555
if (!codec_data.size()) {
5656
Error("No codecs for mjpeg found");
5757
return false;

0 commit comments

Comments
 (0)