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 initStream(Uri, int, 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:
initStream(..) - User gets notified whether the stream has been initialized or not via attributesChanges(..) .newFrameAvailable(...) .StreamExceptions.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.
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().
| 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 MAXIMUM_VIDEO_ASYNC ahead of time.
If its timestamp is more than MAXIMUM_VIDEO_ASYNC ahead of time,
the previous frame is returned.
If its timestamp is more than MAXIMUM_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:
| Big Buck Bunny 24f 16:9 | ||||
|---|---|---|---|---|
| Big Buck Bunny | 320p | h264 | aac 48000Hz 2 chan | http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4 |
| Big Buck Bunny | 240p | h264 | aac 48000Hz 2 chan | http://archive.org/download/BigBuckBunny_328/BigBuckBunny_512kb.mp4 |
| Big Buck Bunny | 720p | mpeg4 | ac3 48000Hz 5.1 chan | http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_surround.avi |
| Big Buck Bunny | 720p | msmpeg4v2 | mp3 48000Hz 2 chan | http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_stereo.avi |
| Big Buck Bunny | 720p | theora | vorbis 48000Hz 2 chan | http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_stereo.ogg |
| Big Buck Bunny | 1080p | mpeg4 | ac3 48000Hz 5.1 chan | http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_1080p_surround.avi |
| WebM/Matroska (vp8/vorbis) | ||||
| Big Buck Bunny Trailer | 640p | vp8 | vorbis 44100Hz 1 chan | http://video.webmfiles.org/big-buck-bunny_trailer.webm |
| Elephants Dream | 540p | vp8 | vorbis 44100Hz 1 chan | http://video.webmfiles.org/elephants-dream.webm |
| You Tube http/rtsp | ||||
| Sintel | http://www.youtube.com/watch?v=eRsGyueVLvQ | rtsp://v3.cache1.c.youtube.com/CiILENy73wIaGQn0LpXnygYbeRMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp | ||
| Audio/Video Sync | ||||
| Five-minute-sync-test1080p | https://www.youtube.com/watch?v=szoOsG9137U | rtsp://v7.cache8.c.youtube.com/CiILENy73wIaGQm133VvsA46sxMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp | ||
| Audio-Video-Sync-Test-Calibration-23.98fps-24fps | https://www.youtube.com/watch?v=cGgf_dbDMsw | |||
| sound_in_sync_test | https://www.youtube.com/watch?v=O-zIZkhXNLE | |||