use of android.graphics.SurfaceTexture in project android_frameworks_base by DirtyUnicorns.
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;
}
use of android.graphics.SurfaceTexture in project android_frameworks_base by DirtyUnicorns.
the class CameraSource method open.
@Override
public void open(FilterContext context) {
if (mLogVerbose)
Log.v(TAG, "Opening");
// Open camera
mCamera = Camera.open(mCameraId);
// Set parameters
getCameraParameters();
mCamera.setParameters(mCameraParameters);
// Create frame formats
createFormats();
// Bind it to our camera frame
mCameraFrame = (GLFrame) context.getFrameManager().newBoundFrame(mOutputFormat, GLFrame.EXTERNAL_TEXTURE, 0);
mSurfaceTexture = new SurfaceTexture(mCameraFrame.getTextureId());
try {
mCamera.setPreviewTexture(mSurfaceTexture);
} catch (IOException e) {
throw new RuntimeException("Could not bind camera surface texture: " + e.getMessage() + "!");
}
// Connect SurfaceTexture to callback
mSurfaceTexture.setOnFrameAvailableListener(onCameraFrameAvailableListener);
// Start the preview
mNewFrameAvailable = false;
mCamera.startPreview();
}
use of android.graphics.SurfaceTexture in project android_frameworks_base by DirtyUnicorns.
the class TextureView method getHardwareLayer.
HardwareLayer getHardwareLayer() {
if (mLayer == null) {
if (mAttachInfo == null || mAttachInfo.mHardwareRenderer == null) {
return null;
}
mLayer = mAttachInfo.mHardwareRenderer.createTextureLayer();
boolean createNewSurface = (mSurface == null);
if (createNewSurface) {
// Create a new SurfaceTexture for the layer.
mSurface = new SurfaceTexture(false);
nCreateNativeWindow(mSurface);
}
mLayer.setSurfaceTexture(mSurface);
mSurface.setDefaultBufferSize(getWidth(), getHeight());
mSurface.setOnFrameAvailableListener(mUpdateListener, mAttachInfo.mHandler);
if (mListener != null && createNewSurface) {
mListener.onSurfaceTextureAvailable(mSurface, getWidth(), getHeight());
}
mLayer.setLayerPaint(mLayerPaint);
}
if (mUpdateSurface) {
// Someone has requested that we use a specific SurfaceTexture, so
// tell mLayer about it and set the SurfaceTexture to use the
// current view size.
mUpdateSurface = false;
// Since we are updating the layer, force an update to ensure its
// parameters are correct (width, height, transform, etc.)
updateLayer();
mMatrixChanged = true;
mLayer.setSurfaceTexture(mSurface);
mSurface.setDefaultBufferSize(getWidth(), getHeight());
}
return mLayer;
}
use of android.graphics.SurfaceTexture in project XobotOS by xamarin.
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 XobotOS by xamarin.
the class HTML5VideoInline method getSurfaceTexture.
// Inline Video specific FUNCTIONS:
@Override
public SurfaceTexture getSurfaceTexture(int videoLayerId) {
// Create the surface texture.
if (videoLayerId != mVideoLayerUsingSurfaceTexture || mSurfaceTexture == null) {
if (mTextureNames == null) {
mTextureNames = new int[1];
GLES20.glGenTextures(1, mTextureNames, 0);
}
mSurfaceTexture = new SurfaceTexture(mTextureNames[0]);
}
mVideoLayerUsingSurfaceTexture = videoLayerId;
return mSurfaceTexture;
}
Aggregations