Skip to content

Commit

Permalink
write ts types
Browse files Browse the repository at this point in the history
  • Loading branch information
jean343 committed Sep 17, 2016
1 parent 09d63b3 commit cd7120a
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 34 deletions.
45 changes: 22 additions & 23 deletions lib/components/Camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,38 @@ export class Camera extends omx.Component {

// ---- Text can be edited below this line --------
setFormat(): Camera {
var vf = this.getParameter(this.out_port, omx.INDEXTYPE.IndexParamPortDefinition);
var vf: omx.PARAM_PORTDEFINITIONTYPE = this.getParameter(this.out_port, omx.INDEXTYPE.IndexParamPortDefinition);
vf.video.nSliceHeight = vf.video.nFrameHeight;
this.setParameter(this.out_port, omx.INDEXTYPE.IndexParamPortDefinition, vf);
return this;
};
enable(): Camera {
var format = this.getParameter(this.out_port, omx.INDEXTYPE.IndexConfigPortCapturing);
format.bEnabled = 1;
var format: omx.CONFIG_PORTBOOLEANTYPE = this.getParameter(this.out_port, omx.INDEXTYPE.IndexConfigPortCapturing);
format.bEnabled = true;
this.setParameter(this.out_port, omx.INDEXTYPE.IndexConfigPortCapturing, format);
return this;
};
disable(): Camera {
var format = this.getParameter(this.out_port, omx.INDEXTYPE.IndexConfigPortCapturing);
format.bEnabled = 0;
var format: omx.CONFIG_PORTBOOLEANTYPE = this.getParameter(this.out_port, omx.INDEXTYPE.IndexConfigPortCapturing);
format.bEnabled = false;
this.setParameter(this.out_port, omx.INDEXTYPE.IndexConfigPortCapturing, format);
return this;
};

getDigitalZoom(): omx.CameraZoom {
var p = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexConfigCommonDigitalZoom);
var p: omx.CONFIG_SCALEFACTORTYPE = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexConfigCommonDigitalZoom);
return p.xWidth;
}
setDigitalZoom(zoom?: omx.CameraZoom) {
if (zoom === undefined) zoom = omx.CameraZoom.CAMERA_ZOOM_1X;
this.setParameter(omx.ALL, omx.INDEXTYPE.IndexConfigCommonDigitalZoom, {
this.setParameter(omx.ALL, omx.INDEXTYPE.IndexConfigCommonDigitalZoom, new omx.CONFIG_SCALEFACTORTYPE({
xWidth: zoom,
xHeight: zoom
});
}));
}

getCamplusId(): number {
var p = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexParamCameraCamplusId);
var p: omx.PARAM_U32TYPE = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexParamCameraCamplusId);
return p.nU32;
}
setCamplusId(nU32: number) {
Expand All @@ -52,7 +52,7 @@ export class Camera extends omx.Component {
}

getCameraDeviceNumber(): number {
var p = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexParamCameraDeviceNumber);
var p: omx.PARAM_U32TYPE = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexParamCameraDeviceNumber);
return p.nU32;
}
setCameraDeviceNumber(nU32: number) {
Expand All @@ -62,20 +62,20 @@ export class Camera extends omx.Component {
}

getCameraDevicesPresent(): number {
var p = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexParamCameraDevicesPresent);
var p: omx.PARAM_U32TYPE = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexParamCameraDevicesPresent);
return p.nU32;
}

getFrameStabilisation(): boolean {
var p = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexConfigCommonFrameStabilisation);
return !!p.bStab;
var p: omx.CONFIG_FRAMESTABTYPE = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexConfigCommonFrameStabilisation);
return p.bStab;
}
setFrameStabilisation(enabled?: boolean) {
this.setParameter(omx.ALL, omx.INDEXTYPE.IndexConfigCommonFrameStabilisation, { bStab: enabled });
}

getExposure(): omx.EXPOSURECONTROLTYPE {
var p = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexConfigCommonExposure);
var p: omx.CONFIG_EXPOSURECONTROLTYPE = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexConfigCommonExposure);
return p.eExposureControl;
}
setExposure(exposureControl?: omx.EXPOSURECONTROLTYPE) {
Expand All @@ -84,17 +84,16 @@ export class Camera extends omx.Component {
}

getExposureValue(): omx.CONFIG_EXPOSUREVALUETYPE {
var p = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexConfigCommonExposureValue);
return new omx.CONFIG_EXPOSUREVALUETYPE(p);
var p: omx.CONFIG_EXPOSUREVALUETYPE = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexConfigCommonExposureValue);
return p;
}
setExposureValue(value?: omx.CONFIG_EXPOSUREVALUETYPE) {
// Object.assign(new omx.CONFIG_EXPOSUREVALUETYPE(), value);
this.setParameter(omx.ALL, omx.INDEXTYPE.IndexConfigCommonExposureValue, value);
}

