From e9e1732dc6691cb72920f25b1fb8431e94c7b561 Mon Sep 17 00:00:00 2001 From: Sven Göthel Date: Sun, 7 Jan 2024 04:49:51 +0100 Subject: GraphUI MediaPlayer / GLMediaPlayer: Add current chapter-title to info-field --- .../classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java | 13 ++++++++++++- .../jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/util') diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java index e1472102c..457157285 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java +++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java @@ -1,5 +1,5 @@ /** - * Copyright 2012-2023 JogAmp Community. All rights reserved. + * Copyright 2012-2024 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -65,6 +65,7 @@ import com.jogamp.common.util.WorkerThread; import com.jogamp.math.FloatUtil; import com.jogamp.opengl.GLExtensions; import com.jogamp.opengl.util.av.GLMediaPlayer; +import com.jogamp.opengl.util.av.GLMediaPlayer.Chapter; import com.jogamp.opengl.util.glsl.ShaderCode; import com.jogamp.opengl.util.texture.Texture; import com.jogamp.opengl.util.texture.TextureData; @@ -1792,6 +1793,16 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { @Override public Chapter[] getChapters() { return new Chapter[0]; } + @Override + public final Chapter getChapter(final int msec) { + for(final Chapter c : getChapters()) { + if( c.start <= msec && msec <= c.end ) { + return c; + } + } + return null; + } + @Override public final String toString() { final String tt = PTS.millisToTimeStr(getDuration()); diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java index f091056c2..78c20d90a 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java @@ -1,5 +1,5 @@ /** - * Copyright 2012-2023 JogAmp Community. All rights reserved. + * Copyright 2012-2024 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -46,6 +46,7 @@ import com.jogamp.common.util.SecurityUtil; import com.jogamp.gluegen.runtime.ProcAddressTable; import com.jogamp.opengl.util.GLPixelStorageModes; import com.jogamp.opengl.util.av.GLMediaPlayer; +import com.jogamp.opengl.util.av.GLMediaPlayer.Chapter; import com.jogamp.opengl.util.texture.Texture; import jogamp.common.os.PlatformPropsImpl; -- cgit v1.2.3