diff options
author | Xerxes Rånby <[email protected]> | 2013-07-16 11:56:37 +0200 |
---|---|---|
committer | Xerxes Rånby <[email protected]> | 2013-07-16 11:56:37 +0200 |
commit | 32210a87c2d9b10e04a773fa1b86f8f543d83af0 (patch) | |
tree | b9e5f5557318195f4be273182f3d17b54bea2a33 /src/jogl/classes/jogamp/opengl | |
parent | 6509c313dec8947723a932e7d1646a78dd6ac49a (diff) |
FFMPEGMediaPlayer: Only instance ALAudioSink if JOAL is found on the classpath.
Signed-off-by: Xerxes Rånby <[email protected]>
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java | 22 |
1 files changed, 15 insertions, 7 deletions
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 9c0c9bd94..806befe06 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java @@ -41,17 +41,16 @@ import javax.media.opengl.GLException; import java.util.Arrays; import java.util.Queue; +import com.jogamp.common.util.ReflectionUtil; import com.jogamp.common.util.VersionNumber; import com.jogamp.gluegen.runtime.ProcAddressTable; import com.jogamp.opengl.util.GLPixelStorageModes; +import com.jogamp.opengl.util.av.GLMediaPlayerFactory; import com.jogamp.opengl.util.texture.Texture; import com.jogamp.opengl.util.texture.TextureSequence; import jogamp.opengl.GLContextImpl; import jogamp.opengl.util.av.AudioSink; -import jogamp.opengl.util.av.JavaSoundAudioSink; -import jogamp.opengl.util.av.NullAudioSink; -import jogamp.opengl.openal.av.ALAudioSink; import jogamp.opengl.util.av.EGLMediaPlayerImpl; /*** @@ -130,11 +129,20 @@ public class FFMPEGMediaPlayer extends EGLMediaPlayerImpl { System.err.println("LIB_AV Codec : "+avCodecVersion); initIDs0(); available = true; - audioSink = new ALAudioSink(); - if(!audioSink.isAudioSinkAvailable()) { - audioSink = new JavaSoundAudioSink(); + final ClassLoader cl = GLMediaPlayerFactory.class.getClassLoader(); + + if(ReflectionUtil.isClassAvailable("com.jogamp.openal.ALFactory", cl)){ + // Only instance ALAudioSink if JOAL is found on the classpath. + audioSink = (AudioSink) ReflectionUtil.createInstance("jogamp.opengl.openal.av.ALAudioSink", cl); + if(!audioSink.isAudioSinkAvailable()){ + // Failed to initialize OpenAL. + audioSink=null; + } + } + if(audioSink==null) { + audioSink = (AudioSink) ReflectionUtil.createInstance("jogamp.opengl.util.av.JavaSoundAudioSink", cl); if(!audioSink.isAudioSinkAvailable()) { - audioSink = new NullAudioSink(); + audioSink = (AudioSink) ReflectionUtil.createInstance("jogamp.opengl.util.av.NullAudioSink", cl); } } maxAvailableAudio = audioSink.getDataAvailable(); |