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();
}
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;
}
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;
}
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);
}
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;
}
Aggregations