@sigmaott/base-library-next 2.2.6 → 2.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.npmrc +3 -0
- package/locales/en.yaml +289 -289
- package/locales/vi.yaml +294 -294
- package/nuxt.config.ts +18 -18
- package/package.json +32 -33
- package/public/routes.json +33 -33
- package/src/api/axios.ts +3 -3
- package/src/api/index.ts +86 -86
- package/src/api-client-library/.openapi-generator/FILES +20 -20
- package/src/api-client-library/.openapi-generator-ignore +23 -23
- package/src/api-client-library/api/health-api.ts +119 -119
- package/src/api-client-library/api/presets-api.ts +599 -599
- package/src/api-client-library/api/profiles-api.ts +676 -676
- package/src/api-client-library/api.ts +20 -20
- package/src/api-client-library/base.ts +72 -72
- package/src/api-client-library/common.ts +150 -150
- package/src/api-client-library/configuration.ts +101 -101
- package/src/api-client-library/git_push.sh +57 -57
- package/src/api-client-library/index.ts +18 -18
- package/src/api-client-library/models/create-preset-dto.ts +223 -223
- package/src/api-client-library/models/create-profile-dto.ts +45 -45
- package/src/api-client-library/models/health-controller-get-health200-response-info-value.ts +32 -32
- package/src/api-client-library/models/health-controller-get-health200-response.ts +51 -51
- package/src/api-client-library/models/health-controller-get-health503-response.ts +51 -51
- package/src/api-client-library/models/index.ts +7 -7
- package/src/api-client-library/models/update-preset-dto.ts +223 -223
- package/src/api-client-library/models/update-profile-dto.ts +45 -45
- package/src/components/MediaSelection.vue +40 -40
- package/src/components/PresetModify.vue +154 -154
- package/src/components/PresetTable.vue +114 -114
- package/src/components/ProfileAllList.vue +137 -137
- package/src/components/ProfileFormModal.vue +79 -79
- package/src/components/ProfileModify.vue +152 -152
- package/src/components/ProfileTable.vue +68 -68
- package/src/components/WatermarkDraggableItem.vue +88 -88
- package/src/components/channel/ConfigWatermarkItem.vue +239 -239
- package/src/components/channel/WatermarkPreview.vue +19 -19
- package/src/components/common/Vue3DraggableResizable/Container.vue +71 -71
- package/src/components/common/Vue3DraggableResizable/index.vue +1327 -1327
- package/src/components/common/Vue3DraggableResizable/utils/dom.js +63 -63
- package/src/components/common/Vue3DraggableResizable/utils/fns.js +37 -37
- package/src/components/common/VueDraggableResizable/dom.js +63 -63
- package/src/components/common/VueDraggableResizable/fns.js +37 -37
- package/src/components/common/VueDraggableResizable/index.vue +958 -958
- package/src/components/preset/ConfigItem.vue +956 -956
- package/src/components/profile/ConfigItem.vue +765 -765
- package/src/components/profile/TableColumns.vue +137 -137
- package/src/components/shared/AudioInfoViewer.vue +101 -101
- package/src/components/shared/MediaInfoViewer.vue +257 -249
- package/src/components/shared/MediaInfoViewerSmall.vue +105 -105
- package/src/components/shared/PopoverProfile.vue +17 -17
- package/src/components/shared/VideoInfoViewer.vue +136 -136
- package/src/components/shared/fileSizeFilter.ts +26 -26
- package/src/composables/preset.ts +141 -141
- package/src/public/build-time.json +1 -1
- package/src/public/favicon.svg +15 -15
- package/src/public/logo.svg +9 -9
- package/src/public/routes.json +86 -86
- package/src/utils/common.ts +175 -175
- package/src/utils/config.ts +19 -19
- package/src/utils/preset.ts +353 -353
- package/src/utils/profile.ts +30 -30
- package/tsconfig.json +3 -3
package/src/utils/preset.ts
CHANGED
|
@@ -1,353 +1,353 @@
|
|
|
1
|
-
import { klona } from 'klona'
|
|
2
|
-
import { emptyStr2Undefined } from './common'
|
|
3
|
-
|
|
4
|
-
export function convertStringToNumber(str) {
|
|
5
|
-
if (!str)
|
|
6
|
-
return
|
|
7
|
-
else if (typeof str === 'number')
|
|
8
|
-
return str
|
|
9
|
-
|
|
10
|
-
return Number.parseFloat(str.replace(/\./g, '')) || 0
|
|
11
|
-
}
|
|
12
|
-
export function serializePreset(data) {
|
|
13
|
-
const _preset = klona(data)
|
|
14
|
-
const kind = _preset && _preset.type
|
|
15
|
-
|
|
16
|
-
if (kind === 'video') {
|
|
17
|
-
const {
|
|
18
|
-
name,
|
|
19
|
-
option,
|
|
20
|
-
description,
|
|
21
|
-
type,
|
|
22
|
-
fps,
|
|
23
|
-
codec,
|
|
24
|
-
encoderType,
|
|
25
|
-
preset,
|
|
26
|
-
videoPreset,
|
|
27
|
-
videoCodec,
|
|
28
|
-
videoBitrate,
|
|
29
|
-
videoProfile,
|
|
30
|
-
videoLevel,
|
|
31
|
-
bufsize,
|
|
32
|
-
rateControlMode,
|
|
33
|
-
rc,
|
|
34
|
-
gopMode,
|
|
35
|
-
gopValue,
|
|
36
|
-
minrate,
|
|
37
|
-
bitrate,
|
|
38
|
-
maxrate,
|
|
39
|
-
width,
|
|
40
|
-
height,
|
|
41
|
-
pixelFormat,
|
|
42
|
-
scaleType,
|
|
43
|
-
scanType,
|
|
44
|
-
cq,
|
|
45
|
-
interlaced,
|
|
46
|
-
fixedGOP,
|
|
47
|
-
cbr,
|
|
48
|
-
hdr,
|
|
49
|
-
bframe,
|
|
50
|
-
id,
|
|
51
|
-
aspectRatioMode,
|
|
52
|
-
aspectRatioWidth,
|
|
53
|
-
aspectRatioHeight,
|
|
54
|
-
pteEnabled,
|
|
55
|
-
vmafMin,
|
|
56
|
-
vmafMax,
|
|
57
|
-
vmafThres,
|
|
58
|
-
} = _preset
|
|
59
|
-
const newPreset = emptyStr2Undefined({
|
|
60
|
-
name,
|
|
61
|
-
options: option,
|
|
62
|
-
description,
|
|
63
|
-
type,
|
|
64
|
-
fps,
|
|
65
|
-
codec,
|
|
66
|
-
encoderType,
|
|
67
|
-
preset,
|
|
68
|
-
videoPreset,
|
|
69
|
-
videoCodec,
|
|
70
|
-
videoBitrate: convertStringToNumber(videoBitrate),
|
|
71
|
-
videoProfile,
|
|
72
|
-
videoLevel,
|
|
73
|
-
bufsize: convertStringToNumber(bufsize),
|
|
74
|
-
rc,
|
|
75
|
-
rateControlMode,
|
|
76
|
-
gopMode,
|
|
77
|
-
gopValue: convertStringToNumber(gopValue),
|
|
78
|
-
minrate: convertStringToNumber(minrate),
|
|
79
|
-
bitrate: convertStringToNumber(bitrate),
|
|
80
|
-
maxrate: convertStringToNumber(maxrate),
|
|
81
|
-
width: width === 0 ? 0 : convertStringToNumber(width),
|
|
82
|
-
height: height === 0 ? 0 : convertStringToNumber(height),
|
|
83
|
-
pixelFormat,
|
|
84
|
-
scaleType,
|
|
85
|
-
scanType,
|
|
86
|
-
cq: cq === 0 ? 0 : convertStringToNumber(cq),
|
|
87
|
-
interlaced,
|
|
88
|
-
fixedGOP,
|
|
89
|
-
cbr,
|
|
90
|
-
hdr,
|
|
91
|
-
bframe: bframe === 0 ? 0 : convertStringToNumber(bframe),
|
|
92
|
-
id,
|
|
93
|
-
aspectRatioMode,
|
|
94
|
-
aspectRatioWidth,
|
|
95
|
-
aspectRatioHeight,
|
|
96
|
-
pteEnabled,
|
|
97
|
-
vmafMin,
|
|
98
|
-
vmafMax,
|
|
99
|
-
vmafThres,
|
|
100
|
-
})
|
|
101
|
-
return { ...newPreset, fixedGOP: _preset.fixedGOP, width: width === 0 ? 0 : convertStringToNumber(width), height: height === 0 ? 0 : convertStringToNumber(height), bframe: bframe === 0 ? 0 : convertStringToNumber(bframe), cq: cq === 0 ? 0 : convertStringToNumber(cq) }
|
|
102
|
-
}
|
|
103
|
-
if (kind === 'audio') {
|
|
104
|
-
const {
|
|
105
|
-
name,
|
|
106
|
-
option,
|
|
107
|
-
description,
|
|
108
|
-
type,
|
|
109
|
-
codec,
|
|
110
|
-
audioCodec,
|
|
111
|
-
audioGroupId,
|
|
112
|
-
defaultAudio,
|
|
113
|
-
audioDefault,
|
|
114
|
-
audioGroup,
|
|
115
|
-
bitrate,
|
|
116
|
-
audioBitrate,
|
|
117
|
-
audioProfile,
|
|
118
|
-
sampleRate,
|
|
119
|
-
channel,
|
|
120
|
-
profile,
|
|
121
|
-
volume,
|
|
122
|
-
id,
|
|
123
|
-
language,
|
|
124
|
-
label,
|
|
125
|
-
} = _preset
|
|
126
|
-
return emptyStr2Undefined({
|
|
127
|
-
name,
|
|
128
|
-
options: option,
|
|
129
|
-
description,
|
|
130
|
-
type,
|
|
131
|
-
codec,
|
|
132
|
-
audioCodec,
|
|
133
|
-
audioGroupId,
|
|
134
|
-
defaultAudio,
|
|
135
|
-
audioDefault,
|
|
136
|
-
audioGroup,
|
|
137
|
-
bitrate: convertStringToNumber(bitrate),
|
|
138
|
-
audioBitrate: convertStringToNumber(audioBitrate),
|
|
139
|
-
sampleRate,
|
|
140
|
-
channel,
|
|
141
|
-
profile,
|
|
142
|
-
audioProfile,
|
|
143
|
-
volume,
|
|
144
|
-
id,
|
|
145
|
-
language,
|
|
146
|
-
label,
|
|
147
|
-
})
|
|
148
|
-
}
|
|
149
|
-
if (kind === 'data') {
|
|
150
|
-
const { name, option, description, type, codec, dataCodec, id, scte35OverwriteConfig = {
|
|
151
|
-
enabled: false,
|
|
152
|
-
overwriteDuration: 30,
|
|
153
|
-
overwriteDelayTime: 0,
|
|
154
|
-
} } = _preset
|
|
155
|
-
return emptyStr2Undefined({
|
|
156
|
-
name,
|
|
157
|
-
options: option,
|
|
158
|
-
description,
|
|
159
|
-
type,
|
|
160
|
-
codec,
|
|
161
|
-
dataCodec,
|
|
162
|
-
id,
|
|
163
|
-
scte35OverwriteConfig,
|
|
164
|
-
})
|
|
165
|
-
}
|
|
166
|
-
return _preset
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export function serializeChannelPreset(data, enabled?: boolean) {
|
|
170
|
-
const _preset = klona(data)
|
|
171
|
-
const kind = _preset && _preset.type
|
|
172
|
-
|
|
173
|
-
if (kind === 'video') {
|
|
174
|
-
const {
|
|
175
|
-
name,
|
|
176
|
-
option,
|
|
177
|
-
description,
|
|
178
|
-
type,
|
|
179
|
-
fps,
|
|
180
|
-
codec,
|
|
181
|
-
encoderType,
|
|
182
|
-
preset,
|
|
183
|
-
videoPreset,
|
|
184
|
-
videoCodec,
|
|
185
|
-
videoBitrate,
|
|
186
|
-
videoProfile,
|
|
187
|
-
videoLevel,
|
|
188
|
-
bufsize,
|
|
189
|
-
rc,
|
|
190
|
-
rateControlMode,
|
|
191
|
-
gopMode,
|
|
192
|
-
gopValue,
|
|
193
|
-
minrate,
|
|
194
|
-
bitrate,
|
|
195
|
-
maxrate,
|
|
196
|
-
width,
|
|
197
|
-
height,
|
|
198
|
-
pixelFormat,
|
|
199
|
-
scaleType,
|
|
200
|
-
cq,
|
|
201
|
-
fixedGOP = false,
|
|
202
|
-
interlaced,
|
|
203
|
-
cbr,
|
|
204
|
-
scanType,
|
|
205
|
-
bframe,
|
|
206
|
-
streamIndex,
|
|
207
|
-
streamId,
|
|
208
|
-
pid,
|
|
209
|
-
sourceIndex,
|
|
210
|
-
hdr,
|
|
211
|
-
id,
|
|
212
|
-
aspectRatioMode,
|
|
213
|
-
aspectRatioWidth,
|
|
214
|
-
aspectRatioHeight,
|
|
215
|
-
pteEnabled,
|
|
216
|
-
vmafMin,
|
|
217
|
-
vmafMax,
|
|
218
|
-
vmafThres,
|
|
219
|
-
} = _preset
|
|
220
|
-
const newPreset = emptyStr2Undefined({
|
|
221
|
-
name,
|
|
222
|
-
options: option,
|
|
223
|
-
description,
|
|
224
|
-
type,
|
|
225
|
-
fps,
|
|
226
|
-
codec,
|
|
227
|
-
encoderType,
|
|
228
|
-
videoCodec,
|
|
229
|
-
videoBitrate: convertStringToNumber(videoBitrate),
|
|
230
|
-
videoProfile,
|
|
231
|
-
videoLevel,
|
|
232
|
-
bufsize: convertStringToNumber(bufsize),
|
|
233
|
-
rc,
|
|
234
|
-
rateControlMode,
|
|
235
|
-
gopMode,
|
|
236
|
-
gopValue: convertStringToNumber(gopValue),
|
|
237
|
-
preset,
|
|
238
|
-
videoPreset,
|
|
239
|
-
minrate: convertStringToNumber(minrate),
|
|
240
|
-
bitrate: convertStringToNumber(bitrate),
|
|
241
|
-
maxrate: convertStringToNumber(maxrate),
|
|
242
|
-
width: width === 0 ? 0 : convertStringToNumber(width),
|
|
243
|
-
height: height === 0 ? 0 : convertStringToNumber(height),
|
|
244
|
-
pixelFormat,
|
|
245
|
-
scaleType,
|
|
246
|
-
scanType,
|
|
247
|
-
cq: cq === 0 ? 0 : convertStringToNumber(cq),
|
|
248
|
-
interlaced,
|
|
249
|
-
cbr,
|
|
250
|
-
bframe: bframe === 0 ? 0 : convertStringToNumber(bframe),
|
|
251
|
-
streamId,
|
|
252
|
-
pid,
|
|
253
|
-
streamIndex,
|
|
254
|
-
fixedGOP,
|
|
255
|
-
sourceIndex,
|
|
256
|
-
id,
|
|
257
|
-
hdr,
|
|
258
|
-
aspectRatioMode,
|
|
259
|
-
aspectRatioWidth,
|
|
260
|
-
aspectRatioHeight,
|
|
261
|
-
pteEnabled: !enabled ? undefined : pteEnabled,
|
|
262
|
-
vmafMin: !enabled ? undefined : pteEnabled ? vmafMin : undefined,
|
|
263
|
-
vmafMax: !enabled ? undefined : pteEnabled ? vmafMax : undefined,
|
|
264
|
-
vmafThres: !enabled ? undefined : pteEnabled ? vmafThres : undefined,
|
|
265
|
-
})
|
|
266
|
-
return { ...newPreset, fixedGOP: !!_preset.fixedGOP, width: width === 0 ? 0 : convertStringToNumber(width), height: height === 0 ? 0 : convertStringToNumber(height), bframe: bframe === 0 ? 0 : convertStringToNumber(bframe), cq: cq === 0 ? 0 : convertStringToNumber(cq) }
|
|
267
|
-
}
|
|
268
|
-
if (kind === 'audio') {
|
|
269
|
-
const {
|
|
270
|
-
name,
|
|
271
|
-
option,
|
|
272
|
-
description,
|
|
273
|
-
type,
|
|
274
|
-
codec,
|
|
275
|
-
audioCodec,
|
|
276
|
-
audioGroupId,
|
|
277
|
-
audioGroup,
|
|
278
|
-
defaultAudio,
|
|
279
|
-
audioDefault,
|
|
280
|
-
bitrate,
|
|
281
|
-
audioBitrate,
|
|
282
|
-
audioProfile,
|
|
283
|
-
sampleRate,
|
|
284
|
-
channel,
|
|
285
|
-
profile,
|
|
286
|
-
volume,
|
|
287
|
-
streamIndex,
|
|
288
|
-
streamId,
|
|
289
|
-
pid,
|
|
290
|
-
sourceIndex,
|
|
291
|
-
id,
|
|
292
|
-
language,
|
|
293
|
-
label,
|
|
294
|
-
} = _preset
|
|
295
|
-
return emptyStr2Undefined({
|
|
296
|
-
name,
|
|
297
|
-
options: option,
|
|
298
|
-
description,
|
|
299
|
-
type,
|
|
300
|
-
codec,
|
|
301
|
-
audioCodec,
|
|
302
|
-
audioGroupId,
|
|
303
|
-
audioGroup,
|
|
304
|
-
defaultAudio,
|
|
305
|
-
audioDefault,
|
|
306
|
-
bitrate: convertStringToNumber(bitrate),
|
|
307
|
-
audioBitrate: convertStringToNumber(audioBitrate),
|
|
308
|
-
sampleRate,
|
|
309
|
-
channel,
|
|
310
|
-
profile,
|
|
311
|
-
audioProfile,
|
|
312
|
-
volume,
|
|
313
|
-
streamIndex,
|
|
314
|
-
streamId,
|
|
315
|
-
pid,
|
|
316
|
-
sourceIndex,
|
|
317
|
-
id,
|
|
318
|
-
language,
|
|
319
|
-
label,
|
|
320
|
-
})
|
|
321
|
-
}
|
|
322
|
-
if (kind === 'data') {
|
|
323
|
-
const { name, option, description, type, codec, dataCodec, streamIndex, streamId, pid, sourceIndex, id, scte35OverwriteConfig = {
|
|
324
|
-
enabled: false,
|
|
325
|
-
overwriteDuration: 30,
|
|
326
|
-
overwriteDelayTime: 0,
|
|
327
|
-
}, scte35LogEnabled = false } = _preset
|
|
328
|
-
return emptyStr2Undefined({
|
|
329
|
-
name,
|
|
330
|
-
options: option,
|
|
331
|
-
description,
|
|
332
|
-
type,
|
|
333
|
-
codec,
|
|
334
|
-
dataCodec,
|
|
335
|
-
streamIndex,
|
|
336
|
-
streamId,
|
|
337
|
-
pid,
|
|
338
|
-
sourceIndex,
|
|
339
|
-
id,
|
|
340
|
-
scte35OverwriteConfig,
|
|
341
|
-
scte35LogEnabled,
|
|
342
|
-
})
|
|
343
|
-
}
|
|
344
|
-
return _preset
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
export function normalizePreset(data) {
|
|
348
|
-
const preset = klona(data)
|
|
349
|
-
return {
|
|
350
|
-
...preset,
|
|
351
|
-
option: preset?.options,
|
|
352
|
-
}
|
|
353
|
-
}
|
|
1
|
+
import { klona } from 'klona'
|
|
2
|
+
import { emptyStr2Undefined } from './common'
|
|
3
|
+
|
|
4
|
+
export function convertStringToNumber(str) {
|
|
5
|
+
if (!str)
|
|
6
|
+
return
|
|
7
|
+
else if (typeof str === 'number')
|
|
8
|
+
return str
|
|
9
|
+
|
|
10
|
+
return Number.parseFloat(str.replace(/\./g, '')) || 0
|
|
11
|
+
}
|
|
12
|
+
export function serializePreset(data) {
|
|
13
|
+
const _preset = klona(data)
|
|
14
|
+
const kind = _preset && _preset.type
|
|
15
|
+
|
|
16
|
+
if (kind === 'video') {
|
|
17
|
+
const {
|
|
18
|
+
name,
|
|
19
|
+
option,
|
|
20
|
+
description,
|
|
21
|
+
type,
|
|
22
|
+
fps,
|
|
23
|
+
codec,
|
|
24
|
+
encoderType,
|
|
25
|
+
preset,
|
|
26
|
+
videoPreset,
|
|
27
|
+
videoCodec,
|
|
28
|
+
videoBitrate,
|
|
29
|
+
videoProfile,
|
|
30
|
+
videoLevel,
|
|
31
|
+
bufsize,
|
|
32
|
+
rateControlMode,
|
|
33
|
+
rc,
|
|
34
|
+
gopMode,
|
|
35
|
+
gopValue,
|
|
36
|
+
minrate,
|
|
37
|
+
bitrate,
|
|
38
|
+
maxrate,
|
|
39
|
+
width,
|
|
40
|
+
height,
|
|
41
|
+
pixelFormat,
|
|
42
|
+
scaleType,
|
|
43
|
+
scanType,
|
|
44
|
+
cq,
|
|
45
|
+
interlaced,
|
|
46
|
+
fixedGOP,
|
|
47
|
+
cbr,
|
|
48
|
+
hdr,
|
|
49
|
+
bframe,
|
|
50
|
+
id,
|
|
51
|
+
aspectRatioMode,
|
|
52
|
+
aspectRatioWidth,
|
|
53
|
+
aspectRatioHeight,
|
|
54
|
+
pteEnabled,
|
|
55
|
+
vmafMin,
|
|
56
|
+
vmafMax,
|
|
57
|
+
vmafThres,
|
|
58
|
+
} = _preset
|
|
59
|
+
const newPreset = emptyStr2Undefined({
|
|
60
|
+
name,
|
|
61
|
+
options: option,
|
|
62
|
+
description,
|
|
63
|
+
type,
|
|
64
|
+
fps,
|
|
65
|
+
codec,
|
|
66
|
+
encoderType,
|
|
67
|
+
preset,
|
|
68
|
+
videoPreset,
|
|
69
|
+
videoCodec,
|
|
70
|
+
videoBitrate: convertStringToNumber(videoBitrate),
|
|
71
|
+
videoProfile,
|
|
72
|
+
videoLevel,
|
|
73
|
+
bufsize: convertStringToNumber(bufsize),
|
|
74
|
+
rc,
|
|
75
|
+
rateControlMode,
|
|
76
|
+
gopMode,
|
|
77
|
+
gopValue: convertStringToNumber(gopValue),
|
|
78
|
+
minrate: convertStringToNumber(minrate),
|
|
79
|
+
bitrate: convertStringToNumber(bitrate),
|
|
80
|
+
maxrate: convertStringToNumber(maxrate),
|
|
81
|
+
width: width === 0 ? 0 : convertStringToNumber(width),
|
|
82
|
+
height: height === 0 ? 0 : convertStringToNumber(height),
|
|
83
|
+
pixelFormat,
|
|
84
|
+
scaleType,
|
|
85
|
+
scanType,
|
|
86
|
+
cq: cq === 0 ? 0 : convertStringToNumber(cq),
|
|
87
|
+
interlaced,
|
|
88
|
+
fixedGOP,
|
|
89
|
+
cbr,
|
|
90
|
+
hdr,
|
|
91
|
+
bframe: bframe === 0 ? 0 : convertStringToNumber(bframe),
|
|
92
|
+
id,
|
|
93
|
+
aspectRatioMode,
|
|
94
|
+
aspectRatioWidth,
|
|
95
|
+
aspectRatioHeight,
|
|
96
|
+
pteEnabled,
|
|
97
|
+
vmafMin,
|
|
98
|
+
vmafMax,
|
|
99
|
+
vmafThres,
|
|
100
|
+
})
|
|
101
|
+
return { ...newPreset, fixedGOP: _preset.fixedGOP, width: width === 0 ? 0 : convertStringToNumber(width), height: height === 0 ? 0 : convertStringToNumber(height), bframe: bframe === 0 ? 0 : convertStringToNumber(bframe), cq: cq === 0 ? 0 : convertStringToNumber(cq) }
|
|
102
|
+
}
|
|
103
|
+
if (kind === 'audio') {
|
|
104
|
+
const {
|
|
105
|
+
name,
|
|
106
|
+
option,
|
|
107
|
+
description,
|
|
108
|
+
type,
|
|
109
|
+
codec,
|
|
110
|
+
audioCodec,
|
|
111
|
+
audioGroupId,
|
|
112
|
+
defaultAudio,
|
|
113
|
+
audioDefault,
|
|
114
|
+
audioGroup,
|
|
115
|
+
bitrate,
|
|
116
|
+
audioBitrate,
|
|
117
|
+
audioProfile,
|
|
118
|
+
sampleRate,
|
|
119
|
+
channel,
|
|
120
|
+
profile,
|
|
121
|
+
volume,
|
|
122
|
+
id,
|
|
123
|
+
language,
|
|
124
|
+
label,
|
|
125
|
+
} = _preset
|
|
126
|
+
return emptyStr2Undefined({
|
|
127
|
+
name,
|
|
128
|
+
options: option,
|
|
129
|
+
description,
|
|
130
|
+
type,
|
|
131
|
+
codec,
|
|
132
|
+
audioCodec,
|
|
133
|
+
audioGroupId,
|
|
134
|
+
defaultAudio,
|
|
135
|
+
audioDefault,
|
|
136
|
+
audioGroup,
|
|
137
|
+
bitrate: convertStringToNumber(bitrate),
|
|
138
|
+
audioBitrate: convertStringToNumber(audioBitrate),
|
|
139
|
+
sampleRate,
|
|
140
|
+
channel,
|
|
141
|
+
profile,
|
|
142
|
+
audioProfile,
|
|
143
|
+
volume,
|
|
144
|
+
id,
|
|
145
|
+
language,
|
|
146
|
+
label,
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
if (kind === 'data') {
|
|
150
|
+
const { name, option, description, type, codec, dataCodec, id, scte35OverwriteConfig = {
|
|
151
|
+
enabled: false,
|
|
152
|
+
overwriteDuration: 30,
|
|
153
|
+
overwriteDelayTime: 0,
|
|
154
|
+
} } = _preset
|
|
155
|
+
return emptyStr2Undefined({
|
|
156
|
+
name,
|
|
157
|
+
options: option,
|
|
158
|
+
description,
|
|
159
|
+
type,
|
|
160
|
+
codec,
|
|
161
|
+
dataCodec,
|
|
162
|
+
id,
|
|
163
|
+
scte35OverwriteConfig,
|
|
164
|
+
})
|
|
165
|
+
}
|
|
166
|
+
return _preset
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export function serializeChannelPreset(data, enabled?: boolean) {
|
|
170
|
+
const _preset = klona(data)
|
|
171
|
+
const kind = _preset && _preset.type
|
|
172
|
+
|
|
173
|
+
if (kind === 'video') {
|
|
174
|
+
const {
|
|
175
|
+
name,
|
|
176
|
+
option,
|
|
177
|
+
description,
|
|
178
|
+
type,
|
|
179
|
+
fps,
|
|
180
|
+
codec,
|
|
181
|
+
encoderType,
|
|
182
|
+
preset,
|
|
183
|
+
videoPreset,
|
|
184
|
+
videoCodec,
|
|
185
|
+
videoBitrate,
|
|
186
|
+
videoProfile,
|
|
187
|
+
videoLevel,
|
|
188
|
+
bufsize,
|
|
189
|
+
rc,
|
|
190
|
+
rateControlMode,
|
|
191
|
+
gopMode,
|
|
192
|
+
gopValue,
|
|
193
|
+
minrate,
|
|
194
|
+
bitrate,
|
|
195
|
+
maxrate,
|
|
196
|
+
width,
|
|
197
|
+
height,
|
|
198
|
+
pixelFormat,
|
|
199
|
+
scaleType,
|
|
200
|
+
cq,
|
|
201
|
+
fixedGOP = false,
|
|
202
|
+
interlaced,
|
|
203
|
+
cbr,
|
|
204
|
+
scanType,
|
|
205
|
+
bframe,
|
|
206
|
+
streamIndex,
|
|
207
|
+
streamId,
|
|
208
|
+
pid,
|
|
209
|
+
sourceIndex,
|
|
210
|
+
hdr,
|
|
211
|
+
id,
|
|
212
|
+
aspectRatioMode,
|
|
213
|
+
aspectRatioWidth,
|
|
214
|
+
aspectRatioHeight,
|
|
215
|
+
pteEnabled,
|
|
216
|
+
vmafMin,
|
|
217
|
+
vmafMax,
|
|
218
|
+
vmafThres,
|
|
219
|
+
} = _preset
|
|
220
|
+
const newPreset = emptyStr2Undefined({
|
|
221
|
+
name,
|
|
222
|
+
options: option,
|
|
223
|
+
description,
|
|
224
|
+
type,
|
|
225
|
+
fps,
|
|
226
|
+
codec,
|
|
227
|
+
encoderType,
|
|
228
|
+
videoCodec,
|
|
229
|
+
videoBitrate: convertStringToNumber(videoBitrate),
|
|
230
|
+
videoProfile,
|
|
231
|
+
videoLevel,
|
|
232
|
+
bufsize: convertStringToNumber(bufsize),
|
|
233
|
+
rc,
|
|
234
|
+
rateControlMode,
|
|
235
|
+
gopMode,
|
|
236
|
+
gopValue: convertStringToNumber(gopValue),
|
|
237
|
+
preset,
|
|
238
|
+
videoPreset,
|
|
239
|
+
minrate: convertStringToNumber(minrate),
|
|
240
|
+
bitrate: convertStringToNumber(bitrate),
|
|
241
|
+
maxrate: convertStringToNumber(maxrate),
|
|
242
|
+
width: width === 0 ? 0 : convertStringToNumber(width),
|
|
243
|
+
height: height === 0 ? 0 : convertStringToNumber(height),
|
|
244
|
+
pixelFormat,
|
|
245
|
+
scaleType,
|
|
246
|
+
scanType,
|
|
247
|
+
cq: cq === 0 ? 0 : convertStringToNumber(cq),
|
|
248
|
+
interlaced,
|
|
249
|
+
cbr,
|
|
250
|
+
bframe: bframe === 0 ? 0 : convertStringToNumber(bframe),
|
|
251
|
+
streamId,
|
|
252
|
+
pid,
|
|
253
|
+
streamIndex,
|
|
254
|
+
fixedGOP,
|
|
255
|
+
sourceIndex,
|
|
256
|
+
id,
|
|
257
|
+
hdr,
|
|
258
|
+
aspectRatioMode,
|
|
259
|
+
aspectRatioWidth,
|
|
260
|
+
aspectRatioHeight,
|
|
261
|
+
pteEnabled: !enabled ? undefined : pteEnabled,
|
|
262
|
+
vmafMin: !enabled ? undefined : pteEnabled ? vmafMin : undefined,
|
|
263
|
+
vmafMax: !enabled ? undefined : pteEnabled ? vmafMax : undefined,
|
|
264
|
+
vmafThres: !enabled ? undefined : pteEnabled ? vmafThres : undefined,
|
|
265
|
+
})
|
|
266
|
+
return { ...newPreset, fixedGOP: !!_preset.fixedGOP, width: width === 0 ? 0 : convertStringToNumber(width), height: height === 0 ? 0 : convertStringToNumber(height), bframe: bframe === 0 ? 0 : convertStringToNumber(bframe), cq: cq === 0 ? 0 : convertStringToNumber(cq) }
|
|
267
|
+
}
|
|
268
|
+
if (kind === 'audio') {
|
|
269
|
+
const {
|
|
270
|
+
name,
|
|
271
|
+
option,
|
|
272
|
+
description,
|
|
273
|
+
type,
|
|
274
|
+
codec,
|
|
275
|
+
audioCodec,
|
|
276
|
+
audioGroupId,
|
|
277
|
+
audioGroup,
|
|
278
|
+
defaultAudio,
|
|
279
|
+
audioDefault,
|
|
280
|
+
bitrate,
|
|
281
|
+
audioBitrate,
|
|
282
|
+
audioProfile,
|
|
283
|
+
sampleRate,
|
|
284
|
+
channel,
|
|
285
|
+
profile,
|
|
286
|
+
volume,
|
|
287
|
+
streamIndex,
|
|
288
|
+
streamId,
|
|
289
|
+
pid,
|
|
290
|
+
sourceIndex,
|
|
291
|
+
id,
|
|
292
|
+
language,
|
|
293
|
+
label,
|
|
294
|
+
} = _preset
|
|
295
|
+
return emptyStr2Undefined({
|
|
296
|
+
name,
|
|
297
|
+
options: option,
|
|
298
|
+
description,
|
|
299
|
+
type,
|
|
300
|
+
codec,
|
|
301
|
+
audioCodec,
|
|
302
|
+
audioGroupId,
|
|
303
|
+
audioGroup,
|
|
304
|
+
defaultAudio,
|
|
305
|
+
audioDefault,
|
|
306
|
+
bitrate: convertStringToNumber(bitrate),
|
|
307
|
+
audioBitrate: convertStringToNumber(audioBitrate),
|
|
308
|
+
sampleRate,
|
|
309
|
+
channel,
|
|
310
|
+
profile,
|
|
311
|
+
audioProfile,
|
|
312
|
+
volume,
|
|
313
|
+
streamIndex,
|
|
314
|
+
streamId,
|
|
315
|
+
pid,
|
|
316
|
+
sourceIndex,
|
|
317
|
+
id,
|
|
318
|
+
language,
|
|
319
|
+
label,
|
|
320
|
+
})
|
|
321
|
+
}
|
|
322
|
+
if (kind === 'data') {
|
|
323
|
+
const { name, option, description, type, codec, dataCodec, streamIndex, streamId, pid, sourceIndex, id, scte35OverwriteConfig = {
|
|
324
|
+
enabled: false,
|
|
325
|
+
overwriteDuration: 30,
|
|
326
|
+
overwriteDelayTime: 0,
|
|
327
|
+
}, scte35LogEnabled = false } = _preset
|
|
328
|
+
return emptyStr2Undefined({
|
|
329
|
+
name,
|
|
330
|
+
options: option,
|
|
331
|
+
description,
|
|
332
|
+
type,
|
|
333
|
+
codec,
|
|
334
|
+
dataCodec,
|
|
335
|
+
streamIndex,
|
|
336
|
+
streamId,
|
|
337
|
+
pid,
|
|
338
|
+
sourceIndex,
|
|
339
|
+
id,
|
|
340
|
+
scte35OverwriteConfig,
|
|
341
|
+
scte35LogEnabled,
|
|
342
|
+
})
|
|
343
|
+
}
|
|
344
|
+
return _preset
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export function normalizePreset(data) {
|
|
348
|
+
const preset = klona(data)
|
|
349
|
+
return {
|
|
350
|
+
...preset,
|
|
351
|
+
option: preset?.options,
|
|
352
|
+
}
|
|
353
|
+
}
|