diff options
author | Sven Göthel <[email protected]> | 2024-01-07 04:49:51 +0100 |
---|---|---|
committer | Sven Göthel <[email protected]> | 2024-01-07 04:49:51 +0100 |
commit | e9e1732dc6691cb72920f25b1fb8431e94c7b561 (patch) | |
tree | dddf8fb3580f017ca820e457873e0b1654d6f576 /src/graphui/classes/com/jogamp/graph/ui | |
parent | 79eba1f0e450a75f01505ca5ed5817ec481491a8 (diff) |
GraphUI MediaPlayer / GLMediaPlayer: Add current chapter-title to info-field
Diffstat (limited to 'src/graphui/classes/com/jogamp/graph/ui')
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/shapes/MediaButton.java | 2 | ||||
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/widgets/MediaPlayer.java | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/MediaButton.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/MediaButton.java index 74ab3312b..248887e90 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/shapes/MediaButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/MediaButton.java @@ -1,5 +1,5 @@ /** - * Copyright 2014-2023 JogAmp Community. All rights reserved. + * Copyright 2014-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: diff --git a/src/graphui/classes/com/jogamp/graph/ui/widgets/MediaPlayer.java b/src/graphui/classes/com/jogamp/graph/ui/widgets/MediaPlayer.java index da912fa8a..75b07b7c8 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/widgets/MediaPlayer.java +++ b/src/graphui/classes/com/jogamp/graph/ui/widgets/MediaPlayer.java @@ -520,7 +520,7 @@ public class MediaPlayer extends Widget { return getInfo(mPlayer.getPTS().get(currentMillis), mPlayer.getDuration(), mPlayer, full); } public static String getInfo(final int ptsMS, final int durationMS, final GLMediaPlayer mPlayer, final boolean full) { - final String name; + final String name, chapter; { final String basename; final String s = mPlayer.getUri().path.decode(); @@ -536,6 +536,12 @@ public class MediaPlayer extends Widget { } else { name = basename; } + final GLMediaPlayer.Chapter c = mPlayer.getChapter(ptsMS); + if( null != c ) { + chapter = " - "+c.title; + } else { + chapter = ""; + } } final float aspect = (float)mPlayer.getWidth() / (float)mPlayer.getHeight(); final float pct = (float)ptsMS / (float)durationMS; @@ -547,12 +553,12 @@ public class MediaPlayer extends Widget { mPlayer.getAID(), mPlayer.getAudioBitrate()/1000, mPlayer.getAudioCodec()); final String text3 = String.format("video: id %d, kbps %d, codec %s", mPlayer.getVID(), mPlayer.getVideoBitrate()/1000, mPlayer.getVideoCodec()); - return text1+"\n"+text2+"\n"+text3+"\n"+name; + return text1+"\n"+text2+"\n"+text3+"\n"+name+chapter; } else { final String text1 = String.format("%s / %s (%.0f %%), %s (%01.1fx, vol %1.2f), A/R %.2f", PTS.millisToTimeStr(ptsMS, false), PTS.millisToTimeStr(durationMS, false), pct*100, mPlayer.getState().toString().toLowerCase(), mPlayer.getPlaySpeed(), mPlayer.getAudioVolume(), aspect); - return text1+"\n"+name; + return text1+"\n"+name+chapter; } } public static String getMultilineTime(final long currentMillis, final GLMediaPlayer mPlayer) { |