android camera rawcallback 与jpegcallback 数据是一样的吗
推荐于2016-10-30 · 知道合伙人数码行家
huanglenzhi
知道合伙人数码行家
向TA提问 私信TA
知道合伙人数码行家
采纳数:117538
获赞数:517190
长期从事计算机组装,维护,网络组建及管理。对计算机硬件、操作系统安装、典型网络设备具有详细认知。
向TA提问 私信TA
关注
展开全部
CameraHardwareInterface.h定义了CameraService和CameraHAL之间的接口,在这个文件中定义了四个回调函数
[cpp] view plaincopy
typedef camera_memory_t* (*camera_request_memory)(int fd, size_t buf_size, unsigned int num_bufs,
void *user);
typedef void (*camera_notify_callback)(int32_t msg_type,
int32_t ext1,
int32_t ext2,
void *user);
typedef void (*camera_data_callback)(int32_t msg_type,
const camera_memory_t *data, unsigned int index,
camera_frame_metadata_t *metadata, void *user);
typedef void (*camera_data_timestamp_callback)(int64_t timestamp,
int32_t msg_type,
const camera_memory_t *data, unsigned int index,
void *user);
这四个回调函数在frameworks/av/services/camera/libcameraservice/CameraClient.cpp中实现。
camera_request_memory
Camera HAL通知CameraService申请buffer
@buf_size: buf的大小
@num_bufs:buf数目
msg_type的取值范围定义在 android/system/core/include/system/camera.h中
[cpp] view plaincopy
/** msgType in notifyCallback and dataCallback functions */
enum {
CAMERA_MSG_ERROR = 0x0001, // notifyCallback
CAMERA_MSG_SHUTTER = 0x0002, // notifyCallback
CAMERA_MSG_FOCUS = 0x0004, // notifyCallback
CAMERA_MSG_ZOOM = 0x0008, // notifyCallback
CAMERA_MSG_PREVIEW_FRAME = 0x0010, // dataCallback
CAMERA_MSG_VIDEO_FRAME = 0x0020, // data_timestamp_callback
CAMERA_MSG_POSTVIEW_FRAME = 0x0040, // dataCallback
CAMERA_MSG_RAW_IMAGE = 0x0080, // dataCallback
CAMERA_MSG_COMPRESSED_IMAGE = 0x0100, // dataCallback
CAMERA_MSG_RAW_IMAGE_NOTIFY = 0x0200, // dataCallback
// Preview frame metadata. This can be combined with
// CAMERA_MSG_PREVIEW_FRAME in dataCallback. For example, the apps can
// request FRAME and METADATA. Or the apps can request only FRAME or only
// METADATA.
CAMERA_MSG_PREVIEW_METADATA = 0x0400, // dataCallback
// Notify on autofocus start and stop. This is useful in continuous
// autofocus - FOCUS_MODE_CONTINUOUS_VIDEO and FOCUS_MODE_CONTINUOUS_PICTURE.
CAMERA_MSG_FOCUS_MOVE = 0x0800, // notifyCallback
CAMERA_MSG_ALL_MSGS = 0xFFFF
};
camera_notify_callback
用来传递一些消息: 如快门消息,自动对焦完成消息,出错消息,拍照编码结束等
参数@msg_type可以是:
CAMERA_MSG_ERROR
CAMERA_MSG_SHUTTER
CAMERA_MSG_FOCUS
CAMERA_MSG_ZOOM
CAMERA_MSG_FOCUS_MOVE
camera_data_callback
该函数用于从camera HAL返回数据,
返回的数据可以是:
preview的数据帧,
preview的元数据,
以及压缩为jpeg格式的帧数据
参数@msg_type可以是:
CAMERA_MSG_PREVIEW_FRAME
CAMERA_MSG_PREVIEW_METADATA
CAMERA_MSG_COMPRESSED_IMAGE
CAMERA_MSG_RAW_IMAGE
CAMERA_MSG_RAW_IMAGE_NOTIFY
CAMERA_MSG_POSTVIEW_FRAME
参数@data 用来返回图像数据
参数@metadata 用来返回图像的元数据
camera_data_timestamp_callback
该回调函数用来从Camera HAL返回帧数据以及对应的时间戳,这个callback用于录像的场景。
@timestamp:生成帧数据的时间戳
@msg_type: 取值为CAMERA_MSG_VIDEO_FRAME
@data:用来返回帧数据
[cpp] view plaincopy
typedef camera_memory_t* (*camera_request_memory)(int fd, size_t buf_size, unsigned int num_bufs,
void *user);
typedef void (*camera_notify_callback)(int32_t msg_type,
int32_t ext1,
int32_t ext2,
void *user);
typedef void (*camera_data_callback)(int32_t msg_type,
const camera_memory_t *data, unsigned int index,
camera_frame_metadata_t *metadata, void *user);
typedef void (*camera_data_timestamp_callback)(int64_t timestamp,
int32_t msg_type,
const camera_memory_t *data, unsigned int index,
void *user);
这四个回调函数在frameworks/av/services/camera/libcameraservice/CameraClient.cpp中实现。
camera_request_memory
Camera HAL通知CameraService申请buffer
@buf_size: buf的大小
@num_bufs:buf数目
msg_type的取值范围定义在 android/system/core/include/system/camera.h中
[cpp] view plaincopy
/** msgType in notifyCallback and dataCallback functions */
enum {
CAMERA_MSG_ERROR = 0x0001, // notifyCallback
CAMERA_MSG_SHUTTER = 0x0002, // notifyCallback
CAMERA_MSG_FOCUS = 0x0004, // notifyCallback
CAMERA_MSG_ZOOM = 0x0008, // notifyCallback
CAMERA_MSG_PREVIEW_FRAME = 0x0010, // dataCallback
CAMERA_MSG_VIDEO_FRAME = 0x0020, // data_timestamp_callback
CAMERA_MSG_POSTVIEW_FRAME = 0x0040, // dataCallback
CAMERA_MSG_RAW_IMAGE = 0x0080, // dataCallback
CAMERA_MSG_COMPRESSED_IMAGE = 0x0100, // dataCallback
CAMERA_MSG_RAW_IMAGE_NOTIFY = 0x0200, // dataCallback
// Preview frame metadata. This can be combined with
// CAMERA_MSG_PREVIEW_FRAME in dataCallback. For example, the apps can
// request FRAME and METADATA. Or the apps can request only FRAME or only
// METADATA.
CAMERA_MSG_PREVIEW_METADATA = 0x0400, // dataCallback
// Notify on autofocus start and stop. This is useful in continuous
// autofocus - FOCUS_MODE_CONTINUOUS_VIDEO and FOCUS_MODE_CONTINUOUS_PICTURE.
CAMERA_MSG_FOCUS_MOVE = 0x0800, // notifyCallback
CAMERA_MSG_ALL_MSGS = 0xFFFF
};
camera_notify_callback
用来传递一些消息: 如快门消息,自动对焦完成消息,出错消息,拍照编码结束等
参数@msg_type可以是:
CAMERA_MSG_ERROR
CAMERA_MSG_SHUTTER
CAMERA_MSG_FOCUS
CAMERA_MSG_ZOOM
CAMERA_MSG_FOCUS_MOVE
camera_data_callback
该函数用于从camera HAL返回数据,
返回的数据可以是:
preview的数据帧,
preview的元数据,
以及压缩为jpeg格式的帧数据
参数@msg_type可以是:
CAMERA_MSG_PREVIEW_FRAME
CAMERA_MSG_PREVIEW_METADATA
CAMERA_MSG_COMPRESSED_IMAGE
CAMERA_MSG_RAW_IMAGE
CAMERA_MSG_RAW_IMAGE_NOTIFY
CAMERA_MSG_POSTVIEW_FRAME
参数@data 用来返回图像数据
参数@metadata 用来返回图像的元数据
camera_data_timestamp_callback
该回调函数用来从Camera HAL返回帧数据以及对应的时间戳,这个callback用于录像的场景。
@timestamp:生成帧数据的时间戳
@msg_type: 取值为CAMERA_MSG_VIDEO_FRAME
@data:用来返回帧数据
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
Storm代理
2023-07-25 广告
2023-07-25 广告
StormProxies是一家可靠的代理服务提供商,提供原生IP(住宅原生IP)和高匿名代理服务。以下是关于StormProxies的原生IP服务的一些信息:1. 住宅原生IP:StormProxies提供的住宅原生IP是指从真实的家庭或企...
点击进入详情页
本回答由Storm代理提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询