aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes')
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java5
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java67
2 files changed, 64 insertions, 8 deletions
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 8865d47be..b0181bd7d 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java
@@ -59,7 +59,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
private static final List<String> glueLibNames = new ArrayList<String>(); // none
- private static final int symbolCount = 42;
+ private static final int symbolCount = 43;
private static final String[] symbolNames = {
"avcodec_version",
"avformat_version",
@@ -98,6 +98,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
"avformat_close_input", // 53.17.0 (opt)
"av_close_input_file",
"av_register_all",
+ "av_find_input_format",
"avformat_open_input",
"av_dump_format",
"av_read_frame",
@@ -108,7 +109,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
"avformat_network_init", // 53.13.0 (opt)
"avformat_network_deinit", // 53.13.0 (opt)
"avformat_find_stream_info", // 53.3.0 (opt)
-/* 42 */ "av_find_stream_info",
+/* 43 */ "av_find_stream_info",
};
// alternate symbol names
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 e59a8849f..78f5954e5 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
@@ -38,6 +38,7 @@ import javax.media.opengl.GL;
import javax.media.opengl.GL2ES2;
import javax.media.opengl.GLException;
+import com.jogamp.common.os.Platform;
import com.jogamp.common.util.VersionNumber;
import com.jogamp.gluegen.runtime.ProcAddressTable;
import com.jogamp.opengl.util.TimeFrameI;
@@ -113,6 +114,9 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
private static final int AV_DEFAULT_AFRAMES = 8;
// Instance data
+ private static final int avUtilMajorVersionCC;
+ private static final int avFormatMajorVersionCC;
+ private static final int avCodecMajorVersionCC;
private static final VersionNumber avUtilVersion;
private static final VersionNumber avFormatVersion;
private static final VersionNumber avCodecVersion;
@@ -120,19 +124,33 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
static {
final boolean libAVGood = FFMPEGDynamicLibraryBundleInfo.initSingleton();
+ final boolean libAVVersionGood;
if( FFMPEGDynamicLibraryBundleInfo.libsLoaded() ) {
+ avUtilMajorVersionCC = getAvUtilMajorVersionCC0();
+ avFormatMajorVersionCC = getAvFormatMajorVersionCC0();
+ avCodecMajorVersionCC = getAvCodecMajorVersionCC0();
avUtilVersion = getAVVersion(getAvUtilVersion0());
avFormatVersion = getAVVersion(getAvFormatVersion0());
avCodecVersion = getAVVersion(getAvCodecVersion0());
- System.err.println("LIB_AV Util : "+avUtilVersion);
- System.err.println("LIB_AV Format: "+avFormatVersion);
- System.err.println("LIB_AV Codec : "+avCodecVersion);
+ System.err.println("LIB_AV Util : "+avUtilVersion+" [cc "+avUtilMajorVersionCC+"]");
+ System.err.println("LIB_AV Format: "+avFormatVersion+" [cc "+avFormatMajorVersionCC+"]");
+ System.err.println("LIB_AV Codec : "+avCodecVersion+" [cc "+avCodecMajorVersionCC+"]");
+ libAVVersionGood = avUtilMajorVersionCC == avUtilVersion.getMajor() &&
+ avFormatMajorVersionCC == avFormatVersion.getMajor() &&
+ avCodecMajorVersionCC == avCodecVersion.getMajor();
+ if( !libAVVersionGood ) {
+ System.err.println("LIB_AV Not Matching Compile-Time / Runtime Major-Version");
+ }
} else {
+ avUtilMajorVersionCC = 0;
+ avFormatMajorVersionCC = 0;
+ avCodecMajorVersionCC = 0;
avUtilVersion = null;
avFormatVersion = null;
avCodecVersion = null;
+ libAVVersionGood = false;
}
- available = libAVGood ? initIDs0() : false;
+ available = libAVGood && libAVVersionGood ? initIDs0() : false;
}
public static final boolean isAvailable() { return available; }
@@ -200,6 +218,9 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
}
}
+ public static final String dev_video = "/dev/video";
+ private static final int dev_video_len = dev_video.length();
+
@Override
protected final void initStreamImpl(int vid, int aid) throws IOException {
if(0==moviePtr) {
@@ -222,7 +243,38 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
}
// setStream(..) issues updateAttributes*(..), and defines avChosenAudioFormat, vid, aid, .. etc
final int snoopVideoFrameCount = 0; // 10*textureCount
- setStream0(moviePtr, streamLocS, vid, aid, snoopVideoFrameCount, preferredAudioFormat.channelCount, preferredAudioFormat.sampleRate);
+
+ final int streamLocSLen = streamLocS.length();
+ final String inFormat;
+ final String resStreamLocS;
+ if( streamLocSLen == dev_video_len + 1 && streamLocS.startsWith(dev_video) ) {
+ final int index = Integer.valueOf( streamLocS.substring(streamLocSLen-1) ).intValue();
+ switch(Platform.OS_TYPE) {
+ case ANDROID:
+ // ??
+ case FREEBSD:
+ case HPUX:
+ case LINUX:
+ case SUNOS:
+ resStreamLocS = streamLocS;
+ inFormat = "video4linux2";
+ break;
+ case WINDOWS:
+ resStreamLocS = String.valueOf(index);
+ inFormat = "vfwcap";
+ break;
+ case MACOS:
+ case OPENKODE:
+ default:
+ resStreamLocS = streamLocS;
+ inFormat = null;
+ break;
+ }
+ } else {
+ resStreamLocS = streamLocS;
+ inFormat = null;
+ }
+ setStream0(moviePtr, resStreamLocS, inFormat, vid, aid, snoopVideoFrameCount, preferredAudioFormat.channelCount, preferredAudioFormat.sampleRate);
}
@Override
@@ -530,8 +582,11 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
}
private static native int getAvUtilVersion0();
+ private static native int getAvUtilMajorVersionCC0();
private static native int getAvFormatVersion0();
+ private static native int getAvFormatMajorVersionCC0();
private static native int getAvCodecVersion0();
+ private static native int getAvCodecMajorVersionCC0();
private static native boolean initIDs0();
private native long createInstance0(boolean verbose);
private native void destroyInstance0(long moviePtr);
@@ -555,7 +610,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
* @param aChannelCount
* @param aSampleRate
*/
- private native void setStream0(long moviePtr, String url, int vid, int aid, int snoopVideoFrameCount, int aChannelCount, int aSampleRate);
+ private native void setStream0(long moviePtr, String url, String inFormat, int vid, int aid, int snoopVideoFrameCount, int aChannelCount, int aSampleRate);
private native void setGLFuncs0(long moviePtr, long procAddrGLTexSubImage2D, long procAddrGLGetError, long procAddrGLFlush, long procAddrGLFinish);
private native int getVideoPTS0(long moviePtr);