Search in sources :

Example 46 with SurfaceTexture

use of android.graphics.SurfaceTexture in project android_frameworks_base by ParanoidAndroid.

the class HTML5VideoInline method decideDisplayMode.

@Override
public void decideDisplayMode() {
    SurfaceTexture surfaceTexture = getSurfaceTexture(getVideoLayerId());
    Surface surface = new Surface(surfaceTexture);
    mPlayer.setSurface(surface);
    surface.release();
}
Also used : SurfaceTexture(android.graphics.SurfaceTexture) Surface(android.view.Surface)

Example 47 with SurfaceTexture

use of android.graphics.SurfaceTexture in project android_frameworks_base by ParanoidAndroid.

the class HTML5VideoInline method getSurfaceTexture.

// Inline Video specific FUNCTIONS:
public static SurfaceTexture getSurfaceTexture(int videoLayerId) {
    // Create the surface texture.
    if (videoLayerId != mVideoLayerUsingSurfaceTexture || mSurfaceTexture == null || mTextureNames == null) {
        // The GL texture will store in the VideoLayerManager at native side.
        // They will be clean up when requested.
        // The reason we recreated GL texture name is for screen shot support.
        mTextureNames = new int[1];
        GLES20.glGenTextures(1, mTextureNames, 0);
        mSurfaceTexture = new SurfaceTexture(mTextureNames[0]);
    }
    mVideoLayerUsingSurfaceTexture = videoLayerId;
    return mSurfaceTexture;
}
Also used : SurfaceTexture(android.graphics.SurfaceTexture)

Example 48 with SurfaceTexture

use of android.graphics.SurfaceTexture in project android_frameworks_base by AOSPA.

the class EGL14 method eglCreateWindowSurface.

public static EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, Object win, int[] attrib_list, int offset) {
    Surface sur = null;
    if (win instanceof SurfaceView) {
        SurfaceView surfaceView = (SurfaceView) win;
        sur = surfaceView.getHolder().getSurface();
    } else if (win instanceof SurfaceHolder) {
        SurfaceHolder holder = (SurfaceHolder) win;
        sur = holder.getSurface();
    } else if (win instanceof Surface) {
        sur = (Surface) win;
    }
    EGLSurface surface;
    if (sur != null) {
        surface = _eglCreateWindowSurface(dpy, config, sur, attrib_list, offset);
    } else if (win instanceof SurfaceTexture) {
        surface = _eglCreateWindowSurfaceTexture(dpy, config, win, attrib_list, offset);
    } else {
        throw new java.lang.UnsupportedOperationException("eglCreateWindowSurface() can only be called with an instance of " + "Surface, SurfaceView, SurfaceTexture or SurfaceHolder at the moment, " + "this will be fixed later.");
    }
    return surface;
}
Also used : SurfaceHolder(android.view.SurfaceHolder) SurfaceTexture(android.graphics.SurfaceTexture) SurfaceView(android.view.SurfaceView) Surface(android.view.Surface)

Example 49 with SurfaceTexture

use of android.graphics.SurfaceTexture in project android_frameworks_base by AOSPA.

the class EGLImpl method eglCreateWindowSurface.

public EGLSurface eglCreateWindowSurface(EGLDisplay display, EGLConfig config, Object native_window, int[] attrib_list) {
    Surface sur = null;
    if (native_window instanceof SurfaceView) {
        SurfaceView surfaceView = (SurfaceView) native_window;
        sur = surfaceView.getHolder().getSurface();
    } else if (native_window instanceof SurfaceHolder) {
        SurfaceHolder holder = (SurfaceHolder) native_window;
        sur = holder.getSurface();
    } else if (native_window instanceof Surface) {
        sur = (Surface) native_window;
    }
    long eglSurfaceId;
    if (sur != null) {
        eglSurfaceId = _eglCreateWindowSurface(display, config, sur, attrib_list);
    } else if (native_window instanceof SurfaceTexture) {
        eglSurfaceId = _eglCreateWindowSurfaceTexture(display, config, native_window, attrib_list);
    } else {
        throw new java.lang.UnsupportedOperationException("eglCreateWindowSurface() can only be called with an instance of " + "Surface, SurfaceView, SurfaceHolder or SurfaceTexture at the moment.");
    }
    if (eglSurfaceId == 0) {
        return EGL10.EGL_NO_SURFACE;
    }
    return new EGLSurfaceImpl(eglSurfaceId);
}
Also used : SurfaceHolder(android.view.SurfaceHolder) SurfaceTexture(android.graphics.SurfaceTexture) SurfaceView(android.view.SurfaceView) Surface(android.view.Surface)

Example 50 with SurfaceTexture

use of android.graphics.SurfaceTexture in project android_frameworks_base by AOSPA.

the class SurfaceTextureSource method open.

@Override
public void open(FilterContext context) {
    if (mLogVerbose)
        Log.v(TAG, "Opening SurfaceTextureSource");
    // Create SurfaceTexture anew each time - it can use substantial memory.
    mSurfaceTexture = new SurfaceTexture(mMediaFrame.getTextureId());
    // Connect SurfaceTexture to callback
    mSurfaceTexture.setOnFrameAvailableListener(onFrameAvailableListener);
    // Connect SurfaceTexture to source
    mSourceListener.onSurfaceTextureSourceReady(mSurfaceTexture);
    mFirstFrame = true;
}
Also used : SurfaceTexture(android.graphics.SurfaceTexture)

Aggregations

SurfaceTexture (android.graphics.SurfaceTexture)99 Surface (android.view.Surface)49 SurfaceView (android.view.SurfaceView)16 IOException (java.io.IOException)16 SurfaceHolder (android.view.SurfaceHolder)14 EGLSurface (android.opengl.EGLSurface)13 OutputConfiguration (android.hardware.camera2.params.OutputConfiguration)5 ServiceSpecificException (android.os.ServiceSpecificException)5 SmallTest (android.test.suitebuilder.annotation.SmallTest)5 Size (android.util.Size)5 RequiresPermission (android.support.annotation.RequiresPermission)4 TextureView (android.view.TextureView)4 PrintWriter (java.io.PrintWriter)3 StringWriter (java.io.StringWriter)3 Camera (android.hardware.Camera)2 WindowManager (android.view.WindowManager)2 FrameLayout (android.widget.FrameLayout)2 ByteBuffer (java.nio.ByteBuffer)2 CalledByNative (org.chromium.base.CalledByNative)2 Size (android.hardware.Camera.Size)1