aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-08-11 05:25:39 +0200
committerSven Gothel <[email protected]>2023-08-11 05:25:39 +0200
commit19895532b6b605f3a839071c6082214b06dd89bb (patch)
tree1a54c21f7b16554e32ffc25db62f3401f70476de /src
parent1442d8dc875af3e945e656509105c89e394647c3 (diff)
GLMediaPlayer: Show more reasonable DEBUG output in factory; Impl initGL(GL) shall handle null streamWorker, i.e. when using NullGLMediaPlayer
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java22
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java10
2 files changed, 26 insertions, 6 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java
index 9378cec91..5430f0a29 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java
@@ -29,6 +29,7 @@ package com.jogamp.opengl.util.av;
import jogamp.opengl.util.av.NullGLMediaPlayer;
+import com.jogamp.common.JogampRuntimeException;
import com.jogamp.common.util.ReflectionUtil;
public class GLMediaPlayerFactory {
@@ -52,15 +53,32 @@ public class GLMediaPlayerFactory {
return sink;
}
public static GLMediaPlayer createNull() {
+ if(GLMediaPlayer.DEBUG) { System.err.println("GLMediaPlayerFactory: Using NullGLMediaPlayer"); }
return new NullGLMediaPlayer();
}
public static GLMediaPlayer create(final ClassLoader cl, final String implName) {
try {
+ if(GLMediaPlayer.DEBUG) { System.err.println("GLMediaPlayerFactory: Trying: "+implName); }
if(((Boolean)ReflectionUtil.callStaticMethod(implName, isAvailableMethodName, null, null, cl)).booleanValue()) {
- return (GLMediaPlayer) ReflectionUtil.createInstance(implName, cl);
+ final GLMediaPlayer res = (GLMediaPlayer) ReflectionUtil.createInstance(implName, cl);
+ if(GLMediaPlayer.DEBUG) { System.err.println("GLMediaPlayerFactory: Using: "+implName); }
+ return res;
+ } else {
+ if(GLMediaPlayer.DEBUG) { System.err.println("GLMediaPlayerFactory: Not available: "+implName); }
}
- } catch (final Throwable t) { if(GLMediaPlayer.DEBUG) { System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); } }
+ } catch (final JogampRuntimeException jre) {
+ if(GLMediaPlayer.DEBUG) {
+ final Throwable cause = jre.getCause();
+ System.err.println("GLMediaPlayerFactory: Not available: "+implName);
+ System.err.println("Caught cause "+cause.getClass().getName()+": "+cause.getMessage());
+ }
+ } catch (final Throwable t) {
+ if(GLMediaPlayer.DEBUG) {
+ System.err.println("GLMediaPlayerFactory: Not available: "+implName);
+ System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace();
+ }
+ }
return null;
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
index eb4ef5713..4133a50fd 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
@@ -704,10 +704,12 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
{
streamWorker = new StreamWorker();
}
- streamWorker.initGL(gl);
- streamWorker.doResume();
- changeState(new GLMediaPlayer.EventMask(), State.Paused);
- resume();
+ if( null != streamWorker ) {
+ streamWorker.initGL(gl);
+ streamWorker.doResume();
+ changeState(new GLMediaPlayer.EventMask(), State.Paused);
+ resume();
+ }
} else if( null == gl ) {
width = 0;
height = 0;