Package com.leia.sdk.views
Class InputGLBinding
- java.lang.Object
-
- com.leia.sdk.views.InputGLBinding
-
- Direct Known Subclasses:
PictureGLBinding
public abstract class InputGLBinding extends Object
InputGLBinding represents a GL state of an InputViewsAsset. In general, this class is designed to be used only from a GL thread and is not thread-safe. But it also gracefully handles when GL context is lost, so it's safe to release it from a non-GL thread. InputGLBinding is weakly coupled to InputViewsAsset because GL state is owned by GL thread but InputGLBinding is invalidated when the original InputViewsAsset is released.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
InputGLBinding.SRGBConfig
static class
InputGLBinding.Texture
-
Field Summary
Fields Modifier and Type Field Description static int
GL_TEXTURE_PROTECTED_EXT
When InterlacedSurfaceView configured to display protected (aka DRM) content, Views texture must be set up with GL_TEXTURE_PROTECTED_EXT parameter set to GL_TRUE.protected boolean
mIsValid
InputGLBinding invalidated when it's or its asset is released.protected WeakReference<InputViewsAsset.Impl>
mWeakAsset
A weak reference to theInputViewsAsset
.InputGLBinding.SRGBConfig
preferredSRGBConfig
-
Constructor Summary
Constructors Constructor Description InputGLBinding(InputViewsAsset.Impl asset)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
Reset to the clean state and invalidate the binding.InputGLBinding.SRGBConfig
getPreferredSRGBConfig()
boolean
isValidGLContext()
Use it to determine whether GL resources can be released on this thread.protected void
logThread(String subTag)
protected abstract void
render(InterlacedRenderer renderer, int viewportWidth, int viewportHeight, boolean isRoot)
Render views using the interlacer.protected void
reset()
Reset to the clean state.protected void
update(InterlacedRenderer renderer, boolean isProtected)
Update the state.protected <T extends InputViewsAsset.Impl>
TupdateAsset(Class<T> clazz)
update(InterlacedRenderer, boolean)
must update the asset, even if it's not actually used.protected void
updateViewScreenPosition(Interlacer interlacer, int posX, int posY)
-
-
-
Field Detail
-
GL_TEXTURE_PROTECTED_EXT
public static int GL_TEXTURE_PROTECTED_EXT
When InterlacedSurfaceView configured to display protected (aka DRM) content, Views texture must be set up with GL_TEXTURE_PROTECTED_EXT parameter set to GL_TRUE.
-
mWeakAsset
protected final WeakReference<InputViewsAsset.Impl> mWeakAsset
A weak reference to theInputViewsAsset
. Each InputGLBinding weakly references its asset. When the asset release detected (GC orInputViewsAsset.Impl.close()
),InputGLBinding
is reset to the clean state and invalidated.
-
mIsValid
protected volatile boolean mIsValid
InputGLBinding invalidated when it's or its asset is released. When invalidated, views texture must be released.
-
preferredSRGBConfig
public final InputGLBinding.SRGBConfig preferredSRGBConfig
-
-
Constructor Detail
-
InputGLBinding
public InputGLBinding(InputViewsAsset.Impl asset)
-
-
Method Detail
-
close
public void close()
Reset to the clean state and invalidate the binding. Safe to call from a non-GL thread if InterlacedRenderer GLThread is stopped.
-
updateAsset
protected <T extends InputViewsAsset.Impl> T updateAsset(Class<T> clazz)
update(InterlacedRenderer, boolean)
must update the asset, even if it's not actually used. This function automatically closes the binding when the asset is released.
-
isValidGLContext
public boolean isValidGLContext()
Use it to determine whether GL resources can be released on this thread. If a GL resource was allocated on another thread, there is nothing that can be done from the current thread. The GL resource is either already has been released automatically on GL context release or it will be.- Returns:
- whether the current thread is the GL thread on which this binding was initialized
-
getPreferredSRGBConfig
public final InputGLBinding.SRGBConfig getPreferredSRGBConfig()
-
update
protected void update(InterlacedRenderer renderer, boolean isProtected)
Update the state. This method is used to initialize and/or update views texture. After this method, if the binding is still valid, getViewsTexture must return a valid texture.- Parameters:
renderer
- current renderer that will interlace the views texture.isProtected
- whether the views texture should be configured as protected.- See Also:
GL_TEXTURE_PROTECTED_EXT
-
updateViewScreenPosition
protected void updateViewScreenPosition(Interlacer interlacer, int posX, int posY)
-
reset
protected void reset()
Reset to the clean state.
-
render
protected abstract void render(InterlacedRenderer renderer, int viewportWidth, int viewportHeight, boolean isRoot)
Render views using the interlacer.
-
logThread
protected void logThread(String subTag)
-
-