private void setView(int id, TextureView view) { if (!AndroidUtil.isICSOrLater) throw new IllegalArgumentException("TextureView not implemented in this android version"); ensureInitState(); if (view == null) throw new NullPointerException("view is null"); final SurfaceHelper surfaceHelper = mSurfaceHelpers[id]; if (surfaceHelper != null) surfaceHelper.release(); mSurfaceHelpers[id] = new SurfaceHelper(id, view); }
@Override @MainThread public void attachViews(OnNewVideoLayoutListener onNewVideoLayoutListener) { if (mSurfacesState.get() != SURFACE_STATE_INIT || mSurfaceHelpers[ID_VIDEO] == null) throw new IllegalStateException("already attached or video view not configured"); mSurfacesState.set(SURFACE_STATE_ATTACHED); synchronized (mNativeLock) { mOnNewVideoLayoutListener = onNewVideoLayoutListener; mNativeLock.buffersGeometryConfigured = false; mNativeLock.buffersGeometryAbort = false; } for (int id = 0; id < ID_MAX; ++id) { final SurfaceHelper surfaceHelper = mSurfaceHelpers[id]; if (surfaceHelper != null) surfaceHelper.attach(); } }
@MainThread private void onSurfaceCreated() { if (mSurfacesState.get() != SURFACE_STATE_ATTACHED) throw new IllegalArgumentException("invalid state"); final SurfaceHelper videoHelper = mSurfaceHelpers[ID_VIDEO]; final SurfaceHelper subtitlesHelper = mSurfaceHelpers[ID_SUBTITLES]; if (videoHelper == null) throw new NullPointerException("videoHelper shouldn't be null here"); if (videoHelper.isReady() && (subtitlesHelper == null || subtitlesHelper.isReady())) { mSurfacesState.set(SURFACE_STATE_READY); for (IVLCVout.Callback cb : mIVLCVoutCallbacks) cb.onSurfacesCreated(this); if (mSurfaceCallback != null) mSurfaceCallback.onSurfacesCreated(this); } }
@Override @MainThread public void detachViews() { if (mSurfacesState.get() == SURFACE_STATE_INIT) return; mSurfacesState.set(SURFACE_STATE_INIT); mHandler.removeCallbacksAndMessages(null); synchronized (mNativeLock) { mOnNewVideoLayoutListener = null; mNativeLock.buffersGeometryAbort = true; mNativeLock.notifyAll(); } for (int id = 0; id < ID_MAX; ++id) { final SurfaceHelper surfaceHelper = mSurfaceHelpers[id]; if (surfaceHelper != null) surfaceHelper.release(); mSurfaceHelpers[id] = null; } for (IVLCVout.Callback cb : mIVLCVoutCallbacks) cb.onSurfacesDestroyed(this); if (mSurfaceCallback != null) mSurfaceCallback.onSurfacesDestroyed(this); if (AndroidUtil.isJellyBeanOrLater) mSurfaceTextureThread.release(); }
@Override @MainThread public void detachViews() { if (mSurfacesState.get() == SURFACE_STATE_INIT) return; mSurfacesState.set(SURFACE_STATE_INIT); mHandler.removeCallbacksAndMessages(null); synchronized (mNativeLock) { mOnNewVideoLayoutListener = null; mNativeLock.buffersGeometryAbort = true; mNativeLock.notifyAll(); } for (int id = 0; id < ID_MAX; ++id) { final SurfaceHelper surfaceHelper = mSurfaceHelpers[id]; if (surfaceHelper != null) surfaceHelper.release(); mSurfaceHelpers[id] = null; } for (IVLCVout.Callback cb : mIVLCVoutCallbacks) cb.onSurfacesDestroyed(this); if (mSurfaceCallback != null) mSurfaceCallback.onSurfacesDestroyed(this); if (AndroidUtil.isJellyBeanOrLater) mSurfaceTextureThread.release(); }
@Override @MainThread public void detachViews() { if (mSurfacesState.get() == SURFACE_STATE_INIT) return; mSurfacesState.set(SURFACE_STATE_INIT); mHandler.removeCallbacksAndMessages(null); synchronized (mBuffersGeometryCond) { mBuffersGeometryCond.abort = true; mBuffersGeometryCond.notifyAll(); } for (int id = 0; id < ID_MAX; ++id) { final SurfaceHelper surfaceHelper = mSurfaceHelpers[id]; if (surfaceHelper != null) surfaceHelper.release(); mSurfaceHelpers[id] = null; } for (Callback cb : mIVLCVoutCallbacks) cb.onSurfacesDestroyed(this); if (mSurfaceCallback != null) mSurfaceCallback.onSurfacesDestroyed(this); }
@Override @MainThread public void detachViews() { if (mSurfacesState.get() == SURFACE_STATE_INIT) return; mSurfacesState.set(SURFACE_STATE_INIT); mHandler.removeCallbacksAndMessages(null); synchronized (mNativeLock) { mOnNewVideoLayoutListener = null; mNativeLock.buffersGeometryAbort = true; mNativeLock.notifyAll(); } for (int id = 0; id < ID_MAX; ++id) { final SurfaceHelper surfaceHelper = mSurfaceHelpers[id]; if (surfaceHelper != null) surfaceHelper.release(); mSurfaceHelpers[id] = null; } for (IVLCVout.Callback cb : mIVLCVoutCallbacks) cb.onSurfacesDestroyed(this); if (mSurfaceCallback != null) mSurfaceCallback.onSurfacesDestroyed(this); if (AndroidUtil.isJellyBeanOrLater) mSurfaceTextureThread.release(); }
@Override @MainThread public void detachViews() { if (mSurfacesState.get() == SURFACE_STATE_INIT) return; mSurfacesState.set(SURFACE_STATE_INIT); mHandler.removeCallbacksAndMessages(null); synchronized (mBuffersGeometryCond) { mBuffersGeometryCond.abort = true; mBuffersGeometryCond.notifyAll(); } for (int id = 0; id < ID_MAX; ++id) { final SurfaceHelper surfaceHelper = mSurfaceHelpers[id]; if (surfaceHelper != null) surfaceHelper.release(); mSurfaceHelpers[id] = null; } for (IVLCVout.Callback cb : mIVLCVoutCallbacks) cb.onSurfacesDestroyed(this); if (mSurfaceCallback != null) mSurfaceCallback.onSurfacesDestroyed(this); }
@Override public void run() { final AWindow.SurfaceHelper surfaceHelper = getSurfaceHelper(surface); final SurfaceHolder surfaceHolder = surfaceHelper != null ? surfaceHelper.getSurfaceHolder() : null; if (surfaceHolder != null) { if (surfaceHolder.getSurface().isValid()) { if (format != 0) surfaceHolder.setFormat(format); surfaceHolder.setFixedSize(width, height); } } synchronized (mNativeLock) { mNativeLock.buffersGeometryConfigured = true; mNativeLock.notifyAll(); } } });
@Override public void run() { final SurfaceHelper surfaceHelper = getSurfaceHelper(surface); final SurfaceHolder surfaceHolder = surfaceHelper != null ? surfaceHelper.getSurfaceHolder() : null; if (surfaceHolder != null) { if (surfaceHolder.getSurface().isValid()) { if (format != 0) surfaceHolder.setFormat(format); surfaceHolder.setFixedSize(width, height); } } synchronized (mNativeLock) { mNativeLock.buffersGeometryConfigured = true; mNativeLock.notifyAll(); } } });
@Override @MainThread public void attachViews() { if (mSurfacesState.get() != SURFACE_STATE_INIT || mSurfaceHelpers[ID_VIDEO] == null) throw new IllegalStateException("already attached or video view not configured"); mSurfacesState.set(SURFACE_STATE_ATTACHED); synchronized (mBuffersGeometryCond) { mBuffersGeometryCond.configured = false; mBuffersGeometryCond.abort = false; } for (int id = 0; id < ID_MAX; ++id) { final SurfaceHelper surfaceHelper = mSurfaceHelpers[id]; if (surfaceHelper != null) surfaceHelper.attach(); } }
@Override @MainThread public void attachViews(OnNewVideoLayoutListener onNewVideoLayoutListener) { if (mSurfacesState.get() != SURFACE_STATE_INIT || mSurfaceHelpers[ID_VIDEO] == null) throw new IllegalStateException("already attached or video view not configured"); mSurfacesState.set(SURFACE_STATE_ATTACHED); synchronized (mNativeLock) { mOnNewVideoLayoutListener = onNewVideoLayoutListener; mNativeLock.buffersGeometryConfigured = false; mNativeLock.buffersGeometryAbort = false; } for (int id = 0; id < ID_MAX; ++id) { final SurfaceHelper surfaceHelper = mSurfaceHelpers[id]; if (surfaceHelper != null) surfaceHelper.attach(); } }
@Override @MainThread public void attachViews(OnNewVideoLayoutListener onNewVideoLayoutListener) { if (mSurfacesState.get() != SURFACE_STATE_INIT || mSurfaceHelpers[ID_VIDEO] == null) throw new IllegalStateException("already attached or video view not configured"); mSurfacesState.set(SURFACE_STATE_ATTACHED); synchronized (mNativeLock) { mOnNewVideoLayoutListener = onNewVideoLayoutListener; mNativeLock.buffersGeometryConfigured = false; mNativeLock.buffersGeometryAbort = false; } for (int id = 0; id < ID_MAX; ++id) { final SurfaceHelper surfaceHelper = mSurfaceHelpers[id]; if (surfaceHelper != null) surfaceHelper.attach(); } }
@Override @MainThread public void attachViews() { if (mSurfacesState.get() != SURFACE_STATE_INIT || mSurfaceHelpers[ID_VIDEO] == null) throw new IllegalStateException("already attached or video view not configured"); mSurfacesState.set(SURFACE_STATE_ATTACHED); synchronized (mBuffersGeometryCond) { mBuffersGeometryCond.configured = false; mBuffersGeometryCond.abort = false; } for (int id = 0; id < ID_MAX; ++id) { final SurfaceHelper surfaceHelper = mSurfaceHelpers[id]; if (surfaceHelper != null) surfaceHelper.attach(); } }
@MainThread private void onSurfaceCreated() { if (mSurfacesState.get() != SURFACE_STATE_ATTACHED) throw new IllegalArgumentException("invalid state"); final SurfaceHelper videoHelper = mSurfaceHelpers[ID_VIDEO]; final SurfaceHelper subtitlesHelper = mSurfaceHelpers[ID_SUBTITLES]; if (videoHelper == null) throw new NullPointerException("videoHelper shouldn't be null here"); if (videoHelper.isReady() && (subtitlesHelper == null || subtitlesHelper.isReady())) { mSurfacesState.set(SURFACE_STATE_READY); for (IVLCVout.Callback cb : mIVLCVoutCallbacks) cb.onSurfacesCreated(this); if (mSurfaceCallback != null) mSurfaceCallback.onSurfacesCreated(this); } }
@Override public void run() { final AWindow.SurfaceHelper surfaceHelper = getSurfaceHelper(surface); final SurfaceHolder surfaceHolder = surfaceHelper != null ? surfaceHelper.getSurfaceHolder() : null; if (surfaceHolder != null) { if (surfaceHolder.getSurface().isValid()) { if (format != 0) surfaceHolder.setFormat(format); surfaceHolder.setFixedSize(width, height); } } synchronized (mNativeLock) { mNativeLock.buffersGeometryConfigured = true; mNativeLock.notifyAll(); } } });
@MainThread private void onSurfaceCreated() { if (mSurfacesState.get() != SURFACE_STATE_ATTACHED) throw new IllegalArgumentException("invalid state"); final SurfaceHelper videoHelper = mSurfaceHelpers[ID_VIDEO]; final SurfaceHelper subtitlesHelper = mSurfaceHelpers[ID_SUBTITLES]; if (videoHelper == null) throw new NullPointerException("videoHelper shouldn't be null here"); if (videoHelper.isReady() && (subtitlesHelper == null || subtitlesHelper.isReady())) { mSurfacesState.set(SURFACE_STATE_READY); for (IVLCVout.Callback cb : mIVLCVoutCallbacks) cb.onSurfacesCreated(this); if (mSurfaceCallback != null) mSurfaceCallback.onSurfacesCreated(this); } }
@MainThread private void onSurfaceCreated() { if (mSurfacesState.get() != SURFACE_STATE_ATTACHED) throw new IllegalArgumentException("invalid state"); final SurfaceHelper videoHelper = mSurfaceHelpers[ID_VIDEO]; final SurfaceHelper subtitlesHelper = mSurfaceHelpers[ID_SUBTITLES]; if (videoHelper == null) throw new NullPointerException("videoHelper shouldn't be null here"); if (videoHelper.isReady() && (subtitlesHelper == null || subtitlesHelper.isReady())) { mSurfacesState.set(SURFACE_STATE_READY); for (Callback cb : mIVLCVoutCallbacks) cb.onSurfacesCreated(this); if (mSurfaceCallback != null) mSurfaceCallback.onSurfacesCreated(this); } }
@MainThread private void onSurfaceCreated() { if (mSurfacesState.get() != SURFACE_STATE_ATTACHED) throw new IllegalArgumentException("invalid state"); final SurfaceHelper videoHelper = mSurfaceHelpers[ID_VIDEO]; final SurfaceHelper subtitlesHelper = mSurfaceHelpers[ID_SUBTITLES]; if (videoHelper == null) throw new NullPointerException("videoHelper shouldn't be null here"); if (videoHelper.isReady() && (subtitlesHelper == null || subtitlesHelper.isReady())) { mSurfacesState.set(SURFACE_STATE_READY); for (IVLCVout.Callback cb : mIVLCVoutCallbacks) cb.onSurfacesCreated(this); if (mSurfaceCallback != null) mSurfaceCallback.onSurfacesCreated(this); } }
private void attachSurfaceView() { mSurfaceHolder.addCallback(mSurfaceHolderCallback); setSurface(mSurfaceHolder.getSurface()); }