From c37629ea8fdcb11f7f8a18e37a4cde57d4ba6a01 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 14 Aug 2013 07:02:59 +0200 Subject: GLMediaPlayer Multithreaded Decoding: GLMediaPlayer* (Part-3) - WIP - GLMediaPlayer - Remove State.Stopped and method stop() - redundant, use pause() / destroy() - Add notion of stream IDs - Add API doc: State / Stream-ID incl. html-anchor - Expose video/audio PTS, .. - Expose optional AudioSink - Min multithreaded textureCount is 4 (EGL* and FFMPEG*) - GLMediaPlayerImpl - Move AudioSink rel. impl. to this class, allowing a tight video implementation reusing logic. - Remove 'synchronized' methods, synchronize on State where applicable - implement new methods (see above) - playSpeed is handled partially in AudioSink. If it exeeds AudioSink's capabilities, drop audio and rely solely on video sync. - video sync (WIP) - video pts delay based on geometric weight - reset video SCR if 'out of range', resync w/ PTS - - FramePusher - allow interruption when pausing/stopping, while waiting for next avail free frame to decode. - FFMPEGMediaPlayer - Add proper AudioDataFormat negotiation AudioSink <-> libav - Parse libav's SampleFormat - Remove AudioSink interaction (moved to GLMediaPlayerImpl) - Tests (MovieSimple, MovieCube): - Add aid/vid selection - Add KeyListener for actions: seek(..), play()/pause(), setPlaySpeed(..) - Dump perf-string each 2s - TODO: - Add audio sync in AudioSink, similar to GLMediaPlayer's weighted video delay, here: drop audio frames. --- .../com/jogamp/opengl/util/av/GLMediaPlayer.java | 146 ++-- .../opengl/util/av/GLMediaPlayerFactory.java | 5 +- .../opengl/util/texture/TextureSequence.java | 5 +- .../android/av/AndroidGLMediaPlayerAPI14.java | 53 +- .../jogamp/opengl/util/av/EGLMediaPlayerImpl.java | 2 +- .../jogamp/opengl/util/av/GLMediaPlayerImpl.java | 740 +++++++++++++++------ .../jogamp/opengl/util/av/NullGLMediaPlayer.java | 27 +- .../opengl/util/av/impl/FFMPEGMediaPlayer.java | 232 ++++--- .../opengl/util/av/impl/OMXGLMediaPlayer.java | 25 +- src/jogl/native/libav/ffmpeg_tool.h | 19 +- .../jogamp_opengl_util_av_impl_FFMPEGMediaPlayer.c | 223 ++++--- .../opengl/test/android/MovieCubeActivity0.java | 3 +- .../opengl/test/android/MovieSimpleActivity0.java | 3 +- .../opengl/test/android/MovieSimpleActivity1.java | 4 +- .../jogl/demos/es2/TextureSequenceCubeES2.java | 23 +- .../test/junit/jogl/demos/es2/av/MovieCube.java | 157 +++-- .../test/junit/jogl/demos/es2/av/MovieSimple.java | 228 +++++-- 17 files changed, 1279 insertions(+), 616 deletions(-) (limited to 'src') diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java index a36bce305..fae88ea18 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java @@ -34,19 +34,37 @@ import javax.media.opengl.GL; import javax.media.opengl.GLException; import jogamp.opengl.Debug; +import jogamp.opengl.util.av.GLMediaPlayerImpl; import com.jogamp.opengl.util.texture.TextureSequence; /** - * Lifecycle of an GLMediaPlayer: + * GLMediaPlayer interface specifies a {@link TextureSequence} + * with a video stream as it's source. + *

+ * Audio maybe supported and played back internally or via an {@link AudioSink} implementation, + * if an audio stream is selected in {@link #initGLStream(GL, int, URLConnection, int, int)}. + *

+ *
GLMediaPlayer Lifecycle
+ *

+ * + * + * + * + * + * + * + *
action state before state after
{@link #initGLStream(GL, int, URLConnection, int, int)} Uninitialized Paused
{@link #play()} Paused Playing
{@link #pause()} Playing Paused
{@link #seek(int)} Playing, Paused Unchanged
{@link #destroy(GL)} ANY Uninitialized
+ *

+ *
Audio and video Stream IDs
+ *

* - * - * - * - * - * - * + * + * + * + * *
action state before state after
{@link #initGLStream(GL, int, URLConnection)} Uninitialized Stopped
{@link #start()} Stopped, Paused Playing
{@link #stop()} Playing, Paused Stopped
{@link #pause()} Playing Paused
{@link #destroy(GL)} ANY Uninitialized
value request get
{@link #STREAM_ID_NONE} mute not available
{@link #STREAM_ID_AUTO} auto unspecified
≥0 specific stream specific stream
+ *

*

* Current implementations (check each API doc link for details): *