当前位置: 首页>>代码示例>>C++>>正文


C++ ANativeWindow_release函数代码示例

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


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

示例1: gl_ThreadSetWindow

// Sets new native window for creating EGLSurface.
void gl_ThreadSetWindow(ANativeWindow* window) {
	// We accept new window only when rendering
	// thread is active. Otherwise we can't promise
	// it gets released as expected.
	if (!gl_ThreadRunning()) {
		ANativeWindow_release(window);
		return;
	}
	// Acquire thread lock.
	gl_ThreadLock();
	// If we have new nativeWin.
	if (GLOBALS.window != window) {
		// If there is old one, release it first.
		if (GLOBALS.window) {
			ANativeWindow_release(GLOBALS.window);
		}
		// Store new nativeWin and mark it changed.
		GLOBALS.window = window;
		GLOBALS.windowChanged = GL_THREAD_TRUE;
		// Set window size to zero and mark it changed.
		GLOBALS.windowWidth = GLOBALS.windowHeight = 0;
		GLOBALS.windowSizeChanged = GL_THREAD_TRUE;
	}
	// Else if window != NULL.
	else if (window) {
		// Release window instantly.
		ANativeWindow_release(window);
	}
	// Release thread lock.
	gl_ThreadUnlock();
}
开发者ID:houssemeddinelassoued,项目名称:android_wallpaper_flowers_ndk,代码行数:32,代码来源:gl_thread.c

示例2: ENTER

int UVCPreview::stopPreview() {
	ENTER();
	bool b = isRunning();
	if (LIKELY(b)) {
		mIsRunning = false;
		pthread_cond_signal(&preview_sync);
		pthread_cond_signal(&capture_sync);
		if (pthread_join(capture_thread, NULL) != EXIT_SUCCESS) {
			LOGW("UVCPreview::terminate capture thread: pthread_join failed");
		}
		if (pthread_join(preview_thread, NULL) != EXIT_SUCCESS) {
			LOGW("UVCPreview::terminate preview thread: pthread_join failed");
		}
		clearDisplay();
	}
	clearPreviewFrame();
	clearCaptureFrame();
	pthread_mutex_lock(&preview_mutex);
	if (mPreviewWindow) {
		ANativeWindow_release(mPreviewWindow);
		mPreviewWindow = NULL;
	}
	pthread_mutex_unlock(&preview_mutex);
	pthread_mutex_lock(&capture_mutex);
	if (mCaptureWindow) {
		ANativeWindow_release(mCaptureWindow);
		mCaptureWindow = NULL;
	}
	pthread_mutex_unlock(&capture_mutex);
	RETURN(0, int);
}
开发者ID:ozone999,项目名称:usbcamera,代码行数:31,代码来源:UVCPreview.cpp

示例3: gl_ThreadDestroy

void gl_ThreadDestroy() {
	// If there's thread running.
	if (GLOBALS.threadCreated) {
		// Mark exit flag.
		GLOBALS.threadExit = GL_THREAD_TRUE;
		// Notify thread.
		pthread_cond_signal(&GLOBALS.cond);
		// Wait until thread has exited.
		pthread_join(GLOBALS.thread, NULL);

		// If there are pending mutex locks let
		// them execute before destroying it.
		// This is needed because otherwise
		// pthread_mutex_destroy will fail.
		pthread_mutex_lock(&GLOBALS.mutex);
		while (GLOBALS.mutexCounter > 0) {
			pthread_cond_wait(&GLOBALS.cond, &GLOBALS.mutex);
		}
		pthread_mutex_unlock(&GLOBALS.mutex);

		// Release all GLOBALS data.
		pthread_cond_destroy(&GLOBALS.cond);
		pthread_mutex_destroy(&GLOBALS.mutex);
		// If we're holding a window release it.
		if (GLOBALS.window) {
			ANativeWindow_release(GLOBALS.window);
		}
		memset(&GLOBALS, 0, sizeof GLOBALS);
	}
}
开发者ID:houssemeddinelassoued,项目名称:android_wallpaper_flowers_ndk,代码行数:30,代码来源:gl_thread.c

示例4: nv_avc_destroy

