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) --- .../av/impl/FFMPEGDynamicLibraryBundleInfo.java | 11 +++++--- .../opengl/util/av/impl/FFMPEGMediaPlayer.java | 17 +++++++---- .../libav/ffmpeg_lavc55_lavf55_lavu52_lavr01.c | 33 ---------------------- .../libav/ffmpeg_lavc55_lavf55_lavu53_lavr01.c | 33 ++++++++++++++++++++++ 4 files changed, 51 insertions(+), 43 deletions(-) delete mode 100644 src/jogl/native/libav/ffmpeg_lavc55_lavf55_lavu52_lavr01.c create mode 100644 src/jogl/native/libav/ffmpeg_lavc55_lavf55_lavu53_lavr01.c (limited to 'src/jogl') 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 ) { diff --git a/src/jogl/native/libav/ffmpeg_lavc55_lavf55_lavu52_lavr01.c b/src/jogl/native/libav/ffmpeg_lavc55_lavf55_lavu52_lavr01.c deleted file mode 100644 index 277100398..000000000 --- a/src/jogl/native/libav/ffmpeg_lavc55_lavf55_lavu52_lavr01.c +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2013 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of JogAmp Community. - */ - -#include "jogamp_opengl_util_av_impl_FFMPEGv10Natives.h" - -#define FF_FUNC(METHOD) Java_jogamp_opengl_util_av_impl_FFMPEGv10Natives_ ## METHOD - -#include "ffmpeg_impl_template.c" diff --git a/src/jogl/native/libav/ffmpeg_lavc55_lavf55_lavu53_lavr01.c b/src/jogl/native/libav/ffmpeg_lavc55_lavf55_lavu53_lavr01.c new file mode 100644 index 000000000..277100398 --- /dev/null +++ b/src/jogl/native/libav/ffmpeg_lavc55_lavf55_lavu53_lavr01.c @@ -0,0 +1,33 @@ +/** + * Copyright 2013 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +#include "jogamp_opengl_util_av_impl_FFMPEGv10Natives.h" + +#define FF_FUNC(METHOD) Java_jogamp_opengl_util_av_impl_FFMPEGv10Natives_ ## METHOD + +#include "ffmpeg_impl_template.c" -- cgit v1.2.3