use of android.graphics.SurfaceTexture in project android_frameworks_base by AOSPA.
the class MediaSource method open.
@Override
public void open(FilterContext context) {
if (mLogVerbose) {
Log.v(TAG, "Opening MediaSource");
if (mSelectedIsUrl) {
Log.v(TAG, "Current URL is " + mSourceUrl);
} else {
Log.v(TAG, "Current source is Asset!");
}
}
mMediaFrame = (GLFrame) context.getFrameManager().newBoundFrame(mOutputFormat, GLFrame.EXTERNAL_TEXTURE, 0);
mSurfaceTexture = new SurfaceTexture(mMediaFrame.getTextureId());
if (!setupMediaPlayer(mSelectedIsUrl)) {
throw new RuntimeException("Error setting up MediaPlayer!");
}
}
use of android.graphics.SurfaceTexture in project android_frameworks_base by DirtyUnicorns.
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 SocialRec by Jkuras.
the class CameraSource method start.
/**
* Opens the camera and starts sending preview frames to the underlying detector. The preview
* frames are not displayed.
*
* @throws IOException if the camera's preview texture or display could not be initialized
*/
@RequiresPermission(Manifest.permission.CAMERA)
public CameraSource start() throws IOException {
synchronized (mCameraLock) {
if (mCamera != null) {
return this;
}
mCamera = createCamera();
// old version of Android. fall back to use SurfaceView.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
mDummySurfaceTexture = new SurfaceTexture(DUMMY_TEXTURE_NAME);
mCamera.setPreviewTexture(mDummySurfaceTexture);
} else {
mDummySurfaceView = new SurfaceView(mContext);
mCamera.setPreviewDisplay(mDummySurfaceView.getHolder());
}
mCamera.startPreview();
mProcessingThread = new Thread(mFrameProcessor);
mFrameProcessor.setActive(true);
mProcessingThread.start();
}
return this;
}
use of android.graphics.SurfaceTexture in project KISS by Neamar.
the class CameraHandler method openCamera.
private void openCamera() throws IOException {
if (camera == null) {
camera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK);
if (surfaceTexture == null) {
surfaceTexture = new SurfaceTexture(0);
camera.setPreviewTexture(surfaceTexture);
}
}
}
use of android.graphics.SurfaceTexture in project android_frameworks_base by ResurrectionRemix.
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;
}
Aggregations