本文整理汇总了C++中JNICameraContext::setCallbackMode方法的典型用法代码示例。如果您正苦于以下问题:C++ JNICameraContext::setCallbackMode方法的具体用法?C++ JNICameraContext::setCallbackMode怎么用?C++ JNICameraContext::setCallbackMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JNICameraContext
的用法示例。
在下文中一共展示了JNICameraContext::setCallbackMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: android_hardware_Camera_setHasPreviewCallback
static void android_hardware_Camera_setHasPreviewCallback(JNIEnv *env, jobject thiz, jboolean installed, jboolean manualBuffer)
{
LOGV("setHasPreviewCallback: installed:%d, manualBuffer:%d", (int)installed, (int)manualBuffer);
// Important: Only install preview_callback if the Java code has called
// setPreviewCallback() with a non-null value, otherwise we'd pay to memcpy
// each preview frame for nothing.
JNICameraContext* context;
sp<Camera> camera = get_native_camera(env, thiz, &context);
if (camera == 0) return;
// setCallbackMode will take care of setting the context flags and calling
// camera->setPreviewCallbackFlags within a mutex for us.
context->setCallbackMode(env, installed, manualBuffer);
}
示例2: android_hardware_Camera_setPreviewCallbackSurface
static void android_hardware_Camera_setPreviewCallbackSurface(JNIEnv *env,
jobject thiz, jobject jSurface)
{
ALOGV("setPreviewCallbackSurface");
JNICameraContext* context;
sp<Camera> camera = get_native_camera(env, thiz, &context);
if (camera == 0) return;
sp<IGraphicBufferProducer> gbp;
sp<Surface> surface;
if (jSurface) {
surface = android_view_Surface_getSurface(env, jSurface);
if (surface != NULL) {
gbp = surface->getIGraphicBufferProducer();
}
}
// Clear out normal preview callbacks
context->setCallbackMode(env, false, false);
// Then set up callback surface
if (camera->setPreviewCallbackTarget(gbp) != NO_ERROR) {
jniThrowException(env, "java/io/IOException", "setPreviewCallbackTarget failed");
}
}