这篇教程C++ ANativeWindow_fromSurface函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ANativeWindow_fromSurface函数的典型用法代码示例。如果您正苦于以下问题:C++ ANativeWindow_fromSurface函数的具体用法?C++ ANativeWindow_fromSurface怎么用?C++ ANativeWindow_fromSurface使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ANativeWindow_fromSurface函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: onSurfaceCreatedstatic 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,
示例2: ANativeWindow_fromSurface//renderingJNIEXPORT 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,
示例3: Java_org_skia_viewer_ViewerActivity_onSurfaceChangedextern "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,
示例4: com_stainberg_MediaPlayer_MediaPlayer_setSurfacestatic voidcom_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,
示例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,
示例6: onSurfaceChangedstatic 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,
示例7: GetPlatformWindowDimensionsextern 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,
示例8: Java_com_gaulois94_samples_ZombieRenderer_createZombieRendererJNIEXPORT 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,
示例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,
示例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,
示例11: Java_com_android_cts_opengl_primitive_GLPrimitiveActivity_setupContextSwitchBenchmarkextern "C" JNIEXPORT void JNICALLJava_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,
示例12: Java_com_huazhen_barcode_MainActivity_JNIinitDecoderextern "C" JNIEXPORT void JNICALLJava_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,
示例13: Android_JNI_GetEnvANativeWindow *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,
示例14: Java_com_example_nativecodec_NativeCodec_setSurface// set the surfacevoid 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,
示例15: naSetSurfacevoid 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,
示例16: Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceChanged// Surface HandlingJNIEXPORT 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,
示例17: gst_native_surface_initstatic 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,
示例18: ANativeWindow_releaseJNIEXPORT 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,
示例19: nativeSetCaptureDisplaystatic 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,
示例20: clearEglvoid 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,
示例21: Java_com_virtualapplications_play_NativeInterop_setupGsHandlerextern "C" JNIEXPORT void JNICALL Java_com_virtualapplications_play_NativeInterop_setupGsHandler(JNIEnv* env, jobject obj, jobject surface){ auto nativeWindow = ANativeWindow_fromSurface(env, surface); auto gsHandler = g_virtualMachine->GetGSHandler(); if(gsHandler == nullptr) { g_virtualMachine->CreateGSHandler(CGSH_OpenGLAndroid::GetFactoryFunction(nativeWindow)); } else { static_cast<CGSH_OpenGLAndroid*>(gsHandler)->SetWindow(nativeWindow); }}
开发者ID:Ratan3,项目名称:Play-,代码行数:13,
示例22: Java_com_example_rogelio_opengl_NativeEglExample_nativeSetSurfaceJNIEXPORT void JNICALL Java_com_example_rogelio_opengl_NativeEglExample_nativeSetSurface(JNIEnv* jenv, jobject obj, jobject surface){ if (surface != 0) { window = ANativeWindow_fromSurface(jenv, surface); LOG_INFO("Got window %p", window); renderer->setWindow(window); } else { LOG_INFO("Releasing window"); ANativeWindow_release(window); } return;}
开发者ID:AlfredoNunez7AM,项目名称:ProyectoFinal9no,代码行数:13,
示例23: setSurfacestatic void setSurface(JNIEnv *env, jobject /*thiz*/, jobject jSurface){#ifndef ANDROID_PLUGIN_OPENGL if (m_surface) env->DeleteGlobalRef(m_surface); m_surface = env->NewGlobalRef(jSurface);#else m_surfaceMutex.lock(); EGLNativeWindowType nativeWindow = ANativeWindow_fromSurface(env, jSurface); bool sameNativeWindow = (nativeWindow != 0 && nativeWindow == m_nativeWindow); m_nativeWindow = nativeWindow; if (m_waitForWindow) m_waitForWindowSemaphore.release(); if (m_androidPlatformIntegration) { // Use the desktop size. // On some devices, the getters for the native window size gives wrong values QSize size = QAndroidPlatformIntegration::defaultDesktopSize(); QPlatformScreen *screen = m_androidPlatformIntegration->screen(); QRect geometry(QPoint(0, 0), size); if (screen) { QWindowSystemInterface::handleScreenAvailableGeometryChange(screen->screen(), geometry); QWindowSystemInterface::handleScreenGeometryChange(screen->screen(), geometry); } if (!sameNativeWindow) { m_surfaceMutex.unlock(); m_androidPlatformIntegration->surfaceChanged(); } else { // Resize all top level windows, since they share the same surface foreach (QWindow *w, QGuiApplication::topLevelWindows()) { QAndroidOpenGLPlatformWindow *window = static_cast<QAndroidOpenGLPlatformWindow *>(w->handle()); if (window != 0) { window->lock(); window->scheduleResize(size); QWindowSystemInterface::handleExposeEvent(window->window(), QRegion(window->window()->geometry())); window->unlock(); } } m_surfaceMutex.unlock(); } } else {
开发者ID:CodeDJ,项目名称:qt5-hidpi,代码行数:50,
示例24: DEFINE_JNIDEFINE_JNI(jlong, setsurface) (JNIEnv* env, jclass clazz, jlong info, jobject surface){ FFmpegInfo* pInfo = (FFmpegInfo*) info; if (!pInfo || !pInfo->binit) return -1; LOGI("get native window ..."); ANativeWindow* pNativeWindow = ANativeWindow_fromSurface(env, surface); if (!pNativeWindow) return -1; pInfo->window = pNativeWindow; LOGI("setsurface ok"); return 0;}
开发者ID:peterxu,项目名称:demo,代码行数:14,
示例25: Java_ws_websca_benchscaw_MainActivity_directRender jint Java_ws_websca_benchscaw_MainActivity_directRender( JNIEnv* env, jobject thiz, jobject surface ) { //__android_log_write(ANDROID_LOG_DEBUG, "Benchscaw JNI native nextFrame cpu flags:", "flags"); //__android_log_write(ANDROID_LOG_DEBUG, "Benchscaw JNI native nextFrame", "av_read_frame"); int done = av_read_frame(pFormatCtx, &packet); if(done>=0) { // Is this a packet from the video stream? if(packet.stream_index==videoStream) { // Decode video frame //__android_log_write(ANDROID_LOG_DEBUG, "Benchscaw JNI native nextFrame", "avcodec_decode_video2"); avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet); // Did we get a video frame? if(frameFinished) { ANativeWindow* window = ANativeWindow_fromSurface(env, surface); ANativeWindow_Buffer buffer; if (ANativeWindow_lock(window, &buffer, NULL) == 0) { // Convert the image from its native format to RGB AVPicture pict; pict.data[0] = (uint8_t*)buffer.bits; pict.linesize[0] = buffer.stride*4; sws_scale ( sws_ctx, (uint8_t const * const *)pFrame->data, pFrame->linesize, 0, pCodecCtx->height, pict.data, pict.linesize ); //char str[200]; //sprintf(str, "%i", buffer.width); ///__android_log_write(ANDROID_LOG_DEBUG, "width", str); ANativeWindow_unlockAndPost(window); } ANativeWindow_release(window); } } // Free the packet that was allocated by av_read_frame //__android_log_write(ANDROID_LOG_DEBUG, "Benchscaw JNI native nextFrame", "av_free_packet"); av_free_packet(&packet); } return done; }
开发者ID:kripton,项目名称:benchscaw,代码行数:49,
示例26: Java_com_test_surfaceview_TestNative_Init void Java_com_test_surfaceview_TestNative_Init(JNIEnv* env,jobject obj ,jobject surface,jobject assetManager) { g_nativeWindow = ANativeWindow_fromSurface(env,surface); if(g_nativeWindow == NULL) { LOGE("Get AAssetManager ERROR!"); } //ANativeWindow_acquire(g_nativeWindow); g_assetManager = AAssetManager_fromJava(env, assetManager); if(g_assetManager == NULL) { LOGE("Get AAssetManager ERROR!"); } }
开发者ID:lywschxd,项目名称:NativeSurfaceview,代码行数:15,
示例27: Java_com_virtualapplications_play_NativeInterop_setupGsHandlerextern "C" JNIEXPORT void JNICALL Java_com_virtualapplications_play_NativeInterop_setupGsHandler(JNIEnv* env, jobject obj, jobject surface){ auto nativeWindow = ANativeWindow_fromSurface(env, surface); auto gsHandler = g_virtualMachine->GetGSHandler(); if(gsHandler == nullptr) { g_virtualMachine->CreateGSHandler(CGSH_OpenGLAndroid::GetFactoryFunction(nativeWindow)); g_virtualMachine->m_ee->m_gs->OnNewFrame.connect( boost::bind(&CStatsManager::OnNewFrame, &CStatsManager::GetInstance(), _1)); } else { static_cast<CGSH_OpenGLAndroid*>(gsHandler)->SetWindow(nativeWindow); }}
开发者ID:250394,项目名称:Play-,代码行数:15,
示例28: Java_com_android_video_worker_EFEditorWorker_createEditorWorkerJNIEXPORT jboolean JNICALL Java_com_android_video_worker_EFEditorWorker_createEditorWorker(JNIEnv* env, jobject obj, jobject surface, jstring rootfolder, jstring videopath){ EFEditorWorker* editorWorker = new EFEditorWorker(); setJavaNativeObject(env, obj, editorWorker); ANativeWindow* nativeWindow = ANativeWindow_fromSurface(env, surface); const char* pRootPath = env->GetStringUTFChars(rootfolder, NULL) ; std::string strRootPath = pRootPath ; env->ReleaseStringUTFChars(rootfolder, pRootPath); const char* pVideoFile = env->GetStringUTFChars(videopath, NULL) ; std::string strVideoFile = pVideoFile ; env->ReleaseStringUTFChars(videopath, pVideoFile); return editorWorker->createEditorWorker(nativeWindow, strRootPath.c_str(), strVideoFile.c_str()) ;}
开发者ID:joyoyao,项目名称:AndroidVideo,代码行数:17,
注:本文中的ANativeWindow_fromSurface函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ANativeWindow_release函数代码示例 C++ ANTLR_USE_NAMESPACE函数代码示例 |