-
Notifications
You must be signed in to change notification settings - Fork 10
/
VideoConfiguration.ts
101 lines (88 loc) · 3.1 KB
/
VideoConfiguration.ts
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
import {map, mapArray} from '../common/Mapper';
import CodecConfiguration from './CodecConfiguration';
import ColorConfig from './ColorConfig';
import DisplayAspectRatio from './DisplayAspectRatio';
import EncodingMode from './EncodingMode';
import PixelFormat from './PixelFormat';
/**
* @export
* @class VideoConfiguration
*/
export class VideoConfiguration extends CodecConfiguration {
/**
* Width of the encoded video in pixels
* @type {number}
* @memberof VideoConfiguration
*/
public width?: number;
/**
* Height of the encoded video in pixels
* @type {number}
* @memberof VideoConfiguration
*/
public height?: number;
/**
* Target bitrate for the encoded video in bps. Either bitrate or crf is required.
* @type {number}
* @memberof VideoConfiguration
*/
public bitrate?: number;
/**
* Target frame rate of the encoded video. Must be set for live encodings
* @type {number}
* @memberof VideoConfiguration
*/
public rate?: number;
/**
* Describes the color encoding, bit depth, and chroma subsampling of each pixel in the output image.
* @type {PixelFormat}
* @memberof VideoConfiguration
*/
public pixelFormat?: PixelFormat;
/**
* @type {ColorConfig}
* @memberof VideoConfiguration
*/
public colorConfig?: ColorConfig;
/**
* The numerator of the sample aspect ratio (also known as pixel aspect ratio). Must be set if sampleAspectRatioDenominator is set. If set then displayAspectRatio is not allowed.
* @type {number}
* @memberof VideoConfiguration
*/
public sampleAspectRatioNumerator?: number;
/**
* The denominator of the sample aspect ratio (also known as pixel aspect ratio). Must be set if sampleAspectRatioNumerator is set. If set then displayAspectRatio is not allowed.
* @type {number}
* @memberof VideoConfiguration
*/
public sampleAspectRatioDenominator?: number;
/**
* Specifies a display aspect ratio (DAR) to be enforced. The sample aspect ratio (SAR) will be adjusted accordingly. If set then sampleAspectRatioNumerator and sampleAspectRatioDenominator are not allowed.
* @type {DisplayAspectRatio}
* @memberof VideoConfiguration
*/
public displayAspectRatio?: DisplayAspectRatio;
/**
* The mode of the encoding. When this is set, `encodingMode` (`liveEncodingMode`) must not be set in the (live) encoding start request.
* @type {EncodingMode}
* @memberof VideoConfiguration
*/
public encodingMode?: EncodingMode;
constructor(obj?: Partial<VideoConfiguration>) {
super(obj);
if(!obj) {
return;
}
this.width = map(obj.width);
this.height = map(obj.height);
this.bitrate = map(obj.bitrate);
this.rate = map(obj.rate);
this.pixelFormat = map(obj.pixelFormat);
this.colorConfig = map(obj.colorConfig, ColorConfig);
this.sampleAspectRatioNumerator = map(obj.sampleAspectRatioNumerator);
this.sampleAspectRatioDenominator = map(obj.sampleAspectRatioDenominator);
this.displayAspectRatio = map(obj.displayAspectRatio, DisplayAspectRatio);
this.encodingMode = map(obj.encodingMode);
}
}
export default VideoConfiguration;