• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ANativeWindow_fromSurface函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ANativeWindow_fromSurface函数的典型用法代码示例。如果您正苦于以下问题:C++ ANativeWindow_fromSurface函数的具体用法?C++ ANativeWindow_fromSurface怎么用?C++ ANativeWindow_fromSurface使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ANativeWindow_fromSurface函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: onSurfaceCreated

static void onSurfaceCreated(JNIEnv *env, jobject /*object*/, jobject surface)
{
    s_currentNativeWindowMutex.lock();
    s_currentNativeWindow = AndroidWindow(ANativeWindow_fromSurface(env, surface), [](ANativeWindow *w) { ANativeWindow_release(w); });
    ++s_currentNativeWindowId;
    s_currentNativeWindowMutex.unlock();
}
开发者ID:goneflash,项目名称:apitrace,代码行数:7,代码来源:glws_egl_android.cpp


示例2: ANativeWindow_fromSurface

//rendering
JNIEXPORT void JNICALL Java_me_lake_librestreaming_core_ColorHelper_renderingSurface
(JNIEnv * env, jobject thiz,jobject javaSurface,jbyteArray pixelsArray,jint w,jint h,jint size) {
	ANativeWindow* window = ANativeWindow_fromSurface(env, javaSurface);
	if(window!=NULL)
	{
		ANativeWindow_setBuffersGeometry(window,w,h,COLOR_FORMAT_NV21);
		ANativeWindow_Buffer buffer;
		if (ANativeWindow_lock(window, &buffer, NULL) == 0) {
			unsigned char *pixels = (unsigned char*)(*env)->GetByteArrayElements(env,pixelsArray, 0);
			if(buffer.width==buffer.stride){
				memcpy(buffer.bits, pixels,  size);
			}else{
				int height = h*3/2;
				int width = w;
				int i=0;
				for(;i<height;++i)
					memcpy(buffer.bits +  buffer.stride * i
						, pixels + width * i
						, width);
			}
			(*env)->ReleaseByteArrayElements(env,pixelsArray,pixels,JNI_ABORT);
			ANativeWindow_unlockAndPost(window);
		}
		ANativeWindow_release(window);
	}
	return;
}
开发者ID:fly518420,项目名称:librestreaming,代码行数:28,代码来源:restreaming.c


示例3: Java_org_skia_viewer_ViewerActivity_onSurfaceChanged

extern "C" JNIEXPORT void JNICALL Java_org_skia_viewer_ViewerActivity_onSurfaceChanged(
    JNIEnv* env, jobject activity, jlong handle, jobject surface) {
    auto skiaAndroidApp = (SkiaAndroidApp*)handle;
    Message message(kSurfaceChanged);
    message.fNativeWindow = ANativeWindow_fromSurface(env, surface);
    skiaAndroidApp->postMessage(message);
}
开发者ID:VarcoDevs,项目名称:skia,代码行数:7,代码来源:surface_glue_android.cpp


示例4: com_stainberg_MediaPlayer_MediaPlayer_setSurface

static void
com_stainberg_MediaPlayer_MediaPlayer_setSurface(JNIEnv* env, jobject thiz, jobject surface) {
//	if(surface != NULL) {
//		if(spWindow != NULL) {
//			ANativeWindow_release(spWindow);
//			spWindow = NULL;
//		}
//		spWindow = ANativeWindow_fromSurface(env, surface);
//		if(spMediaPlayer != NULL) {
//			spMediaPlayer->initSurface(spWindow);
//		}
//	}
	if(spWindow != NULL) {
		ANativeWindow_release(spWindow);
		spWindow = NULL;
	}
	if(spMediaPlayer != NULL) {
		spMediaPlayer->initSurface(NULL);
	}
	if(surface != NULL) {
		spWindow = ANativeWindow_fromSurface(env, surface);
		if(spMediaPlayer != NULL) {
			spMediaPlayer->initSurface(spWindow);
		}
	}
}
开发者ID:stainberg,项目名称:android_FFMPEG,代码行数:26,代码来源:com_stainberg_MediaPlayer_MediaPlayer.cpp


示例5: ANativeWindow_fromSurface

/*
 * Class:     com_mcxiaoke_ndk_Native
 * Method:    initNW
 * Signature: (JLandroid/view/Surface;)V
 */
JNIEXPORT void JNICALL Java_com_mcxiaoke_ndk_Native_initNW
(JNIEnv *env, jclass clazz, jlong avi, jobject surface)
{
    // Get the native window from the surface
    ANativeWindow* nativeWindow = ANativeWindow_fromSurface(
                                      env, surface);
    if (0 == nativeWindow)
    {
        ThrowException(env, "java/lang/RuntimeException",
                       "Unable to get native window from surface.");
        goto exit;
    }

    // Set the buffers geometry to AVI movie frame dimensions
    // If these are different than the window's physical size
    // then the buffer will be scaled to match that size.
    if (0 > ANativeWindow_setBuffersGeometry(nativeWindow,
            AVI_video_width((avi_t*) avi),
            AVI_video_height((avi_t*) avi),
            WINDOW_FORMAT_RGB_565))
    {
        ThrowException(env, "java/lang/RuntimeException",
                       "Unable to set buffers geometry.");
    }

    // Release the native window
    ANativeWindow_release(nativeWindow);
    nativeWindow = 0;

exit:
    return;
}
开发者ID:GoghVin,项目名称:android-ndk-notes,代码行数:37,代码来源:player.cpp