// This function must be called after
// decoding is finished
void nv_avc_destroy(void) {
	if (decoder_ctx) {
		avcodec_close(decoder_ctx);
		av_free(decoder_ctx);
		decoder_ctx = NULL;
	}
	if (scaler_ctx) {
		sws_freeContext(scaler_ctx);
		scaler_ctx = NULL;
	}
	if (dec_frame) {
		av_frame_free(&dec_frame);
		dec_frame = NULL;
	}
	if (yuv_frame) {
		av_frame_free(&yuv_frame);
		yuv_frame = NULL;
	}
	if (rgb_frame) {
		av_frame_free(&rgb_frame);
		rgb_frame = NULL;
	}
	if (rgb_frame_buf) {
		av_free(rgb_frame_buf);
		rgb_frame_buf = NULL;
	}
#ifdef __ANDROID_API__
	if (window) {
		ANativeWindow_release(window);
		window = NULL;
	}
#endif
	pthread_mutex_destroy(&mutex);
}
开发者ID:Degot,项目名称:limelight-pc,代码行数:36,代码来源:nv_avc_dec.c

示例5: SDL_VoutAndroid_SetNativeWindow_l

static void SDL_VoutAndroid_SetNativeWindow_l(SDL_Vout *vout, ANativeWindow *native_window)
{
    AMCTRACE("%s(%p, %p)\n", __func__, vout, native_window);
    SDL_Vout_Opaque *opaque = vout->opaque;

    if (opaque->native_window == native_window) {
        if (native_window == NULL) {
            // always invalidate buffers, if native_window is changed
            SDL_VoutAndroid_invalidateAllBuffers_l(vout);
        }
        return;
    } else

    IJK_EGL_terminate(opaque->egl);
    SDL_VoutAndroid_invalidateAllBuffers_l(vout);

    if (opaque->native_window)
        ANativeWindow_release(opaque->native_window);

    if (native_window)
        ANativeWindow_acquire(native_window);

    opaque->native_window = native_window;
    opaque->null_native_window_warned = 0;
}
开发者ID:Harman-Jeremywang,项目名称:ijkplayer,代码行数:25,代码来源:ijksdl_vout_android_nativewindow.c

示例6: deinit_opengl

static pj_status_t deinit_opengl(void * data)
{
    struct andgl_stream *stream = (struct andgl_stream *)data;

    if (stream->gl_buf) {
        pjmedia_vid_dev_opengl_destroy_buffers(stream->gl_buf);
        stream->gl_buf = NULL;
    }

    if (stream->display != EGL_NO_DISPLAY) {
        eglMakeCurrent(stream->display, EGL_NO_SURFACE, EGL_NO_SURFACE,
                       EGL_NO_CONTEXT);
        if (stream->context != EGL_NO_CONTEXT)
            eglDestroyContext(stream->display, stream->context);
        if (stream->surface != EGL_NO_SURFACE)
            eglDestroySurface(stream->display, stream->surface);
        eglTerminate(stream->display);
    }
    
    if (stream->window) {
        ANativeWindow_release(stream->window);
        stream->window = NULL;
    }
    
    stream->display = EGL_NO_DISPLAY;
    stream->surface = EGL_NO_SURFACE;
    stream->context = EGL_NO_CONTEXT;
    
    return PJ_SUCCESS;
}
开发者ID:CloudStyleStudio,项目名称:csip,代码行数:30,代码来源:android_opengl.c

示例7: Java_com_test_surfaceview_TestNative_Destroye

	void Java_com_test_surfaceview_TestNative_Destroye(JNIEnv* env,jobject obj)
	{
		ANativeWindow_release(g_nativeWindow);
		g_nWidth = 0;
		g_nHeight = 0;
		g_nativeWindow = NULL;
	}
开发者ID:lywschxd,项目名称:NativeSurfaceview,代码行数:7,代码来源:TestSufaceView.cpp

示例8: 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

示例9: VERBOSE

void SwViewport::DrawToWindow()
{
    VERBOSE("Releasing native window");
    Surface.reset();
    ANativeWindow_unlockAndPost(NativeWindow);
    ANativeWindow_release(NativeWindow);
}
开发者ID:AvaloniaUI,项目名称:libperspesk,代码行数:7,代码来源:droid.cpp

示例10: Android_DestroyWindow

void
Android_DestroyWindow(_THIS, SDL_Window * window)
{
    SDL_WindowData *data;
    
    if (window == Android_Window) {
        Android_Window = NULL;
        if (Android_PauseSem) SDL_DestroySemaphore(Android_PauseSem);
        if (Android_ResumeSem) SDL_DestroySemaphore(Android_ResumeSem);
        Android_PauseSem = NULL;
        Android_ResumeSem = NULL;
        
        if(window->driverdata) {
            data = (SDL_WindowData *) window->driverdata;
            if (data->egl_surface != EGL_NO_SURFACE) {
                SDL_EGL_DestroySurface(_this, data->egl_surface);
            }
            if (data->native_window) {
                ANativeWindow_release(data->native_window);
            }
            SDL_free(window->driverdata);
            window->driverdata = NULL;
        }
    }
}
开发者ID:jfiguinha,项目名称:Regards,代码行数:25,代码来源:SDL_androidwindow.c

示例11: 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

示例12: ACameraCaptureSession_stopRepeating

NDKCamera::~NDKCamera() {
  valid_ = false;
  // stop session if it is on:
  if (captureSessionState_ == CaptureSessionState::ACTIVE) {
    ACameraCaptureSession_stopRepeating(captureSession_);
  }
  ACameraCaptureSession_close(captureSession_);

  for (auto& req : requests_) {
    CALL_REQUEST(removeTarget(req.request_, req.target_));
    ACaptureRequest_free(req.request_);
    ACameraOutputTarget_free(req.target_);

    CALL_CONTAINER(remove(outputContainer_, req.sessionOutput_));
    ACaptureSessionOutput_free(req.sessionOutput_);

    ANativeWindow_release(req.outputNativeWindow_);
  }

  requests_.resize(0);
  ACaptureSessionOutputContainer_free(outputContainer_);

  for (auto& cam : cameras_) {
    if (cam.second.device_) {
      CALL_DEV(close(cam.second.device_));
    }
  }
  cameras_.clear();
  if (cameraMgr_) {
    CALL_MGR(unregisterAvailabilityCallback(cameraMgr_, GetManagerListener()));
    ACameraManager_delete(cameraMgr_);
    cameraMgr_ = nullptr;
  }
}
开发者ID:cRAN-cg,项目名称:android-ndk,代码行数:34,代码来源:camera_manager.cpp

示例13: 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

示例14: DeleteMCDec

void DeleteMCDec(GF_BaseDecoder *ifcg)
{
    MCDec *ctx = (MCDec *)ifcg->privateStack;

    if(ctx->format && AMediaFormat_delete(ctx->format) != AMEDIA_OK){
         GF_LOG(GF_LOG_ERROR, GF_LOG_CODEC,("AMediaFormat_delete failed"));
    }
   
    if(ctx->codec && AMediaCodec_delete(ctx->codec) != AMEDIA_OK) {
         GF_LOG(GF_LOG_ERROR, GF_LOG_CODEC,("AMediaCodec_delete failed"));
    }
    
    if(ctx->window) {
		ANativeWindow_release(ctx->window);
		ctx->window = NULL;
    }

	
    gf_free(ctx);
    gf_free(ifcg);
	
	MCDec_DelParamList(ctx->SPSs);
	ctx->SPSs = NULL;
	MCDec_DelParamList(ctx->PPSs);
	ctx->PPSs = NULL;
}
开发者ID:ARSekkat,项目名称:gpac,代码行数:26,代码来源:mediacodec_dec.c

示例15: func_free_l

static void func_free_l(SDL_Vout *vout)
{
    if (!vout)
        return;

    SDL_Vout_Opaque *opaque = vout->opaque;
    if (opaque) {
        SDL_AMediaCodecBufferProxy **begin = (SDL_AMediaCodecBufferProxy **)ISDL_Array__begin(&opaque->overlay_manager);
        SDL_AMediaCodecBufferProxy **end   = (SDL_AMediaCodecBufferProxy **)ISDL_Array__end(&opaque->overlay_manager);
        for (; begin < end; ++begin) {
            SDL_AMediaCodecBufferProxy_destroyP(begin);
        }
        ISDL_Array__clear(&opaque->overlay_pool);
        ISDL_Array__clear(&opaque->overlay_manager);

        if (opaque->native_window) {
            ANativeWindow_release(opaque->native_window);
            opaque->native_window = NULL;
        }

        IJK_EGL_freep(&opaque->egl);

        SDL_AMediaCodec_decreaseReferenceP(&opaque->acodec);
    }

    SDL_Vout_FreeInternal(vout);
}
开发者ID:Harman-Jeremywang,项目名称:ijkplayer,代码行数:27,代码来源:ijksdl_vout_android_nativewindow.c


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