From 1eea4278f1be5900f0d990d0a7d352923def217c Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Thu, 5 Feb 2015 16:27:56 +0100
Subject: FFMPEGMediaPlayer: Add support for libav-11 and ffmpeg 2.[4-x]
(Latest release, used in Debian 8, etc)
---
.../av/impl/FFMPEGDynamicLibraryBundleInfo.java | 63 ++++++++++-------
.../opengl/util/av/impl/FFMPEGMediaPlayer.java | 16 ++++-
.../opengl/util/av/impl/FFMPEGv11Natives.java | 78 ++++++++++++++++++++++
.../libav/ffmpeg_lavc56_lavf56_lavu54_lavr02.c | 33 +++++++++
4 files changed, 164 insertions(+), 26 deletions(-)
create mode 100644 src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv11Natives.java
create mode 100644 src/jogl/native/libav/ffmpeg_lavc56_lavf56_lavu54_lavr02.c
(limited to 'src')
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 055fb4bae..f294d5bc0 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java
@@ -115,7 +115,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
/* 54 */ "avformat_find_stream_info", // 53.3.0 (opt)
// libavdevice
-/* 55 */ "avdevice_register_all", // ???
+/* 55 */ "avdevice_register_all", // supported in all version <= 56
// libavresample
"avresample_alloc_context", // 1.0.1
@@ -283,6 +283,9 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
} 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 if( avCodecMajor == 56 && avFormatMajor == 56 && avUtilMajor == 54 ) {
+ // lavc56.lavf56.lavu54.lavr02
+ natives = new FFMPEGv11Natives();
} else {
System.err.println("LIB_AV No Version/Native-Impl Match");
natives = null;
@@ -333,13 +336,17 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
final List avutil = new ArrayList();
avutil.add("avutil"); // default
- avutil.add("libavutil.so.53"); // dummy future proof
- avutil.add("libavutil.so.52"); // ffmpeg 1.2 + 2 / libav 9 + 10
+ avutil.add("libavutil.so.55"); // dummy future proof
+ avutil.add("libavutil.so.54"); // ffmpeg 2.[4-x] / libav 11
+ avutil.add("libavutil.so.53"); // ffmpeg 2.[0-3] / libav 10
+ avutil.add("libavutil.so.52"); // ffmpeg 1.2 + 2.[0-3] / libav 9
avutil.add("libavutil.so.51"); // 0.8
avutil.add("libavutil.so.50"); // 0.7
- avutil.add("avutil-53"); // dummy future proof
- avutil.add("avutil-52"); // ffmpeg 1.2 + 2 / libav 9 + 10
+ avutil.add("avutil-55"); // dummy future proof
+ avutil.add("avutil-54"); // ffmpeg 2.[4-x] / libav 11
+ avutil.add("avutil-53"); // ffmpeg 2.[0-3] / libav 10
+ avutil.add("avutil-52"); // ffmpeg 1.2 + 2.[0-3] / libav 9
avutil.add("avutil-51"); // 0.8
avutil.add("avutil-50"); // 0.7
libsList.add(avutil);
@@ -347,14 +354,16 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
final List avformat = new ArrayList();
avformat.add("avformat"); // default
- avformat.add("libavformat.so.56"); // dummy future proof
- avformat.add("libavformat.so.55"); // ffmpeg 2 / libav 10
+ avformat.add("libavformat.so.57"); // dummy future proof
+ avformat.add("libavformat.so.56"); // ffmpeg 2.[4-x] / libav 11
+ avformat.add("libavformat.so.55"); // ffmpeg 2.[0-3] / libav 10
avformat.add("libavformat.so.54"); // ffmpeg 1.2 / libav 9
avformat.add("libavformat.so.53"); // 0.8
avformat.add("libavformat.so.52"); // 0.7
- avformat.add("avformat-56"); // dummy future proof
- avformat.add("avformat-55"); // ffmpeg 2 / libav 10
+ avformat.add("avformat-57"); // dummy future proof
+ avformat.add("avformat-56"); // ffmpeg 2.[4-x] / libav 11
+ avformat.add("avformat-55"); // ffmpeg 2.[0-3] / libav 10
avformat.add("avformat-54"); // ffmpeg 1.2 / libav 9
avformat.add("avformat-53"); // 0.8
avformat.add("avformat-52"); // 0.7
@@ -363,14 +372,16 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
final List avcodec = new ArrayList();
avcodec.add("avcodec"); // default
- avcodec.add("libavcodec.so.56"); // dummy future proof
- avcodec.add("libavcodec.so.55"); // ffmpeg 2/ libav 10
+ avcodec.add("libavcodec.so.57"); // dummy future proof
+ avcodec.add("libavcodec.so.56"); // ffmpeg 2.[4-x] / libav 11
+ avcodec.add("libavcodec.so.55"); // ffmpeg 2.[0-3] / libav 10
avcodec.add("libavcodec.so.54"); // ffmpeg 1.2 / libav 9
avcodec.add("libavcodec.so.53"); // 0.8
avcodec.add("libavcodec.so.52"); // 0.7
- avcodec.add("avcodec-56"); // dummy future proof
- avcodec.add("avcodec-55"); // ffmpeg 2/ libav 10
+ avcodec.add("avcodec-57"); // dummy future proof
+ avcodec.add("avcodec-56"); // ffmpeg 2.[4-x] / libav 11
+ avcodec.add("avcodec-55"); // ffmpeg 2.[0-3] / libav 10
avcodec.add("avcodec-54"); // ffmpeg 1.2 / libav 9
avcodec.add("avcodec-53"); // 0.8
avcodec.add("avcodec-52"); // 0.7
@@ -379,13 +390,15 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
final List avdevice = new ArrayList();
avdevice.add("avdevice"); // default
- avdevice.add("libavdevice.so.56"); // dummy future proof
- avdevice.add("libavdevice.so.55"); // ffmpeg 2
+ avdevice.add("libavdevice.so.57"); // dummy future proof
+ avdevice.add("libavdevice.so.56"); // ffmpeg 2.[4-x]
+ avdevice.add("libavdevice.so.55"); // ffmpeg 2.[0-3] / libav 11
avdevice.add("libavdevice.so.54"); // ffmpeg 1.2 / libav 10
avdevice.add("libavdevice.so.53"); // 0.8 && libav 9
- avdevice.add("avdevice-56"); // dummy future proof
- avdevice.add("avdevice-55"); // ffmpeg 2
+ avdevice.add("avdevice-57"); // dummy future proof
+ avdevice.add("avdevice-56"); // ffmpeg 2.[4-x]
+ avdevice.add("avdevice-55"); // ffmpeg 2.[0-3] / libav 11
avdevice.add("avdevice-54"); // ffmpeg 1.2 / libav 10
avdevice.add("avdevice-53"); // 0.8 && libav 9
libsList.add(avdevice);
@@ -393,21 +406,25 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
final List avresample = new ArrayList();
avresample.add("avresample"); // default
- avresample.add("libavresample.so.2"); // dummy future proof
+ avresample.add("libavresample.so.3"); // dummy future proof
+ avresample.add("libavresample.so.2"); // libav 11
avresample.add("libavresample.so.1"); // libav 9 + 10
- avresample.add("avresample-2"); // dummy future proof
+ avresample.add("avresample-3"); // dummy future proof
+ avresample.add("avresample-2"); // libav 11
avresample.add("avresample-1"); // libav 9 + 10
libsList.add(avresample);
final List swresample = new ArrayList();
swresample.add("swresample"); // default
- swresample.add("libswresample.so.1"); // dummy future proof
- swresample.add("libswresample.so.0"); // ffmpeg 1.2 + 2.x
+ swresample.add("libswresample.so.2"); // dummy future proof
+ swresample.add("libswresample.so.1"); // ffmpeg 2.[4-x]
+ swresample.add("libswresample.so.0"); // ffmpeg 1.2 + 2.[0-3]
- swresample.add("swresample-1"); // dummy future proof
- swresample.add("swresample-0"); // ffmpeg 1.2 + 2.x
+ swresample.add("swresample-2"); // dummy future proof
+ swresample.add("swresample-1"); // ffmpeg 2.[4-x]
+ swresample.add("swresample-0"); // ffmpeg 1.2 + 2.[0-3]
libsList.add(swresample);
return libsList;
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 a43f026ad..7df5d6a9e 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
@@ -106,14 +106,24 @@ import jogamp.opengl.util.av.VideoPixelFormat;
*
* Currently we are binary compatible w/:
*
- * libav / ffmpeg | lavc | lavf | lavu | lavr | FFMPEG* class |
+ * libav / ffmpeg | lavc | lavf | lavu | lavr/lswr | FFMPEG* class |
* 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 |
+ * 10 / 2.[0-3] | 55 | 55 | 53/52 | 01/00 | FFMPEGv10 |
+ * 11 / 2.[4-x] | 56 | 56 | 54 | 02/01 | FFMPEGv11 |
*
*
*
- * See http://upstream-tracker.org/versions/libav.html
+ * See FFmpeg:
+ *
+ * - http://ffmpeg.org/documentation.html
+ * - http://git.videolan.org/?p=ffmpeg.git;a=blob;f=doc/APIchanges;hb=HEAD
+ *
+ * See libav:
+ *
+ * - https://libav.org/documentation.html
+ * - http://upstream-tracker.org/versions/libav.html
+ *
*
*
* Check tag 'FIXME: Add more planar formats !'
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv11Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv11Natives.java
new file mode 100644
index 000000000..9654eca82
--- /dev/null
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv11Natives.java
@@ -0,0 +1,78 @@
+/**
+ * Copyright 2015 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.
+ */
+package jogamp.opengl.util.av.impl;
+
+class FFMPEGv11Natives extends FFMPEGNatives {
+ @Override
+ native boolean initSymbols0(Object mutex_avcodec_openclose, long[] symbols, int count);
+
+ @Override
+ native int getAvUtilMajorVersionCC0();
+
+ @Override
+ native int getAvFormatMajorVersionCC0();
+
+ @Override
+ native int getAvCodecMajorVersionCC0();
+
+ @Override
+ native int getAvResampleMajorVersionCC0();
+
+ @Override
+ native int getSwResampleMajorVersionCC0();
+
+ @Override
+ native long createInstance0(FFMPEGMediaPlayer upstream, boolean enableAvResample, boolean enableSwResample, boolean verbose);
+
+ @Override
+ native void destroyInstance0(long moviePtr);
+
+ @Override
+ native void setStream0(long moviePtr, String url, boolean isCameraInput, int vid, String sizes, int vWidth, int vHeight, int vRate, int aid, int aMaxChannelCount, int aPrefSampleRate);
+
+ @Override
+ native void setGLFuncs0(long moviePtr, long procAddrGLTexSubImage2D, long procAddrGLGetError, long procAddrGLFlush, long procAddrGLFinish);
+
+ @Override
+ native int getVideoPTS0(long moviePtr);
+
+ @Override
+ native int getAudioPTS0(long moviePtr);
+
+ @Override
+ native int readNextPacket0(long moviePtr, int texTarget, int texFmt, int texType);
+
+ @Override
+ native int play0(long moviePtr);
+
+ @Override
+ native int pause0(long moviePtr);
+
+ @Override
+ native int seek0(long moviePtr, int position);
+}
diff --git a/src/jogl/native/libav/ffmpeg_lavc56_lavf56_lavu54_lavr02.c b/src/jogl/native/libav/ffmpeg_lavc56_lavf56_lavu54_lavr02.c
new file mode 100644
index 000000000..d1657d0c6
--- /dev/null
+++ b/src/jogl/native/libav/ffmpeg_lavc56_lavf56_lavu54_lavr02.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_FFMPEGv11Natives.h"
+
+#define FF_FUNC(METHOD) Java_jogamp_opengl_util_av_impl_FFMPEGv11Natives_ ## METHOD
+
+#include "ffmpeg_impl_template.c"
--
cgit v1.2.3