@Override protected void doStart() { Log.d(LOGTAG, "doStart"); startBackgroundThread(); super.doStart(); }
private void startBackgroundThread() { Log.i(LOGTAG, "startBackgroundThread"); stopBackgroundThread(); mBackgroundThread = new HandlerThread("CameraBackground"); mBackgroundThread.start(); mBackgroundHandler = new Handler(mBackgroundThread.getLooper()); }
@Override protected void setCameraPreviewSize(int width, int height) { Log.i(LOGTAG, "setCameraPreviewSize("+width+"x"+height+")"); if(mMaxCameraWidth > 0 && mMaxCameraWidth < width) width = mMaxCameraWidth; if(mMaxCameraHeight > 0 && mMaxCameraHeight < height) height = mMaxCameraHeight; try { mCameraOpenCloseLock.acquire(); boolean needReconfig = cacPreviewSize(width, height); mCameraWidth = mPreviewSize.getWidth(); mCameraHeight = mPreviewSize.getHeight(); if( !needReconfig ) { mCameraOpenCloseLock.release(); return; } if (null != mCaptureSession) { Log.d(LOGTAG, "closing existing previewSession"); mCaptureSession.close(); mCaptureSession = null; } mCameraOpenCloseLock.release(); createCameraPreviewSession(); } catch (InterruptedException e) { mCameraOpenCloseLock.release(); throw new RuntimeException("Interrupted while setCameraPreviewSize.", e); } } }
public CameraGLSurfaceView(Context context, AttributeSet attrs) { super(context, attrs); TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase); int cameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1); styledAttrs.recycle(); if (android.os.Build.VERSION.SDK_INT >= 21) mRenderer = new Camera2Renderer(this); else mRenderer = new CameraRenderer(this); setCameraIndex(cameraIndex); setEGLContextClientVersion(2); setRenderer(mRenderer); setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); }
@Override protected void setCameraPreviewSize(int width, int height) { Log.i(LOGTAG, "setCameraPreviewSize("+width+"x"+height+")"); if(mMaxCameraWidth > 0 && mMaxCameraWidth < width) width = mMaxCameraWidth; if(mMaxCameraHeight > 0 && mMaxCameraHeight < height) height = mMaxCameraHeight; try { mCameraOpenCloseLock.acquire(); boolean needReconfig = cacPreviewSize(width, height); mCameraWidth = mPreviewSize.getWidth(); mCameraHeight = mPreviewSize.getHeight(); if( !needReconfig ) { mCameraOpenCloseLock.release(); return; } if (null != mCaptureSession) { Log.d(LOGTAG, "closing existing previewSession"); mCaptureSession.close(); mCaptureSession = null; } mCameraOpenCloseLock.release(); createCameraPreviewSession(); } catch (InterruptedException e) { mCameraOpenCloseLock.release(); throw new RuntimeException("Interrupted while setCameraPreviewSize.", e); } } }
public CameraGLSurfaceView(Context context, AttributeSet attrs) { super(context, attrs); TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase); int cameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1); styledAttrs.recycle(); if(android.os.Build.VERSION.SDK_INT >= 21) mRenderer = new Camera2Renderer(this); else mRenderer = new CameraRenderer(this); setCameraIndex(cameraIndex); setEGLContextClientVersion(2); setRenderer(mRenderer); setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); }
@Override protected void setCameraPreviewSize(int width, int height) { Log.i(LOGTAG, "setCameraPreviewSize("+width+"x"+height+")"); if(mMaxCameraWidth > 0 && mMaxCameraWidth < width) width = mMaxCameraWidth; if(mMaxCameraHeight > 0 && mMaxCameraHeight < height) height = mMaxCameraHeight; try { mCameraOpenCloseLock.acquire(); boolean needReconfig = cacPreviewSize(width, height); mCameraWidth = mPreviewSize.getWidth(); mCameraHeight = mPreviewSize.getHeight(); if( !needReconfig ) { mCameraOpenCloseLock.release(); return; } if (null != mCaptureSession) { Log.d(LOGTAG, "closing existing previewSession"); mCaptureSession.close(); mCaptureSession = null; } mCameraOpenCloseLock.release(); createCameraPreviewSession(); } catch (InterruptedException e) { mCameraOpenCloseLock.release(); throw new RuntimeException("Interrupted while setCameraPreviewSize.", e); } } }
private void startBackgroundThread() { Log.i(LOGTAG, "startBackgroundThread"); stopBackgroundThread(); mBackgroundThread = new HandlerThread("CameraBackground"); mBackgroundThread.start(); mBackgroundHandler = new Handler(mBackgroundThread.getLooper()); }
@Override protected void doStart() { Log.d(LOGTAG, "doStart"); startBackgroundThread(); super.doStart(); }
public CameraGLSurfaceView(Context context, AttributeSet attrs) { super(context, attrs); TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase); int cameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1); styledAttrs.recycle(); if(android.os.Build.VERSION.SDK_INT >= 21) mRenderer = new Camera2Renderer(this); else mRenderer = new CameraRenderer(this); setCameraIndex(cameraIndex); setEGLContextClientVersion(2); setRenderer(mRenderer); setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); }
@Override protected void setCameraPreviewSize(int width, int height) { Log.i(LOGTAG, "setCameraPreviewSize("+width+"x"+height+")"); if(mMaxCameraWidth > 0 && mMaxCameraWidth < width) width = mMaxCameraWidth; if(mMaxCameraHeight > 0 && mMaxCameraHeight < height) height = mMaxCameraHeight; try { mCameraOpenCloseLock.acquire(); boolean needReconfig = cacPreviewSize(width, height); mCameraWidth = mPreviewSize.getWidth(); mCameraHeight = mPreviewSize.getHeight(); if( !needReconfig ) { mCameraOpenCloseLock.release(); return; } if (null != mCaptureSession) { Log.d(LOGTAG, "closing existing previewSession"); mCaptureSession.close(); mCaptureSession = null; } mCameraOpenCloseLock.release(); createCameraPreviewSession(); } catch (InterruptedException e) { mCameraOpenCloseLock.release(); throw new RuntimeException("Interrupted while setCameraPreviewSize.", e); } } }
private void startBackgroundThread() { Log.i(LOGTAG, "startBackgroundThread"); stopBackgroundThread(); mBackgroundThread = new HandlerThread("CameraBackground"); mBackgroundThread.start(); mBackgroundHandler = new Handler(mBackgroundThread.getLooper()); }
@Override protected void doStart() { Log.d(LOGTAG, "doStart"); startBackgroundThread(); super.doStart(); }
public CameraGLSurfaceView(Context context, AttributeSet attrs) { super(context, attrs); TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase); int cameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1); styledAttrs.recycle(); if(android.os.Build.VERSION.SDK_INT >= 21) mRenderer = new Camera2Renderer(this); else mRenderer = new CameraRenderer(this); setCameraIndex(cameraIndex); setEGLContextClientVersion(2); setRenderer(mRenderer); setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); }
@Override protected void setCameraPreviewSize(int width, int height) { Log.i(LOGTAG, "setCameraPreviewSize("+width+"x"+height+")"); if(mMaxCameraWidth > 0 && mMaxCameraWidth < width) width = mMaxCameraWidth; if(mMaxCameraHeight > 0 && mMaxCameraHeight < height) height = mMaxCameraHeight; try { mCameraOpenCloseLock.acquire(); boolean needReconfig = cacPreviewSize(width, height); mCameraWidth = mPreviewSize.getWidth(); mCameraHeight = mPreviewSize.getHeight(); if( !needReconfig ) { mCameraOpenCloseLock.release(); return; } if (null != mCaptureSession) { Log.d(LOGTAG, "closing existing previewSession"); mCaptureSession.close(); mCaptureSession = null; } mCameraOpenCloseLock.release(); createCameraPreviewSession(); } catch (InterruptedException e) { mCameraOpenCloseLock.release(); throw new RuntimeException("Interrupted while setCameraPreviewSize.", e); } } }
private void startBackgroundThread() { Log.i(LOGTAG, "startBackgroundThread"); stopBackgroundThread(); mBackgroundThread = new HandlerThread("CameraBackground"); mBackgroundThread.start(); mBackgroundHandler = new Handler(mBackgroundThread.getLooper()); }
@Override protected void doStart() { Log.d(LOGTAG, "doStart"); startBackgroundThread(); super.doStart(); }
public CameraGLSurfaceView(Context context, AttributeSet attrs) { super(context, attrs); TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase); int cameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1); styledAttrs.recycle(); if(android.os.Build.VERSION.SDK_INT >= 21) mRenderer = new Camera2Renderer(this); else mRenderer = new CameraRenderer(this); setCameraIndex(cameraIndex); setEGLContextClientVersion(2); setRenderer(mRenderer); setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); }
@Override protected void setCameraPreviewSize(int width, int height) { Log.i(LOGTAG, "setCameraPreviewSize("+width+"x"+height+")"); if(mMaxCameraWidth > 0 && mMaxCameraWidth < width) width = mMaxCameraWidth; if(mMaxCameraHeight > 0 && mMaxCameraHeight < height) height = mMaxCameraHeight; try { mCameraOpenCloseLock.acquire(); boolean needReconfig = cacPreviewSize(width, height); mCameraWidth = mPreviewSize.getWidth(); mCameraHeight = mPreviewSize.getHeight(); if( !needReconfig ) { mCameraOpenCloseLock.release(); return; } if (null != mCaptureSession) { Log.d(LOGTAG, "closing existing previewSession"); mCaptureSession.close(); mCaptureSession = null; } mCameraOpenCloseLock.release(); createCameraPreviewSession(); } catch (InterruptedException e) { mCameraOpenCloseLock.release(); throw new RuntimeException("Interrupted while setCameraPreviewSize.", e); } } }
private void startBackgroundThread() { Log.i(LOGTAG, "startBackgroundThread"); stopBackgroundThread(); mBackgroundThread = new HandlerThread("CameraBackground"); mBackgroundThread.start(); mBackgroundHandler = new Handler(mBackgroundThread.getLooper()); }