Camera.PreviewCallback

android.hardware.Camera.PreviewCallback

官方介绍:Link 

Class Overview


Callback interface used to deliver copies of preview frames as they are displayed.

Public Methods


public abstract void onPreviewFrame (byte[] data, Camera camera)

Called as preview frames are displayed. This callback is invoked on the event thread open(int) was called from.

If using the YV12 format, refer to the equations in setPreviewFormat(int) for the arrangement of the pixel data in the preview callback buffers.

Parameters

datathe contents of the preview frame in the format defined by ImageFormat, which can be queried with getPreviewFormat(). If setPreviewFormat(int) is never called, the default will be the YCbCr_420_SP (NV21) format.
camerathe Camera service object.

如果 setPreviewCallback(Camera.PreviewCallback)setOneShotPreviewCallback(Camera.PreviewCallback), 或者 setPreviewCallbackWithBuffer(Camera.PreviewCallback) 被调用, 当预览数据可得到时,onPreviewFrame(byte[], Camera) 也会被调用。

  • public final void setPreviewCallback (Camera.PreviewCallback cb)

    Installs a callback to be invoked for every preview frame in addition to displaying them on the screen. The callback will be repeatedly called for as long as preview is active. This method can be called at any time, even while preview is live. Any other preview callbacks are overridden.

    Parameters

    cba callback object that receives a copy of each preview frame, or null to stop receiving callbacks.
  • public final void setOneShotPreviewCallback (Camera.PreviewCallback cb)

    Installs a callback to be invoked for the next preview frame in addition to displaying it on the screen. After one invocation, the callback is cleared. This method can be called any time, even when preview is live. Any other preview callbacks are overridden.

    Parameters

    cba callback object that receives a copy of the next preview frame, or null to stop receiving callbacks
  • public final void setPreviewCallbackWithBuffer (Camera.PreviewCallback cb)

    Installs a callback to be invoked for every preview frame, using buffers supplied with addCallbackBuffer(byte[]), in addition to displaying them on the screen. The callback will be repeatedly called for as long as preview is active and buffers are available. Any other preview callbacks are overridden.

    The purpose of this method is to improve preview efficiency and frame rate by allowing preview frame memory reuse. You must call addCallbackBuffer(byte[]) at some point -- before or after calling this method -- or no callbacks will received.

    The buffer queue will be cleared if this method is called with a null callback,setPreviewCallback(Camera.PreviewCallback) is called, or is called., or setOneShotPreviewCallback(Camera.PreviewCallback) is called.

    Parameters

    cba callback object that receives a copy of the preview frame, or null to stop receiving callbacks and clear the buffer queue.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值