diff options
-rwxr-xr-x | make/scripts/tests-osx-x64.sh | 3 | ||||
-rwxr-xr-x | make/scripts/tests-x64.sh | 1 | ||||
-rw-r--r-- | make/scripts/tests.sh | 25 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java | 40 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java | 10 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java | 6 | ||||
-rw-r--r-- | src/jogl/native/libav/ffmpeg_impl_template.c | 6 |
7 files changed, 75 insertions, 16 deletions
diff --git a/make/scripts/tests-osx-x64.sh b/make/scripts/tests-osx-x64.sh index 5d9cd6f66..3828806d8 100755 --- a/make/scripts/tests-osx-x64.sh +++ b/make/scripts/tests-osx-x64.sh @@ -1,6 +1,7 @@ #! /bin/bash -export DYLD_LIBRARY_PATH=/usr/local/libav:$DYLD_LIBRARY_PATH +#export DYLD_LIBRARY_PATH=$HOME/ffmpeg-0.8_0.9/lib:$DYLD_LIBRARY_PATH +export DYLD_LIBRARY_PATH=$HOME/ffmpeg-2.2.3/lib:$DYLD_LIBRARY_PATH JAVA_HOME=`/usr/libexec/java_home -version 1.7` #JAVA_HOME=`/usr/libexec/java_home -version 1.7.0_25` diff --git a/make/scripts/tests-x64.sh b/make/scripts/tests-x64.sh index 93be80787..421b912fb 100755 --- a/make/scripts/tests-x64.sh +++ b/make/scripts/tests-x64.sh @@ -10,6 +10,7 @@ SDIR=`dirname $0` #export LD_LIBRARY_PATH=$HOME/libav-10.1/lib:$LD_LIBRARY_PATH #export LD_LIBRARY_PATH=$HOME/ffmpeg-2.2.2/lib:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=$HOME/ffmpeg-2.2.3/lib:$LD_LIBRARY_PATH if [ -e $SDIR/../../../gluegen/make/scripts/setenv-build-jogl-x86_64.sh ] ; then . $SDIR/../../../gluegen/make/scripts/setenv-build-jogl-x86_64.sh diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 906953255..bd19633f0 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -99,7 +99,12 @@ function jrun() { #D_ARGS="-Djogl.debug=all -Dnewt.debug=all" #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all" #D_ARGS="-Djogamp.debug=all -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" - #D_ARGS="-Djogamp.debug=all -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all -Djogamp.debug.NativeLibrary=true -Djogamp.debug.JNILibLoader=true -Djogl.disable.opengles=true" + + #D_ARGS="-Djogamp.debug.NativeLibrary=true -Djogamp.debug.JNILibLoader=true" + #D_ARGS="-Djogamp.debug.ProcAddressHelper -Djogamp.debug.NativeLibrary -Djogamp.debug.NativeLibrary.Lookup -Djogamp.debug.JNILibLoader -Djogamp.debug.TempJarCache -Djogamp.debug.JarUtil" + #D_ARGS="-Djogl.debug.GLContext -Djogamp.debug.NativeLibrary -Djogamp.debug.JNILibLoader -Djogl.debug.DebugGL -Djogl.debug.GLDebugMessageHandler" + #D_ARGS="-Djogamp.debug.ProcAddressHelper -Djogamp.debug.NativeLibrary -Djogamp.debug.NativeLibrary.Lookup -Djogamp.debug.JNILibLoader -Djogamp.debug.TempJarCache -Djogamp.debug.JarUtil" + #D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" #D_ARGS="-Dnativewindow.debug=all -Dnewt.debug.Window" #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all -Dnewt.debug=all -Djogamp.debug.Lock" @@ -149,11 +154,9 @@ function jrun() { #D_ARGS="-Djogl.debug.GLDebugMessageHandler -Djogl.debug.DebugGL" #D_ARGS="-Djogl.debug.GLDebugMessageHandler -Djogl.debug.TraceGL -Djogl.debug.DebugGL -Djogl.debug.GLSLCode -Djogl.debug.GLSLState" #D_ARGS="-Djogl.debug.GLDebugMessageHandler -Djogl.debug.DebugGL -Djogl.debug.TraceGL" - #D_ARGS="-Djogamp.debug.NativeLibrary" #D_ARGS="-Djogl.1thread=false -Djogl.debug.Threading" #D_ARGS="-Djogl.1thread=true -Djogl.debug.Threading" #D_ARGS="-Djogl.debug.DebugGL -Djogl.debug.TraceGL -Djogl.debug.GLContext.TraceSwitch -Djogl.debug=all" - #D_ARGS="-Djogl.debug.AudioSink" #D_ARGS="-Djogl.debug.GLArrayData" #D_ARGS="-Dnewt.debug.Screen -Dnewt.debug.Window" #D_ARGS="-Dnewt.debug.Window" @@ -161,16 +164,13 @@ function jrun() { #D_ARGS="-Dnewt.test.Screen.disableRandR13" #D_ARGS="-Dnewt.test.Screen.disableScreenMode -Dnewt.debug.Screen" #D_ARGS="-Dnewt.debug.Screen -Djogl.debug.Animator" - #D_ARGS="-Djogamp.debug.ProcAddressHelper -Djogamp.debug.NativeLibrary -Djogamp.debug.NativeLibrary.Lookup -Djogamp.debug.JNILibLoader -Djogamp.debug.TempJarCache -Djogamp.debug.JarUtil" #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLProfile" #D_ARGS="-Djogl.debug.GLProfile" - #D_ARGS="-Djogl.debug.GLContext -Djogamp.debug.NativeLibrary -Djogamp.debug.JNILibLoader -Djogl.debug.DebugGL -Djogl.debug.GLDebugMessageHandler" #D_ARGS="-Dnewt.debug.MainThread" #D_ARGS="-Dnativewindow.debug.GraphicsConfiguration -Dnativewindow.debug.NativeWindow" #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Animator -Djogl.debug.GLDrawable -Djogl.debug.GLContext -Djogl.debug.GLContext.TraceSwitch" #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.ExtensionAvailabilityCache" #D_ARGS="-Djogl.debug.EGLDrawableFactory.QueryNativeTK -Djogl.debug.GLDrawable" - #D_ARGS="-Djogamp.debug.ProcAddressHelper -Djogamp.debug.NativeLibrary -Djogamp.debug.NativeLibrary.Lookup -Djogamp.debug.JNILibLoader -Djogamp.debug.TempJarCache -Djogamp.debug.JarUtil" #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLProfile -Djogl.debug.GLDrawable -Djogl.debug.EGLDisplayUtil -Dnativewindow.debug.GraphicsDevice" #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLProfile -Djogl.debug.GLDrawable -Djogl.debug.EGLDisplayUtil -Djogl.debug.EGLDrawableFactory.QueryNativeTK" #D_ARGS="-Djogl.debug.EGLDisplayUtil -Dnativewindow.debug.GraphicsConfiguration -Djogl.debug.GLDrawable" @@ -266,12 +266,19 @@ function jrun() { #X_ARGS="-Xrs" #X_ARGS="-Dsun.awt.disableMixing=true" #D_ARGS="-Djogamp.debug.IOUtil -Djogl.debug.GLSLCode -Djogl.debug.GLMediaPlayer" + #D_ARGS="-Djogl.debug.AudioSink -Djoal.openal.lib=soft" + #D_ARGS="-Djogl.debug.AudioSink -Djogl.debug.GLMediaPlayer" + #D_ARGS="-Djogl.debug.AudioSink -Djogl.debug.GLMediaPlayer.Native" + #D_ARGS="-Djogl.debug.GLMediaPlayer -Djogl.debug.GLMediaPlayer.Native" + #D_ARGS="-Djogl.debug.GLMediaPlayer.Native" + #D_ARGS="-Djogl.debug.AudioSink -Djoal.openal.lib=system" #D_ARGS="-Djogl.debug.AudioSink" #D_ARGS="-Djogl.debug.AudioSink.trace" #D_ARGS="-Djogl.debug.GLMediaPlayer -Djogl.debug.GLMediaPlayer.Native" - #D_ARGS="-Djogl.debug.GLMediaPlayer" + #D_ARGS="-Djogl.debug.GLMediaPlayer -Djogl.debug.GLSLCode" #D_ARGS="-Djogl.debug.GLMediaPlayer.StreamWorker.delay=25 -Djogl.debug.GLMediaPlayer" #D_ARGS="-Djogl.debug.GLMediaPlayer.Native" + D_ARGS="-Djogl.debug.GLSLCode" if [ $awton -eq 1 ] ; then export USE_CLASSPATH=$JOGAMP_ALL_AWT_CLASSPATH @@ -364,8 +371,10 @@ function testawtswt() { #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $* -testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestRulerNEWT01 $* +#testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestRulerNEWT01 $* #testawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtCanvasAWTDemo $* +testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $* +#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo $* #testawt com.jogamp.opengl.test.junit.jogl.awt.ManualHiDPIBufferedImage01AWT $* diff --git a/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java b/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java index da6c8fde7..2c3adf957 100644 --- a/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java +++ b/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java @@ -133,6 +133,19 @@ public class ALAudioSink implements AudioSink { staticAvailable = null != alc && null != al && null != alExt; } + private void clearPreALError(final String prefix) { + checkALError(prefix); + } + private boolean checkALError(final String prefix) { + final int alcErr = alc.alcGetError(device); + final int alErr = al.alGetError(); + final boolean ok = ALC.ALC_NO_ERROR == alcErr && AL.AL_NO_ERROR == alErr; + if( DEBUG ) { + System.err.println("ALAudioSink."+prefix+": ok "+ok+", err [alc "+toHexString(alcErr)+", al "+toHexString(alErr)+"]"); + } + return ok; + } + public ALAudioSink() { initialized = false; chosenFormat = null; @@ -147,6 +160,9 @@ public class ALAudioSink implements AudioSink { if (device == null) { throw new RuntimeException(getThreadName()+": ALAudioSink: Error opening default OpenAL device"); } + int checkErrIter = 1; + + clearPreALError("init."+checkErrIter++); // Get the device specifier. deviceSpecifier = alc.alcGetString(device, ALC.ALC_DEVICE_SPECIFIER); @@ -155,6 +171,8 @@ public class ALAudioSink implements AudioSink { } // Create audio context. + // final int[] attrs = new int[] { ALC.ALC_FREQUENCY, DefaultFormat.sampleRate, 0 }; + // context = alc.alcCreateContext(device, attrs, 0); context = alc.alcCreateContext(device, null); if (context == null) { throw new RuntimeException(getThreadName()+": ALAudioSink: Error creating OpenAL context for "+deviceSpecifier); @@ -170,14 +188,18 @@ public class ALAudioSink implements AudioSink { hasSOFTBufferSamples = al.alIsExtensionPresent(AL_SOFT_buffer_samples); hasALC_thread_local_context = alc.alcIsExtensionPresent(null, ALC_EXT_thread_local_context) || alc.alcIsExtensionPresent(device, ALC_EXT_thread_local_context) ; - preferredAudioFormat = queryPreferredAudioFormat(); + clearPreALError("init."+checkErrIter++); + preferredAudioFormat = new AudioFormat(querySampleRate(), DefaultFormat.sampleSize, DefaultFormat.channelCount, DefaultFormat.signed, DefaultFormat.fixedP, DefaultFormat.planar, DefaultFormat.littleEndian); if( DEBUG ) { System.out.println("ALAudioSink: OpenAL Extensions:"+al.alGetString(AL.AL_EXTENSIONS)); + clearPreALError("init."+checkErrIter++); System.out.println("ALAudioSink: Null device OpenAL Extensions:"+alc.alcGetString(null, ALC.ALC_EXTENSIONS)); + clearPreALError("init."+checkErrIter++); System.out.println("ALAudioSink: Device "+deviceSpecifier+" OpenAL Extensions:"+alc.alcGetString(device, ALC.ALC_EXTENSIONS)); System.out.println("ALAudioSink: hasSOFTBufferSamples "+hasSOFTBufferSamples); System.out.println("ALAudioSink: hasALC_thread_local_context "+hasALC_thread_local_context); System.out.println("ALAudioSink: preferredAudioFormat "+preferredAudioFormat); + clearPreALError("init."+checkErrIter++); } // Create source @@ -202,20 +224,28 @@ public class ALAudioSink implements AudioSink { } catch ( Exception e ) { if( DEBUG ) { System.err.println(e.getMessage()); + e.printStackTrace(); } destroy(); } } } - private final AudioFormat queryPreferredAudioFormat() { - int sampleRate = DefaultFormat.sampleRate; + private final int querySampleRate() { + final int sampleRate; final int[] value = new int[1]; alc.alcGetIntegerv(device, ALC.ALC_FREQUENCY, 1, value, 0); - if ( alc.alcGetError(device) == ALC.ALC_NO_ERROR ) { + final int alcErr = alc.alcGetError(device); + final int alErr = al.alGetError(); + if ( ALC.ALC_NO_ERROR == alcErr && AL.AL_NO_ERROR == alErr && 0 != value[0] ) { sampleRate = value[0]; + } else { + sampleRate = DefaultFormat.sampleRate; + } + if( DEBUG ) { + System.err.println("ALAudioSink.querySampleRate: err [alc "+toHexString(alcErr)+", al "+toHexString(alErr)+"], freq: "+value[0]+" -> "+sampleRate); } - return new AudioFormat(sampleRate, DefaultFormat.sampleSize, DefaultFormat.channelCount, DefaultFormat.signed, DefaultFormat.fixedP, DefaultFormat.planar, DefaultFormat.littleEndian); + return sampleRate; } private final void lockContext() { diff --git a/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java b/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java index a68adb3a4..4ab90322d 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java +++ b/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java @@ -88,6 +88,16 @@ public class NullAudioSink implements AudioSink { @Override public final boolean isSupported(AudioFormat format) { + /** + * If we like to emulate constraints .. + * + if( format.planar || !format.littleEndian ) { + return false; + } + if( format.sampleRate != DefaultFormat.sampleRate ) { + return false; + } + */ 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 4ce48bfaf..9cfd3d80e 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java @@ -138,7 +138,11 @@ import jogamp.opengl.util.av.VideoPixelFormat; * <li>http://ffmpeg.zeranoe.com/builds/ (ffmpeg) <i>recommended, works w/ dshow</i></li> * <li>http://win32.libav.org/releases/ (libav)</li> * </ul></li> - * <li>MacOSX: http://ffmpegmac.net/</li> + * <li>MacOSX using Homebrew + * <ul> + * <li>https://github.com/Homebrew/homebrew/wiki/Installation</li> + * <li>https://trac.ffmpeg.org/wiki/CompilationGuide/MacOSX</li> + * </ul></li> * <li>OpenIndiana/Solaris:<pre> * pkg set-publisher -p http://pkg.openindiana.org/sfe-encumbered. * pkt install pkg:/video/ffmpeg diff --git a/src/jogl/native/libav/ffmpeg_impl_template.c b/src/jogl/native/libav/ffmpeg_impl_template.c index a7e9f4857..3077070db 100644 --- a/src/jogl/native/libav/ffmpeg_impl_template.c +++ b/src/jogl/native/libav/ffmpeg_impl_template.c @@ -572,7 +572,7 @@ JNIEXPORT jlong JNICALL FF_FUNC(createInstance0) pAV->aid=AV_STREAM_ID_AUTO; if(pAV->verbose) { - fprintf(stderr, "Info: Use avresample %d, swresample %d, device %d, refCount %d\n", + fprintf(stderr, "Info: Has avresample %d, swresample %d, device %d, refCount %d\n", AV_HAS_API_AVRESAMPLE(pAV), AV_HAS_API_SWRESAMPLE(pAV), HAS_FUNC(sp_avdevice_register_all), pAV->useRefCountedFrames); } return (jlong) (intptr_t) pAV; @@ -991,6 +991,10 @@ JNIEXPORT void JNICALL FF_FUNC(setStream0) } } } + if(pAV->verbose) { + fprintf(stderr, "Info: Need resample %d, Use avresample %d, swresample %d\n", + pAV->aSinkSupport, NULL!=pAV->avResampleCtx, NULL!=pAV->swResampleCtx); + } // Allocate audio frames // FIXME: Libav Binary compatibility! JAU01 |