summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/util/av
diff options
context:
space:
mode:
authorXerxes Rånby <[email protected]>2013-06-24 19:39:56 +0200
committerXerxes Rånby <[email protected]>2013-06-24 19:39:56 +0200
commit6509c313dec8947723a932e7d1646a78dd6ac49a (patch)
treea031b69a7d341a8f1c6c7aa10b06d048e40b66a7 /src/jogl/classes/jogamp/opengl/util/av
parent11e27bf78f5fc1a117e02aba8a58b6c5fa088514 (diff)
AudioSink: interface add isAudioSinkAvailable
Signed-off-by: Xerxes Rånby <[email protected]>
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util/av')
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/AudioSink.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java3
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java5
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java9
4 files changed, 14 insertions, 5 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/av/AudioSink.java b/src/jogl/classes/jogamp/opengl/util/av/AudioSink.java
index fedead713..504e4b2db 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/AudioSink.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/AudioSink.java
@@ -2,6 +2,8 @@ package jogamp.opengl.util.av;
public interface AudioSink {
+ boolean isAudioSinkAvailable();
+
int getDataAvailable();
boolean isDataAvailable(int data_size);
diff --git a/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java b/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java
index 0e2806322..653a02111 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java
@@ -71,7 +71,8 @@ public class JavaSoundAudioSink implements AudioSink {
return auline.available()>=data_size;
}
- public static boolean isAvailable() {
+ @Override
+ public boolean isAudioSinkAvailable() {
return available;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java b/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java
index 81259f4c5..d92967849 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java
@@ -15,4 +15,9 @@ public class NullAudioSink implements AudioSink {
@Override
public void writeData(byte[] sampleData, int data_size) {
}
+
+ @Override
+ public boolean isAudioSinkAvailable() {
+ return true;
+ }
}
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 9ae1541f9..9c0c9bd94 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
@@ -130,11 +130,12 @@ public class FFMPEGMediaPlayer extends EGLMediaPlayerImpl {
System.err.println("LIB_AV Codec : "+avCodecVersion);
initIDs0();
available = true;
- audioSink = new NullAudioSink();
- if(ALAudioSink.isAvailable()) {
- audioSink = new ALAudioSink();
- } else if(JavaSoundAudioSink.isAvailable()) {
+ audioSink = new ALAudioSink();
+ if(!audioSink.isAudioSinkAvailable()) {
audioSink = new JavaSoundAudioSink();
+ if(!audioSink.isAudioSinkAvailable()) {
+ audioSink = new NullAudioSink();
+ }
}
maxAvailableAudio = audioSink.getDataAvailable();