コード例 #1
0
void CameraControl::postData(
		int32_t msg_type,
		const android::sp<android::IMemory>& data,
		camera_frame_metadata_t* metadata)
{
	REPORT_FUNCTION();

	if (!listener)
		return;

	switch (msg_type) {
	case CAMERA_MSG_RAW_IMAGE:
		if (listener->on_data_raw_image_cb)
			listener->on_data_raw_image_cb(data->pointer(), data->size(), listener->context);
		break;
	case CAMERA_MSG_COMPRESSED_IMAGE:
		if (listener->on_data_compressed_image_cb)
			listener->on_data_compressed_image_cb(data->pointer(), data->size(), listener->context);
		break;
	default:
		break;
	}

	camera->releaseRecordingFrame(data);
}
コード例 #2
0
    void postData(int32_t msgType, const android::sp<android::IMemory>& dataPtr,
                  camera_frame_metadata_t *metadata)
    {
        int32_t dataMsgType = msgType & ~CAMERA_MSG_PREVIEW_METADATA;
        DroidMediaData mem;

        switch (dataMsgType) {
            case CAMERA_MSG_RAW_IMAGE:
                mem.size = dataPtr->size();
                mem.data = dataPtr->pointer();

                if (m_cam->m_cb.raw_image_cb) {
                    m_cam->m_cb.raw_image_cb(m_cam->m_cb_data, &mem);
                }
                break;

            case CAMERA_MSG_COMPRESSED_IMAGE:
                mem.size = dataPtr->size();
                mem.data = dataPtr->pointer();

                if (m_cam->m_cb.compressed_image_cb) {
                    m_cam->m_cb.compressed_image_cb(m_cam->m_cb_data, &mem);
                }
                break;

            case CAMERA_MSG_POSTVIEW_FRAME:
                mem.size = dataPtr->size();
                mem.data = dataPtr->pointer();
                if (m_cam->m_cb.postview_frame_cb) {
                    m_cam->m_cb.postview_frame_cb(m_cam->m_cb_data, &mem);
                }
                break;

            case CAMERA_MSG_RAW_IMAGE_NOTIFY:
                if (m_cam->m_cb.raw_image_notify_cb) {
                    m_cam->m_cb.raw_image_notify_cb(m_cam->m_cb_data);
                }
                break;

            case CAMERA_MSG_PREVIEW_FRAME:
                mem.size = dataPtr->size();
                mem.data = dataPtr->pointer();
                if (m_cam->m_cb.preview_frame_cb) {
                    m_cam->m_cb.preview_frame_cb(m_cam->m_cb_data, &mem);
                }
                break;

            case 0:
              // Nothing
              break;

            default:
                ALOGW("unknown postData message 0x%x", dataMsgType);
                break;
        }

        if (metadata && (msgType & CAMERA_MSG_PREVIEW_METADATA)
            && m_cam->m_cb.preview_metadata_cb) {
            sendPreviewMetadata(metadata);
        }
    }