-
public class UVCCamera
-
-
Field Summary
Fields Modifier and Type Field Description public final static intUVC_ERROR_BUSYpublic final static intUVC_VS_FORMAT_UNCOMPRESSEDpublic final static intUVC_VS_FRAME_UNCOMPRESSEDpublic final static intUVC_VS_FORMAT_MJPEGpublic final static intUVC_VS_FRAME_MJPEGpublic final static intDEFAULT_PREVIEW_WIDTHpublic final static intDEFAULT_PREVIEW_HEIGHTpublic final static intDEFAULT_PREVIEW_FRAME_FORMATpublic final static intDEFAULT_PREVIEW_FPSpublic final static intFRAME_FORMAT_YUYVpublic final static intFRAME_FORMAT_MJPEGpublic final static intPIXEL_FORMAT_RAWpublic final static intPIXEL_FORMAT_YUVpublic final static intPIXEL_FORMAT_NV12public final static intPIXEL_FORMAT_NV21public final static intPIXEL_FORMAT_RGBpublic final static intPIXEL_FORMAT_RGB565public final static intPIXEL_FORMAT_RGBXpublic final static intPIXEL_FORMAT_BGRpublic final static intUVC_QUIRK_FIX_BANDWIDTH
-
Method Summary
Modifier and Type Method Description synchronized intopen(USBMonitor.UsbControlBlock ctrlBlock)connect to a UVC cameraUSB permission is necessary before this method is called voidsetQuirks(IStatusCallback callback)set status callback voidsetStatusCallback(IStatusCallback callback)set status callback voidsetButtonCallback(IButtonCallback callback)set button callback synchronized voidclose()close and release UVC camera synchronized voidclose(boolean isSilent)close and release UVC camera UsbDevicegetDevice()StringgetDeviceName()USBMonitor.UsbControlBlockgetUsbControlBlock()synchronized StringgetSupportedSize()List<Format>getSupportedFormatList()List<Size>getSupportedSizeList()SizegetSupportedSizeOne()get supported size that has max pixel and match default frame format SizegetPreviewSize()voidsetPreviewSize(int width, int height)Set preview size and preview mode voidsetPreviewSize(int width, int height, int frameType)Set preview size and preview mode voidsetPreviewSize(int width, int height, int frameType, int fps)Set preview size and preview mode voidsetPreviewSize(Size size)Set preview size and preview mode synchronized voidsetPreviewDisplay(SurfaceHolder holder)set preview surface with SurfaceHolderyou can use SurfaceHolder came from SurfaceView/GLSurfaceView synchronized voidsetPreviewTexture(SurfaceTexture texture)set preview surface with SurfaceTexture. synchronized voidsetPreviewDisplay(Surface surface)set preview surface with Surface voidsetFrameCallback(IFrameCallback callback, int pixelFormat)set frame callback synchronized voidstartPreview()start preview synchronized voidstopPreview()stop preview voidstartCapture(Surface surface)start movie capturing(this should call while previewing) voidstopCapture()stop movie capturing synchronized voiddestroy()destroy UVCCamera object synchronized voiddestroy(boolean isSilent)destroy UVCCamera object UVCControlgetControl()Returns true if UVCCamera is opened. booleanisOpened()-
-
Constructor Detail
-
UVCCamera
UVCCamera(UVCParam param)
the constructor of this class should be call within the thread that has a looper(UI thread or a thread that called Looper.
-
-
Method Detail
-
open
synchronized int open(USBMonitor.UsbControlBlock ctrlBlock)
connect to a UVC cameraUSB permission is necessary before this method is called
-
setQuirks
void setQuirks(IStatusCallback callback)
set status callback
-
setStatusCallback
void setStatusCallback(IStatusCallback callback)
set status callback
-
setButtonCallback
void setButtonCallback(IButtonCallback callback)
set button callback
-
close
synchronized void close()
close and release UVC camera
-
close
synchronized void close(boolean isSilent)
close and release UVC camera
-
getDevice
UsbDevice getDevice()
-
getDeviceName
String getDeviceName()
-
getUsbControlBlock
USBMonitor.UsbControlBlock getUsbControlBlock()
-
getSupportedSize
synchronized String getSupportedSize()
-
getSupportedFormatList
List<Format> getSupportedFormatList()
-
getSupportedSizeList
List<Size> getSupportedSizeList()
-
getSupportedSizeOne
Size getSupportedSizeOne()
get supported size that has max pixel and match default frame format
-
getPreviewSize
Size getPreviewSize()
-
setPreviewSize
void setPreviewSize(int width, int height)
Set preview size and preview mode
-
setPreviewSize
void setPreviewSize(int width, int height, int frameType)
Set preview size and preview mode
- Parameters:
frameType- either UVC_VS_FRAME_UNCOMPRESSED or UVC_VS_FRAME_MJPEG
-
setPreviewSize
void setPreviewSize(int width, int height, int frameType, int fps)
Set preview size and preview mode
- Parameters:
frameType- either UVC_VS_FRAME_UNCOMPRESSED or UVC_VS_FRAME_MJPEG
-
setPreviewSize
void setPreviewSize(Size size)
Set preview size and preview mode
-
setPreviewDisplay
synchronized void setPreviewDisplay(SurfaceHolder holder)
set preview surface with SurfaceHolderyou can use SurfaceHolder came from SurfaceView/GLSurfaceView
-
setPreviewTexture
synchronized void setPreviewTexture(SurfaceTexture texture)
set preview surface with SurfaceTexture.this method require API >= 14
-
setPreviewDisplay
synchronized void setPreviewDisplay(Surface surface)
set preview surface with Surface
-
setFrameCallback
void setFrameCallback(IFrameCallback callback, int pixelFormat)
set frame callback
- Parameters:
callback- The callback that receive frame data in pixelFormatpixelFormat- The frame format of callback.
-
startPreview
synchronized void startPreview()
start preview
-
stopPreview
synchronized void stopPreview()
stop preview
-
startCapture
void startCapture(Surface surface)
start movie capturing(this should call while previewing)
-
stopCapture
void stopCapture()
stop movie capturing
-
destroy
synchronized void destroy()
destroy UVCCamera object
-
destroy
synchronized void destroy(boolean isSilent)
destroy UVCCamera object
-
getControl
UVCControl getControl()
Returns true if UVCCamera is opened.
-
isOpened
boolean isOpened()
-
-
-
-