From 8426f47419bf116b427461a36534e70c48ed930d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 5 Feb 2015 04:35:51 +0100 Subject: Fix FFMPEGMediaPlayer: static init block issue, libavresample debian8 packaging - static init block issue commit 06a05d30fc026b21f59310986ea9eb7f3ff30d54 used a static final field initialized after the static {} block which was still null if called -> moved above static {} - libavresample debian8 packaging Debian8 packages a libav10 combination w/ libavresample version 2, which actually belongs to libav11 - libav10 uses libarvresample version 1. Allow libavresample and libswresample to be selectively skipped if version mismatch. --- .../jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java') 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"); } -- cgit v1.2.3