From 6c5f79e6c8144ed5b238b3612abefe9f64d9b18a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 9 May 2014 09:23:06 +0200 Subject: FFMPEGMediaPlayer / FFMPEGv10Natives: Fix libav-10 and ffmpeg-2.x version validation (libavutil) --- .../util/av/impl/FFMPEGDynamicLibraryBundleInfo.java | 11 +++++++---- .../jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java | 17 +++++++++++------ 2 files changed, 18 insertions(+), 10 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl') 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 a6a6fba97..e7a425a54 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java @@ -214,14 +214,17 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { natives = null; ready = false; } else { - if( avCodecVersion.getMajor() == 53 && avFormatVersion.getMajor() == 53 && avUtilVersion.getMajor() == 51 ) { + 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( avCodecVersion.getMajor() == 54 && avFormatVersion.getMajor() == 54 && avUtilVersion.getMajor() == 52 ) { + } else if( avCodecMajor == 54 && avFormatMajor == 54 && avUtilMajor == 52 ) { // lavc54.lavf54.lavu52.lavr01 natives = new FFMPEGv09Natives(); - } else if( avCodecVersion.getMajor() == 55 && avFormatVersion.getMajor() == 55 && avUtilVersion.getMajor() == 52 ) { - // lavc55.lavf55.lavu52.lavr01 + } 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"); 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 6121172c8..bbdc6f206 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java @@ -107,9 +107,9 @@ import jogamp.opengl.util.av.impl.FFMPEGNatives.SampleFormat; * Currently we are binary compatible w/: * * - * - * - * + * + * + * *
libav / ffmpeglavclavflavulavr FFMPEG* class
0.8 53 53 51 FFMPEGv08
9.0 / 1.2 54 54 52 01/00 FFMPEGv09
10 / 2 55 55 52 01/00 FFMPEGv10
0.8 53 53 51 FFMPEGv08
9.0 / 1.2 54 54 52 01/00 FFMPEGv09
10 / 2 55 55 53/52 01/00 FFMPEGv10
*

*

@@ -194,9 +194,14 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { System.err.println("LIB_AV Device : [loaded "+FFMPEGDynamicLibraryBundleInfo.avDeviceLoaded()+"]"); System.err.println("LIB_AV Class : "+(null!= natives ? natives.getClass().getSimpleName() : "n/a")); } - libAVVersionGood = avCodecMajorVersionCC == avCodecVersion.getMajor() && - avFormatMajorVersionCC == avFormatVersion.getMajor() && - avUtilMajorVersionCC == avUtilVersion.getMajor() && + final int avCodecMajor = avCodecVersion.getMajor(); + final int avFormatMajor = avFormatVersion.getMajor(); + final int avUtilMajor = avUtilVersion.getMajor(); + libAVVersionGood = avCodecMajorVersionCC == avCodecMajor && + 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() ) ; if( !libAVVersionGood ) { -- cgit v1.2.3