diff options
Diffstat (limited to 'src')
3 files changed, 17 insertions, 17 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid01.java index 0b1f1377b..0a268fa06 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid01.java @@ -89,6 +89,7 @@ public class UIMediaGrid01 { private static int aid = GLMediaPlayer.STREAM_ID_AUTO; private static float videoAspectRatio = 16f/9f; private static boolean letterBox = true; + private static int texCount = GLMediaPlayer.TEXTURE_COUNT_DEFAULT; public static void main(final String[] args) throws IOException { float mmPerCellWidth = 50f; @@ -120,6 +121,9 @@ public class UIMediaGrid01 { } else if(args[idx[0]].equals("-col")) { idx[0]++; gridColumns = MiscUtils.atoi(args[idx[0]], gridColumns); + } else if(args[idx[0]].equals("-texCount")) { + idx[0]++; + texCount = MiscUtils.atoi(args[idx[0]], texCount); } } } @@ -127,6 +131,7 @@ public class UIMediaGrid01 { System.err.println("mediaDir "+mediaDir); System.err.println("maxMediaFiles "+maxMediaFiles); System.err.println("aid "+aid); + System.err.println("texCount "+texCount); System.err.println("boxRatio "+videoAspectRatio); System.err.println("letterBox "+letterBox); System.err.println("columns "+gridColumns); @@ -367,7 +372,7 @@ public class UIMediaGrid01 { customCtrls.add(button); } grid.addShape( new MediaPlayer(options.renderModes, scene, mPlayer, medium, defRatio, letterBox, zoomSize, customCtrls) ); - mPlayer.playStream(medium, GLMediaPlayer.STREAM_ID_AUTO, aid, GLMediaPlayer.TEXTURE_COUNT_DEFAULT); + mPlayer.playStream(medium, GLMediaPlayer.STREAM_ID_AUTO, aid, texCount); } } private static boolean printNativeInfoOnce = true; 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 f3294e671..bd106f1b0 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/widgets/MediaPlayer.java +++ b/src/graphui/classes/com/jogamp/graph/ui/widgets/MediaPlayer.java @@ -135,7 +135,7 @@ public class MediaPlayer extends Widget { final RangeSlider ctrlSlider; { final float knobScale = ctrlSliderHeightMax / ctrlSliderHeightMin; - ctrlSlider = new RangeSlider(renderModes, new Vec2f(aratio - ctrlSliderHeightMax, ctrlSliderHeightMin), knobScale, new Vec2f(0, 100), 1, 0); + ctrlSlider = new RangeSlider(renderModes, new Vec2f(aratio - ctrlSliderHeightMax, ctrlSliderHeightMin), knobScale, new Vec2f(0, 100), 1000, 0); final float dx = ctrlSliderHeightMax / 2f; final float dy = ( ctrlSliderHeightMax - ctrlSliderHeightMin ) * 0.5f; ctrlSlider.setPaddding(new Padding(0, dx, ctrlCellHeight-dy, dx)); @@ -278,17 +278,12 @@ public class MediaPlayer extends Widget { } ); ctrlSlider.addSliderListener(new SliderAdapter() { private void seekPlayer(final int ptsMS) { - final int durationMS = mPlayer.getDuration(); - timeLabel.setText(getMultilineTime(ptsMS, durationMS)); - mPlayer.seek(ptsMS); - } - @Override - public void clicked(final RangeSlider w, final MouseEvent e) { - if( DEBUG ) { - System.err.println("Clicked "+w.getName()+": "+PTS.millisToTimeStr(Math.round(w.getValue()), true)+"ms, "+(w.getValuePct()*100f)+"%"); - System.err.println("Slider.C "+ctrlSlider.getDescription()); - } - seekPlayer( Math.round( w.getValue() ) ); + scene.invoke(false, (final GLAutoDrawable d) -> { + final int durationMS = mPlayer.getDuration(); + timeLabel.setText(getMultilineTime(ptsMS, durationMS)); + mPlayer.seek(ptsMS); + return true; + } ); } @Override public void dragged(final RangeSlider w, final float old_val, final float val, final float old_val_pct, final float val_pct) { @@ -306,7 +301,7 @@ public class MediaPlayer extends Widget { ctrlBlend.setColor(0, 0, 0, AlphaBlend); this.addShape( ctrlBlend.setVisible(false) ); - final float toolTipScaleY = 0.6f; + final float toolTipScaleY = 0.4f; ctrlGroup = new Group(new GridLayout(ctrlCellWidth, ctrlCellHeight, Alignment.FillCenter, Gap.None, 1)); ctrlGroup.setName("ctrlGroup").setInteractive(false); ctrlGroup.setPaddding(new Padding(0, BorderSzS, 0, BorderSzS)); diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java index bceb3cca5..0525f7f17 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java +++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java @@ -508,15 +508,15 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { case Paused: final State _state = state; setState( State.Paused ); - if( null != streamWorker ) { - streamWorker.pause(true); - } // Adjust target .. if( msec >= duration ) { msec = duration - (int)Math.floor(frame_duration); } else if( msec < 0 ) { msec = 0; } + if( null != streamWorker ) { + streamWorker.pause(true); + } pts1 = seekImpl(msec); resetAVPTSAndFlush(false); if( null != audioSink && State.Playing == _state ) { |