///
///
import { EventEmitter } from 'tsee';
import { SpawnHelperType } from './spawn-helper';
import { ICamera, ICameraInferenceDimensions, ICameraProfilingInfoEvent, ICameraSnapshotForInferenceEvent, ICameraStartOptions } from './icamera';
type GStreamerCap = {
type: 'video/x-raw' | 'image/jpeg' | 'nvarguscamerasrc' | 'pylonsrc';
width: number;
height: number;
framerate: number;
formats?: string[];
};
export type GStreamerMode = 'default' | 'rpi' | 'rpi5' | 'qualcomm-rb3gen2' | 'qualcomm-yupik' | 'unoq';
export declare class GStreamer extends EventEmitter<{
snapshot: (buffer: Buffer, filename: string) => void;
snapshotForInference: (ev: ICameraSnapshotForInferenceEvent) => void;
error: (message: string) => void;
profilingInfo: (ev: ICameraProfilingInfoEvent) => void;
}> implements ICamera {
private _captureProcess?;
private _tempDir?;
private _watcher?;
private _originalAndRgbFilesSeen;
private _handledFiles;
private _verbose;
private _lastFile;
private _processing;
private _lastOptions?;
private _mode;
private _modeOverride;
private _keepAliveTimeout;
private _isStarted;
private _isRestarting;
private _spawnHelper;
private _customLaunchCommand;
private _profiling;
private _preferCapType;
private _emitsOriginalSizeImages;
private _emitsRgbBuffers;
private _overrideColorFormat;
private _lastGstLaunchCommand;
private _outputRgbBuffers;
private _imagesReceived;
private _offset;
private _customGstSource;
constructor(verbose: boolean, options?: {
spawnHelperOverride?: SpawnHelperType;
customLaunchCommand?: string;
modeOverride?: GStreamerMode;
profiling?: boolean;
dontRunCleanupLoop?: boolean;
colorFormat?: string;
dontOutputRgbBuffers?: boolean;
preferCapType?: 'image/jpeg' | 'video/x-raw';
customGstSource?: string;
});
init(): Promise;
listDevices(): Promise;
start(options: ICameraStartOptions): Promise;
getGstreamerLaunchCommand(device: {
id: string;
name: string;
caps: GStreamerCap[];
videoSource: string;
}, dimensions: {
width: number;
height: number;
}, inferenceDims: ICameraInferenceDimensions | undefined): Promise<{
command: string;
pipeline: string;
}>;
stop(): Promise;
getAllDevices(): Promise<{
id: string;
name: string;
caps: GStreamerCap[];
videoSource: string;
}[]>;
private hasGstPlugin;
private listNvarguscamerasrcDevices;
private listPylonsrcDevices;
private listQtiqmmsrcDevices;
private listQtiqmmsrcOnYupikDevices;
getLastOptions(): ICameraStartOptions | undefined;
private exists;
private restart;
private timeoutCallback;
/**
* Compute the crop to get to the right aspect ratio (fit-short only)
* @param srcW Input width (so the webcam resolution)
* @param srcH Input height (so the webcam resolution)
* @param tgtW Target width (so the inference dimensions)
* @param tgtH Target height (so the inference dimensions)
* @returns
*/
private computeCropForFitShort;
private startOriginalCleanupLoop;
private wait;
private safeUnlinkFile;
private cleanupTempDirAsync;
private timestampNsToPts;
}
export {};