Java Code Examples for android.graphics.SurfaceTexture#detachFromGLContext()

The following examples show how to use android.graphics.SurfaceTexture#detachFromGLContext() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AWindow.java    From libvlc-android-sdk with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void run() {
    Looper.prepare();

    synchronized (this) {
        /* Ideally, all devices are running Android O, and we can create a SurfaceTexture
         * without an OpenGL context and we can specify the thread (Handler) where to run
         * SurfaceTexture callbacks. But this is not the case. The SurfaceTexture has to be
         * created from a new thread with a prepared looper in order to don't use the
         * MainLooper one (and have deadlock when we stop VLC from the mainloop).
         */
        mLooper = Looper.myLooper();
        mSurfaceTexture = new SurfaceTexture(0);
        /* The OpenGL texture will be attached from the OpenGL Thread */
        mSurfaceTexture.detachFromGLContext();
        mSurfaceTexture.setOnFrameAvailableListener(this);
        notify();
    }

    Looper.loop();
}
 
Example 2
Source File: AWindow.java    From OTTLivePlayer_vlc with MIT License 6 votes vote down vote up
@Override
public void run() {
    Looper.prepare();

    synchronized (this) {
        /* Ideally, all devices are running Android O, and we can create a SurfaceTexture
         * without an OpenGL context and we can specify the thread (Handler) where to run
         * SurfaceTexture callbacks. But this is not the case. The SurfaceTexture has to be
         * created from a new thread with a prepared looper in order to don't use the
         * MainLooper one (and have deadlock when we stop VLC from the mainloop).
         */
        mLooper = Looper.myLooper();
        mSurfaceTexture = new SurfaceTexture(0);
        /* The OpenGL texture will be attached from the OpenGL Thread */
        mSurfaceTexture.detachFromGLContext();
        mSurfaceTexture.setOnFrameAvailableListener(this);
        notify();
    }

    Looper.loop();
}
 
Example 3
Source File: AWindow.java    From OTTLivePlayer_vlc with MIT License 6 votes vote down vote up
@Override
public void run() {
    Looper.prepare();

    synchronized (this) {
        /* Ideally, all devices are running Android O, and we can create a SurfaceTexture
         * without an OpenGL context and we can specify the thread (Handler) where to run
         * SurfaceTexture callbacks. But this is not the case. The SurfaceTexture has to be
         * created from a new thread with a prepared looper in order to don't use the
         * MainLooper one (and have deadlock when we stop VLC from the mainloop).
         */
        mLooper = Looper.myLooper();
        mSurfaceTexture = new SurfaceTexture(0);
        /* The OpenGL texture will be attached from the OpenGL Thread */
        mSurfaceTexture.detachFromGLContext();
        mSurfaceTexture.setOnFrameAvailableListener(this);
        notify();
    }

    Looper.loop();
}
 
Example 4
Source File: AWindow.java    From vlc-example-streamplayer with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void run() {
    Looper.prepare();

    synchronized (this) {
        /* Ideally, all devices are running Android O, and we can create a SurfaceTexture
         * without an OpenGL context and we can specify the thread (Handler) where to run
         * SurfaceTexture callbacks. But this is not the case. The SurfaceTexture has to be
         * created from a new thread with a prepared looper in order to don't use the
         * MainLooper one (and have deadlock when we stop VLC from the mainloop).
         */
        mLooper = Looper.myLooper();
        mSurfaceTexture = new SurfaceTexture(0);
        /* The OpenGL texture will be attached from the OpenGL Thread */
        mSurfaceTexture.detachFromGLContext();
        mSurfaceTexture.setOnFrameAvailableListener(this);
        notify();
    }

    Looper.loop();
}
 
Example 5
Source File: AWindow.java    From libvlc-sdk-android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void run() {
    Looper.prepare();

    synchronized (this) {
        /* Ideally, all devices are running Android O, and we can create a SurfaceTexture
         * without an OpenGL context and we can specify the thread (Handler) where to run
         * SurfaceTexture callbacks. But this is not the case. The SurfaceTexture has to be
         * created from a new thread with a prepared looper in order to don't use the
         * MainLooper one (and have deadlock when we stop VLC from the mainloop).
         */
        mLooper = Looper.myLooper();
        mSurfaceTexture = new SurfaceTexture(0);
        /* The OpenGL texture will be attached from the OpenGL Thread */
        mSurfaceTexture.detachFromGLContext();
        mSurfaceTexture.setOnFrameAvailableListener(this);
        notify();
    }

    Looper.loop();
}
 
Example 6
Source File: BurstFacadeImpl.java    From Camera2 with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(SurfaceTexture surfaceTexture)
{
    MainThread.checkMainThread();
    // TODO: Use preview sizes from Camera API here instead of using the
    // default.
    surfaceTexture.setDefaultBufferSize(DEFAULT_PREVIEW_WIDTH, DEFAULT_PREVIEW_HEIGHT);

    // Detach from GL context, to allow frame distributor to attach to the
    // GL context.
    surfaceTexture.detachFromGLContext();
    mSurfaceTextureContainer.set(new SurfaceTextureContainer(surfaceTexture));
}
 
Example 7
Source File: SurfaceTexturePlatformWrapper.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@CalledByNative
private static void detachFromGLContext(SurfaceTexture surfaceTexture) {
    surfaceTexture.detachFromGLContext();
}