From c200045aa661cf82474c2b3c1db0ac69db40452a Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Fri, 16 Aug 2013 20:18:36 +0200
Subject: GLMediaPlayer Multithreaded Decoding: GLMediaPlayer* (Part-4) - WIP

- Use Platform.currentTimeMillis() for accurate timing!

- GLMediaPlayer / GLMediaPlayerImpl
  - Add DEBUG_NATIVE property jogl.debug.GLMediaPlayer.Native
    for verbose impl. messages, i.e. ffmpeg/libav

  - Add 'synchronization' section in GLMediaPlayer API doc (WIP)

  - Use passive non-blocking video synchronization,
    i.e. repeat frames instead of 'sleep'.
    Thx to Xerxes's suggestion.

  - Add flushing of cached decoded frames,
    allowing to remove complicated 'videoSCR_reset_latch'

  - FramePusher (threaded decoding):
    - Always create a shared context!
    - Release context while pausing
    - Pre/post 'getNextTextureImpl()' actions only
      at makeCurrent/release.
    - newFrameAvailable(..) signal after decoded frame is enqueued

- FFMPEGDynamicLibraryBundleInfo
  - Bind add. functions of libavcodec:
    +         "av_init_packet",
    +         "av_new_packet",
    +         "av_destruct_packet",
  - Bind add. functions of libavformat:
    +         "avformat_seek_file",
    +         "av_read_play",
    +         "av_read_pause",
  - DEBUG property := FFMPEGMediaPlayer.DEBUG || DynamicLibraryBundleInfo.DEBUG;

- FFMPEGMediaPlayer
  - Use libavformat's 'av_read_play()' and 'av_read_pause()',
    which may get utilized for network streams, e.g. RTSP

  - getNextTextureImpl(..):
    - Fix retry loop
    - Use postNextTextureImpl/preNextTextureImpl if desired (PSM)

  - Native:
    - Use fixed my_av_q2i32(..) macro (again)
    - Use INVALID_PTS marker (synced w/ Java code)
    - DEBUG: Dump more detailed frame information
    - TODO: Consider passing frame_delay, especially for repeated frames!

- Tests (MovieSimple, MovieCube):
  - Refine KeyEvents control for seek and speed.

- TODO:
  - Proper audio clock calculation - difficult w/ OpenAL !
  - Video / Audio sync:
    - seek !
    - streams w/ very async A/V frames
    - Test Streams:
      - Five-minute-sync-test.mp4
      - Audio-Video-Sync-Test-Calibration-23.98fps-24fps.mp4
      - sound_in_sync_test.mp4
      - big_buck_bunny_1080p_surround.avi
---
 .../com/jogamp/opengl/util/texture/TextureSequence.java    | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

(limited to 'src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java')

diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java
index 50801e791..05fda99ae 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java
@@ -110,23 +110,31 @@ public interface TextureSequence {
      * to associated related data. 
      */
     public static class TextureFrame {
-        /** Constant marking an invalid PTS, i.e. Integer.MIN_VALUE {@value}. */
-        public static final int INVALID_PTS = Integer.MIN_VALUE;
+        /** Constant marking an invalid PTS, i.e. Integer.MIN_VALUE 0x80000000 {@value}. */
+        public static final int INVALID_PTS = 0x80000000 ; // == -2147483648 == Integer.MIN_VALUE;
         
         public TextureFrame(Texture t) {
             texture = t;
             pts = INVALID_PTS;
+            duration = 0;
         }
         
         public final Texture getTexture() { return texture; }
+        /** Get this frame's presentation timestamp (PTS) in milliseconds. */
         public final int getPTS() { return pts; }
+        /** Set this frame's presentation timestamp (PTS) in milliseconds. */
         public final void setPTS(int pts) { this.pts = pts; }
+        /** Get this frame's duration in milliseconds. */
+        public final int getDuration() { return duration; }
+        /** Set this frame's duration in milliseconds. */
+        public final void setDuration(int duration) { this.duration = duration; }
         
         public String toString() {
-            return "TextureFrame[" + pts + "ms: " + texture + "]";
+            return "TextureFrame[pts " + pts + " ms, l " + duration + " ms, "+ texture + "]";
         }
         protected final Texture texture;
         protected int pts;
+        protected int duration;
     }
 
     public interface TexSeqEventListener<T extends TextureSequence> {
-- 
cgit v1.2.3