Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/lib/shared-args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@ import { StillOptions } from './still-camera';
import { StreamOptions } from './stream-camera';
import { Flip } from '..';

/**
* Generates the annotate command line arguments
*
* @param annotate Annotate option array
*/
function generateAnnotate(annotate: (number | string)[]): string[] {
const argumentsArray: string[] = [];

for (const element of annotate) {
argumentsArray.push('--annotate');
argumentsArray.push(typeof element === 'number' ? element.toString() : element);
}

return argumentsArray;
}

/**
* Get the command line arguments for `raspistill` or `raspivid` that are common among both
*
Expand Down Expand Up @@ -94,5 +110,10 @@ export function getSharedArgs(options: StillOptions | StreamOptions): string[] {
* Digital Gain
*/
...(options.digitalGain ? ['--digitalgain', options.digitalGain.toString()] : []),

/**
* Annotate
*/
...(options.annotate ? generateAnnotate(options.annotate) : []),
];
}
1 change: 1 addition & 0 deletions src/lib/still-camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface StillOptions {
awbMode?: AwbMode;
analogGain?: number;
digitalGain?: number;
annotate?: (number | string)[];
}

export default class StillCamera {
Expand Down
1 change: 1 addition & 0 deletions src/lib/stream-camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface StreamOptions {
awbMode?: AwbMode;
analogGain?: number;
digitalGain?: number;
annotate?: (number | string)[];
}

declare interface StreamCamera {
Expand Down