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


Java SurfaceTexture.release方法代码示例

本文整理汇总了Java中android.graphics.SurfaceTexture.release方法的典型用法代码示例。如果您正苦于以下问题:Java SurfaceTexture.release方法的具体用法?Java SurfaceTexture.release怎么用?Java SurfaceTexture.release使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.SurfaceTexture的用法示例。


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

示例1: testSetPresentationTime

import android.graphics.SurfaceTexture; //导入方法依赖的package包/类
/**
 * Test for {@link GLTools#setPresentationTime(EGLDisplay, EGLSurface, long)} .
 * @throws Exception by some fails
 */
@Test
public final void testSetPresentationTime() throws Exception {
    final EGLDisplay eglDisplay = GLTools.newDisplay();
    final EGLConfig eglConfig = GLTools.newConfig(eglDisplay, true);
    final EGLContext eglContext = GLTools.newContext(eglDisplay, eglConfig);
    final EGLSurface eglSurface =
            GLTools.newSurface(eglDisplay, eglConfig, FRAME_SIZE, FRAME_SIZE);
    GLTools.makeCurrent(eglDisplay, eglSurface, eglContext);

    final int txt = GLTools.newTexture(TEXTURE_LEVEL);
    final SurfaceTexture surfaceTexture = new SurfaceTexture(txt, true);
    final Surface surface = new Surface(surfaceTexture);
    final EGLSurface window = GLTools.newSurface(eglDisplay, eglConfig, surface);

    GLTools.setPresentationTime(eglDisplay, window, PRESENTATION_TIME);

    GLTools.closeSurface(eglDisplay, window);
    surface.release();
    surfaceTexture.release();
    GLTools.closeTexture(txt, TEXTURE_LEVEL);

    GLTools.closeSurface(eglDisplay, eglSurface);
    GLTools.closeContext(eglDisplay, eglContext);
    GLTools.closeDisplay(eglDisplay);
}
 
开发者ID:Nik-Gleb,项目名称:mpeg-encoder,代码行数:30,代码来源:GLToolsAndroidTest.java

示例2: releaseSurfaceTexture

