|
JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java (public API).
|
GLMediaPlayer interface specifies a TextureSequence state machine using a multiplexed audio/video stream as it's source.
More...
Classes | |
| class | Chapter |
Chapter meta-data of stream, see GLMediaPlayer#getChapters(). More... | |
| class | EventMask |
| Changes attributes event mask. More... | |
| interface | GLMediaEventListener |
As the contract of GLMediaFrameListener and TexSeqEventListener requests, implementations of GLMediaEventListener shall: More... | |
| interface | GLMediaFrameListener |
| enum | State |
| See Lifecycle. More... | |
| class | StreamException |
| A StreamException encapsulates a caught exception in the decoder thread, a.k.a StreamWorker, see See StreamWorker Error Handling. More... | |
Public Member Functions | |||||
| void | printNativeInfo (final PrintStream out) | ||||
| Print native library information of used implementation to given out PrintStream. More... | |||||
| int | getTextureCount () | ||||
| void | setTextureUnit (int u) | ||||
| Sets the texture unit. More... | |||||
| void | setTextureMinMagFilter (int[] minMagFilter) | ||||
Sets the texture min-mag filter, defaults to GL#GL_NEAREST. More... | |||||
| void | setTextureWrapST (int[] wrapST) | ||||
Sets the texture min-mag filter, defaults to GL#GL_CLAMP_TO_EDGE. More... | |||||
| boolean | useARatioAdjustment () | ||||
Returning true indicates texture correction for aspect-ratio in the shader.Graph's Region shader will utilize setTexCoordBBox(Texture, AABBox, boolean, float[], boolean) for texture-coordinate bounding-box calculation. Returning false indicates no correction for aspect-ratio in the shader. Graph's Region shader will utilize setTexCoordBBoxSimple(Texture, AABBox, float[], boolean) for texture-coordinate bounding-box calculation. Default value is implementation specific and toggling is optional.
| |||||
| void | setARatioAdjustment (final boolean v) | ||||
Toggles useARatioLetterbox().Default value is implementation specific and toggling is optional.
More... | |||||
| boolean | useARatioLetterbox () | ||||
Returns whether useARatioAdjustment() shall add letter-box space to match aspect-ratio, otherwise it will be zoomed in.Default value is implementation specific and toggling is optional.
More... | |||||
| Vec4f | getARatioLetterboxBackColor () | ||||
Returns useARatioLetterbox() background color for added letter-box space, defaults to transparent zero. More... | |||||
| void | setARatioLetterbox (final boolean v, Vec4f backColor) | ||||
Toggles useARatioLetterbox().Default value is implementation specific and toggling is optional. Impacts only if useARatioAdjustment() returns true.
| |||||
| void | setAudioChannelLimit (final int cc) | ||||
| Limit maximum supported audio channels by user. More... | |||||
| void | playStream (Uri streamLoc, int vid, int aid, int sid, int textureCount) throws IllegalStateException, IllegalArgumentException | ||||
| Issues asynchronous stream initialization. More... | |||||
| void | playStream (final Uri streamLoc, final int vid, final String alang, final int aid, final String slang, final int sid, final int reqTextureCount) throws IllegalStateException, IllegalArgumentException | ||||
Same as playStream(Uri, int, int, int, int), but providing desired audio- and subtile languages to be selected. More... | |||||
| void | switchStream (final int vid, final int aid, final int sid) throws IllegalStateException, IllegalArgumentException | ||||
Switches current playStream(Uri, int, int, int, int) to given stream IDs and continues at same getVideoPTS(). More... | |||||
| StreamException | getStreamException () | ||||
Returns the StreamException caught in the decoder thread, or null if none occured. More... | |||||
| void | initGL (GL gl) throws IllegalStateException, StreamException, GLException | ||||
| Initializes OpenGL related resources. More... | |||||
| AudioSink | getAudioSink () | ||||
If implementation uses a AudioSink, it's instance will be returned. More... | |||||
| State | destroy (GL gl) | ||||
Releases the GL, stream and other resources, including attached user objects. More... | |||||
| State | stop () | ||||
Stops streaming and releases the GL, stream and other resources, but keeps attached user objects. More... | |||||
| boolean | setPlaySpeed (float rate) | ||||
| Sets the playback speed. More... | |||||
| float | getPlaySpeed () | ||||
| Returns the playback speed. More... | |||||
| boolean | setAudioVolume (float v) | ||||
| Sets the audio volume, [0f..1f]. More... | |||||
| float | getAudioVolume () | ||||
| Returns the audio volume. More... | |||||
| boolean | isAudioMuted () | ||||
| Returns true if audio is muted, i.e. More... | |||||
| State | resume () | ||||
| Starts or resumes the StreamWorker decoding thread. More... | |||||
| State | pause (boolean flush) | ||||
| Pauses the StreamWorker decoding thread. More... | |||||
| int | seek (int msec) | ||||
| Seeks to the new absolute position. More... | |||||
| State | getState () | ||||
| See Lifecycle. More... | |||||
| int[] | getVStreams () | ||||
| Return an array of detected video stream IDs. More... | |||||
| String[] | getVLangs () | ||||
Return an array of detected video stream language codes, matching getVStreams() array and its indices. More... | |||||
| int | getVID () | ||||
| Return the video stream id, see audio and video Stream IDs. More... | |||||
| int | getNextVID () | ||||
| Returns the next video stream id, rotates. More... | |||||
| int[] | getAStreams () | ||||
| Return an array of detected audio stream IDs. More... | |||||
| String[] | getALangs () | ||||
Return an array of detected audio stream language codes, matching getAStreams() array and its indices. More... | |||||
| int | getAID () | ||||
| Return the audio stream id, see audio and video Stream IDs. More... | |||||
| int | getNextAID () | ||||
| Returns the next audio stream id, rotates. More... | |||||
| int[] | getSStreams () | ||||
| Return an array of detected subtitle stream IDs. More... | |||||
| String[] | getSLangs () | ||||
Return an array of detected subtitle stream language codes, matching getSStreams() array and its indices. More... | |||||
| int | getSID () | ||||
| Return the subtitle stream id, see audio and video Stream IDs. More... | |||||
| int | getNextSID () | ||||
| Returns the next subtitle stream id, rotates including no-stream. More... | |||||
| boolean | hasStreamID (int id) | ||||
| Return whether the given stream ID is available, i.e. More... | |||||
| String | getLang (int id) | ||||
Return the matching language code of given stream ID, matching one of the stream IDs in getVStreams(), getAStreams() or getSStreams(). More... | |||||
| int | getDecodedFrameCount () | ||||
| int | getPresentedFrameCount () | ||||
| PTS | getPTS () | ||||
Returns current System Clock Reference (SCR) presentation timestamp (PTS). More... | |||||
| int | getVideoPTS () | ||||
Returns current video presentation timestamp (PTS) in milliseconds of getLastTexture(), try using getPTS(). More... | |||||
| int | getAudioPTS () | ||||
Returns current audio presentation timestamp (PTS) in milliseconds, try using getPTS(). More... | |||||
| TextureSequence.TextureFrame | getLastTexture () throws IllegalStateException | ||||
Returns the last updated texture.In case the instance is just initialized, it shall return a TextureFrame object with valid attributes. The texture content may be undefined until the first call of getNextTexture(GL).Not blocking.
| |||||
| TextureSequence.TextureFrame | getNextTexture (GL gl) throws IllegalStateException | ||||
Returns the next texture to be rendered.Implementation shall return the next frame if available, may block if a next frame may arrive soon. Otherwise implementation shall return the last frame. Shall return null in case no next or last frame is available.
| |||||
| Uri | getUri () | ||||
Return the stream location, as set by playStream(Uri, int, int, int, int). More... | |||||
| CodecID | getVideoCodecID () | ||||
| Warning: Optional information, may not be supported by implementation. More... | |||||
| String | getVideoCodec () | ||||
| Warning: Optional information, may not be supported by implementation. More... | |||||
| CodecID | getAudioCodecID () | ||||
| Warning: Optional information, may not be supported by implementation. More... | |||||
| String | getAudioCodec () | ||||
| Warning: Optional information, may not be supported by implementation. More... | |||||
| CodecID | getSubtitleCodecID () | ||||
| Warning: Optional information, may not be supported by implementation. More... | |||||
| String | getSubtitleCodec () | ||||
| Warning: Optional information, may not be supported by implementation. More... | |||||
| int | getVideoFrames () | ||||
| Warning: Optional information, may not be supported by implementation. More... | |||||
| int | getAudioFrames () | ||||
| Warning: Optional information, may not be supported by implementation. More... | |||||
| int | getDuration () | ||||
| Return total duration of stream in msec. More... | |||||
| long | getStreamBitrate () | ||||
| Warning: Optional information, may not be supported by implementation. More... | |||||
| int | getVideoBitrate () | ||||
| Warning: Optional information, may not be supported by implementation. More... | |||||
| int | getAudioBitrate () | ||||
| Warning: Optional information, may not be supported by implementation. More... | |||||
| float | getFramerate () | ||||
| Warning: Optional information, may not be supported by implementation. More... | |||||
| boolean | isGLOriented () | ||||
Returns true if the video frame is oriented in OpenGL's coordinate system, origin at bottom left. More... | |||||
| int | getWidth () | ||||
| Returns the width of the video. More... | |||||
| int | getHeight () | ||||
| Returns the height of the video. More... | |||||
| String | getTitle () | ||||
Returns title meta-data from stream, available after State#Initialized is reached after issuing playStream(Uri, int, int, int, int). More... | |||||
| Chapter[] | getChapters () | ||||
Returns Chapter meta-data from stream, available after State#Initialized is reached after issuing playStream(Uri, int, int, int, int). More... | |||||
| Chapter | getChapter (int msec) | ||||
Returns Chapter covering given time position in milliseconds or null if none covers given time. More... | |||||
| String | toString () | ||||
| Returns a string representation of this player, incl. More... | |||||
| String | getPerfString () | ||||
| Returns a string representation of this player's performance values. More... | |||||
| void | addEventListener (GLMediaEventListener l) | ||||
Adds a GLMediaEventListener to this player. More... | |||||
| void | removeEventListener (GLMediaEventListener l) | ||||
Removes a GLMediaEventListener to this player. More... | |||||
| GLMediaEventListener[] | getEventListeners () | ||||
Return all GLMediaEventListener of this player. More... | |||||
| void | addFrameListener (GLMediaFrameListener l) | ||||
Adds a GLMediaFrameListener to this player. More... | |||||
| void | removeFrameListener (GLMediaFrameListener l) | ||||
Removes a GLMediaFrameListener to this player. More... | |||||
| GLMediaFrameListener[] | getFrameListeners () | ||||
Return all GLMediaFrameListener of this player. More... | |||||
| void | setSubtitleEventListener (SubtitleEventListener l) | ||||
Sets the SubtitleEventListener for this player. More... | |||||
| SubtitleEventListener | getSubtitleEventListener () | ||||
Returns the setSubtitleEventListener(SubtitleEventListener) of this player. More... | |||||
| Object | getAttachedObject (String name) | ||||
| Returns the attached user object for the given name. More... | |||||
| Object | attachObject (String name, Object obj) | ||||
| Attaches the user object for the given name. More... | |||||
| Object | detachObject (String name) | ||||
| Detaches the user object for the given name. More... | |||||
Public Member Functions inherited from com.jogamp.opengl.util.texture.TextureSequence | |||||
| int | getTextureTarget () | ||||
| Returns the texture target used by implementation. More... | |||||
| int | getTextureUnit () | ||||
| Return the texture unit used to render the current frame. More... | |||||
| int[] | getTextureMinMagFilter () | ||||
| int[] | getTextureWrapST () | ||||
| boolean | useARatioAdjustment () | ||||
Returning true indicates texture correction for aspect-ratio in the shader. More... | |||||
| void | setARatioAdjustment (final boolean v) | ||||
Toggles useARatioLetterbox(). More... | |||||
| boolean | useARatioLetterbox () | ||||
Returns whether useARatioAdjustment() shall add letter-box space to match aspect-ratio, otherwise it will be zoomed in. More... | |||||
| Vec4f | getARatioLetterboxBackColor () | ||||
Returns useARatioLetterbox() background color for added letter-box space, defaults to transparent zero. More... | |||||
| void | setARatioLetterbox (final boolean v, Vec4f backColor) | ||||
Toggles useARatioLetterbox(). More... | |||||
| boolean | isTextureAvailable () | ||||
Returns true if texture source is ready and a texture is available via getNextTexture(GL) and getLastTexture(). More... | |||||
| TextureFrame | getLastTexture () throws IllegalStateException | ||||
| Returns the last updated texture. More... | |||||
| TextureFrame | getNextTexture (GL gl) throws IllegalStateException | ||||
| Returns the next texture to be rendered. More... | |||||
| String | getRequiredExtensionsShaderStub () throws IllegalStateException | ||||
| In case a shader extension is required, based on the implementation and the runtime GL profile, this method returns the preprocessor macros, e.g. More... | |||||
| String | getTextureSampler2DType () throws IllegalStateException | ||||
Returns either sampler2D or samplerExternalOES depending on getLastTexture(). More... | |||||
| String | setTextureLookupFunctionName (String texLookupFuncName) throws IllegalStateException | ||||
| Set the desired shader code's texture lookup function name. More... | |||||
| String | getTextureLookupFunctionName () throws IllegalStateException | ||||
Returns the chosen lookup function name, which can be set via setTextureLookupFunctionName(String). More... | |||||
| String | getTextureLookupFragmentShaderImpl () throws IllegalStateException | ||||
| Returns the complete texture2D lookup function code of type. More... | |||||
| String | getTextureFragmentShaderHashID () | ||||
Returns the concatenated string representing the following values utilized for getTextureFragmentShaderHashCode(). More... | |||||
| int | getTextureFragmentShaderHashCode () | ||||
Returns the hash code of the string getTextureFragmentShaderHashID(). More... | |||||
Static Public Attributes | |
| static final boolean | DEBUG = Debug.debug("GLMediaPlayer") |
| static final boolean | DEBUG_AVSYNC = Debug.debug("GLMediaPlayer.AVSync") |
| static final boolean | DEBUG_NATIVE = Debug.debug("GLMediaPlayer.Native") |
| static final int | TEXTURE_COUNT_DEFAULT = 3 |
| Default texture count, value {@value}. More... | |
| static final int | TEXTURE_COUNT_MIN = 1 |
| Minimum texture count, value {@value}. More... | |
| static final int | STREAM_ID_NONE = -2 |
| Constant {@value} for mute or not available. More... | |
| static final int | STREAM_ID_AUTO = -1 |
| Constant {@value} for auto or unspecified. More... | |
| static final Uri.Encoded | CameraInputScheme = Uri.Encoded.cast("camera") |
Uri scheme name {@value} for camera input. More... | |
| static final String | CameraPropSizeS = "size" |
| Camera property {@value}, size as string, e.g. More... | |
| static final String | CameraPropWidth = "width" |
| Camera property {@value}. More... | |
| static final String | CameraPropHeight = "height" |
| Camera property {@value}. More... | |
| static final String | CameraPropRate = "rate" |
| Camera property {@value}. More... | |
| static final int | MAX_VIDEO_ASYNC = 22 |
| Maximum video frame async of {@value} milliseconds. More... | |
| static final int | MIN_VIDEO_ASYNC = 11 |
Static Public Attributes inherited from com.jogamp.opengl.util.texture.TextureSequence | |
| static final String | samplerExternalOES = "samplerExternalOES" |
| static final String | sampler2D = "sampler2D" |
Additional Inherited Members | |
Static Public Member Functions inherited from com.jogamp.opengl.util.texture.TextureSequence | |
| static void | setTexCoordBBoxSimple (final Texture tex, final AABBox box, final float[] colorTexBBox, final boolean verbose) |
| Calculates the texture coordinates bounding box w/o correcting aspect-ratio. More... | |
| static void | setTexCoordBBox (final Texture tex, final AABBox box, final boolean letterBox, final float[] colorTexBBox, final boolean verbose) |
| Calculates the texture coordinates bounding box while correcting for aspect-ratio. More... | |
GLMediaPlayer interface specifies a TextureSequence state machine using a multiplexed audio/video stream as it's source.
Audio maybe supported and played back internally or via an AudioSink implementation.
Audio and video streams can be selected or muted via playStream(Uri, int, int, int, int) or playStream(Uri, int, String, int, String, int, int) using the appropriate stream id's.
Camera input can be selected using the CameraInputScheme Uri.
Most of the stream processing is performed on the decoding thread, a.k.a. StreamWorker:
playStream(..) - User gets notified whether the stream has been initialized or not via attributesChanges(..). newFrameAvailable(...). StreamExceptions. StreamWorker generates it's own GLContext, shared with the one passed to initGL(GL). The shared GLContext allows the decoding thread to push the video frame data directly into the designated TextureFrame, later returned via getNextTexture(GL) and used by the user.
<h7>StreamWorker Error Handling</h7>
Caught exceptions on StreamWorker are delivered as StreamExceptions, which either degrades the State to State#Uninitialized or State#Paused.
An occurring StreamException triggers a EVENT_CHANGE_ERR event, which can be listened to via GLMediaEventListener#attributesChanged(GLMediaPlayer, int, long).
An occurred StreamException can be read via getStreamException().
| Action | State Before | State After | Event |
|---|---|---|---|
playStream(Uri, int, int, int, int) | Uninitialized | Initialized1, Uninitialized | Init or ( Error + Uninit ) |
initGL(GL) | Initialized, Uninitialized | Playing, Uninitialized | Play or ( Error + Uninit ) |
pause(boolean) | Playing | Paused | Pause |
resume() | Paused | Playing | Play |
stop() | Playing, Paused | Uninitialized | Pause |
seek(int) | Paused, Playing | Paused, Playing | none |
getNextTexture(GL) | any | same | none |
getLastTexture() | any | same | none |
END_OF_STREAM | Playing | Paused | EOS + Pause |
StreamException | any | Paused, Uninitialized | Error + ( Pause or Uninit ) |
destroy(GL) | any | Uninitialized | Uninit |
| value | request | get |
|---|---|---|
STREAM_ID_NONE | mute | not available |
STREAM_ID_AUTO | auto | unspecified |
| ≥0 | specific stream | specific stream |
Current implementations (check each API doc link for details):
jogamp.opengl.util.av.NullGLMediaPlayer jogamp.opengl.util.av.impl.OMXGLMediaPlayer jogamp.opengl.util.av.impl.FFMPEGMediaPlayer jogamp.opengl.android.av.AndroidGLMediaPlayerAPI14 Implementations of this interface must implement:
public static final boolean isAvailable();
to be properly considered by GLMediaPlayerFactory#create(ClassLoader, String) and GLMediaPlayerFactory#createDefault().
Timestamp type and value range has been chosen to suit embedded CPUs and characteristics of audio and video streaming. See TimeFrameI.
The class follows a passive A/V synchronization pattern. Audio is being untouched, while getNextTexture(GL) delivers a new video frame only, if its timestamp is less than MAX_VIDEO_ASYNC ahead of time. If its timestamp is more than MAX_VIDEO_ASYNC ahead of time, the previous frame is returned. If its timestamp is more than MAX_VIDEO_ASYNC after time, the frame is dropped and the next frame is being fetched.
https://en.wikipedia.org/wiki/Audio_to_video_synchronization
d_av = v_pts - a_pts;
Recommendation of audio/video pts time lead/lag at production:
Recommendation of av pts time lead/lag at presentation:
Definition at line 197 of file GLMediaPlayer.java.
| void com.jogamp.opengl.util.av.GLMediaPlayer.addEventListener | ( | GLMediaEventListener | l | ) |
| void com.jogamp.opengl.util.av.GLMediaPlayer.addFrameListener | ( | GLMediaFrameListener | l | ) |
Adds a GLMediaFrameListener to this player.
| Object com.jogamp.opengl.util.av.GLMediaPlayer.attachObject | ( | String | name, |
| Object | obj | ||
| ) |
Attaches the user object for the given name.
Returns the previously set object, may be null.
Releases the GL, stream and other resources, including attached user objects.
Lifecycle: ANY -> State#Uninitialized
| Object com.jogamp.opengl.util.av.GLMediaPlayer.detachObject | ( | String | name | ) |
Detaches the user object for the given name.
Returns the previously set object, may be null.
| int com.jogamp.opengl.util.av.GLMediaPlayer.getAID | ( | ) |
Return the audio stream id, see audio and video Stream IDs.
| String[] com.jogamp.opengl.util.av.GLMediaPlayer.getALangs | ( | ) |
Return an array of detected audio stream language codes, matching getAStreams() array and its indices.
The language code is supposed to be 3-letters of ISO 639-2 language codes.
| Vec4f com.jogamp.opengl.util.av.GLMediaPlayer.getARatioLetterboxBackColor | ( | ) |
Returns useARatioLetterbox() background color for added letter-box space, defaults to transparent zero.
Implements com.jogamp.opengl.util.texture.TextureSequence.
| int[] com.jogamp.opengl.util.av.GLMediaPlayer.getAStreams | ( | ) |
Return an array of detected audio stream IDs.
| Object com.jogamp.opengl.util.av.GLMediaPlayer.getAttachedObject | ( | String | name | ) |
Returns the attached user object for the given name.
| int com.jogamp.opengl.util.av.GLMediaPlayer.getAudioBitrate | ( | ) |
Warning: Optional information, may not be supported by implementation.
| String com.jogamp.opengl.util.av.GLMediaPlayer.getAudioCodec | ( | ) |
Warning: Optional information, may not be supported by implementation.
| CodecID com.jogamp.opengl.util.av.GLMediaPlayer.getAudioCodecID | ( | ) |
Warning: Optional information, may not be supported by implementation.
CodecID of the audio stream, if available | int com.jogamp.opengl.util.av.GLMediaPlayer.getAudioFrames | ( | ) |
Warning: Optional information, may not be supported by implementation.
| int com.jogamp.opengl.util.av.GLMediaPlayer.getAudioPTS | ( | ) |
Returns current audio presentation timestamp (PTS) in milliseconds, try using getPTS().
The relative millisecond PTS since start of the presentation stored in integer covers a time span of 2'147'483'647 ms (see Integer#MAX_VALUE or 2'147'483 seconds or 24.855 days.
| AudioSink com.jogamp.opengl.util.av.GLMediaPlayer.getAudioSink | ( | ) |
If implementation uses a AudioSink, it's instance will be returned.
The AudioSink instance is available after playStream(Uri, int, int, int, int), if used by implementation.
| float com.jogamp.opengl.util.av.GLMediaPlayer.getAudioVolume | ( | ) |
Returns the audio volume.
| Chapter com.jogamp.opengl.util.av.GLMediaPlayer.getChapter | ( | int | msec | ) |
Returns Chapter covering given time position in milliseconds or null if none covers given time.
| msec | desired chapter covering time position in milliseconds |
| Chapter[] com.jogamp.opengl.util.av.GLMediaPlayer.getChapters | ( | ) |
Returns Chapter meta-data from stream, available after State#Initialized is reached after issuing playStream(Uri, int, int, int, int).
| int com.jogamp.opengl.util.av.GLMediaPlayer.getDecodedFrameCount | ( | ) |
resume() and seek(int) as increased by getNextTexture(GL) or the decoding thread. | int com.jogamp.opengl.util.av.GLMediaPlayer.getDuration | ( | ) |
Return total duration of stream in msec.
The duration stored in integer covers 2'147'483'647 ms (see Integer#MAX_VALUE or 2'147'483 seconds or 24.855 days.
| GLMediaEventListener[] com.jogamp.opengl.util.av.GLMediaPlayer.getEventListeners | ( | ) |
Return all GLMediaEventListener of this player.
| GLMediaFrameListener[] com.jogamp.opengl.util.av.GLMediaPlayer.getFrameListeners | ( | ) |
Return all GLMediaFrameListener of this player.
| float com.jogamp.opengl.util.av.GLMediaPlayer.getFramerate | ( | ) |
Warning: Optional information, may not be supported by implementation.
| int com.jogamp.opengl.util.av.GLMediaPlayer.getHeight | ( | ) |
Returns the height of the video.
| String com.jogamp.opengl.util.av.GLMediaPlayer.getLang | ( | int | id | ) |
Return the matching language code of given stream ID, matching one of the stream IDs in getVStreams(), getAStreams() or getSStreams().
The language code is supposed to be 3-letters of ISO 639-2 language codes.
If the stream ID is not available, und is returned
| TextureSequence.TextureFrame com.jogamp.opengl.util.av.GLMediaPlayer.getLastTexture | ( | ) | throws IllegalStateException |
Returns the last updated texture.In case the instance is just initialized, it shall return a TextureFrame object with valid attributes. The texture content may be undefined until the first call of getNextTexture(GL).
Not blocking.
| IllegalStateException | if instance is not initialized |
Returns the last decoded Video TextureSequence.TextureFrame.
See audio and video synchronization.
| IllegalStateException | if not invoked in State#Paused or State#Playing |
Implements com.jogamp.opengl.util.texture.TextureSequence.
| int com.jogamp.opengl.util.av.GLMediaPlayer.getNextAID | ( | ) |
Returns the next audio stream id, rotates.
| int com.jogamp.opengl.util.av.GLMediaPlayer.getNextSID | ( | ) |
Returns the next subtitle stream id, rotates including no-stream.
| TextureSequence.TextureFrame com.jogamp.opengl.util.av.GLMediaPlayer.getNextTexture | ( | GL | gl | ) | throws IllegalStateException |
Returns the next texture to be rendered.Implementation shall return the next frame if available, may block if a next frame may arrive soon. Otherwise implementation shall return the last frame. Shall return null in case no next or last frame is available.
| IllegalStateException | if instance is not initialized |
Returns the next Video TextureSequence.TextureFrame to be rendered in sync with getPTS() and keeps decoding going.
In case the current state is not State#Playing, getLastTexture() is returned.
See audio and video synchronization.
| IllegalStateException | if not invoked in State#Paused or State#Playing |
Implements com.jogamp.opengl.util.texture.TextureSequence.
| int com.jogamp.opengl.util.av.GLMediaPlayer.getNextVID | ( | ) |
Returns the next video stream id, rotates.
| String com.jogamp.opengl.util.av.GLMediaPlayer.getPerfString | ( | ) |
Returns a string representation of this player's performance values.
| float com.jogamp.opengl.util.av.GLMediaPlayer.getPlaySpeed | ( | ) |
Returns the playback speed.
| int com.jogamp.opengl.util.av.GLMediaPlayer.getPresentedFrameCount | ( | ) |
resume() and seek(int) as increased by getNextTexture(GL) for new frames. | PTS com.jogamp.opengl.util.av.GLMediaPlayer.getPTS | ( | ) |
Returns current System Clock Reference (SCR) presentation timestamp (PTS).
To retrieve the current interpolated PTS against the stored System Clock Reference (SCR), use:
int pts = mPlayer.getPTS().get(Clock.currentMillis());
| int com.jogamp.opengl.util.av.GLMediaPlayer.getSID | ( | ) |
Return the subtitle stream id, see audio and video Stream IDs.
| String[] com.jogamp.opengl.util.av.GLMediaPlayer.getSLangs | ( | ) |
Return an array of detected subtitle stream language codes, matching getSStreams() array and its indices.
The language code is supposed to be 3-letters of ISO 639-2 language codes.
| int[] com.jogamp.opengl.util.av.GLMediaPlayer.getSStreams | ( | ) |
Return an array of detected subtitle stream IDs.
| State com.jogamp.opengl.util.av.GLMediaPlayer.getState | ( | ) |
See Lifecycle.
State#Uninitialized, State#Initialized, State#Playing or State#Paused | long com.jogamp.opengl.util.av.GLMediaPlayer.getStreamBitrate | ( | ) |
Warning: Optional information, may not be supported by implementation.
| StreamException com.jogamp.opengl.util.av.GLMediaPlayer.getStreamException | ( | ) |
Returns the StreamException caught in the decoder thread, or null if none occured.
Method clears the cached StreamException, hence an immediate subsequent call will return null.
| String com.jogamp.opengl.util.av.GLMediaPlayer.getSubtitleCodec | ( | ) |
Warning: Optional information, may not be supported by implementation.
| CodecID com.jogamp.opengl.util.av.GLMediaPlayer.getSubtitleCodecID | ( | ) |
Warning: Optional information, may not be supported by implementation.
CodecID of the subtitle stream, if available | SubtitleEventListener com.jogamp.opengl.util.av.GLMediaPlayer.getSubtitleEventListener | ( | ) |
Returns the setSubtitleEventListener(SubtitleEventListener) of this player.
| int com.jogamp.opengl.util.av.GLMediaPlayer.getTextureCount | ( | ) |
| String com.jogamp.opengl.util.av.GLMediaPlayer.getTitle | ( | ) |
Returns title meta-data from stream, available after State#Initialized is reached after issuing playStream(Uri, int, int, int, int).
In case no title meta-data is being used, the getUri() basename w/o suffix is being returned.
| Uri com.jogamp.opengl.util.av.GLMediaPlayer.getUri | ( | ) |
Return the stream location, as set by playStream(Uri, int, int, int, int).
| int com.jogamp.opengl.util.av.GLMediaPlayer.getVID | ( | ) |
Return the video stream id, see audio and video Stream IDs.
| int com.jogamp.opengl.util.av.GLMediaPlayer.getVideoBitrate | ( | ) |
Warning: Optional information, may not be supported by implementation.
| String com.jogamp.opengl.util.av.GLMediaPlayer.getVideoCodec | ( | ) |
Warning: Optional information, may not be supported by implementation.
| CodecID com.jogamp.opengl.util.av.GLMediaPlayer.getVideoCodecID | ( | ) |
Warning: Optional information, may not be supported by implementation.
CodecID of the video stream, if available | int com.jogamp.opengl.util.av.GLMediaPlayer.getVideoFrames | ( | ) |
Warning: Optional information, may not be supported by implementation.
| int com.jogamp.opengl.util.av.GLMediaPlayer.getVideoPTS | ( | ) |
Returns current video presentation timestamp (PTS) in milliseconds of getLastTexture(), try using getPTS().
The relative millisecond PTS since start of the presentation stored in integer covers a time span of 2'147'483'647 ms (see Integer#MAX_VALUE or 2'147'483 seconds or 24.855 days.
| String[] com.jogamp.opengl.util.av.GLMediaPlayer.getVLangs | ( | ) |
Return an array of detected video stream language codes, matching getVStreams() array and its indices.
The language code is supposed to be 3-letters of ISO 639-2 language codes.
| int[] com.jogamp.opengl.util.av.GLMediaPlayer.getVStreams | ( | ) |
Return an array of detected video stream IDs.
| int com.jogamp.opengl.util.av.GLMediaPlayer.getWidth | ( | ) |
Returns the width of the video.
| boolean com.jogamp.opengl.util.av.GLMediaPlayer.hasStreamID | ( | int | id | ) |
Return whether the given stream ID is available, i.e.
matching one of the stream IDs in getVStreams(), getAStreams() or getSStreams().
| void com.jogamp.opengl.util.av.GLMediaPlayer.initGL | ( | GL | gl | ) | throws IllegalStateException, StreamException, GLException |
Initializes OpenGL related resources.
Lifecycle: State#Initialized -> State#Paused or State#Initialized
Argument gl is ignored if video is muted, see playStream(Uri, int, int, int, int).
| gl | current GL object. Maybe null, for audio only. |
| IllegalStateException | if not invoked in State#Initialized. |
| StreamException | forwarded from the off-thread stream initialization |
| GLException | in case of difficulties to initialize the GL resources |
| boolean com.jogamp.opengl.util.av.GLMediaPlayer.isAudioMuted | ( | ) |
Returns true if audio is muted, i.e.
setAudioVolume(float) to zero.
| boolean com.jogamp.opengl.util.av.GLMediaPlayer.isGLOriented | ( | ) |
Returns true if the video frame is oriented in OpenGL's coordinate system, origin at bottom left.
Otherwise returns false, i.e. video frame is oriented origin at top left.
false is the default assumption for videos, but user shall not rely on.
false GL orientation leads to Texture#getMustFlipVertically() == true, as reflected by all TextureFrame's Textures retrieved via getLastTexture() or getNextTexture(GL).
| State com.jogamp.opengl.util.av.GLMediaPlayer.pause | ( | boolean | flush | ) |
Pauses the StreamWorker decoding thread.
Lifecycle: State#Playing -> State#Paused
If a new frame is desired after the next resume() call, e.g. to make a snapshot of a camera input stream, flush shall be set to true.
| flush | if true flushes the video and audio buffers, otherwise keep them intact. |
| void com.jogamp.opengl.util.av.GLMediaPlayer.playStream | ( | final Uri | streamLoc, |
| final int | vid, | ||
| final String | alang, | ||
| final int | aid, | ||
| final String | slang, | ||
| final int | sid, | ||
| final int | reqTextureCount | ||
| ) | throws IllegalStateException, IllegalArgumentException |
Same as playStream(Uri, int, int, int, int), but providing desired audio- and subtile languages to be selected.
| streamLoc | the stream location |
| vid | video stream id, see audio and video Stream IDs |
| alang | desired audio language, pass null to use aid |
| aid | fallback audio stream id in case alang is null, see audio and video Stream IDs |
| slang | desired subtitle language, pass null to use sid |
| sid | fallback subtitle stream id in case alang is null, see audio and video Stream IDs |
| textureCount | desired number of buffered textures to be decoded off-thread, will be validated by implementation. The minimum value is TEXTURE_COUNT_MIN (single-threaded) or above to enable multi-threaded stream decoding. Default is TEXTURE_COUNT_DEFAULT. Value is ignored if video is muted. |
| IllegalStateException | if not invoked in State#Uninitialized |
| IllegalArgumentException | if arguments are invalid |
| void com.jogamp.opengl.util.av.GLMediaPlayer.playStream | ( | Uri | streamLoc, |
| int | vid, | ||
| int | aid, | ||
| int | sid, | ||
| int | textureCount | ||
| ) | throws IllegalStateException, IllegalArgumentException |
Issues asynchronous stream initialization.
Lifecycle: State#Uninitialized -> State#Initialized1 or State#Uninitialized
State#Initialized is reached asynchronous, i.e. user gets notified via attributesChanges(..).
A possible caught asynchronous StreamException while initializing the stream off-thread will be thrown at initGL(GL).
Muted audio can be achieved by passing STREAM_ID_NONE to aid.
Muted video can be achieved by passing STREAM_ID_NONE to vid, in which case textureCount is ignored as well as the passed GL object of the subsequent initGL(GL) call.
| streamLoc | the stream location |
| vid | video stream id, see audio and video Stream IDs |
| aid | audio stream id, see audio and video Stream IDs |
| sid | subtitle stream id, see audio and video Stream IDs |
| textureCount | desired number of buffered textures to be decoded off-thread, will be validated by implementation. The minimum value is TEXTURE_COUNT_MIN (single-threaded) or above to enable multi-threaded stream decoding. Default is TEXTURE_COUNT_DEFAULT. Value is ignored if video is muted. |
| IllegalStateException | if not invoked in State#Uninitialized |
| IllegalArgumentException | if arguments are invalid |
| void com.jogamp.opengl.util.av.GLMediaPlayer.printNativeInfo | ( | final PrintStream | out | ) |
Print native library information of used implementation to given out PrintStream.
| void com.jogamp.opengl.util.av.GLMediaPlayer.removeEventListener | ( | GLMediaEventListener | l | ) |
Removes a GLMediaEventListener to this player.
| void com.jogamp.opengl.util.av.GLMediaPlayer.removeFrameListener | ( | GLMediaFrameListener | l | ) |
Removes a GLMediaFrameListener to this player.
| State com.jogamp.opengl.util.av.GLMediaPlayer.resume | ( | ) |
Starts or resumes the StreamWorker decoding thread.
Lifecycle: State#Paused -> State#Playing
| int com.jogamp.opengl.util.av.GLMediaPlayer.seek | ( | int | msec | ) |
Seeks to the new absolute position.
The StreamWorker decoding thread is paused while doing so and the A/V buffers are flushed.
Allowed in state State#Playing and State#Paused, otherwise ignored, see Lifecycle.
| msec | absolute desired time position in milliseconds |
| void com.jogamp.opengl.util.av.GLMediaPlayer.setARatioAdjustment | ( | final boolean | v | ) |
Toggles useARatioLetterbox().Default value is implementation specific and toggling is optional.
Defaults to true and toggling is not supported.
Implements com.jogamp.opengl.util.texture.TextureSequence.
| void com.jogamp.opengl.util.av.GLMediaPlayer.setARatioLetterbox | ( | final boolean | v, |
| Vec4f | backColor | ||
| ) |
Toggles useARatioLetterbox().Default value is implementation specific and toggling is optional. Impacts only if useARatioAdjustment() returns true.
| v | new value for useARatioLetterbox() |
| backColor | optional background color for added letter-box space, defaults to transparent zero |
Defaults to false.
Implements com.jogamp.opengl.util.texture.TextureSequence.
| void com.jogamp.opengl.util.av.GLMediaPlayer.setAudioChannelLimit | ( | final int | cc | ) |
Limit maximum supported audio channels by user.
Must be set before playStream(Uri, int, int, int, int)
May be utilized to enforce 1 channel (mono) downsampling in combination with JOAL/OpenAL to experience spatial 3D position effects.
| cc | maximum supported audio channels, will be clipped [1..x], with x being the underlying audio subsystem's maximum |
| boolean com.jogamp.opengl.util.av.GLMediaPlayer.setAudioVolume | ( | float | v | ) |
Sets the audio volume, [0f..1f].
To simplify test, volume is normalized, i.e.
0.0f: if Math.abs(v) < 0.01f 1.0f: if Math.abs(1.0f - v) < 0.01f | boolean com.jogamp.opengl.util.av.GLMediaPlayer.setPlaySpeed | ( | float | rate | ) |
Sets the playback speed.
To simplify test, play speed is normalized, i.e.
1.0f: if Math.abs(1.0f - rate) < 0.01f | void com.jogamp.opengl.util.av.GLMediaPlayer.setSubtitleEventListener | ( | SubtitleEventListener | l | ) |
| void com.jogamp.opengl.util.av.GLMediaPlayer.setTextureMinMagFilter | ( | int[] | minMagFilter | ) |
Sets the texture min-mag filter, defaults to GL#GL_NEAREST.
| void com.jogamp.opengl.util.av.GLMediaPlayer.setTextureUnit | ( | int | u | ) |
Sets the texture unit.
Defaults to 0.
| void com.jogamp.opengl.util.av.GLMediaPlayer.setTextureWrapST | ( | int[] | wrapST | ) |
Sets the texture min-mag filter, defaults to GL#GL_CLAMP_TO_EDGE.
| State com.jogamp.opengl.util.av.GLMediaPlayer.stop | ( | ) |
Stops streaming and releases the GL, stream and other resources, but keeps attached user objects.
Lifecycle: ANY -> State#Uninitialized
| void com.jogamp.opengl.util.av.GLMediaPlayer.switchStream | ( | final int | vid, |
| final int | aid, | ||
| final int | sid | ||
| ) | throws IllegalStateException, IllegalArgumentException |
Switches current playStream(Uri, int, int, int, int) to given stream IDs and continues at same getVideoPTS().
Implementation just issues stop(), seek(int) and playStream(Uri, int, int, int, int).
| vid | video stream id, see audio and video Stream IDs |
| aid | audio stream id, see audio and video Stream IDs |
| sid | subtitle stream id, see audio and video Stream IDs |
| IllegalStateException | |
| IllegalArgumentException |
| String com.jogamp.opengl.util.av.GLMediaPlayer.toString | ( | ) |
Returns a string representation of this player, incl.
state and audio/video details.
| boolean com.jogamp.opengl.util.av.GLMediaPlayer.useARatioAdjustment | ( | ) |
Returning true indicates texture correction for aspect-ratio in the shader.Graph's Region shader will utilize setTexCoordBBox(Texture, AABBox, boolean, float[], boolean) for texture-coordinate bounding-box calculation. Returning false indicates no correction for aspect-ratio in the shader. Graph's Region shader will utilize setTexCoordBBoxSimple(Texture, AABBox, float[], boolean) for texture-coordinate bounding-box calculation. Default value is implementation specific and toggling is optional.
Defaults to true and toggling not supported.
Implements com.jogamp.opengl.util.texture.TextureSequence.
| boolean com.jogamp.opengl.util.av.GLMediaPlayer.useARatioLetterbox | ( | ) |
Returns whether useARatioAdjustment() shall add letter-box space to match aspect-ratio, otherwise it will be zoomed in.Default value is implementation specific and toggling is optional.
Defaults to false and toggling is supported via setARatioLetterbox(boolean, Vec4f)
Implements com.jogamp.opengl.util.texture.TextureSequence.
|
static |
Uri scheme name {@value} for camera input.
E.g. camera:/0 for the 1st camera device.
The Uri path is being used to identify the camera (<id>), where the root fwd-slash is being cut-off.
The <id> is usually an integer value indexing the camera ranging from [0..max-number].
The <somewhere> is usually empty, since it would imply a networking camera protocol.
The Uri query is used to pass options to the camera using ; as the separator. The latter avoids trouble w/ escaping.
camera:/<id> camera:/<id>?width=640;height=480;rate=15 camera:/<id>?size=640x480;rate=15 camera://<somewhere>/<id> camera://<somewhere>/<id>?width=640;height=480;rate=15 camera://<somewhere>/<id>?size=640x480;rate=15 camera:///<id>?width=640;height=480;rate=15 camera:///<id>?size=640x480;rate=15
Uri: [scheme:][//authority][path][?query][#fragment] w/ authority: [user-info@]host[:port] Note: 'path' starts w/ fwd slash
Definition at line 248 of file GLMediaPlayer.java.
|
static |
|
static |
|
static |
Camera property {@value}, size as string, e.g.
1280x720, hd720. May not be supported on all platforms. See CameraInputScheme.
Definition at line 250 of file GLMediaPlayer.java.
|
static |
|
static |
Definition at line 198 of file GLMediaPlayer.java.
|
static |
Definition at line 199 of file GLMediaPlayer.java.
|
static |
Definition at line 200 of file GLMediaPlayer.java.
|
static |
Maximum video frame async of {@value} milliseconds.
Definition at line 259 of file GLMediaPlayer.java.
|
static |
Definition at line 260 of file GLMediaPlayer.java.
|
static |
Constant {@value} for auto or unspecified.
See Audio and video Stream IDs.
Definition at line 211 of file GLMediaPlayer.java.
|
static |
Constant {@value} for mute or not available.
See Audio and video Stream IDs.
Definition at line 209 of file GLMediaPlayer.java.
|
static |
Default texture count, value {@value}.
Definition at line 203 of file GLMediaPlayer.java.
|
static |
Minimum texture count, value {@value}.
Using the minimum texture count disables multi-threaded decoding.
Definition at line 206 of file GLMediaPlayer.java.