feat: Use yuv
by default if no pixelFormat
is set (#2441)
This commit is contained in:
parent
7e2889cf84
commit
11eb1f68e4
@ -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}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user