示例6: onSurfaceChanged

static void onSurfaceChanged(JNIEnv *env, jobject /*object*/, jobject surface, int /*format*/, int /*width*/, int /*height*/)
{
    s_currentNativeWindowMutex.lock();
    s_currentNativeWindow = AndroidWindow(ANativeWindow_fromSurface(env, surface), [](ANativeWindow *w) { ANativeWindow_release(w); });
    ++s_currentNativeWindowId;
    s_currentNativeWindowMutex.unlock();
}
开发者ID:goneflash,项目名称:apitrace,代码行数:7,代码来源:glws_egl_android.cpp


示例7: GetPlatformWindowDimensions

extern void GetPlatformWindowDimensions(void* nativeHandle, int* width, int* height)
{
    ANativeWindow* w = ANativeWindow_fromSurface(Jni, (jobject)nativeHandle);
    VERBOSE("Got native window for measurements %p", w);
    *width = ANativeWindow_getWidth(w);
    *height = ANativeWindow_getHeight(w);
    ANativeWindow_release(w);
}
开发者ID:AvaloniaUI,项目名称:libperspesk,代码行数:8,代码来源:droid.cpp


示例8: Java_com_gaulois94_samples_ZombieRenderer_createZombieRenderer

JNIEXPORT jlong JNICALL Java_com_gaulois94_samples_ZombieRenderer_createZombieRenderer(JNIEnv* jenv, jclass jcls, jlong parent, jobject surface)
{
	ZombieRenderer* renderer = new ZombieRenderer((Updatable*)parent);
	ANativeWindow* window = ANativeWindow_fromSurface(jenv, surface);
	renderer->initializeContext(window);

	return (jlong)renderer;
}
开发者ID:MickaelSERENO,项目名称:ZombieAttack,代码行数:8,代码来源:nativeZombieRenderer.cpp


示例9: nativeSetSurface

	JNIEXPORT void JNICALL nativeSetSurface(JNIEnv* jenv, jobject obj, jobject surface) {
		if(surface != 0) {
			nativeWindow = ANativeWindow_fromSurface(jenv, surface);
		} else {
			ANativeWindow_release(nativeWindow);
		}
		return;
	}
开发者ID:yaakuro,项目名称:XdevLSDK,代码行数:8,代码来源:XdevLWindowAndroid.cpp


示例10: Java_info_sodapanda_sodaplayer_FFmpegVideoView_setupsurface

//当Android系统中对应播放窗口的Surfaceview创建的时候,在native层得到这个surface的引用地址
int Java_info_sodapanda_sodaplayer_FFmpegVideoView_setupsurface(JNIEnv* env,jobject thiz,jobject pSurface,int pwidth,int pheight,jlong ptr){
	playInstance *instance = (playInstance *)ptr;
	instance->window = ANativeWindow_fromSurface(env,pSurface);
	if(instance->display_width !=0){
		setAndroidWindowPix(instance->display_width,instance->display_height,instance);
	}
	instance->disable_video=0;
	return 0;
}
开发者ID:PlayOrion,项目名称:sodaplayer,代码行数:10,代码来源:main.c


示例11: Java_com_android_cts_opengl_primitive_GLPrimitiveActivity_setupContextSwitchBenchmark

extern "C" JNIEXPORT void JNICALL
Java_com_android_cts_opengl_primitive_GLPrimitiveActivity_setupContextSwitchBenchmark(
        JNIEnv* env, jclass clazz, jobject surface, jboolean offscreen, jint workload) {
    if (workload <= 8) {
        // This test uses 8 iterations, so workload can't be more than 8.
        gRenderer = new ContextSwitchRenderer(
                ANativeWindow_fromSurface(env, surface), offscreen, workload);
    }
}
开发者ID:10114395,项目名称:android-5.0.0_r5,代码行数:9,代码来源:GLPrimitive.cpp


示例12: Java_com_huazhen_barcode_MainActivity_JNIinitDecoder

extern "C" JNIEXPORT void JNICALL
Java_com_huazhen_barcode_MainActivity_JNIinitDecoder(JNIEnv *env, jclass cls, jint w, jint h, jobject surface) {
    ANativeWindow* window = 0;
    if (surface) {
        window = ANativeWindow_fromSurface(env, surface); // ANativeWindow_release
        ERR_EXIT_IF(!window, "ANativeWindow_fromSurface: %p %p", env, surface);
    }
    hgs_init( w,h, window);
}
开发者ID:hyz,项目名称:cpp-snippets,代码行数:9,代码来源:hgs-jni.cpp


示例13: Android_JNI_GetEnv

