feat: Use yuv by default if no pixelFormat is set (#2441)

This commit is contained in:
Marc Rousavy 2024-01-26 10:07:16 +01:00 committed by GitHub
parent 7e2889cf84
commit 11eb1f68e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -470,6 +470,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
}
const shouldEnableBufferCompression = props.video === true && frameProcessor == null
const pixelFormat = props.pixelFormat ?? (frameProcessor == null ? 'yuv' : 'native')
const torch = this.state.isRecordingWithFlash ? 'on' : props.torch
return (
@ -487,6 +488,7 @@ export class Camera extends React.PureComponent<CameraProps, CameraState> {
codeScannerOptions={codeScanner}
enableFrameProcessor={frameProcessor != null}
enableBufferCompression={props.enableBufferCompression ?? shouldEnableBufferCompression}
pixelFormat={pixelFormat}
/>
)
}

View File

@ -74,7 +74,9 @@ export interface CameraProps extends ViewProps {
* - `yuv`: The YUV (Y'CbCr 4:2:0 or NV21, 8-bit) format, either video- or full-range, depending on hardware capabilities. This is the second most efficient format.
* - `rgb`: The RGB (RGB, RGBA or ABGRA, 8-bit) format. This is least efficient and requires explicit conversion.
*
* @default `native`
* @default
* - Without a Frame Processor: `native`
* - With a Frame Processor: `yuv`
*/
pixelFormat?: 'native' | 'yuv' | 'rgb'
//#endregion