diff options
Diffstat (limited to 'src/jogl/classes/jogamp')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java | 7 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java | 8 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java index 9e390319a..eb4ef5713 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java +++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java @@ -96,6 +96,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { private int textureInternalFormat; private int textureType; private int texUnit; + private int userMaxChannels = -1; // not set private int textureFragmentShaderHashCode; @@ -248,6 +249,12 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { public final int[] getTextureWrapST() { return texWrapST; } @Override + public final void setAudioChannelLimit(final int cc) { + userMaxChannels = Math.min(8, Math.max(1, cc)); + } + protected int getAudioChannelLimit() { return userMaxChannels; } + + @Override public String getRequiredExtensionsShaderStub() { if(GLES2.GL_TEXTURE_EXTERNAL_OES == textureTarget) { return ShaderCode.createExtensionDirective(GLExtensions.OES_EGL_image_external, ShaderCode.ENABLE); 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 d6bbbdc5d..7b86b012d 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java @@ -346,6 +346,12 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { } else { audioSink = AudioSinkFactory.createDefault(FFMPEGMediaPlayer.class.getClassLoader()); } + { + final int audioChannelLimit = getAudioChannelLimit(); + if( audioChannelLimit >= 1 ) { + audioSink.setChannelLimit(audioChannelLimit); + } + } final AudioFormat preferredAudioFormat = audioSink.getPreferredFormat(); if(DEBUG) { System.err.println("initStream: p2 aid "+aid+", preferred "+preferredAudioFormat+" on "+audioSink+", "+this); @@ -385,7 +391,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { } else { resStreamLocS = streamLocS; } - final int aMaxChannelCount = audioSink.getMaxSupportedChannels(); + final int aMaxChannelCount = preferredAudioFormat.channelCount; final int aPrefSampleRate = preferredAudioFormat.sampleRate; // setStream(..) issues updateAttributes*(..), and defines avChosenAudioFormat, vid, aid, .. etc if(DEBUG) { |