import android.graphics.SurfaceTexture; //导入方法依赖的package包/类
@Override
public void releaseSurfaceTexture(SurfaceTexture surfaceTexture) {
    if (surfaceTexture == null) {
        Log.d(TAG, "releaseSurfaceTexture: null");
    } else if (mDidDetachFromWindow) {
        if (surfaceTexture != mSurfaceTexture) {
            Log.d(TAG, "releaseSurfaceTexture: didDetachFromWindow(): release different SurfaceTexture");
            surfaceTexture.release();
        } else if (!mOwnSurfaceTexture) {
            Log.d(TAG, "releaseSurfaceTexture: didDetachFromWindow(): release detached SurfaceTexture");
            surfaceTexture.release();
        } else {
            Log.d(TAG, "releaseSurfaceTexture: didDetachFromWindow(): already released by TextureView");
        }
    } else if (mWillDetachFromWindow) {
        if (surfaceTexture != mSurfaceTexture) {
            Log.d(TAG, "releaseSurfaceTexture: willDetachFromWindow(): release different SurfaceTexture");
            surfaceTexture.release();
        } else if (!mOwnSurfaceTexture) {
            Log.d(TAG, "releaseSurfaceTexture: willDetachFromWindow(): re-attach SurfaceTexture to TextureView");
            setOwnSurfaceTexture(true);
        } else {
            Log.d(TAG, "releaseSurfaceTexture: willDetachFromWindow(): will released by TextureView");
        }
    } else {
        if (surfaceTexture != mSurfaceTexture) {
            Log.d(TAG, "releaseSurfaceTexture: alive: release different SurfaceTexture");
            surfaceTexture.release();
        } else if (!mOwnSurfaceTexture) {
            Log.d(TAG, "releaseSurfaceTexture: alive: re-attach SurfaceTexture to TextureView");
            setOwnSurfaceTexture(true);
        } else {
            Log.d(TAG, "releaseSurfaceTexture: alive: will released by TextureView");
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:37,代码来源:TextureRenderView.java

示例3: testSwapBuffers

import android.graphics.SurfaceTexture; //导入方法依赖的package包/类
/**
 * Test for {@link GLTools#swapBuffers(EGLDisplay, EGLSurface)}.
 * @throws Exception by some fails
 */
@Test
public final void testSwapBuffers() throws Exception {
    final EGLDisplay eglDisplay = GLTools.newDisplay();
    final EGLConfig eglConfig = GLTools.newConfig(eglDisplay, true);
    final EGLContext eglContext = GLTools.newContext(eglDisplay, eglConfig);
    final EGLSurface eglSurface =
            GLTools.newSurface(eglDisplay, eglConfig, FRAME_SIZE, FRAME_SIZE);
    GLTools.makeCurrent(eglDisplay, eglSurface, eglContext);
    try {
        GLTools.swapBuffers(eglDisplay, eglSurface);
    } catch (RuntimeException exception) {

        final int txt = GLTools.newTexture(TEXTURE_LEVEL);
        final SurfaceTexture surfaceTexture = new SurfaceTexture(txt, true);
        final Surface surface = new Surface(surfaceTexture);
        final EGLSurface window = GLTools.newSurface(eglDisplay, eglConfig, surface);

        GLTools.makeCurrent(eglDisplay, window, eglContext);
        GLTools.swapBuffers(eglDisplay, window);

        GLTools.closeSurface(eglDisplay, window);
        surface.release();
        surfaceTexture.release();
        GLTools.closeTexture(txt, TEXTURE_LEVEL);
    }

    GLTools.closeSurface(eglDisplay, eglSurface);
    GLTools.closeContext(eglDisplay, eglContext);
    GLTools.closeDisplay(eglDisplay);
}
 
开发者ID:Nik-Gleb,项目名称:mpeg-encoder,代码行数:35,代码来源:GLToolsAndroidTest.java

示例4: onDetachedFromWindow

import android.graphics.SurfaceTexture; //导入方法依赖的package包/类
@Override
protected void onDetachedFromWindow() {
	mRenderThread.dispose();
	super.onDetachedFromWindow();
	final SurfaceTexture surfaceTexture = getSurfaceTexture();
	if (surfaceTexture != null) {
		surfaceTexture.release();
	}
}
 
开发者ID:smartbeng,项目名称:PaoMovie,代码行数:10,代码来源:GifTextureView.java

示例5: releaseGlSurface

import android.graphics.SurfaceTexture; //导入方法依赖的package包/类
private void releaseGlSurface(SurfaceTexture st) {
    if (st != null) {
        st.release();
    }

    if (mWindowSurface != null) {
        mWindowSurface.release();
        mWindowSurface = null;
    }

    if (mEglCore != null) {
        mEglCore.release();
        mEglCore = null;
    }
}
 
开发者ID:AgoraIO,项目名称:Agora-Screen-Sharing-Android,代码行数:16,代码来源:GLRender.java

示例6: onSurfaceTextureDestroyed

import android.graphics.SurfaceTexture; //导入方法依赖的package包/类
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
    surface.release();
    return true;
}
 
开发者ID:wp521,项目名称:MyFire,代码行数:6,代码来源:JCVideoPlayer.java

示例7: run

import android.graphics.SurfaceTexture; //导入方法依赖的package包/类
@Override
public void run() {
    while (true) {
        SurfaceTexture surfaceTexture = null;

        // Latch the SurfaceTexture when it becomes available.  We have to wait for
        // the TextureView to create it.
        synchronized (mLock) {
            while (!mDone && (surfaceTexture = mSurfaceTexture) == null) {
                try {
                    mLock.wait();
                } catch (InterruptedException ie) {
                    throw new RuntimeException(ie);     // not expected
                }
            }
            if (mDone) {
                break;
            }
        }
        Log.d(TAG, "Got surfaceTexture=" + surfaceTexture);

        // Create an EGL surface for our new SurfaceTexture.  We're not on the same
        // thread as the SurfaceTexture, which is a concern for the *consumer*, which
        // wants to call updateTexImage().  Because we're the *producer*, i.e. the
        // one generating the frames, we don't need to worry about being on the same
        // thread.
        mEglCore = new EglCore(null, EglCore.FLAG_TRY_GLES3);
        WindowSurface windowSurface = new WindowSurface(mEglCore, mSurfaceTexture);
        windowSurface.makeCurrent();

        // Render frames until we're told to stop or the SurfaceTexture is destroyed.
        doAnimation(windowSurface);

        windowSurface.release();
        mEglCore.release();
        if (!sReleaseInCallback) {
            Log.i(TAG, "Releasing SurfaceTexture in renderer thread");
            surfaceTexture.release();
        }
    }

    Log.d(TAG, "Renderer thread exiting");
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:44,代码来源:TextureViewGLActivity.java

示例8: releaseSurfaceTexture

import android.graphics.SurfaceTexture; //导入方法依赖的package包/类
@Override
public void releaseSurfaceTexture(SurfaceTexture surfaceTexture)
{
    if (surfaceTexture == null)
    {
        Log.d(TAG, "releaseSurfaceTexture: null");
    }
    else if (mDidDetachFromWindow)
    {
        if (surfaceTexture != mSurfaceTexture)
        {
            Log.d(TAG, "releaseSurfaceTexture: didDetachFromWindow(): release different SurfaceTexture");
            surfaceTexture.release();
        }
        else if (!mOwnSurfaceTexture)
        {
            Log.d(TAG, "releaseSurfaceTexture: didDetachFromWindow(): release detached SurfaceTexture");
            surfaceTexture.release();
        }
        else
        {
            Log.d(TAG, "releaseSurfaceTexture: didDetachFromWindow(): already released by TextureView");
        }
    }
    else if (mWillDetachFromWindow)
    {
        if (surfaceTexture != mSurfaceTexture)
        {
            Log.d(TAG, "releaseSurfaceTexture: willDetachFromWindow(): release different SurfaceTexture");
            surfaceTexture.release();
        }
        else if (!mOwnSurfaceTexture)
        {
            Log.d(TAG,
                "releaseSurfaceTexture: willDetachFromWindow(): re-attach SurfaceTexture to TextureView");
            setOwnSurfaceTexture(true);
        }
        else
        {
            Log.d(TAG, "releaseSurfaceTexture: willDetachFromWindow(): will released by TextureView");
        }
    }
    else
    {
        if (surfaceTexture != mSurfaceTexture)
        {
            Log.d(TAG, "releaseSurfaceTexture: alive: release different SurfaceTexture");
            surfaceTexture.release();
        }
        else if (!mOwnSurfaceTexture)
        {
            Log.d(TAG, "releaseSurfaceTexture: alive: re-attach SurfaceTexture to TextureView");
            setOwnSurfaceTexture(true);
        }
        else
        {
            Log.d(TAG, "releaseSurfaceTexture: alive: will released by TextureView");
        }
    }
}
 
开发者ID:Dreamxiaoxuan,项目名称:AndroidTvDemo,代码行数:61,代码来源:TextureRenderView.java

示例9: releaseSurfaceTexture

import android.graphics.SurfaceTexture; //导入方法依赖的package包/类
public void releaseSurfaceTexture(SurfaceTexture surfaceTexture) {
    if (surfaceTexture == null) {
        Log.d(TextureRenderView.TAG, "releaseSurfaceTexture: null");
    } else if (this.mDidDetachFromWindow) {
        if (surfaceTexture != this.mSurfaceTexture) {
            Log.d(TextureRenderView.TAG, "releaseSurfaceTexture: didDetachFromWindow(): " +
                    "release different SurfaceTexture");
            surfaceTexture.release();
        } else if (this.mOwnSurfaceTexture) {
            Log.d(TextureRenderView.TAG, "releaseSurfaceTexture: didDetachFromWindow(): " +
                    "already released by TextureView");
        } else {
            Log.d(TextureRenderView.TAG, "releaseSurfaceTexture: didDetachFromWindow(): " +
                    "release detached SurfaceTexture");
            surfaceTexture.release();
        }
    } else if (this.mWillDetachFromWindow) {
        if (surfaceTexture != this.mSurfaceTexture) {
            Log.d(TextureRenderView.TAG, "releaseSurfaceTexture: willDetachFromWindow(): " +
                    "release different SurfaceTexture");
            surfaceTexture.release();
        } else if (this.mOwnSurfaceTexture) {
            Log.d(TextureRenderView.TAG, "releaseSurfaceTexture: willDetachFromWindow(): " +
                    "will released by TextureView");
        } else {
            Log.d(TextureRenderView.TAG, "releaseSurfaceTexture: willDetachFromWindow(): " +
                    "re-attach SurfaceTexture to TextureView");
            setOwnSurfaceTexture(true);
        }
    } else if (surfaceTexture != this.mSurfaceTexture) {
        Log.d(TextureRenderView.TAG, "releaseSurfaceTexture: alive: release different " +
                "SurfaceTexture");
        surfaceTexture.release();
    } else if (this.mOwnSurfaceTexture) {
        Log.d(TextureRenderView.TAG, "releaseSurfaceTexture: alive: will released by " +
                "TextureView");
    } else {
        Log.d(TextureRenderView.TAG, "releaseSurfaceTexture: alive: re-attach " +
                "SurfaceTexture to TextureView");
        setOwnSurfaceTexture(true);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:43,代码来源:TextureRenderView.java

示例10: onSurfaceTextureDestroyed

import android.graphics.SurfaceTexture; //导入方法依赖的package包/类
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
  surface.release();
  mSurface = null;
  return true;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:7,代码来源:FlatARTSurfaceViewShadowNode.java


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