getFocusControl(): number {
var p = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexConfigFocusControl);
return p.nContrast;
var p: omx.IMAGE_CONFIG_FOCUSCONTROLTYPE = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexConfigFocusControl);
return p.nFocusSteps;
}
setFocusControl(nContrast?: number) {
if (nContrast === undefined) nContrast = 0;
Expand All @@ -103,7 +102,7 @@ export class Camera extends omx.Component {
}

getContrast(): number {
var p = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexConfigCommonContrast);
var p: omx.CONFIG_CONTRASTTYPE = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexConfigCommonContrast);
return p.nContrast;
}
setContrast(nContrast?: number) {
Expand All @@ -113,7 +112,7 @@ export class Camera extends omx.Component {
}

getBrightness(): number {
var p = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexConfigCommonBrightness);
var p: omx.CONFIG_BRIGHTNESSTYPE = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexConfigCommonBrightness);
return p.nBrightness;
}
setBrightness(nBrightness?: number) {
Expand All @@ -123,7 +122,7 @@ export class Camera extends omx.Component {
}

getSaturation(): number {
var p = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexConfigCommonSaturation);
var p: omx.CONFIG_SATURATIONTYPE = this.getParameter(omx.ALL, omx.INDEXTYPE.IndexConfigCommonSaturation);
return p.nSaturation;
}
setSaturation(nSaturation?: number) {
Expand All @@ -133,7 +132,7 @@ export class Camera extends omx.Component {
}

getVideoFramerate(): number {
var p = this.getParameter(this.out_port, omx.INDEXTYPE.IndexConfigVideoFramerate);
var p: omx.CONFIG_FRAMERATETYPE = this.getParameter(this.out_port, omx.INDEXTYPE.IndexConfigVideoFramerate);
return p.xEncodeFramerate >> 16;
}
setVideoFramerate(fps?: number) {
Expand Down
4 changes: 2 additions & 2 deletions lib/components/EglRender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export class EglRender extends omx.Component {
}

// ---- Text can be edited below this line --------
setBufferCount (countIN: number, countOUT: number) {
var portdef = this.getParameter(this.in_port, omx.INDEXTYPE.IndexParamPortDefinition);
setBufferCount(countIN: number, countOUT: number) {
var portdef: omx.PARAM_PORTDEFINITIONTYPE = this.getParameter(this.in_port, omx.INDEXTYPE.IndexParamPortDefinition);
portdef.nBufferCountActual = Math.max(countIN, portdef.nBufferCountMin);
this.setParameter(this.in_port, omx.INDEXTYPE.IndexParamPortDefinition, portdef);

Expand Down
4 changes: 2 additions & 2 deletions lib/components/ImageDecode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export class ImageDecode extends omx.Component {
}

// ---- Text can be edited below this line --------
setInputFormat (eCompressionFormat: omx.IMAGE_CODINGTYPE) {
var format = this.getParameter(this.in_port, omx.INDEXTYPE.IndexParamImagePortFormat);
setInputFormat(eCompressionFormat: omx.IMAGE_CODINGTYPE) {
var format: omx.IMAGE_PARAM_PORTFORMATTYPE = this.getParameter(this.in_port, omx.INDEXTYPE.IndexParamImagePortFormat);
format.eCompressionFormat = eCompressionFormat;
this.setParameter(this.in_port, omx.INDEXTYPE.IndexParamImagePortFormat, format);
return this;
Expand Down
2 changes: 1 addition & 1 deletion lib/components/ImageEncode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class ImageEncode extends omx.Component {

// ---- Text can be edited below this line --------
setInputFormat(eCompressionFormat: omx.IMAGE_CODINGTYPE) {
var format = this.getParameter(this.out_port, omx.INDEXTYPE.IndexParamImagePortFormat);
var format: omx.IMAGE_PARAM_PORTFORMATTYPE = this.getParameter(this.out_port, omx.INDEXTYPE.IndexParamImagePortFormat);
format.eCompressionFormat = eCompressionFormat;
this.setParameter(this.out_port, omx.INDEXTYPE.IndexParamImagePortFormat, format);
return this;
Expand Down
8 changes: 4 additions & 4 deletions lib/components/VideoDecode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ export class VideoDecode extends omx.Component {
}

// ---- Text can be edited below this line --------
setVideoPortFormat (eCompressionFormat: omx.VIDEO_CODINGTYPE) {
var format = this.getParameter(this.in_port, omx.INDEXTYPE.IndexParamVideoPortFormat);
setVideoPortFormat(eCompressionFormat: omx.VIDEO_CODINGTYPE) {
var format: omx.VIDEO_PARAM_PORTFORMATTYPE = this.getParameter(this.in_port, omx.INDEXTYPE.IndexParamVideoPortFormat);
format.eCompressionFormat = eCompressionFormat;
this.setParameter(this.in_port, omx.INDEXTYPE.IndexParamVideoPortFormat, format);
return this;
};
setBufferCount(countIN: number, countOUT: number) {
var portdef = this.getParameter(this.in_port, omx.INDEXTYPE.IndexParamPortDefinition);
setBufferCount(countIN: number, countOUT: number) {
var portdef: omx.PARAM_PORTDEFINITIONTYPE = this.getParameter(this.in_port, omx.INDEXTYPE.IndexParamPortDefinition);
portdef.nBufferCountActual = Math.max(countIN, portdef.nBufferCountMin);
portdef.nBufferSize = 65536;
this.setParameter(this.in_port, omx.INDEXTYPE.IndexParamPortDefinition, portdef);
Expand Down
4 changes: 2 additions & 2 deletions lib/components/VideoRender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export class VideoRender extends omx.Component {
}

// ---- Text can be edited below this line --------
setBufferCount (countIN: number) {
var portdef = this.getParameter(this.in_port, omx.INDEXTYPE.IndexParamPortDefinition);
setBufferCount(countIN: number) {
var portdef: omx.PARAM_PORTDEFINITIONTYPE = this.getParameter(this.in_port, omx.INDEXTYPE.IndexParamPortDefinition);
portdef.nBufferCountActual = Math.max(countIN, portdef.nBufferCountMin);
this.setParameter(this.in_port, omx.INDEXTYPE.IndexParamPortDefinition, portdef);
return this;
Expand Down

0 comments on commit cd7120a

Please sign in to comment.