ANativeWindow *Android_JNI_GetNativeWindow(void) {
	ANativeWindow *anw;
	jobject s;
	JNIEnv *env = Android_JNI_GetEnv();

	s = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetNativeSurface);
	anw = ANativeWindow_fromSurface(env, s);
	(*env)->DeleteLocalRef(env, s);

	return anw;
}
开发者ID:angjminer,项目名称:godot,代码行数:11,代码来源:power_android.cpp


示例14: Java_com_example_nativecodec_NativeCodec_setSurface

// set the surface
void Java_com_example_nativecodec_NativeCodec_setSurface(JNIEnv *env, jclass clazz, jobject surface)
{
   // obtain a native window from a Java surface
   if (data.window)
   {
      ANativeWindow_release(data.window);
      data.window = NULL;
   }
   data.window = ANativeWindow_fromSurface(env, surface);
   LOGV("@@@ setsurface %p", data.window);
}
开发者ID:mrkcass,项目名称:MammothPlayer4K,代码行数:12,代码来源:native-codec-jni.cpp


示例15: naSetSurface

void naSetSurface(JNIEnv *pEnv, jobject pObj, jobject pSurface) {
	if (0 != pSurface) {
		// get the native window reference
		window = ANativeWindow_fromSurface(pEnv, pSurface);
		// set format and size of window buffer
		ANativeWindow_setBuffersGeometry(window, 0, 0, WINDOW_FORMAT_RGBA_8888);
	} else {
		// release the native window
		ANativeWindow_release(window);
	}
}
开发者ID:alexandruc,项目名称:android-ffmpeg-player,代码行数:11,代码来源:ffmpeg-player.c


示例16: Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceChanged

// Surface Handling
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceChanged(JNIEnv* env,
                                                                                   jobject obj,
                                                                                   jobject surf)
{
  s_surf = ANativeWindow_fromSurface(env, surf);
  if (s_surf == nullptr)
    __android_log_print(ANDROID_LOG_ERROR, DOLPHIN_TAG, "Error: Surface is null.");

  if (g_renderer)
    g_renderer->ChangeSurface(s_surf);
}
开发者ID:Sintendo,项目名称:dolphin,代码行数:12,代码来源:MainAndroid.cpp


示例17: gst_native_surface_init

static void gst_native_surface_init (JNIEnv *env, jobject thiz, jobject surface) {
    CustomData *data = GET_CUSTOM_DATA (env, thiz, custom_data_field_id);
    if (!data) return;
    ANativeWindow *new_native_window = ANativeWindow_fromSurface(env, surface);
    GST_DEBUG ("Received surface %p (native window %p)", surface, new_native_window);

    data->player->releaseSurface();
    data->player->setSurface(new_native_window);

    if (!new_native_window)
        handle_stream_loading_error();
}
开发者ID:zhuqianqian,项目名称:evercam-play-android,代码行数:12,代码来源:evercam.cpp


示例18: ANativeWindow_release

JNIEXPORT void JNICALL Java_com_orcchg_openglsample_NativeInterface_setSurface
  (JNIEnv *jenv, jobject, jlong descriptor, jobject surface) {
  NativeInterface* ptr = (NativeInterface*) descriptor;
  if (surface == nullptr) {
    ANativeWindow_release(ptr->window);
    ptr->window = nullptr;
  } else {
    ptr->window = ANativeWindow_fromSurface(jenv, surface);
    ptr->render->setSurface(ptr->window);
    ptr->render->draw();
  }
}
开发者ID:jiayu1016,项目名称:OpenGLSample,代码行数:12,代码来源:nativeInterface.cpp


示例19: nativeSetCaptureDisplay

static jint nativeSetCaptureDisplay(JNIEnv *env, jobject thiz,
	ID_TYPE id_camera, jobject jSurface) {

	jint result = JNI_ERR;
	ENTER();
	UVCCamera *camera = reinterpret_cast<UVCCamera *>(id_camera);
	if (LIKELY(camera)) {
		ANativeWindow *capture_window = jSurface ? ANativeWindow_fromSurface(env, jSurface) : NULL;
		result = camera->setCaptureDisplay(capture_window);
	}
	RETURN(result, jint);
}
开发者ID:Volcanoscar,项目名称:UVCCameraDemo,代码行数:12,代码来源:serenegiant_usb_UVCCamera.cpp


示例20: clearEgl

void QAndroidPlatformOpenGLWindow::createEgl(EGLConfig config)
{
    clearEgl();
    QJNIEnvironmentPrivate env;
    m_nativeWindow = ANativeWindow_fromSurface(env, m_androidSurfaceObject.object());
    m_androidSurfaceObject = QJNIObjectPrivate();
    m_eglSurface = eglCreateWindowSurface(m_eglDisplay, config, m_nativeWindow, NULL);
    if (m_eglSurface == EGL_NO_SURFACE) {
        EGLint error = eglGetError();
        eglTerminate(m_eglDisplay);
        qFatal("EGL Error : Could not create the egl surface: error = 0x%x\n", error);
    }
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:13,代码来源:qandroidplatformopenglwindow.cpp



注:本文中的ANativeWindow_fromSurface函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ANativeWindow_release函数代码示例发布时间:2022-05-30
下一篇:
C++ ANTLR_USE_NAMESPACE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap