本文整理汇总了C++中ANativeWindow_release函数的典型用法代码示例。如果您正苦于以下问题:C++ ANativeWindow_release函数的具体用法?C++ ANativeWindow_release怎么用?C++ ANativeWindow_release使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ANativeWindow_release函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: ANativeWindow_acquire
bool CEGLNativeTypeAndroid::GetNativeResolution(RESOLUTION_INFO *res) const
{
EGLNativeWindowType *nativeWindow = (EGLNativeWindowType*)CXBMCApp::GetNativeWindow(30000);
if (!nativeWindow)
return false;
if (!m_width || !m_height)
{
ANativeWindow_acquire(*nativeWindow);
res->iWidth = ANativeWindow_getWidth(*nativeWindow);
res->iHeight= ANativeWindow_getHeight(*nativeWindow);
ANativeWindow_release(*nativeWindow);
}
else
{
res->iWidth = m_width;
res->iHeight = m_height;
}
res->fRefreshRate = currentRefreshRate();
res->dwFlags= D3DPRESENTFLAG_PROGRESSIVE;
res->iScreen = 0;
res->bFullScreen = true;
res->iSubtitles = (int)(0.965 * res->iHeight);
res->fPixelRatio = 1.0f;
res->iScreenWidth = res->iWidth;
res->iScreenHeight = res->iHeight;
res->strMode = StringUtils::Format("%dx%d @ %.2f%s - Full Screen", res->iScreenWidth, res->iScreenHeight, res->fRefreshRate,
res->dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
CLog::Log(LOGNOTICE,"Current resolution: %s\n",res->strMode.c_str());
return true;
}
开发者ID:Johnb9491,项目名称:xbmc,代码行数:32,代码来源:EGLNativeTypeAndroid.cpp
示例17: 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
示例18: 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
示例19: ANativeWindow_release
//-----------------------------------------------------------------------------
OsWindow::~OsWindow()
{
if (m_window)
{
ANativeWindow_release(m_window);
}
}
开发者ID:BasileusOnTop,项目名称:warzone-dcc,代码行数:9,代码来源:OsWindow.cpp
示例20: Run
static void Run(JNIEnv* env, const std::vector<std::string>& paths, bool first_open,
std::optional<std::string> savestate_path = {}, bool delete_savestate = false)
{
ASSERT(!paths.empty());
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Running : %s", paths[0].c_str());
RegisterMsgAlertHandler(&MsgAlert);
Common::AndroidSetReportHandler(&ReportSend);
DolphinAnalytics::AndroidSetGetValFunc(&GetAnalyticValue);
std::unique_lock<std::mutex> guard(s_host_identity_lock);
UICommon::Init();
if (first_open)
{
DolphinAnalytics::Instance()->ReportDolphinStart(GetAnalyticValue("DEVICE_TYPE"));
}
WiimoteReal::InitAdapterClass();
// No use running the loop when booting fails
s_have_wm_user_stop = false;
std::unique_ptr<BootParameters> boot = BootParameters::GenerateFromFile(paths, savestate_path);
boot->delete_savestate = delete_savestate;
WindowSystemInfo wsi(WindowSystemType::Android, nullptr, s_surf);
wsi.render_surface_scale = GetRenderSurfaceScale(env);
if (BootManager::BootCore(std::move(boot), wsi))
{
ButtonManager::Init(SConfig::GetInstance().GetGameID());
static constexpr int TIMEOUT = 10000;
static constexpr int WAIT_STEP = 25;
int time_waited = 0;
// A Core::CORE_ERROR state would be helpful here.
while (!Core::IsRunning() && time_waited < TIMEOUT && !s_have_wm_user_stop)
{
std::this_thread::sleep_for(std::chrono::milliseconds(WAIT_STEP));
time_waited += WAIT_STEP;
}
while (Core::IsRunning())
{
guard.unlock();
s_update_main_frame_event.Wait();
guard.lock();
Core::HostDispatchJobs();
}
}
Core::Shutdown();
ButtonManager::Shutdown();
UICommon::Shutdown();
guard.unlock();
if (s_surf)
{
ANativeWindow_release(s_surf);
s_surf = nullptr;
}
}
开发者ID:Sintendo,项目名称:dolphin,代码行数:58,代码来源:MainAndroid.cpp
注:本文中的ANativeWindow_release函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论