diff options
Diffstat (limited to 'src/jogl/classes/jogamp')
6 files changed, 74 insertions, 66 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java index 744aefb32..055fb4bae 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java @@ -154,7 +154,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { "avresample_free", "avresample_convert", - // libavresample + // libswresample "av_opt_set_sample_fmt", // actually lavu .. but exist only w/ swresample! "swresample_version", // 0 "swr_alloc", @@ -182,63 +182,6 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { private static final int LIB_IDX_AVR = 4; private static final int LIB_IDX_SWR = 5; - static { - // native ffmpeg media player implementation is included in jogl_desktop and jogl_mobile - GLProfile.initSingleton(); - boolean _ready = false; - /** util, format, codec, avresample, swresample */ - final VersionNumber[] _versions = new VersionNumber[5]; - try { - _ready = initSymbols(_versions); - } catch (final Throwable t) { - t.printStackTrace(); - } - libsUFCLoaded = libLoaded[LIB_IDX_UTI] && libLoaded[LIB_IDX_FMT] && libLoaded[LIB_IDX_COD]; - avUtilVersion = _versions[0]; - avFormatVersion = _versions[1]; - avCodecVersion = _versions[2]; - avResampleVersion = _versions[3]; - swResampleVersion = _versions[4]; - if(!libsUFCLoaded) { - System.err.println("LIB_AV Not Available: lavu, lavc, lavu"); - natives = null; - ready = false; - } else if(!_ready) { - System.err.println("LIB_AV Not Matching"); - natives = null; - ready = false; - } else { - final int avCodecMajor = avCodecVersion.getMajor(); - final int avFormatMajor = avFormatVersion.getMajor(); - final int avUtilMajor = avUtilVersion.getMajor(); - if( avCodecMajor == 53 && avFormatMajor == 53 && avUtilMajor == 51 ) { - // lavc53.lavf53.lavu51 - natives = new FFMPEGv08Natives(); - } else if( avCodecMajor == 54 && avFormatMajor == 54 && avUtilMajor == 52 ) { - // lavc54.lavf54.lavu52.lavr01 - natives = new FFMPEGv09Natives(); - } else if( avCodecMajor == 55 && avFormatMajor == 55 && ( avUtilMajor == 52 || avUtilMajor == 53 ) ) { - // lavc55.lavf55.lavu52.lavr01 (ffmpeg) or lavc55.lavf55.lavu53.lavr01 (libav) - natives = new FFMPEGv10Natives(); - } else { - System.err.println("LIB_AV No Version/Native-Impl Match"); - natives = null; - } - if( null != natives && FFMPEGStaticNatives.initIDs0() ) { - ready = natives.initSymbols0(symbolAddr, symbolCount); - } else { - ready = false; - } - } - } - - static boolean libsLoaded() { return libsUFCLoaded; } - static boolean avDeviceLoaded() { return libLoaded[LIB_IDX_DEV]; } - static boolean avResampleLoaded() { return libLoaded[LIB_IDX_AVR]; } - static boolean swResampleLoaded() { return libLoaded[LIB_IDX_SWR]; } - static FFMPEGNatives getNatives() { return natives; } - static boolean initSingleton() { return ready; } - private static final PrivilegedAction<DynamicLibraryBundle> privInitSymbolsAction = new PrivilegedAction<DynamicLibraryBundle>() { @Override public DynamicLibraryBundle run() { @@ -302,6 +245,63 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { return res; } + static { + // native ffmpeg media player implementation is included in jogl_desktop and jogl_mobile + GLProfile.initSingleton(); + boolean _ready = false; + /** util, format, codec, avresample, swresample */ + final VersionNumber[] _versions = new VersionNumber[5]; + try { + _ready = initSymbols(_versions); + } catch (final Throwable t) { + t.printStackTrace(); + } + libsUFCLoaded = libLoaded[LIB_IDX_UTI] && libLoaded[LIB_IDX_FMT] && libLoaded[LIB_IDX_COD]; + avUtilVersion = _versions[0]; + avFormatVersion = _versions[1]; + avCodecVersion = _versions[2]; + avResampleVersion = _versions[3]; + swResampleVersion = _versions[4]; + if(!libsUFCLoaded) { + System.err.println("LIB_AV Not Available: lavu, lavc, lavu"); + natives = null; + ready = false; + } else if(!_ready) { + System.err.println("LIB_AV Not Matching"); + natives = null; + ready = false; + } else { + final int avCodecMajor = avCodecVersion.getMajor(); + final int avFormatMajor = avFormatVersion.getMajor(); + final int avUtilMajor = avUtilVersion.getMajor(); + if( avCodecMajor == 53 && avFormatMajor == 53 && avUtilMajor == 51 ) { + // lavc53.lavf53.lavu51 + natives = new FFMPEGv08Natives(); + } else if( avCodecMajor == 54 && avFormatMajor == 54 && avUtilMajor == 52 ) { + // lavc54.lavf54.lavu52.lavr01 + natives = new FFMPEGv09Natives(); + } else if( avCodecMajor == 55 && avFormatMajor == 55 && ( avUtilMajor == 52 || avUtilMajor == 53 ) ) { + // lavc55.lavf55.lavu52.lavr01 (ffmpeg) or lavc55.lavf55.lavu53.lavr01 (libav) + natives = new FFMPEGv10Natives(); + } else { + System.err.println("LIB_AV No Version/Native-Impl Match"); + natives = null; + } + if( null != natives && FFMPEGStaticNatives.initIDs0() ) { + ready = natives.initSymbols0(symbolAddr, symbolCount); + } else { + ready = false; + } + } + } + + static boolean libsLoaded() { return libsUFCLoaded; } + static boolean avDeviceLoaded() { return libLoaded[LIB_IDX_DEV]; } + static boolean avResampleLoaded() { return libLoaded[LIB_IDX_AVR]; } + static boolean swResampleLoaded() { return libLoaded[LIB_IDX_SWR]; } + static FFMPEGNatives getNatives() { return natives; } + static boolean initSingleton() { return ready; } + protected FFMPEGDynamicLibraryBundleInfo() { } 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 00c3e83b0..a43f026ad 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java @@ -163,6 +163,8 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { private static final int avResampleMajorVersionCC; private static final int swResampleMajorVersionCC; private static final boolean available; + private static final boolean enableAvResample; + private static final boolean enableSwResample; static { final boolean libAVGood = FFMPEGDynamicLibraryBundleInfo.initSingleton(); @@ -205,9 +207,13 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { avFormatMajorVersionCC == avFormatMajor && ( avUtilMajorVersionCC == avUtilMajor || 55 == avCodecMajorVersionCC && 53 == avUtilMajorVersionCC && 52 == avUtilMajor /* ffmpeg 2.x */ - ) && - ( !avResampleLoaded || avResampleMajorVersionCC < 0 || avResampleMajorVersionCC == avResampleVersion.getMajor() ) && - ( !swResampleLoaded || swResampleMajorVersionCC < 0 || swResampleMajorVersionCC == swResampleVersion.getMajor() ) ; + ); + enableAvResample = avResampleLoaded && avResampleMajorVersionCC == avResampleVersion.getMajor(); + enableSwResample = swResampleLoaded && swResampleMajorVersionCC == swResampleVersion.getMajor(); + if( DEBUG ) { + System.err.println("LIB_AV Resample: enabled "+enableAvResample); + System.err.println("LIB_SW Resample: enabled "+enableSwResample); + } if( !libAVVersionGood ) { System.err.println("LIB_AV Not Matching Compile-Time / Runtime Major-Version"); } @@ -219,6 +225,8 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { avResampleMajorVersionCC = 0; swResampleMajorVersionCC = 0; libAVVersionGood = false; + enableAvResample = false; + enableSwResample = false; } available = libAVGood && libAVVersionGood && null != natives; } @@ -256,7 +264,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { if(!available) { throw new RuntimeException("FFMPEGMediaPlayer not available"); } - moviePtr = natives.createInstance0(this, DEBUG_NATIVE); + moviePtr = natives.createInstance0(this, enableAvResample, enableSwResample, DEBUG_NATIVE); if(0==moviePtr) { throw new GLException("Couldn't create FFMPEGInstance"); } diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java index 8fd439082..3b8fc83d9 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java @@ -43,7 +43,7 @@ import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame; abstract int getAvResampleMajorVersionCC0(); abstract int getSwResampleMajorVersionCC0(); - abstract long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose); + abstract long createInstance0(FFMPEGMediaPlayer upstream, boolean enableAvResample, boolean enableSwResample, boolean verbose); abstract void destroyInstance0(long moviePtr); /** diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java index 6bab23f25..eff9ee5f5 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java @@ -47,7 +47,7 @@ class FFMPEGv08Natives extends FFMPEGNatives { native int getSwResampleMajorVersionCC0(); @Override - native long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose); + native long createInstance0(FFMPEGMediaPlayer upstream, boolean enableAvResample, boolean enableSwResample, boolean verbose); @Override native void destroyInstance0(long moviePtr); diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java index a48b5f21f..d61b39c77 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java @@ -47,7 +47,7 @@ class FFMPEGv09Natives extends FFMPEGNatives { native int getSwResampleMajorVersionCC0(); @Override - native long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose); + native long createInstance0(FFMPEGMediaPlayer upstream, boolean enableAvResample, boolean enableSwResample, boolean verbose); @Override native void destroyInstance0(long moviePtr); diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java index f35fb29dc..109fd8953 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java @@ -47,7 +47,7 @@ class FFMPEGv10Natives extends FFMPEGNatives { native int getSwResampleMajorVersionCC0(); @Override - native long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose); + native long createInstance0(FFMPEGMediaPlayer upstream, boolean enableAvResample, boolean enableSwResample, boolean verbose); @Override native void destroyInstance0(long moviePtr); |