aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/util/av
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-01-27 07:58:44 +0100
committerSven Göthel <[email protected]>2024-01-27 07:58:44 +0100
commitb2bd320e2b688097f0d5171eb6e89e985909c7b7 (patch)
tree43a5d38fa41137c550a08de71e8bb8a06b43ff4e /src/jogl/classes/jogamp/opengl/util/av
parent0b908ee7fc80344118d3fa6d4d92ebb082968cb3 (diff)
GLMediaPlayer: Support tile metadata
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util/av')
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java48
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java10
2 files changed, 40 insertions, 18 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
index 01a385b0d..5df858b2d 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
@@ -132,6 +132,8 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
private float audioVolume = 1.0f;
/** Shall be set by the {@link #initStreamImpl(int, int, int)} method implementation. */
+ private String title = "undef";
+ /** Shall be set by the {@link #initStreamImpl(int, int, int)} method implementation. */
private int[] v_streams = new int[0];
/** Shall be set by the {@link #initStreamImpl(int, int, int)} method implementation. */
private String[] v_langs = new String[0];
@@ -749,9 +751,6 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
@Override
public void switchStream(final int vid, final int aid, final int sid) throws IllegalStateException, IllegalArgumentException {
- System.err.println("XXX VID "+getVID()+" -> "+vid);
- System.err.println("XXX AID "+getAID()+" -> "+aid);
- System.err.println("XXX SID "+getSID()+" -> "+sid);
final int v_pts = getVideoPTS();
stop();
seek(v_pts);
@@ -953,11 +952,11 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
final float _fps = 24f;
final int _duration = 10*60*1000; // msec
final int _totalFrames = (int) ( (_duration/1000)*_fps );
- updateAttributes(new int[0], new String[0], GLMediaPlayer.STREAM_ID_NONE,
- new int[0], new String[0], GLMediaPlayer.STREAM_ID_NONE, // audio
- new int[0], new String[0], GLMediaPlayer.STREAM_ID_NONE, // subs
- TestTexture.singleton.getWidth(),
- TestTexture.singleton.getHeight(), 0, 0, 0, _fps, _totalFrames, 0, _duration, "png-static", null);
+ updateAttributes("test", new int[0], new String[0],
+ GLMediaPlayer.STREAM_ID_NONE, new int[0], new String[0], // audio
+ GLMediaPlayer.STREAM_ID_NONE, new int[0], new String[0], // subs
+ GLMediaPlayer.STREAM_ID_NONE,
+ TestTexture.singleton.getWidth(), TestTexture.singleton.getHeight(), 0, 0, 0, _fps, _totalFrames, 0, _duration, "png-static", null);
}
protected abstract TextureFrame createTexImage(GL gl, int texName);
@@ -1700,11 +1699,12 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
* Further calls are issues off-thread by the decoder implementation.
* </p>
*/
- protected final void updateAttributes(final int[] v_streams, final String[] v_langs, int vid,
- final int[] a_streams, final String[] a_langs, int aid,
- final int[] s_streams, final String[] s_langs, int sid,
- final int width, final int height, final int bps_stream,
- final int bps_video, final int bps_audio, final float fps, final int videoFrames, final int audioFrames, final int duration, final String vcodec, final String acodec) {
+ protected final void updateAttributes(final String title,
+ final int[] v_streams, final String[] v_langs,
+ int vid, final int[] a_streams, final String[] a_langs,
+ int aid, final int[] s_streams, final String[] s_langs,
+ int sid, final int width, final int height,
+ final int bps_stream, final int bps_video, final int bps_audio, final float fps, final int videoFrames, final int audioFrames, final int duration, final String vcodec, final String acodec) {
final GLMediaPlayer.EventMask eventMask = new GLMediaPlayer.EventMask();
final boolean wasUninitialized = state == State.Uninitialized;
@@ -1712,6 +1712,25 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
eventMask.setBit(GLMediaPlayer.EventMask.Bit.Init);
setState( State.Initialized );
}
+ if( null == title ) {
+ final String basename;
+ final String s = getUri().path.decode();
+ final int li = s.lastIndexOf('/');
+ if( 0 < li ) {
+ basename = s.substring(li+1);
+ } else {
+ basename = s;
+ }
+ final int di = basename.lastIndexOf('.');
+ if( 0 < di ) {
+ this.title = basename.substring(0, di);
+ } else {
+ this.title = basename;
+ }
+ } else {
+ this.title = title;
+ }
+
this.v_streams = v_streams;
this.v_langs = v_langs;
this.a_streams = a_streams;
@@ -1942,6 +1961,9 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
protected void updateMetadata() {}
@Override
+ public String getTitle() { return this.title; }
+
+ @Override
public Chapter[] getChapters() { return new Chapter[0]; }
@Override
diff --git a/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java
index f88894ce4..f0f06bf2a 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java
@@ -144,15 +144,15 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl {
}
@Override
- protected final void initStreamImpl(final int vid, final int aid, int sid) throws IOException {
+ protected final void initStreamImpl(final int vid, final int aid, final int sid) throws IOException {
texData = createTestTextureData();
final float _fps = 24f;
final int _duration = 10*60*1000; // msec
final int _totalFrames = (int) ( (_duration/1000)*_fps );
- updateAttributes(new int[] { 0 }, new String[] { "und" }, 0 /* fake */,
- new int[0], new String[0], GLMediaPlayer.STREAM_ID_NONE,
- new int[0], new String[0], GLMediaPlayer.STREAM_ID_NONE,
- texData.getWidth(), texData.getHeight(), 0, 0, 0, _fps, _totalFrames, 0, _duration, "png-static", null);
+ updateAttributes("null", new int[] { 0 }, new String[] { "und" },
+ 0 /* fake */, new int[0], new String[0],
+ GLMediaPlayer.STREAM_ID_NONE, new int[0], new String[0],
+ GLMediaPlayer.STREAM_ID_NONE, texData.getWidth(), texData.getHeight(), 0, 0, 0, _fps, _totalFrames, 0, _duration, "png-static", null);
}
@Override
protected final void initGLImpl(final GL gl) throws IOException, GLException {