diff options
author | Sven Gothel <[email protected]> | 2012-04-16 21:30:52 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-04-16 21:30:52 +0200 |
commit | 1e16a4cd123aafe41d51f01b41fad5a77c4ffbe3 (patch) | |
tree | 2e86fba5ccb97be3708ab44c8d950eff8d643c88 /src/jogl/classes | |
parent | 35beeabffed61e1597aaffc0c5926ab5ef86d32e (diff) |
Adding initial Libav/FFMpeg GLMediaPlayer implementation
The Java classes already slipped through in
commit 10935e1ec0d8ed677bc3fddfaa8cd73898a3bcbf - oops.
Since we cannot provide a Libav binary (even though Google does in Android and Chrome)
due to legal uncertainities .. we dynamically link to an existing Libav / FFmpeg library
in a 'relaxed' manner. Ie. we allow certain recent functions to be absent to be able
to run on a wider range of Libav versions.
Currently tested on Debian Linux and Windows7 64bit/32bit
Binaries for Win/OSX:
- Windows http://ffmpeg.zeranoe.com/builds/
- OSX http://www.ffmpegx.com/
Features:
- Dynamic relaxed linking to Libav (see above)
- YUV420P texture lookup function shader stub (conversion to RGB)
- 1-copy only (decoder buffer to texture)
- simple
- uses libavformat's network streaming
- fixes some odd PTS values
TODO:
- Audio output (Should use OpenAL, duh)
- Seek works poorly
- Offthread multi-texture fetching for smoother animation
- Maybe more pixelformat conversions
Diffstat (limited to 'src/jogl/classes')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java index df12fd12c..6fcf20ed2 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java @@ -35,13 +35,21 @@ import com.jogamp.common.util.ReflectionUtil; public class GLMediaPlayerFactory { private static final String AndroidGLMediaPlayerAPI14ClazzName = "jogamp.opengl.android.av.AndroidGLMediaPlayerAPI14"; + private static final String FFMPEGMediaPlayerClazzName = "jogamp.opengl.util.av.impl.FFMPEGMediaPlayer"; + private static final String isAvailableMethodName = "isAvailable"; public static GLMediaPlayer create() { + final ClassLoader cl = GLMediaPlayerFactory.class.getClassLoader(); if(Platform.OS_TYPE.equals(Platform.OSType.ANDROID)) { if(AndroidVersion.SDK_INT >= 14) { - return (GLMediaPlayer) ReflectionUtil.createInstance(AndroidGLMediaPlayerAPI14ClazzName, GLMediaPlayerFactory.class.getClassLoader()); + if(((Boolean)ReflectionUtil.callStaticMethod(AndroidGLMediaPlayerAPI14ClazzName, isAvailableMethodName, null, null, cl)).booleanValue()) { + return (GLMediaPlayer) ReflectionUtil.createInstance(AndroidGLMediaPlayerAPI14ClazzName, cl); + } } } + if(((Boolean)ReflectionUtil.callStaticMethod(FFMPEGMediaPlayerClazzName, isAvailableMethodName, null, null, cl)).booleanValue()) { + return (GLMediaPlayer) ReflectionUtil.createInstance(FFMPEGMediaPlayerClazzName, cl); + } return new NullGLMediaPlayer(); } } |