forked from EasyScreenCast/EasyScreenCast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utilgsp.js
530 lines (447 loc) · 19.4 KB
/
utilgsp.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
/* -*- mode: js; js-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
Copyright (C) 2016 Borsato Ivano
The JavaScript code in this page is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
*/
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const Lib = Me.imports.convenience;
const Settings = Me.imports.settings;
const UtilAudio = Me.imports.utilaudio;
// CONST GSP - base
const SCREEN = '_SCREENCAST_RES_ _ENCODER_VIDEO_ ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! _CONTAINER_';
// CONST GSP - base plus sound
const SCREEN_SOUND = 'queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! _SCREENCAST_RES_ _ENCODER_VIDEO_ ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! mux. pulsesrc ! audioconvert ! _ENCODER_AUDIO_ ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! mux. _CONTAINER_ name=mux ';
// CONST GSP - base plus webcam
const SCREEN_WEBCAM = 'queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! videomixer name=mix _WEBCAM_OPT_ ! videoconvert ! _SCREENCAST_RES_ _ENCODER_VIDEO_ ! mux. v4l2src _WEBCAM_DEV_ ! _WEBCAM_CAP_ ! videoscale ! video/x-raw, width=_WEBCAM_W_, height=_WEBCAM_H_, add-borders=false ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! mix. _CONTAINER_ name=mux';
// CONST GSP - base plus sound and webcam stream
const SCREEN_WEBCAM_SOUND = 'queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! videomixer name=mix _WEBCAM_OPT_ ! videoconvert ! _SCREENCAST_RES_ _ENCODER_VIDEO_ ! mux. v4l2src _WEBCAM_DEV_ ! _WEBCAM_CAP_ ! videoscale ! video/x-raw, width=_WEBCAM_W_, height=_WEBCAM_H_, add-borders=false ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! mix. pulsesrc ! audioconvert ! _ENCODER_AUDIO_ ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! mux. _CONTAINER_ name=mux';
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// CONST CONTAINER - WebM
const webmVP8 = {
fileExt: '.webm',
nameGSP: 'webmmux',
quality: [{
//quality level 0
fps: 15,
vq: 'vp8enc min_quantizer=13 max_quantizer=20 cpu-used=5 deadline=1000000 sharpness=2 target-bitrate=10000 threads=%T',
aq: 'vorbisenc',
descr: 'FPS: 15 \nVideo -> VP8 Encoder:\n-min_quantizer=13\n-max_quantizer=20\n-cpu-used=5\n-deadline=1000000\n-sharpness=2\n-target-bitrate=10000\nAudio -> Vorbis Encoder'
}, {
//quality level 1
fps: 30,
vq: 'vp8enc min_quantizer=4 max_quantizer=13 cpu-used=2 deadline=500000 sharpness=0 target-bitrate=15000 threads=%T',
aq: 'vorbisenc',
descr: 'FPS: 30 \nVideo -> VP8 Encoder:\n-min_quantizer=4\n-max_quantizer=13\n-cpu-used=2\n-deadline=500000\n-sharpness=0\n-target-bitrate=15000\nAudio -> Vorbis Encoder'
}, {
//quality level 2
fps: 30,
vq: 'vp8enc min_quantizer=0 max_quantizer=7 cpu-used=1 deadline=500000 sharpness=0 target-bitrate=25000 threads=%T',
aq: 'vorbisenc',
descr: 'FPS: 30 \nVideo -> VP8 Encoder:\n-min_quantizer=0\n-max_quantizer=7\n-cpu-used=1\n-deadline=500000\n-sharpness=0\n-target-bitrate=25000\nAudio -> Vorbis Encoder'
}, {
//quality level 3
fps: 60,
vq: 'vp8enc min_quantizer=0 max_quantizer=0 cpu-used=0 deadline=100000 sharpness=0 target-bitrate=40000 threads=%T',
aq: 'vorbisenc',
descr: 'FPS: 60 \nVideo -> VP8 Encoder:\n-min_quantizer=0\n-max_quantizer=0\n-cpu-used=0\n-deadline=100000\n-sharpness=0\n-target-bitrate=40000\nAudio -> Vorbis Encoder'
}, ]
};
const webmVP9 = {
fileExt: '.webm',
nameGSP: 'webmmux',
quality: [{
//quality level 0
fps: 15,
vq: 'vp9enc min_quantizer=13 max_quantizer=20 cpu-used=5 deadline=1000000 sharpness=2 target-bitrate=10000 threads=%T',
aq: 'vorbisenc',
descr: 'FPS: 15 \nVideo -> VP9 Encoder:\n-min_quantizer=13\n-max_quantizer=20\n-cpu-used=5\n-deadline=1000000\n-sharpness=2\n-target-bitrate=10000\nAudio -> Vorbis Encoder'
}, {
//quality level 1
fps: 30,
vq: 'vp9enc min_quantizer=4 max_quantizer=13 cpu-used=2 deadline=500000 sharpness=0 target-bitrate=15000 threads=%T',
aq: 'vorbisenc',
descr: 'FPS: 30 \nVideo -> VP9 Encoder:\n-min_quantizer=4\n-max_quantizer=13\n-cpu-used=2\n-deadline=500000\n-sharpness=0\n-target-bitrate=15000\nAudio -> Vorbis Encoder'
}, {
//quality level 2
fps: 30,
vq: 'vp9enc min_quantizer=0 max_quantizer=7 cpu-used=1 deadline=500000 sharpness=0 target-bitrate=25000 threads=%T',
aq: 'vorbisenc',
descr: 'FPS: 30 \nVideo -> VP9 Encoder:\n-min_quantizer=0\n-max_quantizer=7\n-cpu-used=1\n-deadline=500000\n-sharpness=0\n-target-bitrate=25000\nAudio -> Vorbis Encoder'
}, {
//quality level 3
fps: 60,
vq: 'vp9enc min_quantizer=0 max_quantizer=0 cpu-used=0 deadline=100000 sharpness=0 target-bitrate=40000 threads=%T',
aq: 'vorbisenc',
descr: 'FPS: 60 \nVideo -> VP9 Encoder:\n-min_quantizer=0\n-max_quantizer=0\n-cpu-used=0\n-deadline=100000\n-sharpness=0\n-target-bitrate=40000\nAudio -> Vorbis Encoder'
}, ]
};
// CONST CONTAINER - Mp4
const mp4 = {
fileExt: '.mp4',
nameGSP: 'mp4mux',
quality: [{
//quality level 0
fps: 15,
vq: 'x264enc psy-tune="none" speed-preset="superfast" subme=1 qp-min=28 qp-max=40 threads=%T',
aq: 'lamemp3enc',
descr: 'FPS: 15 \nVideo -> x264enc Encoder:\n-psy-tune="none"\n-speed-preset="superfast"\n-subme=1\n-qp-min=28\n-qp-max=40\nAudio -> Mp3 Encoder'
}, {
//quality level 1
fps: 30,
vq: 'x264enc psy-tune="animation" speed-preset="fast" subme=5 qp-min=18 qp-max=28 threads=%T',
aq: 'lamemp3enc',
descr: 'FPS: 30 \nVideo -> x264enc Encoder:\n-psy-tune="animation"\n-speed-preset="fast"\n-subme=5\n-qp-min=18\n-qp-max=28\nAudio -> Mp3 Encoder'
}, {
//quality level 2
fps: 30,
vq: 'x264enc psy-tune="animation" speed-preset="medium" subme=8 qp-min=10 qp-max=18 threads=%T',
aq: 'lamemp3enc',
descr: 'FPS: 30 \nVideo -> x264enc Encoder:\n-psy-tune="animation"\n-speed-preset="medium"\n-subme=8\n-qp-min=10\n-qp-max=18\nAudio -> Mp3 Encoder'
}, {
//quality level 3
fps: 60,
vq: 'x264enc psy-tune="film" speed-preset="slower" subme=10 qp-min=0 qp-max=10 threads=%T',
aq: 'lamemp3enc',
descr: 'FPS: 60 \nVideo -> x264enc Encoder:\n-psy-tune="film"\n-speed-preset="slower"\n-subme=10\n-qp-min=0\n-qp-max=10\nAudio -> Mp3 Encoder'
}, ]
};
// CONST CONTAINER - Mkv
const mkv = {
fileExt: '.mkv',
nameGSP: 'matroskamux',
quality: [{
//quality level 0
fps: 15,
vq: 'x264enc psy-tune="none" speed-preset="superfast" subme=1 qp-min=28 qp-max=40 threads=%T',
aq: 'flacenc',
descr: 'FPS: 15 \nVideo -> x264enc Encoder:\n-psy-tune="none"\n-speed-preset="superfast"\n-subme=1\n-qp-min=28\n-qp-max=40\nAudio -> Flac Encoder'
}, {
//quality level 1
fps: 30,
vq: 'x264enc psy-tune="animation" speed-preset="fast" subme=5 qp-min=18 qp-max=28 threads=%T',
aq: 'flacenc',
descr: 'FPS: 30 \nVideo -> x264enc Encoder:\n-psy-tune="animation"\n-speed-preset="fast"\n-subme=5\n-qp-min=18\n-qp-max=28\nAudio -> Flac Encoder'
}, {
//quality level 2
fps: 30,
vq: 'x264enc psy-tune="animation" speed-preset="medium" subme=8 qp-min=10 qp-max=18 threads=%T',
aq: 'flacenc',
descr: 'FPS: 30 \nVideo -> x264enc Encoder:\n-psy-tune="animation"\n-speed-preset="medium"\n-subme=8\n-qp-min=10\n-qp-max=18\nAudio -> Flac Encoder'
}, {
//quality level 3
fps: 60,
vq: 'x264enc psy-tune="film" speed-preset="slower" subme=10 qp-min=0 qp-max=10 threads=%T',
aq: 'flacenc',
descr: 'FPS: 60 \nVideo -> x264enc Encoder:\n-psy-tune="film"\n-speed-preset="slower"\n-subme=10\n-qp-min=0\n-qp-max=10\nAudio -> Flac Encoder'
}, ]
};
// CONST CONTAINER - Ogg
const ogg = {
fileExt: '.ogg',
nameGSP: 'oggmux',
quality: [{
//quality level 0
fps: 15,
vq: 'theoraenc speed-level=3 vp3-compatible=true quality=10 bitrate=10000',
aq: 'opusenc',
descr: 'FPS: 15 \nVideo -> Theora Encoder:\n-speed-level=3\n-vp3-compatible=true\n-quality=10\n-bitrate=10000\nAudio -> Opus Encoder'
}, {
//quality level 1
fps: 30,
vq: 'theoraenc speed-level=1 vp3-compatible=false quality=30 bitrate=25000',
aq: 'opusenc',
descr: 'FPS: 30 \nVideo -> Theora Encoder:\n-speed-level=1\n-vp3-compatible=false\n-quality=30\n-bitrate=25000\nAudio -> Opus Encoder'
}, {
//quality level 2
fps: 30,
vq: 'theoraenc speed-level=0 vp3-compatible=false quality=50 bitrate=50000',
aq: 'opusenc',
descr: 'FPS: 30 \nVideo -> Theora Encoder:\n-speed-level=0\n-vp3-compatible=false\n-quality=50\n-bitrate=50000\nAudio -> Opus Encoder'
}, {
//quality level 3
fps: 60,
vq: 'theoraenc speed-level=0 vp3-compatible=false quality=60 bitrate=100000',
aq: 'opusenc',
descr: 'FPS: 60 \nVideo -> Theora Encoder\n-speed-level=0\n-vp3-compatible=false\n-quality=60\n-bitrate=100000\nAudio -> Opus Encoder'
}, ]
};
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// CONST RESOLUTION
const RESOLUTION = [
// NATIVE SCREENCAST RESOLUTION
'',
// SD - 480
'videoscale ! video/x-raw, width=640, height=480, add-borders=true ! ',
// HD - 720
'videoscale ! video/x-raw, width=1280, height=720, add-borders=true ! ',
// FHD - 1080
'videoscale ! video/x-raw, width=1920, height=1080, add-borders=true ! ',
// UHD - 2160
'videoscale ! video/x-raw, width=3840, height=2160, add-borders=true ! '
];
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// VAR ARRAY CONTAINER
const CONTAINER = [webmVP8, webmVP9, mp4, mkv, ogg];
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
/*
* Compose GSP
*/
function composeGSP() {
Lib.TalkativeLog('-§-COMPOSE GSP');
this.CtrlAudio = new UtilAudio.MixerAudio();
this.tmpGSP = '';
//retrieve options
let Device_Webcam = Settings.getOption(
'i', Settings.DEVICE_WEBCAM_SETTING_KEY);
let Device_Audio = Settings.getOption(
'i', Settings.INPUT_AUDIO_SOURCE_SETTING_KEY);
let QualityGSP = Settings.getOption(
'i', Settings.QUALITY_SETTING_KEY);
let QualityWebcam = Settings.getOption(
's', Settings.QUALITY_WEBCAM_SETTING_KEY);
let Resolution = Settings.getOption(
'i', Settings.FILE_RESOLUTION_SETTING_KEY);
let Container = Settings.getOption(
'i', Settings.FILE_CONTAINER_SETTING_KEY);
Lib.TalkativeLog('-§-get option||devW: ' + Device_Webcam + '||devA: ' + Device_Audio + '||Qgsp: ' + QualityGSP + '||Qwc: ' + QualityWebcam + '||Res: ' + Resolution + '||Cont: ' + Container);
if (Device_Webcam > 0) {
switch (Device_Audio) {
case 0:
Lib.TalkativeLog('-§- SCREEN-WEBCAM');
this.tmpGSP = SCREEN_WEBCAM;
//replace WEBCAM_DEVICE/WEBCAM_CAPS
this.tmpGSP = replaceWebcam(
this.tmpGSP,
Device_Webcam,
QualityWebcam
);
break;
case 1:
Lib.TalkativeLog('-§-SCREEN-WEBCAM-AUDIO(d)');
this.tmpGSP = SCREEN_WEBCAM_SOUND;
//replace WEBCAM_DEVICE/WEBCAM_CAPS/ENCODER-AUDIO
this.tmpGSP = replaceAudio(
replaceWebcam(
this.tmpGSP,
Device_Webcam,
QualityWebcam),
true,
Container,
QualityGSP);
break;
default:
Lib.TalkativeLog('-§-SCREEN-WEBCAM-AUDIO');
this.tmpGSP = SCREEN_WEBCAM_SOUND;
//replace WEBCAM_DEVICE/WEBCAM_CAPS/ENCODER-AUDIO/AUDIO_DEVICE
this.tmpGSP = replaceAudio(
replaceWebcam(
this.tmpGSP,
Device_Webcam,
QualityWebcam),
false,
Container,
QualityGSP);
}
} else {
switch (Device_Audio) {
case 0:
Lib.TalkativeLog('-§-SCREEN');
this.tmpGSP = SCREEN;
break;
case 1:
Lib.TalkativeLog('-§-SCREEN-AUDIO(d)');
this.tmpGSP = SCREEN_SOUND;
//replace ENCODER-AUDIO
this.tmpGSP = replaceAudio(
this.tmpGSP,
true,
Container,
QualityGSP);
break;
default:
Lib.TalkativeLog('-§-SCREEN-AUDIO');
this.tmpGSP = SCREEN_SOUND;
//replace ENCODER-AUDIO/AUDIO_DEVICE
this.tmpGSP = replaceAudio(
this.tmpGSP,
false,
Container,
QualityGSP);
}
}
//replace RESOLUTION/ENCODER-VIDEO/CONTAINER
var mapObj = {
_SCREENCAST_RES_: RESOLUTION[Resolution],
_ENCODER_VIDEO_: CONTAINER[Container].quality[QualityGSP].vq,
_CONTAINER_: CONTAINER[Container].nameGSP
};
this.tmpGSP = this.tmpGSP.replace(
/_SCREENCAST_RES_|_ENCODER_VIDEO_|_CONTAINER_/gi,
function(match) {
return mapObj[match];
}
);
Lib.TalkativeLog('-§-final GSP :' + this.tmpGSP);
return this.tmpGSP;
}
/*
* replace audio
*/
function replaceAudio(gspRA, defaultAudio, ConTMP, QGSPtmp) {
Lib.TalkativeLog('-§-replace audio default->' + defaultAudio);
//replace device/encoder
var aq = CONTAINER[ConTMP].quality[QGSPtmp].aq;
Lib.TalkativeLog('-§-pipeline pre-audio:' + gspRA + ' aq:' + aq);
var audioPipeline;
if (defaultAudio) {
Lib.TalkativeLog('-§-default audio source');
audioPipeline = gspRA.replace(/_ENCODER_AUDIO_/gi, aq);
} else {
var audiosource = this.CtrlAudio.getAudioSource();
if (audiosource === undefined) {
Lib.TalkativeLog('-§-failure combination of array audio sources');
audioPipeline = gspRA.replace(/_ENCODER_AUDIO_/gi, aq);
} else {
Lib.TalkativeLog('-§-correct audio source assignment');
if (audiosource.indexOf('output') !== -1) {
audiosource += '.monitor';
}
var reDev = 'pulsesrc device="' + audiosource + '"';
var mapObj = {
pulsesrc: reDev,
_ENCODER_AUDIO_: aq
};
audioPipeline = gspRA.replace(/pulsesrc|_ENCODER_AUDIO_/gi,
function(match) {
return mapObj[match];
}
);
}
}
Lib.TalkativeLog('-§-pipeline post-audio:' + audioPipeline);
return audioPipeline;
}
/*
* replace webcam
*/
function replaceWebcam(gspRW, device, caps) {
Lib.TalkativeLog('-§-replace webcam -> ' + device + ' caps: ' + caps);
//replace device/caps
var reDev = 'device=/dev/video' + (device - 1);
var reWCopt = composeWebCamOption();
var [reWCwidth, reWCheight] = getWebCamDimension();
Lib.TalkativeLog('-§-pipeline pre-webcam:' + gspRW);
var mapObj = {
_WEBCAM_DEV_: reDev,
_WEBCAM_CAP_: caps,
_WEBCAM_OPT_: reWCopt,
_WEBCAM_W_: reWCwidth,
_WEBCAM_H_: reWCheight
};
var webcamPipeline = gspRW.replace(
/_WEBCAM_DEV_|_WEBCAM_CAP_|_WEBCAM_OPT_|_WEBCAM_W_|_WEBCAM_H_/gi,
function(match) {
return mapObj[match];
}
);
Lib.TalkativeLog('-§-pipeline post-webcam:' + webcamPipeline);
return webcamPipeline;
}
/*
* compose option webcam position
*/
function composeWebCamOption() {
Lib.TalkativeLog('-§-compose webcam option');
//retrieve option webcam
var WC_Alpha = Settings.getOption('d', Settings.ALPHA_CHANNEL_WEBCAM_SETTING_KEY);
var WC_marginX = Settings.getOption('i', Settings.MARGIN_X_WEBCAM_SETTING_KEY);
var WC_marginY = Settings.getOption('i', Settings.MARGIN_Y_WEBCAM_SETTING_KEY);
var WC_posCorner = Settings.getOption(
'i', Settings.CORNER_POSITION_WEBCAM_SETTING_KEY);
var [WC_w, WC_h, SCR_w, SCR_h] = getWebCamDimension();
var posX = 0;
var posY = 0;
Lib.TalkativeLog('-§-alpha=' + WC_Alpha + ' |marX=' + WC_marginX + ' |marY=' + WC_marginY + ' |corner=' + WC_posCorner);
//corner top-left
posX = WC_marginX;
posY = WC_marginY;
switch (WC_posCorner) {
case 0:
//corner bottom-right
posX = Math.floor(SCR_w - (WC_w + WC_marginX));
posY = Math.floor(SCR_h - (WC_h + WC_marginY));
break;
case 1:
//corner bottom-left
posx = WC_marginX;
posY = Math.floor(SCR_h - (WC_h + WC_marginY));
break;
case 2:
//corner top-right
posX = Math.floor(SCR_w - (WC_w + WC_marginX));
posY = WC_marginY;
break;
default:
}
//check valid position
if ((posX < 0 || posX > SCR_w) && (posY < 0 || posY > SCR_h)) {
Lib.TalkativeLog('-§-NOT valid position');
posX = 0;
posY = 0;
}
var tmpWCopt = 'sink_0::alpha=1 sink_1::alpha=' + WC_Alpha +
' sink_1::xpos=' + posX + ' sink_1::ypos=' + posY + ' ';
Lib.TalkativeLog('-§-posX=' + posX + ' |posY=' + posY);
Lib.TalkativeLog('-§-webcam option=' + tmpWCopt);
return tmpWCopt;
}
/*
* retrieve dimension webcam
*/
function getWebCamDimension() {
Lib.TalkativeLog('-§-get webcam dimension');
var WC_w = Settings.getOption('i', Settings.WIDTH_WEBCAM_SETTING_KEY);
var WC_h = Settings.getOption('i', Settings.HEIGHT_WEBCAM_SETTING_KEY);
var WC_DimType = Settings.getOption('i', Settings.TYPE_UNIT_WEBCAM_SETTING_KEY);
var SCR_w = Settings.getOption('i', Settings.WIDTH_SETTING_KEY);
var SCR_h = Settings.getOption('i', Settings.HEIGHT_SETTING_KEY);
if (Settings.getOption('i', Settings.AREA_SCREEN_SETTING_KEY) === 0) {
SCR_w = global.screen_width;
SCR_h = global.screen_height;
}
Lib.TalkativeLog('-§-WC w=' + WC_w + ' WC h=' + WC_h + ' WCtype=' + WC_DimType + ' screen W=' + SCR_w + ' screen H=' + SCR_h);
if (WC_DimType === 0) {
WC_w = Math.floor((SCR_w * WC_w) / 100);
WC_h = Math.floor((SCR_h * WC_h) / 100);
}
Lib.TalkativeLog('-§-after percentage WCw=' + WC_w + ' WCh=' + WC_h);
return [WC_w, WC_h, SCR_w, SCR_h];
}
/*
* get description
*/
function getDescr(quality, container) {
Lib.TalkativeLog('-§-get description Q-> ' + quality + ' C-> ' + container);
return CONTAINER[container].quality[quality].descr;
}
/*
* get fps
*/
function getFps(quality, container) {
Lib.TalkativeLog('-§-get fps Q-> ' + quality + ' C-> ' + container);
return CONTAINER[container].quality[quality].fps;
}
/*
* get file extension
*/
function getFileExtension(container) {
Lib.TalkativeLog('-§-get file extension C-> ' + container);
return CONTAINER[container].fileExt;
}