summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/util
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-08-16 16:06:57 +0200
committerSven Gothel <[email protected]>2012-08-16 16:06:57 +0200
commit09a8151abe3934ccf17fa84d5b2000e259351312 (patch)
treee23c9b8da10e56ac8c194cc98866564084c981db /src/jogl/classes/jogamp/opengl/util
parentef099612d2adb7223d928d2ba7a88f984501ddb9 (diff)
Fix FFMPEGMediaPlayer: Use GL_ALPHA (texture format intern/data) instead of GL_RGBA/GL_ALPHA ; Load dedicated native libav/libffmpeg
- ES2 spec does not allow GL_RGBA/GL_ALPHA. - Load dedicated native libs (libav/libffmpeg) since distributions don't create symlink e.g. libavutil.so -> libavutil.so.53
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util')
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java13
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java17
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java16
3 files changed, 34 insertions, 12 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
index d3d45e692..27c926704 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
@@ -62,6 +62,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
protected int textureCount;
protected int textureTarget;
protected int textureFormat;
+ protected int textureInternalFormat;
protected int textureType;
protected int texUnit;
@@ -104,6 +105,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
this.textureCount=3;
this.textureTarget=GL.GL_TEXTURE_2D;
this.textureFormat = GL.GL_RGBA;
+ this.textureInternalFormat = GL.GL_RGBA;
this.textureType = GL.GL_UNSIGNED_BYTE;
this.texUnit = 0;
this.state = State.Uninitialized;
@@ -122,7 +124,10 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
public final int getTextureCount() { return textureCount; }
protected final void setTextureTarget(int target) { textureTarget=target; }
- protected final void setTextureFormat(int f) { textureFormat=f; }
+ protected final void setTextureFormat(int internalFormat, int format) {
+ textureInternalFormat=internalFormat;
+ textureFormat=format;
+ }
protected final void setTextureType(int t) { textureType=t; }
public final void setTextureMinMagFilter(int[] minMagFilter) { texMinMagFilter[0] = minMagFilter[0]; texMinMagFilter[1] = minMagFilter[1];}
@@ -361,9 +366,9 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
gl.glTexImage2D(
textureTarget, // target
0, // level
- GL.GL_RGBA, // internal format
- tWidth, // width
- tHeight, // height
+ textureInternalFormat, // internal format
+ tWidth, // width
+ tHeight, // height
0, // border
textureFormat,
textureType,
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 ce9df21cf..32c863553 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java
@@ -222,6 +222,11 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
final List<String> avutil = new ArrayList<String>();
avutil.add("avutil"); // default
+
+ avutil.add("libavutil.so.52"); // dummy future proof
+ avutil.add("libavutil.so.51"); // 0.8
+ avutil.add("libavutil.so.50"); // 0.7
+
avutil.add("avutil-52"); // dummy future proof
avutil.add("avutil-51"); // 0.8
avutil.add("avutil-50"); // 0.7
@@ -229,6 +234,12 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
final List<String> avformat = new ArrayList<String>();
avformat.add("avformat"); // default
+
+ avformat.add("libavformat.so.55"); // dummy future proof
+ avformat.add("libavformat.so.54"); // 0.?
+ avformat.add("libavformat.so.53"); // 0.8
+ avformat.add("libavformat.so.52"); // 0.7
+
avformat.add("avformat-55"); // dummy future proof
avformat.add("avformat-54"); // 0.?
avformat.add("avformat-53"); // 0.8
@@ -237,6 +248,12 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
final List<String> avcodec = new ArrayList<String>();
avcodec.add("avcodec"); // default
+
+ avcodec.add("libavcodec.so.55"); // dummy future proof
+ avcodec.add("libavcodec.so.54"); // 0.?
+ avcodec.add("libavcodec.so.53"); // 0.8
+ avcodec.add("libavcodec.so.52"); // 0.7
+
avcodec.add("avcodec-55"); // dummy future proof
avcodec.add("avcodec-54"); // 0.?
avcodec.add("avcodec-53"); // 0.8
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 7d10cff4d..4be2bcb58 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
@@ -192,14 +192,14 @@ public class FFMPEGMediaPlayer extends EGLMediaPlayerImpl {
System.out.println("setURL: p1 "+this);
setStream0(moviePtr, urlS, -1, -1);
System.out.println("setURL: p2 "+this);
- int tf;
+ int tf, tif=GL.GL_RGBA; // texture format and internal format
switch(vBytesPerPixelPerPlane) {
- case 1: tf = GL2ES2.GL_RED; break;
- case 3: tf = GL2ES2.GL_RGB; break;
- case 4: tf = GL2ES2.GL_RGBA; break;
+ case 1: tf = GL2ES2.GL_ALPHA; tif=GL.GL_ALPHA; break;
+ case 3: tf = GL2ES2.GL_RGB; tif=GL.GL_RGB; break;
+ case 4: tf = GL2ES2.GL_RGBA; tif=GL.GL_RGBA; break;
default: throw new RuntimeException("Unsupported bytes-per-pixel / plane "+vBytesPerPixelPerPlane);
}
- setTextureFormat(tf);
+ setTextureFormat(tif, tf);
setTextureType(GL.GL_UNSIGNED_BYTE);
GLContextImpl ctx = (GLContextImpl)gl.getContext();
ProcAddressTable pt = ctx.getGLProcAddressTable();
@@ -296,9 +296,9 @@ public class FFMPEGMediaPlayer extends EGLMediaPlayerImpl {
" vec2 v_off = vec2("+tc_w_1+", 0.5);\n"+
" vec2 tc_half = texCoord*0.5;\n"+
" float y,u,v,r,g,b;\n"+
- " y = texture2D(image, texCoord).r;\n"+
- " u = texture2D(image, u_off+tc_half).r;\n"+
- " v = texture2D(image, v_off+tc_half).r;\n"+
+ " y = texture2D(image, texCoord).a;\n"+
+ " u = texture2D(image, u_off+tc_half).a;\n"+
+ " v = texture2D(image, v_off+tc_half).a;\n"+
" y = 1.1643*(y-0.0625);\n"+
" u = u-0.5;\n"+
" v = v-0.5;\n"+