aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java110
1 files changed, 44 insertions, 66 deletions
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 6e44dcc37..c1a7eceda 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
@@ -56,16 +56,12 @@ import jogamp.opengl.util.av.GLMediaPlayerImpl;
import jogamp.opengl.util.av.VideoPixelFormat;
/***
- * Implementation utilizes <a href="http://libav.org/">Libav</a>
- * or <a href="http://ffmpeg.org/">FFmpeg</a> which are ubiquitous
+ * Implementation utilizes <a href="http://ffmpeg.org/">FFmpeg</a> which is ubiquitous
* available and usually pre-installed on Unix platforms.
* <p>
- * Due to legal reasons we cannot deploy binaries of it, which contains patented codecs.
- * </p>
- * <p>
* Besides the default BSD/Linux/.. repositories and installations,
* precompiled binaries can be found at the
- * <a href="#libavavail">listed location below</a>.
+ * <a href="#ffmpegavail">listed location below</a>.
* </p>
*
* <a name="implspecifics"><h5>Implementation specifics</h5></a>
@@ -90,29 +86,26 @@ import jogamp.opengl.util.av.VideoPixelFormat;
* </p>
* <p>
*
- * <a name="libavspecifics"><h5>Libav Specifics</h5></a>
+ * <a name="ffmpegspecifics"><h5>FFmpeg Specifics</h5></a>
* <p>
- * Utilizes a slim dynamic and native binding to the Lib_av
- * libraries:
+ * Utilizes a slim dynamic and native binding to the FFmpeg libraries:
* <ul>
- * <li>libavcodec</li>
- * <li>libavformat</li>
- * <li>libavutil</li>
- * <li>libavresample (opt)</li>
- * <li>libavdevice (opt)</li>
+ * <li>avcodec</li>
+ * <li>avformat</li>
+ * <li>avutil</li>
+ * <li>avdevice (optional for video input devices)</li>
+ * <li>swresample</li>
* </ul>
* </p>
*
- * <a name="compatibility"><h5>LibAV Compatibility</h5></a>
+ * <a name="compatibility"><h5>FFmpeg Compatibility</h5></a>
* <p>
- * Currently we are binary compatible w/:
+ * Currently we are binary compatible with the following major versions:
* <table border="1">
- * <tr><th>libav / ffmpeg</th><th>lavc</th><th>lavf</th><th>lavu</th><th>lavr/lswr</th> <th>FFMPEG* class</th></tr>
- * <tr><td>0.8</td> <td>53</td> <td>53</td> <td>51</td> <td></td> <td>FFMPEGv08</td></tr>
- * <tr><td>9.0 / 1.2</td> <td>54</td> <td>54</td> <td>52</td> <td>01/00</td> <td>FFMPEGv09</td></tr>
- * <tr><td>10 / 2.[0-3]</td> <td>55</td> <td>55</td> <td>53/52</td> <td>01/00</td> <td>FFMPEGv10</td></tr>
- * <tr><td>11 / 2.[4-8]</td> <td>56</td> <td>56</td> <td>54</td> <td>02/01</td> <td>FFMPEGv11</td></tr>
- * <tr><td>12 / 2.[9-x]</td> <td>57</td> <td>57</td> <td>55</td> <td>02/01</td> <td>TODO</td></tr>
+ * <tr><th>ffmpeg</th><th>lavcodec</th><th>lavformat</th><th>lavdevice</th><th>lavutil</th><th>swresample</th> <th>FFMPEG* class</th></tr>
+ * <tr><td>4</td> <td>58</td> <td>58</td> <td>58</td> <td>56</td> <td>03</td> <td>FFMPEGv0400</td></tr>
+ * <tr><td>5</td> <td>59</td> <td>59</td> <td>59</td> <td>57</td> <td>04</td> <td>FFMPEGv0500</td></tr>
+ * <tr><td>6</td> <td>60</td> <td>60</td> <td>60</td> <td>58</td> <td>04</td> <td>FFMPEGv0600</td></tr>
* </table>
* </p>
* <p>
@@ -121,11 +114,6 @@ import jogamp.opengl.util.av.VideoPixelFormat;
* <li>http://ffmpeg.org/documentation.html</li>
* <li>http://git.videolan.org/?p=ffmpeg.git;a=blob;f=doc/APIchanges;hb=HEAD</li>
* </ul>
- * See libav:
- * <ul>
- * <li>https://libav.org/documentation.html</li>
- * <li>http://upstream-tracker.org/versions/libav.html</li>
- * </ul>
* </p>
* <p>
* Check tag 'FIXME: Add more planar formats !'
@@ -141,15 +129,14 @@ import jogamp.opengl.util.av.VideoPixelFormat;
* </ul>
* </p>
*
- * <a name="libavavail"><h5>FFMPEG / LibAV Availability</h5></a>
+ * <a name="ffmpegavail"><h5>FFmpeg Availability</h5></a>
* <p>
* <ul>
- * <li>GNU/Linux: ffmpeg or libav are deployed in most distributions.</li>
+ * <li>GNU/Linux: ffmpeg is deployed in most distributions.</li>
* <li>Windows:
* <ul>
* <li>https://ffmpeg.org/download.html#build-windows</li>
* <li>http://ffmpeg.zeranoe.com/builds/ (ffmpeg) <i>recommended, works w/ dshow</i></li>
- * <li>http://win32.libav.org/releases/ (libav)</li>
* </ul></li>
* <li>MacOSX
* <ul>
@@ -211,11 +198,9 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
private static final int avUtilMajorVersionCC;
private static final int avFormatMajorVersionCC;
private static final int avCodecMajorVersionCC;
- private static final int avResampleMajorVersionCC;
+ private static final int avDeviceMajorVersionCC;
private static final int swResampleMajorVersionCC;
private static final boolean available;
- private static final boolean enableAvResample;
- private static final boolean enableSwResample;
static {
// PREFER_SYSTEM_LIBS default on all systems is true for now!
@@ -230,58 +215,51 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
avCodecMajorVersionCC = natives.getAvCodecMajorVersionCC0();
avFormatMajorVersionCC = natives.getAvFormatMajorVersionCC0();
avUtilMajorVersionCC = natives.getAvUtilMajorVersionCC0();
- avResampleMajorVersionCC = natives.getAvResampleMajorVersionCC0();
+ avDeviceMajorVersionCC = natives.getAvDeviceMajorVersionCC0();
swResampleMajorVersionCC = natives.getSwResampleMajorVersionCC0();
} else {
avUtilMajorVersionCC = 0;
avFormatMajorVersionCC = 0;
avCodecMajorVersionCC = 0;
- avResampleMajorVersionCC = 0;
+ avDeviceMajorVersionCC = 0;
swResampleMajorVersionCC = 0;
}
final VersionNumber avCodecVersion = FFMPEGDynamicLibraryBundleInfo.avCodecVersion;
final VersionNumber avFormatVersion = FFMPEGDynamicLibraryBundleInfo.avFormatVersion;
final VersionNumber avUtilVersion = FFMPEGDynamicLibraryBundleInfo.avUtilVersion;
- final VersionNumber avResampleVersion = FFMPEGDynamicLibraryBundleInfo.avResampleVersion;
- final boolean avResampleLoaded = FFMPEGDynamicLibraryBundleInfo.avResampleLoaded();
+ final VersionNumber avDeviceVersion = FFMPEGDynamicLibraryBundleInfo.avDeviceVersion;
final VersionNumber swResampleVersion = FFMPEGDynamicLibraryBundleInfo.swResampleVersion;
+ final boolean avDeviceLoaded = FFMPEGDynamicLibraryBundleInfo.avDeviceLoaded();
final boolean swResampleLoaded = FFMPEGDynamicLibraryBundleInfo.swResampleLoaded();
- if( DEBUG ) {
- System.err.println("LIB_AV Codec : "+avCodecVersion+" [cc "+avCodecMajorVersionCC+"]");
- System.err.println("LIB_AV Format : "+avFormatVersion+" [cc "+avFormatMajorVersionCC+"]");
- System.err.println("LIB_AV Util : "+avUtilVersion+" [cc "+avUtilMajorVersionCC+"]");
- System.err.println("LIB_AV Resample: "+avResampleVersion+" [cc "+avResampleMajorVersionCC+", loaded "+avResampleLoaded+"]");
- System.err.println("LIB_SW Resample: "+swResampleVersion+" [cc "+swResampleMajorVersionCC+", loaded "+swResampleLoaded+"]");
- System.err.println("LIB_AV Device : [loaded "+FFMPEGDynamicLibraryBundleInfo.avDeviceLoaded()+"]");
- System.err.println("LIB_AV Class : "+(null!= natives ? natives.getClass().getSimpleName() : "n/a"));
- }
final int avCodecMajor = avCodecVersion.getMajor();
final int avFormatMajor = avFormatVersion.getMajor();
final int avUtilMajor = avUtilVersion.getMajor();
+ final int avDeviceMajor = avDeviceVersion.getMajor();
+ final int swResampleMajor = swResampleVersion.getMajor();
libAVVersionGood = avCodecMajorVersionCC == avCodecMajor &&
avFormatMajorVersionCC == avFormatMajor &&
- ( avUtilMajorVersionCC == avUtilMajor ||
- 55 == avCodecMajorVersionCC && 53 == avUtilMajorVersionCC && 52 == avUtilMajor /* ffmpeg 2.x */
- );
- 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);
- }
+ avUtilMajorVersionCC == avUtilMajor &&
+ ( avDeviceMajorVersionCC == avDeviceMajor || 0 == avDeviceMajor ) &&
+ swResampleMajorVersionCC == swResampleMajor;
if( !libAVVersionGood ) {
- System.err.println("LIB_AV Not Matching Compile-Time / Runtime Major-Version");
+ System.err.println("FFmpeg Not Matching Compile-Time / Runtime Major-Version");
+ }
+ if( !libAVVersionGood || DEBUG ) {
+ System.err.println("FFmpeg Codec : "+avCodecVersion+" [cc "+avCodecMajorVersionCC+"]");
+ System.err.println("FFmpeg Format : "+avFormatVersion+" [cc "+avFormatMajorVersionCC+"]");
+ System.err.println("FFmpeg Util : "+avUtilVersion+" [cc "+avUtilMajorVersionCC+"]");
+ System.err.println("FFmpeg Device : "+avDeviceVersion+" [cc "+avDeviceMajorVersionCC+", loaded "+avDeviceLoaded+"]");
+ System.err.println("FFmpeg Resample: "+swResampleVersion+" [cc "+swResampleMajorVersionCC+", loaded "+swResampleLoaded+"]");
+ System.err.println("FFmpeg Class : "+(null!= natives ? natives.getClass().getSimpleName() : "n/a"));
}
} else {
natives = null;
avUtilMajorVersionCC = 0;
avFormatMajorVersionCC = 0;
avCodecMajorVersionCC = 0;
- avResampleMajorVersionCC = 0;
+ avDeviceMajorVersionCC = 0;
swResampleMajorVersionCC = 0;
libAVVersionGood = false;
- enableAvResample = false;
- enableSwResample = false;
}
available = libAVGood && libAVVersionGood && null != natives;
}
@@ -319,7 +297,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
if(!available) {
throw new RuntimeException("FFMPEGMediaPlayer not available");
}
- moviePtr = natives.createInstance0(this, enableAvResample, enableSwResample, DEBUG_NATIVE);
+ moviePtr = natives.createInstance0(this, DEBUG_NATIVE);
if(0==moviePtr) {
throw new GLException("Couldn't create FFMPEGInstance");
}
@@ -521,8 +499,8 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
/**
* Native callback
- * Converts the given libav/ffmpeg values to {@link AudioFormat} and returns {@link AudioSink#isSupported(AudioFormat)}.
- * @param audioSampleFmt ffmpeg/libav audio-sample-format, see {@link AudioSampleFormat}.
+ * Converts the given ffmpeg values to {@link AudioFormat} and returns {@link AudioSink#isSupported(AudioFormat)}.
+ * @param audioSampleFmt ffmpeg audio-sample-format, see {@link AudioSampleFormat}.
* @param audioSampleRate sample rate in Hz (1/s)
* @param audioChannels number of channels
*/
@@ -537,8 +515,8 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
}
/**
- * Returns {@link AudioFormat} as converted from the given libav/ffmpeg values.
- * @param audioSampleFmt ffmpeg/libav audio-sample-format, see {@link AudioSampleFormat}.
+ * Returns {@link AudioFormat} as converted from the given ffmpeg values.
+ * @param audioSampleFmt ffmpeg audio-sample-format, see {@link AudioSampleFormat}.
* @param audioSampleRate sample rate in Hz (1/s)
* @param audioChannels number of channels
*/
@@ -853,7 +831,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
}
final int errno = natives.play0(moviePtr);
if( DEBUG_NATIVE && errno != 0 && errno != -ENOSYS) {
- System.err.println("libav play err: "+errno);
+ System.err.println("ffmpeg play err: "+errno);
}
return true;
}
@@ -865,7 +843,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
}
final int errno = natives.pause0(moviePtr);
if( DEBUG_NATIVE && errno != 0 && errno != -ENOSYS) {
- System.err.println("libav pause err: "+errno);
+ System.err.println("ffmpeg pause err: "+errno);
}
return true;
}