diff options
author | Sven Gothel <[email protected]> | 2023-12-30 21:18:16 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-12-30 21:18:16 +0100 |
commit | 68b2dad19bd6d84f18b22f967ce320b448e8a270 (patch) | |
tree | e4d49a1eadc12ef9a456f1eb1d5303eddfe192c8 /src/jogl/classes/com/jogamp/opengl/util/av | |
parent | c6e39c6e313a34688ca0164d7a34b6465e92396f (diff) |
GLMediaPlayer/FFMPEGMediaPlayer: Add chapter metadata support and use com.jogamp.common.av.PTS.millisToTimeStr(..)
Chapter metadata is now supported via our FFMPEGMediaPlayer implementation.
Added public method: 'Chapters[] GLMediaPlayer.getChapters()'
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util/av')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java | 28 |
1 files changed, 24 insertions, 4 deletions
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 7be088c3b..e5351af03 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java @@ -36,12 +36,10 @@ import jogamp.opengl.Debug; import java.io.PrintStream; import java.util.List; -import com.jogamp.common.av.AudioFormat; import com.jogamp.common.av.AudioSink; import com.jogamp.common.av.PTS; import com.jogamp.common.av.TimeFrameI; import com.jogamp.common.net.Uri; -import com.jogamp.common.os.Clock; import com.jogamp.opengl.util.texture.Texture; import com.jogamp.opengl.util.texture.TextureSequence; @@ -273,6 +271,25 @@ public interface GLMediaPlayer extends TextureSequence { } } + /** Chapter meta-data of stream, see {@link GLMediaPlayer#getChapters()}. */ + public static class Chapter { + /** Chapter ID */ + public final int id; + /** Chapter start PTS in ms */ + public final int start; + /** Chapter end PTS in ms */ + public final int end; + /** Chapter title */ + public final String title; + public Chapter(final int i, final int s, final int e, final String t) { + id = i; start = s; end = e; title = t; + } + @Override + public String toString() { + return String.format("%02d: [%s .. %s] %s", id, PTS.millisToTimeStr(start), PTS.millisToTimeStr(end), title); + } + } + /** * {@inheritDoc} * <p> @@ -770,11 +787,14 @@ public interface GLMediaPlayer extends TextureSequence { /** Returns the height of the video. */ public int getHeight(); - /** Returns a string represantation of this player, incl. state and audio/video details. */ + /** Returns {@link Chapter} meta-data from stream, available after {@link State#Initialized} is reached after issuing {@link #playStream(Uri, int, int, int)}. */ + public Chapter[] getChapters(); + + /** Returns a string representation of this player, incl. state and audio/video details. */ @Override public String toString(); - /** Returns a string represantation of this player's performance values. */ + /** Returns a string representation of this player's performance values. */ public String getPerfString(); /** Adds a {@link GLMediaEventListener} to this player. */ |