aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util')
-rw-r--r--src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java24
-rw-r--r--src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java23
-rw-r--r--src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java13
-rw-r--r--src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java19
-rw-r--r--src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java11
-rw-r--r--src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java11
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java47
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java289
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java70
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java54
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java44
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java120
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java175
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java92
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java48
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java27
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java13
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java21
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java70
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java99
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java237
-rw-r--r--src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java144
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java31
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java9
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java3
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java57
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java28
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkPredicate.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java1
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java1
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java11
50 files changed, 1012 insertions, 914 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java
index 1a4ca345b..810a9286b 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java
@@ -37,22 +37,22 @@ import javax.media.opengl.*;
*/
public interface GLArrayHandler {
-
+
/**
- * if <code>bind</code> is true and the data uses VBO,
+ * if <code>bind</code> is true and the data uses VBO,
* the latter will be bound and data written to the GPU if required.
* <p>
* If <code>bind</code> is false and the data uses VBO,
* the latter will be unbound.
* </p>
- *
+ *
* @param gl current GL object
- * @param bind true if VBO shall be bound and data written,
+ * @param bind true if VBO shall be bound and data written,
* otherwise clear VBO binding.
- * @return true if data uses VBO and action was performed, otherwise false
+ * @return true if data uses VBO and action was performed, otherwise false
*/
public boolean bindBuffer(GL gl, boolean bind);
-
+
/**
* Implementation shall enable or disable the array state.
* <p>
@@ -60,23 +60,23 @@ public interface GLArrayHandler {
* implementation shall synchronize the data with the GPU
* and associate the data with the array.
* </p>
- *
+ *
* @param gl current GL object
* @param enable true if array shall be enabled, otherwise false.
- * @param ext extension object allowing passing of an implementation detail
+ * @param ext extension object allowing passing of an implementation detail
*/
public void enableState(GL gl, boolean enable, Object ext);
-
+
/**
- * Supporting interleaved arrays, where sub handlers may handle
+ * Supporting interleaved arrays, where sub handlers may handle
* the array state and the <i>master</i> handler the buffer consistency.
- *
+ *
* @param handler the sub handler
* @throws UnsupportedOperationException if this array handler does not support interleaved arrays
*/
public void addSubHandler(GLArrayHandlerFlat handler) throws UnsupportedOperationException;
public void setSubArrayVBOName(int vboName);
-
+
}
diff --git a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java
index 4a8f40608..179142fee 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java
@@ -39,21 +39,21 @@ public interface GLArrayHandlerFlat {
/**
* Implementation shall associate the data with the array
- *
+ *
* @param gl current GL object
- * @param ext extension object allowing passing of an implementation detail
+ * @param ext extension object allowing passing of an implementation detail
*/
public void syncData(GL gl, Object ext);
-
+
/**
* Implementation shall enable or disable the array state.
- *
+ *
* @param gl current GL object
* @param enable true if array shall be enabled, otherwise false.
- * @param ext extension object allowing passing of an implementation detail
+ * @param ext extension object allowing passing of an implementation detail
*/
- public void enableState(GL gl, boolean enable, Object ext);
-
+ public void enableState(GL gl, boolean enable, Object ext);
+
public GLArrayDataWrapper getData();
}
diff --git a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java
index 98f711b8e..0d4452864 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java
@@ -36,8 +36,8 @@ import javax.media.opengl.GL;
import com.jogamp.opengl.util.GLArrayDataEditable;
/**
- * Interleaved fixed function arrays, i.e. where this buffer data
- * represents many arrays.
+ * Interleaved fixed function arrays, i.e. where this buffer data
+ * represents many arrays.
*/
public class GLArrayHandlerInterleaved extends GLVBOArrayHandler implements GLArrayHandler {
private List<GLArrayHandlerFlat> subArrays = new ArrayList<GLArrayHandlerFlat>();
@@ -45,13 +45,15 @@ public class GLArrayHandlerInterleaved extends GLVBOArrayHandler implements GLAr
public GLArrayHandlerInterleaved(GLArrayDataEditable ad) {
super(ad);
}
-
+
+ @Override
public final void setSubArrayVBOName(int vboName) {
for(int i=0; i<subArrays.size(); i++) {
subArrays.get(i).getData().setVBOName(vboName);
- }
+ }
}
-
+
+ @Override
public final void addSubHandler(GLArrayHandlerFlat handler) {
subArrays.add(handler);
}
@@ -59,20 +61,21 @@ public class GLArrayHandlerInterleaved extends GLVBOArrayHandler implements GLAr
private final void syncSubData(GL gl, Object ext) {
for(int i=0; i<subArrays.size(); i++) {
subArrays.get(i).syncData(gl, ext);
- }
- }
-
+ }
+ }
+
+ @Override
public final void enableState(GL gl, boolean enable, Object ext) {
if(enable) {
final boolean vboBound = bindBuffer(gl, true);
syncSubData(gl, ext);
if(vboBound) {
bindBuffer(gl, false);
- }
+ }
}
for(int i=0; i<subArrays.size(); i++) {
subArrays.get(i).enableState(gl, enable, ext);
- }
+ }
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java
index 862d49d1d..c1f6b954a 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java
@@ -35,8 +35,8 @@ import com.jogamp.opengl.util.GLArrayDataEditable;
/**
- * Used for pure VBO data arrays, i.e. where the buffer data
- * does not represents a specific array name.
+ * Used for pure VBO data arrays, i.e. where the buffer data
+ * does not represents a specific array name.
*/
public class GLDataArrayHandler extends GLVBOArrayHandler implements GLArrayHandler {
@@ -44,15 +44,18 @@ public class GLDataArrayHandler extends GLVBOArrayHandler implements GLArrayHand
super(ad);
}
+ @Override
public final void setSubArrayVBOName(int vboName) {
throw new UnsupportedOperationException();
}
-
+
+ @Override
public final void addSubHandler(GLArrayHandlerFlat handler) {
throw new UnsupportedOperationException();
}
-
- public final void enableState(GL gl, boolean enable, Object ext) {
+
+ @Override
+ public final void enableState(GL gl, boolean enable, Object ext) {
if(enable) {
if(!ad.isVBO()) {
// makes no sense otherwise
diff --git a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java
index 32bba896f..3aac9612a 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java
@@ -35,22 +35,25 @@ import javax.media.opengl.fixedfunc.GLPointerFunc;
import com.jogamp.opengl.util.GLArrayDataEditable;
/**
- * Used for 1:1 fixed function arrays, i.e. where the buffer data
- * represents this array only.
+ * Used for 1:1 fixed function arrays, i.e. where the buffer data
+ * represents this array only.
*/
public class GLFixedArrayHandler extends GLVBOArrayHandler implements GLArrayHandler {
public GLFixedArrayHandler(GLArrayDataEditable ad) {
super(ad);
}
-
+
+ @Override
public final void setSubArrayVBOName(int vboName) {
throw new UnsupportedOperationException();
}
-
+
+ @Override
public final void addSubHandler(GLArrayHandlerFlat handler) {
throw new UnsupportedOperationException();
}
-
+
+ @Override
public final void enableState(GL gl, boolean enable, Object ext) {
final GLPointerFunc glp = gl.getGL2ES1();
if(enable) {
@@ -69,12 +72,12 @@ public class GLFixedArrayHandler extends GLVBOArrayHandler implements GLArrayHan
glp.glTexCoordPointer(ad);
break;
default:
- throw new GLException("invalid glArrayIndex: "+ad.getIndex()+":\n\t"+ad);
+ throw new GLException("invalid glArrayIndex: "+ad.getIndex()+":\n\t"+ad);
}
if(vboBound) {
bindBuffer(gl, false);
- }
- glp.glEnableClientState(ad.getIndex());
+ }
+ glp.glEnableClientState(ad.getIndex());
} else {
glp.glDisableClientState(ad.getIndex());
}
diff --git a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java
index ff1813b95..acec0510f 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java
@@ -35,7 +35,7 @@ import javax.media.opengl.fixedfunc.GLPointerFunc;
import com.jogamp.opengl.util.GLArrayDataWrapper;
/**
- * Used for interleaved fixed function arrays, i.e. where the buffer data itself is handled
+ * Used for interleaved fixed function arrays, i.e. where the buffer data itself is handled
* separately and interleaves many arrays.
*/
public class GLFixedArrayHandlerFlat implements GLArrayHandlerFlat {
@@ -45,10 +45,12 @@ public class GLFixedArrayHandlerFlat implements GLArrayHandlerFlat {
this.ad = ad;
}
+ @Override
public GLArrayDataWrapper getData() {
return ad;
}
-
+
+ @Override
public final void syncData(GL gl, Object ext) {
final GLPointerFunc glp = gl.getGL2ES1();
switch(ad.getIndex()) {
@@ -65,14 +67,15 @@ public class GLFixedArrayHandlerFlat implements GLArrayHandlerFlat {
glp.glTexCoordPointer(ad);
break;
default:
- throw new GLException("invalid glArrayIndex: "+ad.getIndex()+":\n\t"+ad);
+ throw new GLException("invalid glArrayIndex: "+ad.getIndex()+":\n\t"+ad);
}
}
+ @Override
public final void enableState(GL gl, boolean enable, Object ext) {
final GLPointerFunc glp = gl.getGL2ES1();
if(enable) {
- glp.glEnableClientState(ad.getIndex());
+ glp.glEnableClientState(ad.getIndex());
} else {
glp.glDisableClientState(ad.getIndex());
}
diff --git a/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java
index 383898898..5198cacfa 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java
@@ -35,8 +35,8 @@ import javax.media.opengl.GL;
import com.jogamp.opengl.util.GLArrayDataEditable;
/**
- * Interleaved fixed function arrays, i.e. where this buffer data
- * represents many arrays.
+ * Interleaved fixed function arrays, i.e. where this buffer data
+ * represents many arrays.
*/
public abstract class GLVBOArrayHandler implements GLArrayHandler {
protected GLArrayDataEditable ad;
@@ -44,13 +44,14 @@ public abstract class GLVBOArrayHandler implements GLArrayHandler {
public GLVBOArrayHandler(GLArrayDataEditable ad) {
this.ad = ad;
}
-
+
+ @Override
public final boolean bindBuffer(GL gl, boolean bind) {
if( !ad.isVBO() ) {
return false;
}
if(bind) {
- // always bind and refresh the VBO mgr,
+ // always bind and refresh the VBO mgr,
// in case more than one gl*Pointer objects are in use
gl.glBindBuffer(ad.getVBOTarget(), ad.getVBOName());
if(!ad.isVBOWritten()) {
@@ -65,6 +66,6 @@ public abstract class GLVBOArrayHandler implements GLArrayHandler {
}
return true;
}
-
+
}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java
index 31af8e4db..c39b78bb8 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -44,30 +44,31 @@ import jogamp.opengl.egl.EGLExt;
public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl {
final protected TextureType texType;
final protected boolean useKHRSync;
-
+
public enum TextureType {
- GL(0), KHRImage(1);
-
+ GL(0), KHRImage(1);
+
public final int id;
TextureType(int id){
this.id = id;
}
- }
-
+ }
+
public static class EGLTextureFrame extends TextureSequence.TextureFrame {
-
+
public EGLTextureFrame(Buffer clientBuffer, Texture t, long khrImage, long khrSync) {
super(t);
this.clientBuffer = clientBuffer;
this.image = khrImage;
this.sync = khrSync;
}
-
+
public final Buffer getClientBuffer() { return clientBuffer; }
- public final long getImage() { return image; }
+ public final long getImage() { return image; }
public final long getSync() { return sync; }
-
+
+ @Override
public String toString() {
return "EGLTextureFrame[pts " + pts + " ms, l " + duration + " ms, texID "+ texture.getTextureObject() + ", img "+ image + ", sync "+ sync+", clientBuffer "+clientBuffer+"]";
}
@@ -76,7 +77,7 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl {
protected final long sync;
}
-
+
protected EGLMediaPlayerImpl(TextureType texType, boolean useKHRSync) {
super();
this.texType = texType;
@@ -89,21 +90,21 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl {
final Buffer clientBuffer;
final long image;
final long sync;
- final boolean eglUsage = TextureType.KHRImage == texType || useKHRSync ;
+ final boolean eglUsage = TextureType.KHRImage == texType || useKHRSync ;
final EGLContext eglCtx;
final EGLExt eglExt;
final EGLDrawable eglDrawable;
-
+
if(eglUsage) {
eglCtx = (EGLContext) gl.getContext();
eglExt = eglCtx.getEGLExt();
- eglDrawable = (EGLDrawable) eglCtx.getGLDrawable();
+ eglDrawable = (EGLDrawable) eglCtx.getGLDrawable();
} else {
eglCtx = null;
eglExt = null;
eglDrawable = null;
}
-
+
if(TextureType.KHRImage == texType) {
IntBuffer nioTmp = Buffers.newDirectIntBuffer(1);
// create EGLImage from texture
@@ -135,25 +136,25 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl {
}
return new EGLTextureFrame(clientBuffer, texture, image, sync);
}
-
+
@Override
protected void destroyTexFrame(GL gl, TextureSequence.TextureFrame frame) {
- final boolean eglUsage = TextureType.KHRImage == texType || useKHRSync ;
+ final boolean eglUsage = TextureType.KHRImage == texType || useKHRSync ;
final EGLContext eglCtx;
final EGLExt eglExt;
final EGLDrawable eglDrawable;
-
+
if(eglUsage) {
eglCtx = (EGLContext) gl.getContext();
eglExt = eglCtx.getEGLExt();
- eglDrawable = (EGLDrawable) eglCtx.getGLDrawable();
+ eglDrawable = (EGLDrawable) eglCtx.getGLDrawable();
} else {
eglCtx = null;
eglExt = null;
eglDrawable = null;
}
final EGLTextureFrame eglTex = (EGLTextureFrame) frame;
-
+
if(0!=eglTex.getImage()) {
eglExt.eglDestroyImageKHR(eglDrawable.getNativeSurface().getDisplayHandle(), eglTex.getImage());
}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
index 40fa9c9d6..7e41c3fce 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -63,7 +63,7 @@ import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame;
* <li>{@link #setTextureTarget(int)}</li>
* <li>{@link EGLMediaPlayerImpl#setEGLTexImageAttribs(boolean, boolean)}.</li>
* </ul>
- *
+ *
* <p>
* See {@link GLMediaPlayer}.
* </p>
@@ -75,21 +75,21 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
protected volatile State state;
private Object stateLock = new Object();
-
+
protected int textureCount;
protected int textureTarget;
protected int textureFormat;
- protected int textureInternalFormat;
+ protected int textureInternalFormat;
protected int textureType;
protected int texUnit;
-
-
+
+
protected int[] texMinMagFilter = { GL.GL_NEAREST, GL.GL_NEAREST };
protected int[] texWrapST = { GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE };
-
+
/** User requested URI stream location. */
protected URI streamLoc = null;
- /**
+ /**
* In case {@link #streamLoc} is a {@link GLMediaPlayer#CameraInputScheme},
* {@link #cameraPath} holds the URI's path portion
* as parsed in {@link #initStream(URI, int, int, int)}.
@@ -98,10 +98,10 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
protected String cameraPath = null;
/** Optional camera properties, see {@link #cameraPath}. */
protected Map<String, String> cameraProps = null;
-
+
protected volatile float playSpeed = 1.0f;
protected float audioVolume = 1.0f;
-
+
/** Shall be set by the {@link #initStreamImpl(int, int)} method implementation. */
protected int vid = GLMediaPlayer.STREAM_ID_AUTO;
/** Shall be set by the {@link #initStreamImpl(int, int)} method implementation. */
@@ -130,20 +130,20 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
protected String acodec = unknown;
/** Shall be set by the {@link #initStreamImpl(int, int)} method implementation. */
protected String vcodec = unknown;
-
+
protected volatile int decodedFrameCount = 0;
protected int presentedFrameCount = 0;
protected int displayedFrameCount = 0;
protected volatile int video_pts_last = 0;
-
+
/** See {@link #getAudioSink()}. Set by implementation if used from within {@link #initStreamImpl(int, int)}! */
protected AudioSink audioSink = null;
protected boolean audioSinkPlaySpeedSet = false;
-
+
/** System Clock Reference (SCR) of first audio PTS at start time. */
private long audio_scr_t0 = 0;
private boolean audioSCR_reset = true;
-
+
/** System Clock Reference (SCR) of first video frame at start time. */
private long video_scr_t0 = 0;
/** System Clock Reference (SCR) PTS offset, i.e. first video PTS at start time. */
@@ -152,7 +152,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
private float video_dpts_cum = 0;
/** Cumulative video frames. */
private int video_dpts_count = 0;
- /** Number of min frame count required for video cumulative sync. */
+ /** Number of min frame count required for video cumulative sync. */
private static final int VIDEO_DPTS_NUM = 20;
/** Cumulative coefficient, value {@value}. */
private static final float VIDEO_DPTS_COEFF = 0.7943282f; // (float) Math.exp(Math.log(0.01) / VIDEO_DPTS_NUM);
@@ -160,7 +160,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
private static final int VIDEO_DPTS_MAX = 5000; // 5s max diff
/** Trigger video PTS reset with given cause as bitfield. */
private boolean videoSCR_reset = false;
-
+
protected TextureFrame[] videoFramesOrig = null;
protected Ringbuffer<TextureFrame> videoFramesFree = null;
protected Ringbuffer<TextureFrame> videoFramesDecoded = null;
@@ -177,42 +177,46 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
this.textureTarget=GL.GL_TEXTURE_2D;
this.textureFormat = GL.GL_RGBA;
this.textureInternalFormat = GL.GL_RGBA;
- this.textureType = GL.GL_UNSIGNED_BYTE;
+ this.textureType = GL.GL_UNSIGNED_BYTE;
this.texUnit = 0;
this.state = State.Uninitialized;
}
@Override
public final void setTextureUnit(int u) { texUnit = u; }
-
+
@Override
public final int getTextureUnit() { return texUnit; }
-
+
@Override
public final int getTextureTarget() { return textureTarget; }
-
+
@Override
public final int getTextureCount() { return textureCount; }
-
+
protected final void setTextureTarget(int target) { textureTarget=target; }
- protected final void setTextureFormat(int internalFormat, int format) {
- textureInternalFormat=internalFormat;
- textureFormat=format;
- }
+ protected final void setTextureFormat(int internalFormat, int format) {
+ textureInternalFormat=internalFormat;
+ textureFormat=format;
+ }
protected final void setTextureType(int t) { textureType=t; }
+ @Override
public final void setTextureMinMagFilter(int[] minMagFilter) { texMinMagFilter[0] = minMagFilter[0]; texMinMagFilter[1] = minMagFilter[1];}
+ @Override
public final int[] getTextureMinMagFilter() { return texMinMagFilter; }
-
+
+ @Override
public final void setTextureWrapST(int[] wrapST) { texWrapST[0] = wrapST[0]; texWrapST[1] = wrapST[1];}
- public final int[] getTextureWrapST() { return texWrapST; }
-
+ @Override
+ public final int[] getTextureWrapST() { return texWrapST; }
+
private final void checkGLInit() {
if(State.Uninitialized == state || State.Initialized == state ) {
throw new IllegalStateException("GL not initialized: "+this);
- }
+ }
}
-
+
@Override
public String getRequiredExtensionsShaderStub() throws IllegalStateException {
checkGLInit();
@@ -221,24 +225,24 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
return "";
}
-
+
@Override
public String getTextureSampler2DType() throws IllegalStateException {
checkGLInit();
switch(textureTarget) {
case GL.GL_TEXTURE_2D:
- case GL2.GL_TEXTURE_RECTANGLE:
+ case GL2.GL_TEXTURE_RECTANGLE:
return TextureSequence.sampler2D;
case GLES2.GL_TEXTURE_EXTERNAL_OES:
return TextureSequence.samplerExternalOES;
default:
- throw new GLException("Unsuported texture target: "+toHexString(textureTarget));
+ throw new GLException("Unsuported texture target: "+toHexString(textureTarget));
}
}
-
+
/**
* {@inheritDoc}
- *
+ *
* This implementation simply returns the build-in function name of <code>texture2D</code>,
* if not overridden by specialization.
*/
@@ -247,31 +251,31 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
checkGLInit();
return "texture2D";
}
-
+
/**
* {@inheritDoc}
- *
- * This implementation simply returns an empty string since it's using
+ *
+ * This implementation simply returns an empty string since it's using
* the build-in function <code>texture2D</code>,
* if not overridden by specialization.
*/
@Override
public String getTextureLookupFragmentShaderImpl() throws IllegalStateException {
checkGLInit();
- return "";
+ return "";
}
-
+
@Override
public final int getDecodedFrameCount() { return decodedFrameCount; }
-
+
@Override
public final int getPresentedFrameCount() { return presentedFrameCount; }
-
+
@Override
public final int getVideoPTS() { return video_pts_last; }
-
+
@Override
- public final int getAudioPTS() {
+ public final int getAudioPTS() {
if( State.Uninitialized != state ) {
return getAudioPTSImpl();
}
@@ -285,10 +289,10 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
return 0;
}
}
-
+
@Override
public final State getState() { return state; }
-
+
@Override
public final State play() {
synchronized( stateLock ) {
@@ -310,7 +314,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
}
protected abstract boolean playImpl();
-
+
@Override
public final State pause(boolean flush) {
return pauseImpl(flush, 0);
@@ -337,7 +341,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
}
protected abstract boolean pauseImpl();
-
+
@Override
public final State destroy(GL gl) {
return destroyImpl(gl, 0);
@@ -354,7 +358,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
}
protected abstract void destroyImpl(GL gl);
-
+
@Override
public final int seek(int msec) {
synchronized( stateLock ) {
@@ -383,12 +387,12 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
}
protected abstract int seekImpl(int msec);
-
+
@Override
public final float getPlaySpeed() {
return playSpeed;
}
-
+
@Override
public final boolean setPlaySpeed(float rate) {
synchronized( stateLock ) {
@@ -410,18 +414,18 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
return res;
}
}
- /**
+ /**
* Override if not using AudioSink, or AudioSink's {@link AudioSink#setPlaySpeed(float)} is not sufficient!
* <p>
- * AudioSink shall respect <code>!audioSinkPlaySpeedSet</code> to determine data_size
+ * AudioSink shall respect <code>!audioSinkPlaySpeedSet</code> to determine data_size
* at {@link AudioSink#enqueueData(com.jogamp.opengl.util.av.AudioSink.AudioFrame)}.
- * </p>
+ * </p>
*/
protected boolean setPlaySpeedImpl(float rate) {
if( null != audioSink ) {
audioSinkPlaySpeedSet = audioSink.setPlaySpeed(rate);
}
- // still true, even if audioSink rejects command since we deal w/ video sync
+ // still true, even if audioSink rejects command since we deal w/ video sync
// and AudioSink w/ audioSinkPlaySpeedSet at enqueueData(..).
return true;
}
@@ -431,7 +435,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
getAudioVolumeImpl();
return audioVolume;
}
- /**
+ /**
* Override if not using AudioSink, or AudioSink's {@link AudioSink#getVolume()} is not sufficient!
*/
protected void getAudioVolumeImpl() {
@@ -439,7 +443,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
audioVolume = audioSink.getVolume();
}
}
-
+
@Override
public boolean setAudioVolume(float v) {
synchronized( stateLock ) {
@@ -460,7 +464,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
return res;
}
}
- /**
+ /**
* Override if not using AudioSink, or AudioSink's {@link AudioSink#setVolume(float)} is not sufficient!
*/
protected boolean setAudioVolumeImpl(float v) {
@@ -470,7 +474,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
// still true, even if audioSink rejects command ..
return true;
}
-
+
@Override
public final void initStream(URI streamLoc, int vid, int aid, int reqTextureCount) throws IllegalStateException, IllegalArgumentException {
synchronized( stateLock ) {
@@ -490,7 +494,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
decodedFrameCount = 0;
presentedFrameCount = 0;
- displayedFrameCount = 0;
+ displayedFrameCount = 0;
this.streamLoc = streamLoc;
// Pre-parse for camera-input scheme
@@ -500,7 +504,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
if( null != streamLocScheme && streamLocScheme.equals(CameraInputScheme) ) {
final String rawPath = streamLoc.getRawPath();
if( null != rawPath && rawPath.length() > 0 ) {
- // cut-off root fwd-slash
+ // cut-off root fwd-slash
cameraPath = rawPath.substring(1);
final URIQueryProps props = URIQueryProps.create(streamLoc, ';');
cameraProps = props.getProperties();
@@ -508,7 +512,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
throw new IllegalArgumentException("Camera path is empty: "+streamLoc.toString());
}
}
-
+
this.vid = vid;
this.aid = aid;
if (this.streamLoc != null) {
@@ -519,7 +523,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
/**
* Implementation shall set the following set of data here
* @see #vid
- * @see #aid
+ * @see #aid
* @see #width
* @see #height
* @see #fps
@@ -530,7 +534,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
* @see #vcodec
*/
protected abstract void initStreamImpl(int vid, int aid) throws Exception;
-
+
@Override
public final StreamException getStreamException() {
synchronized( stateLock ) {
@@ -541,26 +545,26 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
}
}
-
+
@Override
public final void initGL(GL gl) throws IllegalStateException, StreamException, GLException {
synchronized( stateLock ) {
if(State.Initialized != state ) {
throw new IllegalStateException("Stream not in state initialized: "+this);
- }
+ }
final StreamException streamInitErr = streamWorker.getStreamErr();
if( null != streamInitErr ) {
streamWorker = null; // already terminated!
destroy(null);
throw streamInitErr;
}
- try {
+ try {
if( STREAM_ID_NONE != vid ) {
removeAllTextureFrames(gl);
initGLImpl(gl);
if(DEBUG) {
System.err.println("initGLImpl.X "+this);
- }
+ }
videoFramesOrig = createTexFrames(gl, textureCount);
videoFramesFree = new LFRingbuffer<TextureFrame>(videoFramesOrig);
videoFramesDecoded = new LFRingbuffer<TextureFrame>(TextureFrame[].class, textureCount);
@@ -583,7 +587,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
}
}
- /**
+ /**
* Shall initialize all GL related resources, if not audio-only.
* <p>
* Shall also take care of {@link AudioSink} initialization if appropriate.
@@ -593,8 +597,8 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
* @throws GLException
*/
protected abstract void initGLImpl(GL gl) throws IOException, GLException;
-
- /**
+
+ /**
* Returns the validated number of textures to be handled.
* <p>
* Default is {@link #TEXTURE_COUNT_MIN} minimum textures.
@@ -606,7 +610,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
protected int validateTextureCount(int desiredTextureCount) {
return desiredTextureCount < TEXTURE_COUNT_MIN ? TEXTURE_COUNT_MIN : desiredTextureCount;
}
-
+
protected TextureFrame[] createTexFrames(GL gl, final int count) {
final int[] texNames = new int[count];
gl.glGenTextures(count, texNames, 0);
@@ -621,7 +625,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
return texFrames;
}
protected abstract TextureFrame createTexImage(GL gl, int texName);
-
+
protected final Texture createTexImageImpl(GL gl, int texName, int tWidth, int tHeight) {
if( 0 > texName ) {
throw new RuntimeException("TextureName "+toHexString(texName)+" invalid.");
@@ -661,19 +665,19 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
}
gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MIN_FILTER, texMinMagFilter[0]);
- gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MAG_FILTER, texMinMagFilter[1]);
+ gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MAG_FILTER, texMinMagFilter[1]);
gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_S, texWrapST[0]);
gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_T, texWrapST[1]);
-
+
return com.jogamp.opengl.util.texture.TextureIO.newTexture(
texName, textureTarget,
tWidth, tHeight,
width, height,
- !isInGLOrientation);
+ !isInGLOrientation);
}
-
+
protected void destroyTexFrame(GL gl, TextureFrame frame) {
- frame.getTexture().destroy(gl);
+ frame.getTexture().destroy(gl);
}
@Override
@@ -683,7 +687,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
return lastFrame;
}
-
+
private final void removeAllTextureFrames(GL gl) {
final TextureFrame[] texFrames = videoFramesOrig;
videoFramesOrig = null;
@@ -699,14 +703,14 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
texFrames[i] = null;
}
- System.err.println(Thread.currentThread().getName()+"> Clear TexFrame["+i+"]: "+frame+" -> null");
- }
+ System.err.println(Thread.currentThread().getName()+"> Clear TexFrame["+i+"]: "+frame+" -> null");
+ }
}
}
-
+
protected TextureFrame cachedFrame = null;
protected long lastTimeMillis = 0;
-
+
@Override
public final TextureFrame getNextTexture(GL gl) throws IllegalStateException {
synchronized( stateLock ) {
@@ -750,7 +754,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
} else {
d_apts = 0;
}
-
+
final int frame_period_last = video_pts - video_pts_last; // rendering loop interrupted ?
if( videoSCR_reset || frame_period_last > frame_duration*10 ) {
videoSCR_reset = false;
@@ -782,7 +786,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
cachedFrame = nextFrame;
nextFrame = null;
} else if ( !droppedFrame && dt < -maxVideoDelay && videoFramesDecoded.size() > 0 ) {
- // only drop if prev. frame has not been dropped and
+ // only drop if prev. frame has not been dropped and
// frame is too late and one decoded frame is already available.
dropFrame = true;
}
@@ -791,7 +795,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
System.err.println( "AV_: dT "+(currentTimeMillis-lastTimeMillis)+", "+
getPerfStringImpl( video_scr, video_pts, d_vpts,
audio_scr, audio_pts, d_apts,
- video_dpts_avg_diff ) +
+ video_dpts_avg_diff ) +
", avg dpy-fps "+avg_dpy_duration+" ms/f, maxD "+maxVideoDelay+" ms, "+_nextFrame+", playCached " + playCached + ", dropFrame "+dropFrame);
}
}
@@ -803,7 +807,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
lastFrame = nextFrame;
videoFramesFree.putBlocking(_lastFrame);
}
- } else if( DEBUG ) {
+ } else if( DEBUG ) {
final int video_pts = lastFrame.getPTS();
final int audio_pts = getAudioPTSImpl();
final int audio_scr = (int) ( ( currentTimeMillis - audio_scr_t0 ) * playSpeed );
@@ -835,25 +839,25 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
* Audio frames, i.e. {@link AudioSink.AudioFrame}, shall be handled in the process.
* <p>
* Video frames shall be ignored, if {@link #getVID()} is {@link #STREAM_ID_NONE}.
- * </p>
+ * </p>
* <p>
* Audio frames shall be ignored, if {@link #getAID()} is {@link #STREAM_ID_NONE}.
* </p>
* <p>
* Method may be invoked on the <a href="#streamworker"><i>StreamWorker</i> decoding thread</a>.
- * </p>
+ * </p>
* <p>
* Implementation shall care of OpenGL synchronization as required, e.g. glFinish()/glFlush()!
* </p>
- * @param gl valid and current GL instance, shall be <code>null</code> for audio only.
+ * @param gl valid and current GL instance, shall be <code>null</code> for audio only.
* @param nextFrame the {@link TextureFrame} to store the video PTS and texture data,
* shall be <code>null</code> for audio only.
* @return the last processed video PTS value, maybe {@link TimeFrameI#INVALID_PTS} if video frame is invalid or n/a.
- * Will be {@link TimeFrameI#END_OF_STREAM_PTS} if end of stream reached.
+ * Will be {@link TimeFrameI#END_OF_STREAM_PTS} if end of stream reached.
*/
protected abstract int getNextTextureImpl(GL gl, TextureFrame nextFrame);
-
- /**
+
+ /**
* {@inheritDoc}
* <p>
* Note: All {@link AudioSink} operations are performed from {@link GLMediaPlayerImpl},
@@ -866,8 +870,8 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
*/
@Override
public final AudioSink getAudioSink() { return audioSink; }
-
- /**
+
+ /**
* To be called from implementation at 1st PTS after start
* w/ current pts value in milliseconds.
* @param audio_scr_t0
@@ -908,10 +912,10 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
private final int getVideoDPTSAvg() {
return (int) ( video_dpts_cum * (1.0f - VIDEO_DPTS_COEFF) + 0.5f );
}
-
+
private final void newFrameAvailable(TextureFrame frame, long currentTimeMillis) {
decodedFrameCount++;
- if( 0 == frame.getDuration() ) { // patch frame duration if not set already
+ if( 0 == frame.getDuration() ) { // patch frame duration if not set already
frame.setDuration( (int) frame_duration );
}
synchronized(eventListenersLock) {
@@ -920,38 +924,38 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
}
}
-
+
class StreamWorker extends Thread {
private volatile boolean isRunning = false;
private volatile boolean isActive = false;
private volatile boolean isBlocked = false;
-
+
private volatile boolean shallPause = true;
private volatile boolean shallStop = false;
-
+
private volatile StreamException streamErr = null;
private volatile GLContext sharedGLCtx = null;
private boolean sharedGLCtxCurrent = false;
private GLDrawable dummyDrawable = null;
-
- /**
- * Starts this daemon thread,
+
+ /**
+ * Starts this daemon thread,
* which initializes the stream first via {@link GLMediaPlayerImpl#initStreamImpl(int, int)} first.
* <p>
* After stream initialization, this thread pauses!
* </p>
- **/
+ **/
StreamWorker() {
setDaemon(true);
start();
}
-
+
private void makeCurrent(GLContext ctx) {
if( GLContext.CONTEXT_NOT_CURRENT >= ctx.makeCurrent() ) {
throw new GLException("Couldn't make ctx current: "+ctx);
}
}
-
+
private void destroySharedGL() {
if( null != sharedGLCtx ) {
if( sharedGLCtx.isCreated() ) {
@@ -963,16 +967,16 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
gle.printStackTrace();
}
}
- sharedGLCtx = null;
+ sharedGLCtx = null;
}
if( null != dummyDrawable ) {
final AbstractGraphicsDevice device = dummyDrawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice();
dummyDrawable.setRealized(false);
dummyDrawable = null;
device.close();
- }
+ }
}
-
+
public synchronized void initGL(GL gl) {
final GLContext glCtx = gl.getContext();
final boolean glCtxCurrent = glCtx.isCurrent();
@@ -1013,7 +1017,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
while( !isActive ) {
this.notify(); // wake-up pause-block
try {
- this.wait(); // wait until resumed
+ this.wait(); // wait until resumed
} catch (InterruptedException e) {
e.printStackTrace();
}
@@ -1041,12 +1045,13 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
public boolean isRunning() { return isRunning; }
public boolean isActive() { return isActive; }
- public StreamException getStreamErr() { return streamErr; }
-
+ public StreamException getStreamErr() { return streamErr; }
+
+ @Override
public void run() {
setName(getName()+"-StreamWorker_"+StreamWorkerInstanceId);
StreamWorkerInstanceId++;
-
+
synchronized ( this ) {
isRunning = true;
try {
@@ -1061,7 +1066,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
return; // end of thread!
} // also initializes width, height, .. etc
}
-
+
while( !shallStop ){
if( shallPause ) {
synchronized ( this ) {
@@ -1100,7 +1105,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
}
}
-
+
if( !shallStop ) {
TextureFrame nextFrame = null;
try {
@@ -1121,7 +1126,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
Thread.sleep(STREAM_WORKER_DELAY);
}
if( !videoFramesDecoded.put(nextFrame) ) {
- throw new InternalError("XXX: free "+videoFramesFree+", decoded "+videoFramesDecoded+", "+GLMediaPlayerImpl.this);
+ throw new InternalError("XXX: free "+videoFramesFree+", decoded "+videoFramesDecoded+", "+GLMediaPlayerImpl.this);
}
newFrameAvailable(nextFrame, Platform.currentTimeMillis());
nextFrame = null;
@@ -1170,10 +1175,10 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
this.notify(); // wake-up doStop()
}
}
- }
- static int StreamWorkerInstanceId = 0;
+ }
+ static int StreamWorkerInstanceId = 0;
private StreamWorker streamWorker = null;
-
+
protected final int addStateEventMask(int event_mask, State newState) {
if( state != newState ) {
switch( newState ) {
@@ -1193,7 +1198,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
return event_mask;
}
-
+
protected final void attributesUpdated(int event_mask) {
if( 0 != event_mask ) {
final long now = Platform.currentTimeMillis();
@@ -1204,7 +1209,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
}
}
-
+
protected final void changeState(int event_mask, State newState) {
event_mask = addStateEventMask(event_mask, newState);
if( 0 != event_mask ) {
@@ -1212,9 +1217,9 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
attributesUpdated( event_mask );
}
}
-
- protected final void updateAttributes(int vid, int aid, int width, int height, int bps_stream,
- int bps_video, int bps_audio, float fps,
+
+ protected final void updateAttributes(int vid, int aid, int width, int height, int bps_stream,
+ int bps_video, int bps_audio, float fps,
int videoFrames, int audioFrames, int duration, String vcodec, String acodec) {
int event_mask = 0;
if( state == State.Uninitialized ) {
@@ -1227,19 +1232,19 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
if( this.vid != vid ) {
event_mask |= GLMediaEventListener.EVENT_CHANGE_VID;
this.vid = vid;
- }
+ }
if( STREAM_ID_AUTO == vid ) {
vid = STREAM_ID_NONE;
}
if( this.aid != aid ) {
event_mask |= GLMediaEventListener.EVENT_CHANGE_AID;
this.aid = aid;
- }
+ }
if( this.width != width || this.height != height ) {
event_mask |= GLMediaEventListener.EVENT_CHANGE_SIZE;
this.width = width;
this.height = height;
- }
+ }
if( this.fps != fps ) {
event_mask |= GLMediaEventListener.EVENT_CHANGE_FPS;
this.fps = fps;
@@ -1257,7 +1262,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
this.audioFrames = audioFrames;
this.duration = duration;
}
- if( (null!=acodec && acodec.length()>0 && !this.acodec.equals(acodec)) ) {
+ if( (null!=acodec && acodec.length()>0 && !this.acodec.equals(acodec)) ) {
event_mask |= GLMediaEventListener.EVENT_CHANGE_CODEC;
this.acodec = acodec;
}
@@ -1283,7 +1288,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
attributesUpdated(GLMediaEventListener.EVENT_CHANGE_SIZE);
}
}
-
+
@Override
public final URI getURI() {
return streamLoc;
@@ -1291,10 +1296,10 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
@Override
public final int getVID() { return vid; }
-
+
@Override
public final int getAID() { return aid; }
-
+
@Override
public final String getVideoCodec() {
return vcodec;
@@ -1309,7 +1314,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
public final int getVideoFrames() {
return videoFrames;
}
-
+
@Override
public final int getAudioFrames() {
return audioFrames;
@@ -1319,7 +1324,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
public final int getDuration() {
return duration;
}
-
+
@Override
public final long getStreamBitrate() {
return bps_stream;
@@ -1329,12 +1334,12 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
public final int getVideoBitrate() {
return bps_video;
}
-
+
@Override
public final int getAudioBitrate() {
return bps_audio;
}
-
+
@Override
public final float getFramerate() {
return fps;
@@ -1344,7 +1349,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
public final boolean isGLOriented() {
return isInGLOrientation;
}
-
+
@Override
public final int getWidth() {
return width;
@@ -1369,11 +1374,11 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
"Video[id "+vid+", <"+vcodec+">, "+width+"x"+height+", glOrient "+isInGLOrientation+", "+fps+" fps, "+frame_duration+" fdur, "+bps_video+" bps], "+
"Audio[id "+aid+", <"+acodec+">, "+bps_audio+" bps, "+audioFrames+" frames], uri "+loc+camPath+"]";
}
-
+
@Override
public final String getPerfString() {
final long currentTimeMillis = Platform.currentTimeMillis();
- final int video_scr = video_scr_pts + (int) ( ( currentTimeMillis - video_scr_t0 ) * playSpeed );
+ final int video_scr = video_scr_pts + (int) ( ( currentTimeMillis - video_scr_t0 ) * playSpeed );
final int d_vpts = video_pts_last - video_scr;
final int audio_scr = (int) ( ( currentTimeMillis - audio_scr_t0 ) * playSpeed );
final int audio_pts = getAudioPTSImpl();
@@ -1383,7 +1388,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
private final String getPerfStringImpl(final int video_scr, final int video_pts, final int d_vpts,
final int audio_scr, final int audio_pts, final int d_apts,
final int video_dpts_avg_diff) {
- final float tt = getDuration() / 1000.0f;
+ final float tt = getDuration() / 1000.0f;
final String audioSinkInfo;
final AudioSink audioSink = getAudioSink();
if( null != audioSink ) {
diff --git a/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java b/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java
index 85fab96a4..6e006d9c0 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java
@@ -22,75 +22,75 @@ public class JavaSoundAudioSink implements AudioSink {
public static final int BUFFER_SIZE = 1000;
public static final int SAMPLES_PER_BUFFER = BUFFER_SIZE / 2;
private static final boolean staticAvailable;
-
+
// Sample time values
// public static final double SAMPLE_TIME_IN_SECS = 1.0 / DEFAULT_SAMPLE_RATE;
// public static final double BUFFER_TIME_IN_SECS = SAMPLE_TIME_IN_SECS * SAMPLES_PER_BUFFER;
-
+
private javax.sound.sampled.AudioFormat format;
private DataLine.Info info;
private SourceDataLine auline;
private int bufferCount;
- private byte [] sampleData = new byte[BUFFER_SIZE];
+ private byte [] sampleData = new byte[BUFFER_SIZE];
private boolean initialized = false;
private AudioSink.AudioFormat chosenFormat = null;
-
+
private volatile boolean playRequested = false;
private float volume = 1.0f;
-
+
static {
boolean ok = false;
try {
AudioSystem.getAudioFileTypes();
ok = true;
} catch (Throwable t) {
-
+
}
staticAvailable=ok;
- }
-
+ }
+
@Override
public String toString() {
return "JavaSoundSink[init "+initialized+", dataLine "+info+", source "+auline+", bufferCount "+bufferCount+
", chosen "+chosenFormat+", jsFormat "+format;
}
-
+
@Override
public final float getPlaySpeed() { return 1.0f; } // FIXME
-
+
@Override
- public final boolean setPlaySpeed(float rate) {
- return false; // FIXME
+ public final boolean setPlaySpeed(float rate) {
+ return false; // FIXME
}
-
+
@Override
public final float getVolume() {
// FIXME
- return volume;
+ return volume;
}
-
+
@Override
public final boolean setVolume(float v) {
// FIXME
volume = v;
return true;
}
-
+
@Override
public AudioSink.AudioFormat getPreferredFormat() {
return DefaultFormat;
}
-
+
@Override
public final int getMaxSupportedChannels() {
return 2;
}
-
+
@Override
public final boolean isSupported(AudioSink.AudioFormat format) {
return true;
}
-
+
@Override
public boolean init(AudioSink.AudioFormat requestedFormat, float frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) {
if( !staticAvailable ) {
@@ -117,12 +117,12 @@ public class JavaSoundAudioSink implements AudioSink {
}
return true;
}
-
+
@Override
public boolean isPlaying() {
return playRequested && auline.isRunning();
}
-
+
@Override
public void play() {
if( null != auline ) {
@@ -135,7 +135,7 @@ public class JavaSoundAudioSink implements AudioSink {
auline.start();
}
}
-
+
@Override
public void pause() {
if( null != auline ) {
@@ -143,9 +143,9 @@ public class JavaSoundAudioSink implements AudioSink {
auline.stop();
}
}
-
+
@Override
- public void flush() {
+ public void flush() {
if( null != auline ) {
playRequested = false;
auline.stop();
@@ -157,17 +157,17 @@ public class JavaSoundAudioSink implements AudioSink {
public final int getEnqueuedFrameCount() {
return 0; // FIXME
}
-
+
@Override
public int getFrameCount() {
return 1;
}
-
+
@Override
public int getQueuedFrameCount() {
return 0;
}
-
+
@Override
public boolean isInitialized() {
return initialized;
@@ -179,7 +179,7 @@ public class JavaSoundAudioSink implements AudioSink {
chosenFormat = null;
// FIXEM: complete code!
}
-
+
@Override
public AudioFrame enqueueData(AudioDataFrame audioDataFrame) {
int byteSize = audioDataFrame.getByteSize();
@@ -188,7 +188,7 @@ public class JavaSoundAudioSink implements AudioSink {
final int p = byteBuffer.position();
byteBuffer.get(bytes, 0, byteSize);
byteBuffer.position(p);
-
+
int written = 0;
int len;
while (byteSize > 0) {
@@ -203,27 +203,27 @@ public class JavaSoundAudioSink implements AudioSink {
@Override
public AudioFrame enqueueData(int pts, ByteBuffer bytes, int byteCount) {
return enqueueData(new AudioDataFrame(pts, chosenFormat.getBytesDuration(byteCount), bytes, byteCount));
- }
-
+ }
+
@Override
public int getQueuedByteCount() {
return auline.getBufferSize() - auline.available();
}
-
+
@Override
public int getFreeFrameCount() {
return auline.available();
}
-
+
@Override
public int getQueuedTime() {
return getQueuedTimeImpl( getQueuedByteCount() );
}
private final int getQueuedTimeImpl(int byteCount) {
final int bytesPerSample = chosenFormat.sampleSize >>> 3; // /8
- return byteCount / ( chosenFormat.channelCount * bytesPerSample * ( chosenFormat.sampleRate / 1000 ) );
+ return byteCount / ( chosenFormat.channelCount * bytesPerSample * ( chosenFormat.sampleRate / 1000 ) );
}
@Override
- public final int getPTS() { return 0; } // FIXME
+ public final int getPTS() { return 0; } // FIXME
}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java b/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java
index 723bb9dd1..8d3dbdf44 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java
@@ -15,32 +15,32 @@ public class NullAudioSink implements AudioSink {
private volatile float playSpeed = 1.0f;
private volatile boolean playRequested = false;
private float volume = 1.0f;
-
+
@Override
public final float getPlaySpeed() { return playSpeed; }
-
+
@Override
- public final boolean setPlaySpeed(float rate) {
+ public final boolean setPlaySpeed(float rate) {
if( Math.abs(1.0f - rate) < 0.01f ) {
rate = 1.0f;
}
- playSpeed = rate;
+ playSpeed = rate;
return true;
}
-
+
@Override
public final float getVolume() {
// FIXME
- return volume;
+ return volume;
}
-
+
@Override
public final boolean setVolume(float v) {
// FIXME
- volume = v;
+ volume = v;
return true;
}
-
+
@Override
public AudioFormat getPreferredFormat() {
return DefaultFormat;
@@ -50,73 +50,73 @@ public class NullAudioSink implements AudioSink {
public final int getMaxSupportedChannels() {
return 8;
}
-
+
@Override
public final boolean isSupported(AudioFormat format) {
return true;
}
-
+
@Override
public boolean init(AudioFormat requestedFormat, float frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) {
return true;
}
-
+
@Override
public boolean isPlaying() {
return playRequested;
}
-
+
@Override
public void play() {
playRequested = true;
}
-
+
@Override
public void pause() {
playRequested = false;
}
-
+
@Override
- public void flush() {
+ public void flush() {
}
-
+
@Override
public void destroy() {
}
-
+
@Override
public final int getEnqueuedFrameCount() {
return 0;
}
-
+
@Override
public int getFrameCount() {
return 0;
}
-
+
@Override
public int getQueuedFrameCount() {
return 0;
}
-
+
@Override
public int getQueuedByteCount() {
return 0;
}
-
+
@Override
public int getQueuedTime() {
return 0;
}
-
+
@Override
public final int getPTS() { return 0; }
-
+
@Override
public int getFreeFrameCount() {
- return 1;
+ return 1;
}
-
+
@Override
public AudioFrame enqueueData(AudioDataFrame audioDataFrame) {
return null;
@@ -125,5 +125,5 @@ public class NullAudioSink implements AudioSink {
@Override
public AudioFrame enqueueData(int pts, ByteBuffer bytes, int byteCount) {
return null;
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java
index 1cddaa9cf..840149272 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -54,10 +54,10 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl {
private TextureData texData = null;
private int pos_ms = 0;
private long pos_start = 0;
-
+
public NullGLMediaPlayer() {
super();
-
+
}
@Override
@@ -82,16 +82,16 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl {
validatePos();
return pos_ms;
}
-
+
@Override
protected final int getNextTextureImpl(GL gl, TextureFrame nextFrame) {
final int pts = getAudioPTSImpl();
nextFrame.setPTS( pts );
return pts;
}
-
+
@Override
- protected final int getAudioPTSImpl() {
+ protected final int getAudioPTSImpl() {
pos_ms = (int) ( Platform.currentTimeMillis() - pos_start );
validatePos();
return pos_ms;
@@ -102,9 +102,9 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl {
if(null != texData) {
texData.destroy();
texData = null;
- }
+ }
}
-
+
public final static TextureData createTestTextureData() {
TextureData res = null;
try {
@@ -125,28 +125,28 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl {
buffer.rewind();
res = new TextureData(GLProfile.getGL2ES2(),
GL.GL_RGBA, w, h, 0,
- GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, false,
+ GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, false,
false, false, buffer, null);
}
return res;
}
-
+
@Override
protected final void initStreamImpl(int vid, int aid) throws IOException {
texData = createTestTextureData();
final float _fps = 24f;
final int _duration = 10*60*1000; // msec
final int _totalFrames = (int) ( (_duration/1000)*_fps );
- updateAttributes(0 /* fake */, GLMediaPlayer.STREAM_ID_NONE,
- texData.getWidth(), texData.getHeight(), 0,
- 0, 0, _fps,
+ updateAttributes(0 /* fake */, GLMediaPlayer.STREAM_ID_NONE,
+ texData.getWidth(), texData.getHeight(), 0,
+ 0, 0, _fps,
_totalFrames, 0, _duration, "png-static", null);
- }
+ }
@Override
protected final void initGLImpl(GL gl) throws IOException, GLException {
isInGLOrientation = true;
}
-
+
/**
* {@inheritDoc}
* <p>
@@ -157,21 +157,21 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl {
protected int validateTextureCount(int desiredTextureCount) {
return 2;
}
-
+
@Override
protected final TextureSequence.TextureFrame createTexImage(GL gl, int texName) {
final Texture texture = super.createTexImageImpl(gl, texName, width, height);
if(null != texData) {
texture.updateImage(gl, texData);
- }
+ }
return new TextureSequence.TextureFrame( texture );
}
-
+
@Override
protected final void destroyTexFrame(GL gl, TextureSequence.TextureFrame frame) {
super.destroyTexFrame(gl, frame);
}
-
+
private void validatePos() {
boolean considerPausing = false;
if( 0 > pos_ms) {
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 146a47ebc..a6a6fba97 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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;
import java.security.AccessController;
@@ -48,9 +48,9 @@ import com.jogamp.common.util.VersionNumber;
*/
class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
private static final boolean DEBUG = FFMPEGMediaPlayer.DEBUG || DynamicLibraryBundleInfo.DEBUG;
-
+
private static final List<String> glueLibNames = new ArrayList<String>(); // none
-
+
private static final int symbolCount = 65;
private static final String[] symbolNames = {
"avutil_version",
@@ -61,10 +61,10 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
// libavcodec
"avcodec_register_all",
- "avcodec_close",
- "avcodec_string",
- "avcodec_find_decoder",
- "avcodec_open2", // 53.6.0 (opt)
+ "avcodec_close",
+ "avcodec_string",
+ "avcodec_find_decoder",
+ "avcodec_open2", // 53.6.0 (opt)
"avcodec_alloc_frame",
"avcodec_get_frame_defaults",
"avcodec_free_frame", // 54.28.0 (opt)
@@ -79,10 +79,10 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
"av_init_packet",
"av_new_packet",
"av_destruct_packet",
- "av_free_packet",
+ "av_free_packet",
"avcodec_decode_audio4", // 53.25.0 (opt)
/* 27 */ "avcodec_decode_video2", // 52.23.0
-
+
// libavutil
"av_pix_fmt_descriptors",
"av_frame_unref", // 55.0.0 (opt)
@@ -101,10 +101,10 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
"avformat_alloc_context",
"avformat_free_context", // 52.96.0 (opt)
"avformat_close_input", // 53.17.0 (opt)
- "av_register_all",
+ "av_register_all",
"av_find_input_format",
- "avformat_open_input",
- "av_dump_format",
+ "avformat_open_input",
+ "av_dump_format",
"av_read_frame",
"av_seek_frame",
"avformat_seek_file", // ??? (opt)
@@ -115,24 +115,24 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
/* 54 */ "avformat_find_stream_info", // 53.3.0 (opt)
// libavdevice
-/* 55 */ "avdevice_register_all", // ???
-
+/* 55 */ "avdevice_register_all", // ???
+
// libavresample
"avresample_alloc_context", // 1.0.1
"avresample_open",
"avresample_close",
"avresample_free",
/* 60 */ "avresample_convert",
-
+
// libavresample
"av_opt_set_sample_fmt", // actually lavu .. but exist only w/ swresample!
"swr_alloc",
- "swr_init",
+ "swr_init",
"swr_free",
/* 65 */ "swr_convert",
};
-
+
// optional symbol names
private static final String[] optionalSymbolNames = {
"avformat_seek_file", // ??? (opt)
@@ -145,7 +145,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
// libavdevice
"avdevice_register_all", // 53.0.0 (opt)
-
+
// libavresample
"avresample_version", // 1.0.1
"avresample_alloc_context", // 1.0.1
@@ -153,43 +153,43 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
"avresample_close",
"avresample_free",
"avresample_convert",
-
+
// libavresample
"av_opt_set_sample_fmt", // actually lavu .. but exist only w/ swresample!
"swresample_version", // 0
"swr_alloc",
- "swr_init",
+ "swr_init",
"swr_free",
"swr_convert",
};
-
+
private static final long[] symbolAddr = new long[symbolCount];
private static final boolean ready;
private static final boolean libsUFCLoaded;
private static final boolean avresampleLoaded; // optional
private static final boolean swresampleLoaded; // optional
private static final boolean avdeviceLoaded; // optional
- static final VersionNumber avCodecVersion;
+ static final VersionNumber avCodecVersion;
static final VersionNumber avFormatVersion;
static final VersionNumber avUtilVersion;
static final VersionNumber avResampleVersion;
static final VersionNumber swResampleVersion;
private static final FFMPEGNatives natives;
-
+
private static final int LIB_IDX_UTI = 0;
private static final int LIB_IDX_FMT = 1;
private static final int LIB_IDX_COD = 2;
private static final int LIB_IDX_DEV = 3;
private static final int LIB_IDX_AVR = 4;
private static final int LIB_IDX_SWR = 5;
-
+
static {
- // native ffmpeg media player implementation is included in jogl_desktop and jogl_mobile
+ // native ffmpeg media player implementation is included in jogl_desktop and jogl_mobile
GLProfile.initSingleton();
boolean _ready = false;
- /** util, format, codec, device, avresample, swresample */
- boolean[] _loaded= new boolean[6];
- /** util, format, codec, avresample, swresample */
+ /** util, format, codec, device, avresample, swresample */
+ boolean[] _loaded= new boolean[6];
+ /** util, format, codec, avresample, swresample */
VersionNumber[] _versions = new VersionNumber[5];
try {
_ready = initSymbols(_loaded, _versions);
@@ -226,7 +226,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
} else {
System.err.println("LIB_AV No Version/Native-Impl Match");
natives = null;
- }
+ }
if( null != natives && FFMPEGStaticNatives.initIDs0() ) {
ready = natives.initSymbols0(symbolAddr, symbolCount);
} else {
@@ -234,7 +234,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
}
}
}
-
+
static boolean libsLoaded() { return libsUFCLoaded; }
static boolean avDeviceLoaded() { return avdeviceLoaded; }
static boolean avResampleLoaded() { return avresampleLoaded; }
@@ -252,6 +252,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
loaded[i] = false;
}
final DynamicLibraryBundle dl = AccessController.doPrivileged(new PrivilegedAction<DynamicLibraryBundle>() {
+ @Override
public DynamicLibraryBundle run() {
return new DynamicLibraryBundle(new FFMPEGDynamicLibraryBundleInfo());
} } );
@@ -265,22 +266,23 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
if(symbolNames.length != symbolCount) {
throw new InternalError("XXX0 "+symbolNames.length+" != "+symbolCount);
}
-
+
// optional symbol name set
final Set<String> optionalSymbolNameSet = new HashSet<String>();
optionalSymbolNameSet.addAll(Arrays.asList(optionalSymbolNames));
-
+
// lookup
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
for(int i = 0; i<symbolCount; i++) {
symbolAddr[i] = dl.dynamicLookupFunction(symbolNames[i]);
}
return null;
} } );
-
+
// validate results
- boolean res = true;
+ boolean res = true;
for(int i = 0; i<symbolCount; i++) {
if( 0 == symbolAddr[i] ) {
// no symbol, check optional and alternative symbols
@@ -298,10 +300,10 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
versions[2] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[2]));
versions[3] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[3]));
versions[4] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[4]));
-
+
return res;
}
-
+
protected FFMPEGDynamicLibraryBundleInfo() {
}
@@ -313,12 +315,12 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
* <p>
* Returns <code>true</code>.
* </p>
- */
+ */
@Override
public final boolean shallLookupGlobal() {
- return true;
+ return true;
}
-
+
@Override
public final List<String> getGlueLibNames() {
return glueLibNames;
@@ -329,7 +331,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
List<List<String>> libsList = new ArrayList<List<String>>();
// 6: util, format, codec, device, avresample, swresample
-
+
final List<String> avutil = new ArrayList<String>();
avutil.add("avutil"); // default
@@ -337,13 +339,13 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
avutil.add("libavutil.so.52"); // ffmpeg 1.2 + 2 / libav 9 + 10
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-51"); // 0.8
avutil.add("avutil-50"); // 0.7
libsList.add(avutil);
-
+
final List<String> avformat = new ArrayList<String>();
avformat.add("avformat"); // default
@@ -352,14 +354,14 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
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-54"); // ffmpeg 1.2 / libav 9
avformat.add("avformat-53"); // 0.8
- avformat.add("avformat-52"); // 0.7
+ avformat.add("avformat-52"); // 0.7
libsList.add(avformat);
-
+
final List<String> avcodec = new ArrayList<String>();
avcodec.add("avcodec"); // default
@@ -367,15 +369,15 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
avcodec.add("libavcodec.so.55"); // ffmpeg 2/ 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("libavcodec.so.52"); // 0.7
+
avcodec.add("avcodec-56"); // dummy future proof
avcodec.add("avcodec-55"); // ffmpeg 2/ libav 10
avcodec.add("avcodec-54"); // ffmpeg 1.2 / libav 9
avcodec.add("avcodec-53"); // 0.8
- avcodec.add("avcodec-52"); // 0.7
+ avcodec.add("avcodec-52"); // 0.7
libsList.add(avcodec);
-
+
final List<String> avdevice = new ArrayList<String>();
avdevice.add("avdevice"); // default
@@ -383,19 +385,19 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
avdevice.add("libavdevice.so.55"); // ffmpeg 2
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-54"); // ffmpeg 1.2 / libav 10
avdevice.add("avdevice-53"); // 0.8 && libav 9
libsList.add(avdevice);
-
+
final List<String> avresample = new ArrayList<String>();
avresample.add("avresample"); // default
avresample.add("libavresample.so.2"); // dummy future proof
avresample.add("libavresample.so.1"); // libav 9 + 10
-
+
avresample.add("avresample-2"); // dummy future proof
avresample.add("avresample-1"); // libav 9 + 10
libsList.add(avresample);
@@ -405,11 +407,11 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
swresample.add("libswresample.so.1"); // dummy future proof
swresample.add("libswresample.so.0"); // ffmpeg 1.2 + 2.x
-
+
swresample.add("swresample-1"); // dummy future proof
swresample.add("swresample-0"); // ffmpeg 1.2 + 2.x
libsList.add(swresample);
-
+
return libsList;
}
@@ -431,5 +433,5 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
@Override
public final RunnableExecutor getLibLoaderExecutor() {
return DynamicLibraryBundle.getDefaultRunnableExecutor();
- }
+ }
}
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 f196ebef1..d2ef026bd 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -65,18 +65,18 @@ import jogamp.opengl.util.av.impl.FFMPEGNatives.SampleFormat;
* Besides the default BSD/Linux/.. repositories and installations,
* precompiled binaries can be found at the
* <a href="#libavavail">listed location below</a>.
- * </p>
- *
+ * </p>
+ *
* <a name="implspecifics"><h5>Implementation specifics</h5></a>
* <p>
- * The decoded video frame is written directly into an OpenGL texture
- * on the GPU in it's native format. A custom fragment shader converts
- * the native pixelformat to a usable <i>RGB</i> format if required.
- * Hence only 1 copy is required before bloating the picture
+ * The decoded video frame is written directly into an OpenGL texture
+ * on the GPU in it's native format. A custom fragment shader converts
+ * the native pixelformat to a usable <i>RGB</i> format if required.
+ * Hence only 1 copy is required before bloating the picture
* from <i>YUV*</i> to <i>RGB</i>, for example.
- * </p>
+ * </p>
* <p>
- * Implements pixel format conversion to <i>RGB</i> via
+ * Implements pixel format conversion to <i>RGB</i> via
* fragment shader texture-lookup functions:
* <ul>
* <li>{@link PixelFormat#YUV420P}</li>
@@ -88,10 +88,10 @@ import jogamp.opengl.util.av.impl.FFMPEGNatives.SampleFormat;
* </ul>
* </p>
* <p>
- *
+ *
* <a name="libavspecifics"><h5>Libav Specifics</h5></a>
* <p>
- * Utilizes a slim dynamic and native binding to the Lib_av
+ * Utilizes a slim dynamic and native binding to the Lib_av
* libraries:
* <ul>
* <li>libavcodec</li>
@@ -99,9 +99,9 @@ import jogamp.opengl.util.av.impl.FFMPEGNatives.SampleFormat;
* <li>libavutil</li>
* <li>libavresample (opt)</li>
* <li>libavdevice (opt)</li>
- * </ul>
+ * </ul>
* </p>
- *
+ *
* <a name="compatibility"><h5>LibAV Compatibility</h5></a>
* <p>
* Currently we are binary compatible w/:
@@ -115,25 +115,25 @@ import jogamp.opengl.util.av.impl.FFMPEGNatives.SampleFormat;
* <p>
* See http://upstream-tracker.org/versions/libav.html
* </p>
- * <p>
- * Check tag 'FIXME: Add more planar formats !'
+ * <p>
+ * Check tag 'FIXME: Add more planar formats !'
* here and in the corresponding native code
* <code>jogl/src/jogl/native/libav/ffmpeg_impl_template.c</code>
* </p>
- *
- *
+ *
+ *
* <a name="todo"><h5>TODO:</h5></a>
* <p>
* <ul>
* <li>better audio synchronization handling? (video is synchronized)</li>
- * </ul>
+ * </ul>
* </p>
- *
+ *
* <a name="libavavail"><h5>FFMPEG / LibAV Availability</h5></a>
* <p>
* <ul>
* <li>GNU/Linux: ffmpeg or libav are deployed in most distributions.</li>
- * <li>Windows:
+ * <li>Windows:
* <ul>
* <li>http://ffmpeg.zeranoe.com/builds/ (ffmpeg) <i>recommended, works w/ dshow</i></li>
* <li>http://win32.libav.org/releases/ (libav)</li>
@@ -144,22 +144,22 @@ import jogamp.opengl.util.av.impl.FFMPEGNatives.SampleFormat;
* pkt install pkg:/video/ffmpeg
* </pre></li>
* </ul>
- * </p>
+ * </p>
*/
public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
/** POSIX ENOSYS {@value}: Function not implemented. FIXME: Move to GlueGen ?!*/
private static final int ENOSYS = 38;
-
+
// Instance data
private static final FFMPEGNatives natives;
private static final int avUtilMajorVersionCC;
private static final int avFormatMajorVersionCC;
- private static final int avCodecMajorVersionCC;
+ private static final int avCodecMajorVersionCC;
private static final int avResampleMajorVersionCC;
private static final int swResampleMajorVersionCC;
private static final boolean available;
-
+
static {
final boolean libAVGood = FFMPEGDynamicLibraryBundleInfo.initSingleton();
final boolean libAVVersionGood;
@@ -171,7 +171,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
avUtilMajorVersionCC = natives.getAvUtilMajorVersionCC0();
avResampleMajorVersionCC = natives.getAvResampleMajorVersionCC0();
swResampleMajorVersionCC = natives.getSwResampleMajorVersionCC0();
- } else {
+ } else {
avUtilMajorVersionCC = 0;
avFormatMajorVersionCC = 0;
avCodecMajorVersionCC = 0;
@@ -211,25 +211,25 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
}
available = libAVGood && libAVVersionGood && null != natives;
}
-
+
public static final boolean isAvailable() { return available; }
//
// General
//
-
- private long moviePtr = 0;
-
+
+ private long moviePtr = 0;
+
//
// Video
//
-
+
private String texLookupFuncName = "ffmpegTexture2D";
- private boolean usesTexLookupShader = false;
+ private boolean usesTexLookupShader = false;
private PixelFormat vPixelFmt = null;
private int vPlanes = 0;
private int vBitsPerPixel = 0;
- private int vBytesPerPixelPerPlane = 0;
+ private int vBytesPerPixelPerPlane = 0;
private int texWidth, texHeight; // overall (stuffing planes in one texture)
private String singleTexComp = "r";
private GLPixelStorageModes psm;
@@ -237,10 +237,10 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
//
// Audio
//
-
+
private AudioSink.AudioFormat avChosenAudioFormat;
private int audioSamplesPerFrameAndChannel = 0;
-
+
public FFMPEGMediaPlayer() {
if(!available) {
throw new RuntimeException("FFMPEGMediaPlayer not available");
@@ -263,14 +263,14 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
}
private final void destroyAudioSink() {
final AudioSink _audioSink = audioSink;
- if( null != _audioSink ) {
+ if( null != _audioSink ) {
audioSink = null;
_audioSink.destroy();
}
}
-
+
public static final String dev_video_linux = "/dev/video";
-
+
@Override
protected final void initStreamImpl(int vid, int aid) throws IOException {
if(0==moviePtr) {
@@ -279,7 +279,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
if(DEBUG) {
System.err.println("initStream: p1 "+this);
}
-
+
final String streamLocS=IOUtil.decodeFromURI(streamLoc.toString());
destroyAudioSink();
if( GLMediaPlayer.STREAM_ID_NONE == aid ) {
@@ -291,7 +291,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
if(DEBUG) {
System.err.println("initStream: p2 preferred "+preferredAudioFormat+", "+this);
}
-
+
final boolean isCameraInput = null != cameraPath;
final String resStreamLocS;
// int rw=640, rh=480, rr=15;
@@ -314,7 +314,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
case OPENKODE:
default:
resStreamLocS = streamLocS; // FIXME: ??
- break;
+ break;
}
if( null != cameraProps ) {
sizes = cameraProps.get(CameraPropSizeS);
@@ -346,6 +346,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
if( null != gl && STREAM_ID_NONE != vid ) {
final GLContextImpl ctx = (GLContextImpl)gl.getContext();
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
final ProcAddressTable pt = ctx.getGLProcAddressTable();
final long procAddrGLTexSubImage2D = pt.getAddressFor("glTexSubImage2D");
@@ -362,7 +363,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
if(DEBUG) {
System.err.println("initGL: p3 avChosen "+avChosenAudioFormat);
}
-
+
if( STREAM_ID_NONE == aid ) {
audioSink.destroy();
audioSink = AudioSinkFactory.createNull();
@@ -386,7 +387,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
System.err.println("initGL: p4 chosen "+avChosenAudioFormat);
System.err.println("initGL: p4 chosen "+audioSink);
}
-
+
if( null != gl && STREAM_ID_NONE != vid ) {
int tf, tif=GL.GL_RGBA; // texture format and internal format
int tt = GL.GL_UNSIGNED_BYTE;
@@ -413,9 +414,9 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
tf = GL2ES2.GL_BGRA; tif=GL.GL_RGBA; break;
} else {
tf = GL2ES2.GL_RGBA; tif=GL.GL_RGBA; break;
- }
+ }
default: throw new RuntimeException("Unsupported bytes-per-pixel / plane "+vBytesPerPixelPerPlane);
- }
+ }
setTextureFormat(tif, tf);
setTextureType(tt);
if(DEBUG) {
@@ -423,12 +424,12 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
", tex "+texWidth+"x"+texHeight+", usesTexLookupShader "+usesTexLookupShader);
}
}
- }
+ }
@Override
protected final TextureFrame createTexImage(GL gl, int texName) {
return new TextureFrame( createTexImageImpl(gl, texName, texWidth, texHeight) );
}
-
+
/**
* @param sampleRate sample rate in Hz (1/s)
* @param sampleSize sample size in bits
@@ -439,10 +440,10 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
* @param littleEndian true for little-endian, false for big endian
* @return
*/
-
+
/**
* Native callback
- * Converts the given libav/ffmpeg values to {@link AudioFormat} and returns {@link AudioSink#isSupported(AudioFormat)}.
+ * Converts the given libav/ffmpeg values to {@link AudioFormat} and returns {@link AudioSink#isSupported(AudioFormat)}.
* @param audioSampleFmt ffmpeg/libav audio-sample-format, see {@link SampleFormat}.
* @param audioSampleRate sample rate in Hz (1/s)
* @param audioChannels number of channels
@@ -456,9 +457,9 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
}
return res;
}
-
+
/**
- * Returns {@link AudioFormat} as converted from the given libav/ffmpeg values.
+ * Returns {@link AudioFormat} as converted from the given libav/ffmpeg values.
* @param audioSampleFmt ffmpeg/libav audio-sample-format, see {@link SampleFormat}.
* @param audioSampleRate sample rate in Hz (1/s)
* @param audioChannels number of channels
@@ -506,7 +507,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
}
return new AudioFormat(audioSampleRate, sampleSize, audioChannels, signed, fixedP, planar, true /* littleEndian */);
}
-
+
/**
* Native callback
* @param vid
@@ -523,9 +524,9 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
* @param audioChannels
* @param audioSamplesPerFrameAndChannel in audio samples per frame and channel
*/
- void setupFFAttributes(int vid, int pixFmt, int planes, int bitsPerPixel, int bytesPerPixelPerPlane,
+ void setupFFAttributes(int vid, int pixFmt, int planes, int bitsPerPixel, int bytesPerPixelPerPlane,
int tWd0, int tWd1, int tWd2, int vW, int vH,
- int aid, int audioSampleFmt, int audioSampleRate,
+ int aid, int audioSampleFmt, int audioSampleRate,
int audioChannels, int audioSamplesPerFrameAndChannel) {
// defaults ..
vPixelFmt = null;
@@ -534,28 +535,28 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
vBytesPerPixelPerPlane = 0;
usesTexLookupShader = false;
texWidth = 0; texHeight = 0;
-
+
final int[] vTexWidth = { 0, 0, 0 }; // per plane
-
+
if( STREAM_ID_NONE != vid ) {
vPixelFmt = PixelFormat.valueOf(pixFmt);
vPlanes = planes;
vBitsPerPixel = bitsPerPixel;
- vBytesPerPixelPerPlane = bytesPerPixelPerPlane;
+ vBytesPerPixelPerPlane = bytesPerPixelPerPlane;
vTexWidth[0] = tWd0; vTexWidth[1] = tWd1; vTexWidth[2] = tWd2;
-
+
switch(vPixelFmt) {
case YUVJ420P:
case YUV420P: // < planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
usesTexLookupShader = true;
// YUV420P: Adding U+V on right side of fixed height texture,
// since width is already aligned by decoder.
- // Splitting texture to 4 quadrants:
+ // Splitting texture to 4 quadrants:
// Y covers left top/low quadrant
// U on top-right quadrant.
// V on low-right quadrant.
// Y=w*h, U=w/2*h/2, V=w/2*h/2
- // w*h + 2 ( w/2 * h/2 )
+ // w*h + 2 ( w/2 * h/2 )
// w*h + w*h/2
texWidth = vTexWidth[0] + vTexWidth[1]; texHeight = vH;
break;
@@ -573,27 +574,27 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
case YUYV422: // < packed YUV 4:2:2, 2x 16bpp, Y0 Cb Y1 Cr - stuffed into RGBA half width texture
case BGR24:
usesTexLookupShader = true;
- texWidth = vTexWidth[0]; texHeight = vH;
+ texWidth = vTexWidth[0]; texHeight = vH;
break;
-
+
case RGB24:
case ARGB:
case RGBA:
case ABGR:
case BGRA:
usesTexLookupShader = false;
- texWidth = vTexWidth[0]; texHeight = vH;
+ texWidth = vTexWidth[0]; texHeight = vH;
break;
default: // FIXME: Add more formats !
throw new RuntimeException("Unsupported pixelformat: "+vPixelFmt);
}
}
-
+
// defaults ..
final SampleFormat aSampleFmt;
avChosenAudioFormat = null;;
this.audioSamplesPerFrameAndChannel = 0;
-
+
if( STREAM_ID_NONE != aid ) {
aSampleFmt = SampleFormat.valueOf(audioSampleFmt);
avChosenAudioFormat = avAudioFormat2Local(aSampleFmt, audioSampleRate, audioChannels);
@@ -601,7 +602,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
} else {
aSampleFmt = null;
}
-
+
if(DEBUG) {
System.err.println("audio: id "+aid+", fmt "+aSampleFmt+", "+avChosenAudioFormat+", aFrameSize/fc "+audioSamplesPerFrameAndChannel);
System.err.println("video: id "+vid+", fmt "+vW+"x"+vH+", "+vPixelFmt+", planes "+vPlanes+", bpp "+vBitsPerPixel+"/"+vBytesPerPixelPerPlane+", usesTexLookupShader "+usesTexLookupShader);
@@ -612,7 +613,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
System.err.println(this.toString());
}
}
-
+
/**
* Native callback
* @param isInGLOrientation
@@ -624,13 +625,13 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
* @param tWd1
* @param tWd2
*/
- void updateVidAttributes(boolean isInGLOrientation, int pixFmt, int planes, int bitsPerPixel, int bytesPerPixelPerPlane,
+ void updateVidAttributes(boolean isInGLOrientation, int pixFmt, int planes, int bitsPerPixel, int bytesPerPixelPerPlane,
int tWd0, int tWd1, int tWd2, int vW, int vH) {
}
-
+
/**
* {@inheritDoc}
- *
+ *
* If this implementation generates a specialized shader,
* it allows the user to override the default function name <code>ffmpegTexture2D</code>.
* Otherwise the call is delegated to it's super class.
@@ -646,15 +647,15 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
}
return texLookupFuncName;
}
- return super.getTextureLookupFunctionName(desiredFuncName);
+ return super.getTextureLookupFunctionName(desiredFuncName);
}
-
+
/**
* {@inheritDoc}
- *
+ *
* Depending on the pixelformat, a specific conversion shader is being created,
- * e.g. YUV420P to RGB. Otherwise the call is delegated to it's super class.
- */
+ * e.g. YUV420P to RGB. Otherwise the call is delegated to it's super class.
+ */
@Override
public final String getTextureLookupFragmentShaderImpl() throws IllegalStateException {
if(State.Uninitialized == state) {
@@ -685,7 +686,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
" return vec4(r, g, b, 1);\n"+
"}\n"
;
-
+
case YUVJ422P:
case YUV422P: ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
return
@@ -706,7 +707,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
" return vec4(r, g, b, 1);\n"+
"}\n"
;
-
+
case YUYV422: // < packed YUV 4:2:2, 2 x 16bpp, [Y0 Cb] [Y1 Cr]
// Stuffed into RGBA half width texture
return
@@ -740,9 +741,9 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
default: // FIXME: Add more formats !
throw new InternalError("Add proper mapping of: vPixelFmt "+vPixelFmt+", usesTexLookupShader "+usesTexLookupShader);
- }
+ }
}
-
+
@Override
public final boolean playImpl() {
if(0==moviePtr) {
@@ -754,7 +755,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
}
return true;
}
-
+
@Override
public final boolean pauseImpl() {
if(0==moviePtr) {
@@ -780,12 +781,12 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
psm.setUnpackAlignment(gl, 1); // RGBA ? 4 : 1
gl.glActiveTexture(GL.GL_TEXTURE0+getTextureUnit());
}
-
+
@Override
protected void postNextTextureImpl(GL gl) {
psm.restore(gl);
}
-
+
@Override
protected final int getNextTextureImpl(GL gl, TextureFrame nextFrame) {
if(0==moviePtr) {
@@ -806,14 +807,14 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
nextFrame.setPTS(vPTS);
}
return vPTS;
- }
-
+ }
+
final void pushSound(ByteBuffer sampleData, int data_size, int audio_pts) {
setFirstAudioPTS2SCR( audio_pts );
if( 1.0f == playSpeed || audioSinkPlaySpeedSet ) {
audioSink.enqueueData( audio_pts, sampleData, data_size);
}
}
-
+
}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java
index 8e08c23fa..bc0865aa9 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -30,21 +30,21 @@ package jogamp.opengl.util.av.impl;
import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame;
interface FFMPEGNatives {
-
+
boolean initSymbols0(long[] symbols, int count);
int getAvUtilMajorVersionCC0();
int getAvFormatMajorVersionCC0();
int getAvCodecMajorVersionCC0();
int getAvResampleMajorVersionCC0();
int getSwResampleMajorVersionCC0();
-
+
long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose);
void destroyInstance0(long moviePtr);
-
+
/**
* Issues {@link #updateAttributes(int, int, int, int, int, int, int, float, int, int, String, String)}
* and {@link #updateAttributes2(int, int, int, int, int, int, int, int, int, int)}.
- *
+ *
* @param moviePtr
* @param url
* @param vid
@@ -56,25 +56,25 @@ interface FFMPEGNatives {
* @param aPrefSampleRate
* @param aPrefChannelCount
*/
- void setStream0(long moviePtr, String url, boolean isCameraInput,
- int vid, String sizes, int vWidth, int vHeight,
+ void setStream0(long moviePtr, String url, boolean isCameraInput,
+ int vid, String sizes, int vWidth, int vHeight,
int vRate, int aid, int aMaxChannelCount, int aPrefSampleRate);
-
+
void setGLFuncs0(long moviePtr, long procAddrGLTexSubImage2D, long procAddrGLGetError, long procAddrGLFlush, long procAddrGLFinish);
- int getVideoPTS0(long moviePtr);
-
+ int getVideoPTS0(long moviePtr);
+
int getAudioPTS0(long moviePtr);
-
+
/**
* @return resulting current video PTS, or {@link TextureFrame#INVALID_PTS}
*/
int readNextPacket0(long moviePtr, int texTarget, int texFmt, int texType);
-
+
int play0(long moviePtr);
int pause0(long moviePtr);
int seek0(long moviePtr, int position);
-
+
/** FFMPEG/libAV Audio Sample Format */
public static enum SampleFormat {
// NONE = -1,
@@ -89,10 +89,10 @@ interface FFMPEGNatives {
S32P, ///< signed 32 bits, planar
FLTP, ///< float, planar
DBLP, ///< double, planar
-
+
COUNT; ///< Number of sample formats.
-
- /**
+
+ /**
* Returns the matching SampleFormat value corresponding to the given SampleFormat's integer ordinal.
* <pre>
* given:
@@ -131,7 +131,7 @@ interface FFMPEGNatives {
/** planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) */
YUV411P,
/** Y, 8bpp */
- GRAY8,
+ GRAY8,
/** Y, 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb */
MONOWHITE,
/** Y, 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb */
@@ -151,57 +151,57 @@ interface FFMPEGNatives {
/** packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 */
UYVY422,
/** packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 */
- UYYVYY411,
+ UYYVYY411,
/** packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) */
- BGR8,
+ BGR8,
/** packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits */
- BGR4,
+ BGR4,
/** packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) */
- BGR4_BYTE,
+ BGR4_BYTE,
/** packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) */
- RGB8,
+ RGB8,
/** packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits */
- RGB4,
+ RGB4,
/** packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) */
- RGB4_BYTE,
+ RGB4_BYTE,
/** planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V) */
- NV12,
+ NV12,
/** as above, but U and V bytes are swapped */
- NV21,
+ NV21,
/** packed ARGB 8:8:8:8, 32bpp, ARGBARGB... */
- ARGB,
+ ARGB,
/** packed RGBA 8:8:8:8, 32bpp, RGBARGBA... */
- RGBA,
+ RGBA,
/** packed ABGR 8:8:8:8, 32bpp, ABGRABGR... */
- ABGR,
+ ABGR,
/** packed BGRA 8:8:8:8, 32bpp, BGRABGRA... */
- BGRA,
+ BGRA,
/** Y, 16bpp, big-endian */
- GRAY16BE,
+ GRAY16BE,
/** Y , 16bpp, little-endian */
- GRAY16LE,
+ GRAY16LE,
/** planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) */
- YUV440P,
+ YUV440P,
/** planar YUV 4:4:0 full scale (JPEG), deprecated in favor of YUV440P and setting color_range */
- YUVJ440P,
+ YUVJ440P,
/** planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) */
- YUVA420P,
+ YUVA420P,
/** H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers */
- VDPAU_H264,
+ VDPAU_H264,
/** MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers */
- VDPAU_MPEG1,
+ VDPAU_MPEG1,
/** MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers */
- VDPAU_MPEG2,
+ VDPAU_MPEG2,
/** WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers */
- VDPAU_WMV3,
+ VDPAU_WMV3,
/** VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers */
- VDPAU_VC1,
+ VDPAU_VC1,
/** packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian */
- RGB48BE,
+ RGB48BE,
/** packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian */
- RGB48LE,
+ RGB48LE,
RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
@@ -255,7 +255,7 @@ interface FFMPEGNatives {
GBRP16LE, ///< planar GBR 4:4:4 48bpp, little endian
COUNT ///< number of pixel formats in this list
;
- /**
+ /**
* Returns the matching PixelFormat value corresponding to the given PixelFormat's integer ordinal.
* <pre>
* given:
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java
index 01c249313..22a045825 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -29,7 +29,7 @@ package jogamp.opengl.util.av.impl;
import com.jogamp.common.util.VersionNumber;
-class FFMPEGStaticNatives {
+class FFMPEGStaticNatives {
static VersionNumber getAVVersion(int vers) {
return new VersionNumber( ( vers >> 16 ) & 0xFF,
( vers >> 8 ) & 0xFF,
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java
index 22694888d..4b013c1b3 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -45,7 +45,7 @@ class FFMPEGv08Natives implements FFMPEGNatives {
@Override
public native int getSwResampleMajorVersionCC0();
-
+
@Override
public native long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose);
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java
index 08e19d5e6..d69763287 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -45,7 +45,7 @@ class FFMPEGv09Natives implements FFMPEGNatives {
@Override
public native int getSwResampleMajorVersionCC0();
-
+
@Override
public native long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose);
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java
index 0081743fa..0b5f70d7c 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -45,7 +45,7 @@ class FFMPEGv10Natives implements FFMPEGNatives {
@Override
public native int getSwResampleMajorVersionCC0();
-
+
@Override
public native long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose);
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java
index a5a701a4f..24198703a 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -45,19 +45,19 @@ import jogamp.opengl.util.av.EGLMediaPlayerImpl;
*/
public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
static final boolean available;
-
+
static {
available = false;
/** FIXME!
- // OMX binding is included in jogl_desktop and jogl_mobile
+ // OMX binding is included in jogl_desktop and jogl_mobile
GLProfile.initSingleton();
available = initIDs0(); */
}
-
+
public static final boolean isAvailable() { return available; }
-
+
protected long moviePtr = 0;
-
+
public OMXGLMediaPlayer() {
super(TextureType.KHRImage, true);
if(!available) {
@@ -70,21 +70,21 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
moviePtr = _createInstance();
if(0==moviePtr) {
throw new GLException("Couldn't create OMXInstance");
- }
+ }
}
-
+
@Override
protected TextureSequence.TextureFrame createTexImage(GL gl, int texName) {
final EGLTextureFrame eglTex = (EGLTextureFrame) super.createTexImage(gl, texName);
_setStreamEGLImageTexture2D(moviePtr, texName, eglTex.getImage(), eglTex.getSync());
return eglTex;
}
-
+
@Override
protected void destroyTexFrame(GL gl, TextureSequence.TextureFrame imgTex) {
- super.destroyTexFrame(gl, imgTex);
+ super.destroyTexFrame(gl, imgTex);
}
-
+
@Override
protected void destroyImpl(GL gl) {
if (moviePtr != 0) {
@@ -94,20 +94,20 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
moviePtr = 0;
}
}
-
+
@Override
protected void initStreamImpl(int vid, int aid) throws IOException {
if(0==moviePtr) {
throw new GLException("OMX native instance null");
}
if(!streamLoc.getScheme().equals("file")) {
- throw new IOException("Only file schemes are allowed: "+streamLoc);
+ throw new IOException("Only file schemes are allowed: "+streamLoc);
}
final String path=streamLoc.getPath();
if(DEBUG) {
System.out.println("initGLStream: clean path "+path);
}
-
+
if(DEBUG) {
System.out.println("initGLStream: p1 "+this);
}
@@ -121,7 +121,7 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
// NOP
isInGLOrientation = true;
}
-
+
@Override
protected int getAudioPTSImpl() {
return 0!=moviePtr ? _getCurrentPosition(moviePtr) : 0;
@@ -172,8 +172,8 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
final int nextTex = _getNextTextureID(moviePtr, true);
if(0 < nextTex) {
// FIXME set pts !
- /* FIXME
- final TextureSequence.TextureFrame eglImgTex =
+ /* FIXME
+ final TextureSequence.TextureFrame eglImgTex =
texFrameMap.get(new Integer(_getNextTextureID(moviePtr, blocking)));
if(null!=eglImgTex) {
lastTex = eglImgTex;
@@ -181,7 +181,7 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
}
return 0; // FIXME: return pts
}
-
+
private String replaceAll(String orig, String search, String repl) {
String dest=null;
// In case replaceAll / java.util.regex.* is not supported (-> CVM)
@@ -203,14 +203,14 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
}
private static native boolean initIDs0();
- private native long _createInstance();
+ private native long _createInstance();
private native void _destroyInstance(long moviePtr);
-
+
private native void _detachVideoRenderer(long moviePtr); // stop before
private native void _attachVideoRenderer(long moviePtr); // detach before
private native void _setStream(long moviePtr, int textureNum, String path);
private native void _activateStream(long moviePtr);
-
+
private native void _setStreamEGLImageTexture2D(long moviePtr, int tex, long image, long sync);
private native int _seek(long moviePtr, int position);
private native void _setPlaySpeed(long moviePtr, float rate);
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java
index 3c468f358..3b443fdd0 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java
@@ -41,23 +41,26 @@ import com.jogamp.opengl.util.GLArrayDataEditable;
import com.jogamp.opengl.util.glsl.ShaderState;
/**
- * Used for 1:1 GLSL arrays, i.e. where the buffer data
- * represents this array only.
+ * Used for 1:1 GLSL arrays, i.e. where the buffer data
+ * represents this array only.
*/
-public class GLSLArrayHandler extends GLVBOArrayHandler implements GLArrayHandler {
-
+public class GLSLArrayHandler extends GLVBOArrayHandler implements GLArrayHandler {
+
public GLSLArrayHandler(GLArrayDataEditable ad) {
super(ad);
}
-
+
+ @Override
public final void setSubArrayVBOName(int vboName) {
throw new UnsupportedOperationException();
}
-
+
+ @Override
public final void addSubHandler(GLArrayHandlerFlat handler) {
throw new UnsupportedOperationException();
}
-
+
+ @Override
public final void enableState(GL gl, boolean enable, Object ext) {
final GL2ES2 glsl = gl.getGL2ES2();
if( null != ext ) {
@@ -66,12 +69,12 @@ public class GLSLArrayHandler extends GLVBOArrayHandler implements GLArrayHandle
enableSimple(glsl, enable);
}
}
-
+
private final void enableShaderState(GL2ES2 glsl, boolean enable, ShaderState st) {
if(enable) {
/*
* This would be the non optimized code path:
- *
+ *
if(ad.isVBO()) {
glsl.glBindBuffer(ad.getVBOTarget(), ad.getVBOName());
if(!ad.isVBOWritten()) {
@@ -108,13 +111,13 @@ public class GLSLArrayHandler extends GLVBOArrayHandler implements GLArrayHandle
} else if(null!=buffer) {
st.vertexAttribPointer(glsl, ad);
}
-
+
st.enableVertexAttribArray(glsl, ad);
} else {
st.disableVertexAttribArray(glsl, ad);
}
}
-
+
private final void enableSimple(GL2ES2 glsl, boolean enable) {
final int location = ad.getLocation();
if( 0 > location ) {
@@ -123,7 +126,7 @@ public class GLSLArrayHandler extends GLVBOArrayHandler implements GLArrayHandle
if(enable) {
/*
* This would be the non optimized code path:
- *
+ *
if(ad.isVBO()) {
glsl.glBindBuffer(ad.getVBOTarget(), ad.getVBOName());
if(!ad.isVBOWritten()) {
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java
index 855406db3..34a381d7d 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java
@@ -37,7 +37,7 @@ import com.jogamp.opengl.util.GLArrayDataWrapper;
import com.jogamp.opengl.util.glsl.ShaderState;
/**
- * Used for interleaved GLSL arrays, i.e. where the buffer data itself is handled
+ * Used for interleaved GLSL arrays, i.e. where the buffer data itself is handled
* separately and interleaves many arrays.
*/
public class GLSLArrayHandlerFlat implements GLArrayHandlerFlat {
@@ -47,10 +47,12 @@ public class GLSLArrayHandlerFlat implements GLArrayHandlerFlat {
this.ad = ad;
}
+ @Override
public GLArrayDataWrapper getData() {
return ad;
}
-
+
+ @Override
public final void syncData(GL gl, Object ext) {
final GL2ES2 glsl = gl.getGL2ES2();
if( null != ext ) {
@@ -62,7 +64,7 @@ public class GLSLArrayHandlerFlat implements GLArrayHandlerFlat {
}
/**
* Due to probable application VBO switching, this might not make any sense ..
- *
+ *
if(!written) {
st.vertexAttribPointer(glsl, ad);
} else if(st.getAttribLocation(glsl, ad) >= 0) {
@@ -77,6 +79,7 @@ public class GLSLArrayHandlerFlat implements GLArrayHandlerFlat {
}*/
}
+ @Override
public final void enableState(GL gl, boolean enable, Object ext) {
final GL2ES2 glsl = gl.getGL2ES2();
if( null != ext ) {
@@ -94,7 +97,7 @@ public class GLSLArrayHandlerFlat implements GLArrayHandlerFlat {
} else {
glsl.glDisableVertexAttribArray(location);
}
- }
+ }
}
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java
index c2048d652..b175bb5dc 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java
@@ -40,8 +40,8 @@ import jogamp.opengl.util.GLVBOArrayHandler;
import com.jogamp.opengl.util.GLArrayDataEditable;
/**
- * Interleaved fixed function arrays, i.e. where this buffer data
- * represents many arrays.
+ * Interleaved fixed function arrays, i.e. where this buffer data
+ * represents many arrays.
*/
public class GLSLArrayHandlerInterleaved extends GLVBOArrayHandler implements GLArrayHandler {
private List<GLArrayHandlerFlat> subArrays = new ArrayList<GLArrayHandlerFlat>();
@@ -49,13 +49,15 @@ public class GLSLArrayHandlerInterleaved extends GLVBOArrayHandler implements GL
public GLSLArrayHandlerInterleaved(GLArrayDataEditable ad) {
super(ad);
}
-
+
+ @Override
public final void setSubArrayVBOName(int vboName) {
for(int i=0; i<subArrays.size(); i++) {
subArrays.get(i).getData().setVBOName(vboName);
- }
+ }
}
-
+
+ @Override
public final void addSubHandler(GLArrayHandlerFlat handler) {
subArrays.add(handler);
}
@@ -63,9 +65,10 @@ public class GLSLArrayHandlerInterleaved extends GLVBOArrayHandler implements GL
private final void syncSubData(GL gl, Object ext) {
for(int i=0; i<subArrays.size(); i++) {
subArrays.get(i).syncData(gl, ext);
- }
- }
-
+ }
+ }
+
+ @Override
public final void enableState(GL gl, boolean enable, Object ext) {
if(enable) {
if(!ad.isVBO()) {
@@ -78,7 +81,7 @@ public class GLSLArrayHandlerInterleaved extends GLVBOArrayHandler implements GL
}
for(int i=0; i<subArrays.size(); i++) {
subArrays.get(i).enableState(gl, enable, ext);
- }
+ }
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java
index eaf8dc30a..dba408554 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.glsl;
import java.nio.FloatBuffer;
@@ -45,33 +45,33 @@ import javax.media.opengl.fixedfunc.GLMatrixFunc;
public class GLSLTextureRaster {
private final boolean textureVertFlipped;
private final int textureUnit;
-
+
private ShaderProgram sp;
private PMVMatrix pmvMatrix;
private GLUniformData pmvMatrixUniform;
private GLUniformData activeTexUniform;
private GLArrayDataServer interleavedVBO;
-
+
public GLSLTextureRaster(int textureUnit, boolean textureVertFlipped) {
this.textureVertFlipped = textureVertFlipped;
this.textureUnit = textureUnit;
}
-
+
public int getTextureUnit() { return textureUnit; }
static final String shaderBasename = "texture01_xxx";
static final String shaderSrcPath = "../../shader";
static final String shaderBinPath = "../../shader/bin";
-
+
public void init(GL2ES2 gl) {
// Create & Compile the shader objects
- final ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(),
+ final ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(),
shaderSrcPath, shaderBinPath, shaderBasename, true);
- final ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(),
+ final ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(),
shaderSrcPath, shaderBinPath, shaderBasename, true);
rsVp.defaultShaderCustomization(gl, true, true);
rsFp.defaultShaderCustomization(gl, true, true);
-
+
// Create & Link the shader program
sp = new ShaderProgram();
sp.add(rsVp);
@@ -80,13 +80,13 @@ public class GLSLTextureRaster {
throw new GLException("Couldn't link program: "+sp);
}
sp.useProgram(gl, true);
-
+
// setup mgl_PMVMatrix
pmvMatrix = new PMVMatrix();
pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
- pmvMatrix.glLoadIdentity();
+ pmvMatrix.glLoadIdentity();
pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv
if( pmvMatrixUniform.setLocation(gl, sp.program()) < 0 ) {
throw new GLException("Couldn't locate "+pmvMatrixUniform+" in shader: "+sp);
@@ -105,9 +105,9 @@ public class GLSLTextureRaster {
} else {
s_quadTexCoords = s_quadTexCoords00;
}
-
+
interleavedVBO = GLArrayDataServer.createGLSLInterleaved(3+2, GL.GL_FLOAT, false, 2*4, GL.GL_STATIC_DRAW);
- {
+ {
final GLArrayData vArrayData = interleavedVBO.addGLSLSubArray("mgl_Vertex", 3, GL.GL_ARRAY_BUFFER);
if( vArrayData.setLocation(gl, sp.program()) < 0 ) {
throw new GLException("Couldn't locate "+vArrayData+" in shader: "+sp);
@@ -116,15 +116,15 @@ public class GLSLTextureRaster {
if( tArrayData.setLocation(gl, sp.program()) < 0 ) {
throw new GLException("Couldn't locate "+tArrayData+" in shader: "+sp);
}
- final FloatBuffer ib = (FloatBuffer)interleavedVBO.getBuffer();
+ final FloatBuffer ib = (FloatBuffer)interleavedVBO.getBuffer();
for(int i=0; i<4; i++) {
ib.put(s_quadVertices, i*3, 3);
ib.put(s_quadTexCoords, i*2, 2);
- }
+ }
}
interleavedVBO.seal(gl, true);
interleavedVBO.enableBuffer(gl, false);
-
+
sp.useProgram(gl, false);
}
@@ -133,14 +133,14 @@ public class GLSLTextureRaster {
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
pmvMatrix.glOrthof(-1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 10.0f);
-
+
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
-
+
sp.useProgram(gl, true);
gl.glUniform(pmvMatrixUniform);
sp.useProgram(gl, false);
- }
+ }
}
public void dispose(GL2ES2 gl) {
@@ -162,34 +162,34 @@ public class GLSLTextureRaster {
}
public void display(GL2ES2 gl) {
- if(null != sp) {
- sp.useProgram(gl, true);
+ if(null != sp) {
+ sp.useProgram(gl, true);
interleavedVBO.enableBuffer(gl, true);
-
+
gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4);
-
- interleavedVBO.enableBuffer(gl, false);
+
+ interleavedVBO.enableBuffer(gl, false);
sp.useProgram(gl, false);
}
}
-
- private static final float[] s_quadVertices = {
+
+ private static final float[] s_quadVertices = {
-1f, -1f, 0f, // LB
1f, -1f, 0f, // RB
-1f, 1f, 0f, // LT
- 1f, 1f, 0f // RT
+ 1f, 1f, 0f // RT
};
- private static final float[] s_quadTexCoords00 = {
+ private static final float[] s_quadTexCoords00 = {
0f, 0f, // LB
1f, 0f, // RB
- 0f, 1f, // LT
+ 0f, 1f, // LT
1f, 1f // RT
};
- private static final float[] s_quadTexCoords01 = {
+ private static final float[] s_quadTexCoords01 = {
0f, 1f, // LB
1f, 1f, // RB
- 0f, 0f, // LT
+ 0f, 0f, // LT
1f, 0f // RT
- };
+ };
}
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java
index 6d5b16def..c329945c4 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java
@@ -77,7 +77,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
* @param mode TODO
* @param pmvMatrix optional pass through PMVMatrix for the {@link FixedFuncHook} and {@link FixedFuncPipeline}
*/
- public FixedFuncHook(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix,
+ public FixedFuncHook(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix,
Class<?> shaderRootClass, String shaderSrcRoot, String shaderBinRoot,
String vertexColorFile, String vertexColorLightFile,
String fragmentColorFile, String fragmentColorTextureFile) {
@@ -90,14 +90,14 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
this.pmvMatrix = new PMVMatrix();
}
- fixedFunction = new FixedFuncPipeline(this.gl, mode, this.pmvMatrix, shaderRootClass, shaderSrcRoot,
+ fixedFunction = new FixedFuncPipeline(this.gl, mode, this.pmvMatrix, shaderRootClass, shaderSrcRoot,
shaderBinRoot, vertexColorFile, vertexColorLightFile, fragmentColorFile, fragmentColorTextureFile);
}
public boolean verbose() { return fixedFunction.verbose(); }
public void setVerbose(boolean v) { fixedFunction.setVerbose(v); }
-
+
public void destroy() {
fixedFunction.destroy(gl);
fixedFunction = null;
@@ -111,16 +111,16 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
public PMVMatrix getMatrix() { return pmvMatrix; }
//
- // FixedFuncHookIf - hooks
+ // FixedFuncHookIf - hooks
//
public void glDrawArrays(int mode, int first, int count) {
fixedFunction.glDrawArrays(gl, mode, first, count);
}
public void glDrawElements(int mode, int count, int type, java.nio.Buffer indices) {
- fixedFunction.glDrawElements(gl, mode, count, type, indices);
+ fixedFunction.glDrawElements(gl, mode, count, type, indices);
}
public void glDrawElements(int mode, int count, int type, long indices_buffer_offset) {
- fixedFunction.glDrawElements(gl, mode, count, type, indices_buffer_offset);
+ fixedFunction.glDrawElements(gl, mode, count, type, indices_buffer_offset);
}
public void glActiveTexture(int texture) {
@@ -136,7 +136,8 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
if(fixedFunction.glEnable(cap, false)) {
gl.glDisable(cap);
}
- }
+ }
+ @Override
public void glGetFloatv(int pname, java.nio.FloatBuffer params) {
if(PMVMatrix.isMatrixGetName(pname)) {
pmvMatrix.glGetFloatv(pname, params);
@@ -144,6 +145,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
gl.glGetFloatv(pname, params);
}
+ @Override
public void glGetFloatv(int pname, float[] params, int params_offset) {
if(PMVMatrix.isMatrixGetName(pname)) {
pmvMatrix.glGetFloatv(pname, params, params_offset);
@@ -151,6 +153,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
gl.glGetFloatv(pname, params, params_offset);
}
+ @Override
public void glGetIntegerv(int pname, IntBuffer params) {
if(PMVMatrix.isMatrixGetName(pname)) {
pmvMatrix.glGetIntegerv(pname, params);
@@ -158,6 +161,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
gl.glGetIntegerv(pname, params);
}
+ @Override
public void glGetIntegerv(int pname, int[] params, int params_offset) {
if(PMVMatrix.isMatrixGetName(pname)) {
pmvMatrix.glGetIntegerv(pname, params, params_offset);
@@ -165,7 +169,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
gl.glGetIntegerv(pname, params, params_offset);
}
-
+
public void glTexEnvi(int target, int pname, int value) {
fixedFunction.glTexEnvi(target, pname, value);
}
@@ -179,7 +183,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
fixedFunction.glBindTexture(target, texture);
gl.glBindTexture(target, texture);
}
- public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border,
+ public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border,
int format, int type, Buffer pixels) {
// align internalformat w/ format, an ES2 requirement
switch(internalformat) {
@@ -212,84 +216,103 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
public void glPointParameterfv(int pname, java.nio.FloatBuffer params) {
fixedFunction.glPointParameterfv(pname, params);
}
-
- //
+
+ //
// MatrixIf
//
public int glGetMatrixMode() {
return pmvMatrix.glGetMatrixMode();
}
+ @Override
public void glMatrixMode(int mode) {
pmvMatrix.glMatrixMode(mode);
}
+ @Override
public void glLoadMatrixf(java.nio.FloatBuffer m) {
pmvMatrix.glLoadMatrixf(m);
}
+ @Override
public void glLoadMatrixf(float[] m, int m_offset) {
glLoadMatrixf(GLBuffers.newDirectFloatBuffer(m, m_offset));
}
+ @Override
public void glPopMatrix() {
pmvMatrix.glPopMatrix();
}
+ @Override
public void glPushMatrix() {
pmvMatrix.glPushMatrix();
}
+ @Override
public void glLoadIdentity() {
pmvMatrix.glLoadIdentity();
}
+ @Override
public void glMultMatrixf(java.nio.FloatBuffer m) {
pmvMatrix.glMultMatrixf(m);
}
+ @Override
public void glMultMatrixf(float[] m, int m_offset) {
glMultMatrixf(GLBuffers.newDirectFloatBuffer(m, m_offset));
}
+ @Override
public void glTranslatef(float x, float y, float z) {
pmvMatrix.glTranslatef(x, y, z);
}
+ @Override
public void glRotatef(float angdeg, float x, float y, float z) {
pmvMatrix.glRotatef(angdeg, x, y, z);
}
+ @Override
public void glScalef(float x, float y, float z) {
pmvMatrix.glScalef(x, y, z);
}
public void glOrtho(double left, double right, double bottom, double top, double near_val, double far_val) {
- glOrthof((float) left, (float) right, (float) bottom, (float) top, (float) near_val, (float) far_val);
+ glOrthof((float) left, (float) right, (float) bottom, (float) top, (float) near_val, (float) far_val);
}
+ @Override
public void glOrthof(float left, float right, float bottom, float top, float zNear, float zFar) {
pmvMatrix.glOrthof(left, right, bottom, top, zNear, zFar);
}
public void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) {
- glFrustumf((float) left, (float) right, (float) bottom, (float) top, (float) zNear, (float) zFar);
+ glFrustumf((float) left, (float) right, (float) bottom, (float) top, (float) zNear, (float) zFar);
}
+ @Override
public void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar) {
pmvMatrix.glFrustumf(left, right, bottom, top, zNear, zFar);
}
- //
+ //
// LightingIf
//
+ @Override
public void glColor4f(float red, float green, float blue, float alpha) {
fixedFunction.glColor4f(gl, red, green, blue, alpha);
}
-
+
public void glColor4ub(byte red, byte green, byte blue, byte alpha) {
- glColor4f(ValueConv.byte_to_float(red, false),
- ValueConv.byte_to_float(green, false),
- ValueConv.byte_to_float(blue, false),
+ glColor4f(ValueConv.byte_to_float(red, false),
+ ValueConv.byte_to_float(green, false),
+ ValueConv.byte_to_float(blue, false),
ValueConv.byte_to_float(alpha, false) );
}
+ @Override
public void glLightfv(int light, int pname, java.nio.FloatBuffer params) {
fixedFunction.glLightfv(gl, light, pname, params);
}
+ @Override
public void glLightfv(int light, int pname, float[] params, int params_offset) {
glLightfv(light, pname, GLBuffers.newDirectFloatBuffer(params, params_offset));
}
+ @Override
public void glMaterialfv(int face, int pname, java.nio.FloatBuffer params) {
fixedFunction.glMaterialfv(gl, face, pname, params);
}
+ @Override
public void glMaterialfv(int face, int pname, float[] params, int params_offset) {
glMaterialfv(face, pname, GLBuffers.newDirectFloatBuffer(params, params_offset));
}
+ @Override
public void glMaterialf(int face, int pname, float param) {
glMaterialfv(face, pname, GLBuffers.newDirectFloatBuffer(new float[] { param }));
}
@@ -297,32 +320,36 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
//
// Misc Simple States
//
+ @Override
public void glShadeModel(int mode) {
fixedFunction.glShadeModel(gl, mode);
- }
+ }
public void glAlphaFunc(int func, float ref) {
fixedFunction.glAlphaFunc(func, ref);
}
-
- /** ES2 supports CullFace implicit
+
+ /** ES2 supports CullFace implicit
public void glCullFace(int faceName) {
fixedFunction.glCullFace(faceName);
gl.glCullFace(faceName);
} */
-
+
//
// PointerIf
//
public void glClientActiveTexture(int textureUnit) {
fixedFunction.glClientActiveTexture(textureUnit);
}
+ @Override
public void glEnableClientState(int glArrayIndex) {
fixedFunction.glEnableClientState(gl, glArrayIndex);
}
+ @Override
public void glDisableClientState(int glArrayIndex) {
fixedFunction.glDisableClientState(gl, glArrayIndex);
}
+ @Override
public void glVertexPointer(GLArrayData array) {
if(array.isVBO()) {
if(!gl.glIsVBOArrayBound()) {
@@ -339,19 +366,22 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
fixedFunction.glVertexPointer(gl, array);
}
+ @Override
public void glVertexPointer(int size, int type, int stride, java.nio.Buffer pointer) {
- glVertexPointer(GLArrayDataWrapper.createFixed(GL_VERTEX_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
+ glVertexPointer(GLArrayDataWrapper.createFixed(GL_VERTEX_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
pointer, 0, 0, 0, GL.GL_ARRAY_BUFFER));
}
+ @Override
public void glVertexPointer(int size, int type, int stride, long pointer_buffer_offset) {
int vboName = gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER);
if(vboName==0) {
throw new GLException("no GL_ARRAY_BUFFER VBO bound");
}
- glVertexPointer(GLArrayDataWrapper.createFixed(GL_VERTEX_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
+ glVertexPointer(GLArrayDataWrapper.createFixed(GL_VERTEX_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
null, vboName, pointer_buffer_offset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER));
}
+ @Override
public void glColorPointer(GLArrayData array) {
if(array.isVBO()) {
if(!gl.glIsVBOArrayBound()) {
@@ -367,19 +397,22 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
fixedFunction.glColorPointer(gl, array);
}
+ @Override
public void glColorPointer(int size, int type, int stride, java.nio.Buffer pointer) {
- glColorPointer(GLArrayDataWrapper.createFixed(GL_COLOR_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
+ glColorPointer(GLArrayDataWrapper.createFixed(GL_COLOR_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
pointer, 0, 0, 0, GL.GL_ARRAY_BUFFER));
}
+ @Override
public void glColorPointer(int size, int type, int stride, long pointer_buffer_offset) {
int vboName = gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER);
if(vboName==0) {
throw new GLException("no GL_ARRAY_BUFFER VBO bound");
}
- glColorPointer(GLArrayDataWrapper.createFixed(GL_COLOR_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
+ glColorPointer(GLArrayDataWrapper.createFixed(GL_COLOR_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
null, vboName, pointer_buffer_offset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER));
}
+ @Override
public void glNormalPointer(GLArrayData array) {
if(array.getComponentCount()!=3) {
throw new GLException("Only 3 components per normal allowed");
@@ -398,19 +431,22 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
fixedFunction.glNormalPointer(gl, array);
}
+ @Override
public void glNormalPointer(int type, int stride, java.nio.Buffer pointer) {
- glNormalPointer(GLArrayDataWrapper.createFixed(GL_NORMAL_ARRAY, 3, type, GLBuffers.isGLTypeFixedPoint(type), stride,
+ glNormalPointer(GLArrayDataWrapper.createFixed(GL_NORMAL_ARRAY, 3, type, GLBuffers.isGLTypeFixedPoint(type), stride,
pointer, 0, 0, 0, GL.GL_ARRAY_BUFFER));
}
+ @Override
public void glNormalPointer(int type, int stride, long pointer_buffer_offset) {
int vboName = gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER);
if(vboName==0) {
throw new GLException("no GL_ARRAY_BUFFER VBO bound");
}
- glNormalPointer(GLArrayDataWrapper.createFixed(GL_NORMAL_ARRAY, 3, type, GLBuffers.isGLTypeFixedPoint(type), stride,
+ glNormalPointer(GLArrayDataWrapper.createFixed(GL_NORMAL_ARRAY, 3, type, GLBuffers.isGLTypeFixedPoint(type), stride,
null, vboName, pointer_buffer_offset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER));
}
+ @Override
public void glTexCoordPointer(GLArrayData array) {
if(array.isVBO()) {
if(!gl.glIsVBOArrayBound()) {
@@ -426,21 +462,24 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
fixedFunction.glTexCoordPointer(gl, array);
}
+ @Override
public void glTexCoordPointer(int size, int type, int stride, java.nio.Buffer pointer) {
glTexCoordPointer(
- GLArrayDataWrapper.createFixed(GL_TEXTURE_COORD_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
+ GLArrayDataWrapper.createFixed(GL_TEXTURE_COORD_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
pointer, 0, 0, 0, GL.GL_ARRAY_BUFFER));
}
+ @Override
public void glTexCoordPointer(int size, int type, int stride, long pointer_buffer_offset) {
int vboName = gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER);
if(vboName==0) {
throw new GLException("no GL_ARRAY_BUFFER VBO bound");
}
glTexCoordPointer(
- GLArrayDataWrapper.createFixed(GL_TEXTURE_COORD_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
+ GLArrayDataWrapper.createFixed(GL_TEXTURE_COORD_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
null, vboName, pointer_buffer_offset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER) );
}
+ @Override
public final String toString() {
StringBuilder buf = new StringBuilder();
buf.append(getClass().getName()+" (");
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
index 5349745ea..42269588d 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
@@ -59,25 +59,25 @@ import com.jogamp.opengl.util.glsl.ShaderState;
import com.jogamp.opengl.util.glsl.fixedfunc.ShaderSelectionMode;
/**
- *
+ *
* <p>
- * Note: Certain GL FFP state values (e.g.: alphaTestFunc and cullFace)
- * are mapped to a lower number range so they can be stored in low precision storage,
+ * Note: Certain GL FFP state values (e.g.: alphaTestFunc and cullFace)
+ * are mapped to a lower number range so they can be stored in low precision storage,
* i.e. in a 'lowp int' (GL ES2).
* </p>
*/
public class FixedFuncPipeline {
protected static final boolean DEBUG;
-
+
static {
Debug.initSingleton();
DEBUG = Debug.isPropertyDefined("jogl.debug.FixedFuncPipeline", true);
}
-
+
/** The maximum texture units which could be used, depending on {@link ShaderSelectionMode}. */
public static final int MAX_TEXTURE_UNITS = 8;
public static final int MAX_LIGHTS = 8;
-
+
public FixedFuncPipeline(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix) {
shaderRootClass = FixedFuncPipeline.class;
shaderSrcRoot = shaderSrcRootDef;
@@ -88,8 +88,8 @@ public class FixedFuncPipeline {
fragmentColorTextureFile = fragmentColorTextureFileDef;
init(gl, mode, pmvMatrix);
}
- public FixedFuncPipeline(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix,
- Class<?> shaderRootClass, String shaderSrcRoot,
+ public FixedFuncPipeline(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix,
+ Class<?> shaderRootClass, String shaderSrcRoot,
String shaderBinRoot,
String vertexColorFile, String vertexColorLightFile,
String fragmentColorFile, String fragmentColorTextureFile) {
@@ -100,9 +100,9 @@ public class FixedFuncPipeline {
this.vertexColorLightFile = vertexColorLightFile;
this.fragmentColorFile = fragmentColorFile;
this.fragmentColorTextureFile = fragmentColorTextureFile;
- init(gl, mode, pmvMatrix);
+ init(gl, mode, pmvMatrix);
}
-
+
public ShaderSelectionMode getShaderSelectionMode() { return requestedShaderSelectionMode; }
public void setShaderSelectionMode(ShaderSelectionMode mode) { requestedShaderSelectionMode=mode; }
public ShaderSelectionMode getCurrentShaderSelectionMode() { return currentShaderSelectionMode; }
@@ -153,21 +153,21 @@ public class FixedFuncPipeline {
colorStatic.put(1, green);
colorStatic.put(2, blue);
colorStatic.put(3, alpha);
-
+
shaderState.useProgram(gl, true);
- final GLUniformData ud = shaderState.getUniform(mgl_ColorStatic);
+ final GLUniformData ud = shaderState.getUniform(mgl_ColorStatic);
if(null!=ud) {
// same data object ..
shaderState.uniform(gl, ud);
} else {
throw new GLException("Failed to update: mgl_ColorStatic");
- }
+ }
}
-
+
//
// Arrays / States
//
-
+
public void glEnableClientState(GL2ES2 gl, int glArrayIndex) {
glToggleClientState(gl, glArrayIndex, true);
}
@@ -202,7 +202,7 @@ public class FixedFuncPipeline {
break;
}
}
-
+
public void glVertexPointer(GL2ES2 gl, GLArrayData data) {
shaderState.useProgram(gl, true);
shaderState.vertexAttribPointer(gl, data);
@@ -217,14 +217,14 @@ public class FixedFuncPipeline {
shaderState.useProgram(gl, true);
shaderState.vertexAttribPointer(gl, data);
}
-
+
//
// MULTI-TEXTURE
//
/** Enables/Disables the named texture unit (if changed), returns previous state */
private boolean glEnableTexture(boolean enable, int unit) {
- final boolean isEnabled = 0 != ( textureEnabledBits & ( 1 << activeTextureUnit ) );
+ final boolean isEnabled = 0 != ( textureEnabledBits & ( 1 << activeTextureUnit ) );
if( isEnabled != enable ) {
if(enable) {
textureEnabledBits |= ( 1 << unit );
@@ -237,7 +237,7 @@ public class FixedFuncPipeline {
}
return isEnabled;
}
-
+
public void glClientActiveTexture(int textureUnit) {
textureUnit -= GL.GL_TEXTURE0;
if(0 <= textureUnit && textureUnit<MAX_TEXTURE_UNITS) {
@@ -246,7 +246,7 @@ public class FixedFuncPipeline {
throw new GLException("glClientActiveTexture textureUnit not within GL_TEXTURE0 + [0.."+MAX_TEXTURE_UNITS+"]: "+textureUnit);
}
}
-
+
public void glActiveTexture(int textureUnit) {
textureUnit -= GL.GL_TEXTURE0;
if(0 <= textureUnit && textureUnit<MAX_TEXTURE_UNITS) {
@@ -264,7 +264,7 @@ public class FixedFuncPipeline {
data.setName( GLPointerFuncUtil.getPredefinedArrayIndexName(data.getIndex(), clientActiveTextureUnit) ) ;
shaderState.vertexAttribPointer(gl, data);
}
-
+
public void glBindTexture(int target, int texture) {
if(GL.GL_TEXTURE_2D == target) {
if( texture != boundTextureObject[activeTextureUnit] ) {
@@ -272,15 +272,15 @@ public class FixedFuncPipeline {
textureFormatDirty = true;
}
} else {
- System.err.println("FixedFuncPipeline: Unimplemented glBindTexture for target "+toHexString(target)+". Texture name "+toHexString(texture));
+ System.err.println("FixedFuncPipeline: Unimplemented glBindTexture for target "+toHexString(target)+". Texture name "+toHexString(texture));
}
}
-
+
public void glTexImage2D(int target, /* int level, */ int internalformat, /*, int width, int height, int border, */
int format /*, int type, Buffer pixels */) {
final int ifmt;
if(GL.GL_TEXTURE_2D == target) {
- switch(internalformat) {
+ switch(internalformat) {
case 3:
case GL.GL_RGB:
case GL.GL_RGB565:
@@ -306,16 +306,16 @@ public class FixedFuncPipeline {
// System.err.println("glTexImage2D TEXTURE_2D: internalformat ifmt "+toHexString(internalformat)+" fmt "+toHexString(format)+" -> "+toHexString(ifmt));
}
} else {
- System.err.println("FixedFuncPipeline: Unimplemented glTexImage2D: target "+toHexString(target)+", internalformat "+toHexString(internalformat));
+ System.err.println("FixedFuncPipeline: Unimplemented glTexImage2D: target "+toHexString(target)+", internalformat "+toHexString(internalformat));
}
}
/*
public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border,
- int format, int type, long pixels_buffer_offset) {
+ int format, int type, long pixels_buffer_offset) {
textureFormat.put(activeTextureUnit, internalformat);
textureFormatDirty = true;
}*/
-
+
public void glTexEnvi(int target, int pname, int value) {
if(GL2ES1.GL_TEXTURE_ENV == target && GL2ES1.GL_TEXTURE_ENV_MODE == pname) {
final int mode;
@@ -351,7 +351,7 @@ public class FixedFuncPipeline {
if( value != textureEnvMode.get(activeTextureUnit) ) {
textureEnvMode.put(activeTextureUnit, value);
textureEnvModeDirty = true;
- }
+ }
}
public void glGetTexEnviv(int target, int pname, IntBuffer params) { // FIXME
System.err.println("FixedFuncPipeline: Unimplemented glGetTexEnviv: target "+toHexString(target)+", pname "+toHexString(pname));
@@ -359,13 +359,13 @@ public class FixedFuncPipeline {
public void glGetTexEnviv(int target, int pname, int[] params, int params_offset) { // FIXME
System.err.println("FixedFuncPipeline: Unimplemented glGetTexEnviv: target "+toHexString(target)+", pname "+toHexString(pname));
}
-
+
//
// Point Sprites
//
public void glPointSize(float size) {
pointParams.put(0, size);
- pointParamsDirty = true;
+ pointParamsDirty = true;
}
public void glPointParameterf(int pname, float param) {
switch(pname) {
@@ -379,7 +379,7 @@ public class FixedFuncPipeline {
pointParams.put(4+3, param);
break;
}
- pointParamsDirty = true;
+ pointParamsDirty = true;
}
public void glPointParameterfv(int pname, float[] params, int params_offset) {
switch(pname) {
@@ -389,7 +389,7 @@ public class FixedFuncPipeline {
pointParams.put(4+2, params[params_offset + 2]);
break;
}
- pointParamsDirty = true;
+ pointParamsDirty = true;
}
public void glPointParameterfv(int pname, java.nio.FloatBuffer params) {
final int o = params.position();
@@ -400,24 +400,24 @@ public class FixedFuncPipeline {
pointParams.put(4+2, params.get(o + 2));
break;
}
- pointParamsDirty = true;
+ pointParamsDirty = true;
}
// private int[] pointTexObj = new int[] { 0 };
-
+
private void glDrawPoints(GL2ES2 gl, GLRunnable2<Object,Object> glDrawAction, Object args) {
if(gl.isGL2GL3()) {
gl.glEnable(GL2GL3.GL_VERTEX_PROGRAM_POINT_SIZE);
}
if(gl.isGL2ES1()) {
gl.glEnable(GL2ES1.GL_POINT_SPRITE);
- }
+ }
loadShaderPoints(gl);
shaderState.attachShaderProgram(gl, shaderProgramPoints, true);
validate(gl, false); // sync uniforms
glDrawAction.run(gl, args);
-
+
if(gl.isGL2ES1()) {
gl.glDisable(GL2ES1.GL_POINT_SPRITE);
}
@@ -432,17 +432,17 @@ public class FixedFuncPipeline {
int[] _args = (int[])args;
gl.glDrawArrays(GL.GL_POINTS, _args[0], _args[1]);
return null;
- }
- };
+ }
+ };
private final void glDrawPointArrays(GL2ES2 gl, int first, int count) {
- glDrawPoints(gl, glDrawArraysAction, new int[] { first, count });
+ glDrawPoints(gl, glDrawArraysAction, new int[] { first, count });
}
-
+
//
// Lighting
- //
+ //
- public void glLightfv(GL2ES2 gl, int light, int pname, java.nio.FloatBuffer params) {
+ public void glLightfv(GL2ES2 gl, int light, int pname, java.nio.FloatBuffer params) {
shaderState.useProgram(gl, true);
light -=GLLightingFunc.GL_LIGHT0;
if(0 <= light && light < MAX_LIGHTS) {
@@ -536,14 +536,14 @@ public class FixedFuncPipeline {
ud.setData(params);
shaderState.uniform(gl, ud);
} else if(verbose) {
-
+
}
}
//
// Misc States
//
-
+
public void glShadeModel(GL2ES2 gl, int mode) {
shaderState.useProgram(gl, true);
GLUniformData ud = shaderState.getUniform(mgl_ShadeModel);
@@ -608,7 +608,7 @@ public class FixedFuncPipeline {
_func = 8;
break;
default:
- throw new GLException("glAlphaFunc invalid func: "+toHexString(func));
+ throw new GLException("glAlphaFunc invalid func: "+toHexString(func));
}
if(0 < _func) {
if(0>alphaTestFunc) {
@@ -623,7 +623,7 @@ public class FixedFuncPipeline {
}
/**
- * @return false if digested in regard to GL2ES2 spec,
+ * @return false if digested in regard to GL2ES2 spec,
* eg this call must not be passed to an underlying ES2 implementation.
* true if this call shall be passed to an underlying GL2ES2/ES2 implementation as well.
*/
@@ -631,16 +631,16 @@ public class FixedFuncPipeline {
switch(cap) {
case GL.GL_BLEND:
case GL.GL_DEPTH_TEST:
- case GL.GL_DITHER:
+ case GL.GL_DITHER:
case GL.GL_POLYGON_OFFSET_FILL:
case GL.GL_SAMPLE_ALPHA_TO_COVERAGE:
case GL.GL_SAMPLE_COVERAGE:
case GL.GL_SCISSOR_TEST:
case GL.GL_STENCIL_TEST:
return true;
-
+
case GL.GL_CULL_FACE:
- /** ES2 supports CullFace implicit
+ /** ES2 supports CullFace implicit
final int _cullFace;
if(0>cullFace && enable || 0<cullFace && !enable) {
_cullFace = cullFace * -1;
@@ -652,15 +652,15 @@ public class FixedFuncPipeline {
cullFace=_cullFace;
} */
return true;
-
+
case GL.GL_TEXTURE_2D:
glEnableTexture(enable, activeTextureUnit);
return false;
-
+
case GLLightingFunc.GL_LIGHTING:
lightingEnabled=enable;
return false;
-
+
case GL2ES1.GL_ALPHA_TEST:
final int _alphaTestFunc;
if(0>alphaTestFunc && enable || 0<alphaTestFunc && !enable) {
@@ -673,12 +673,12 @@ public class FixedFuncPipeline {
alphaTestFunc=_alphaTestFunc;
}
return false;
-
+
case GL2ES1.GL_POINT_SMOOTH:
pointParams.put(1, enable ? 1.0f : 0.0f);
pointParamsDirty = true;
return false;
-
+
case GL2ES1.GL_POINT_SPRITE:
// gl_PointCoord always enabled
return false;
@@ -699,7 +699,7 @@ public class FixedFuncPipeline {
//
// Draw
//
-
+
public void glDrawArrays(GL2ES2 gl, int mode, int first, int count) {
switch(mode) {
case GL2.GL_QUAD_STRIP:
@@ -717,34 +717,34 @@ public class FixedFuncPipeline {
for (int j = first; j < count - 3; j += 4) {
gl.glDrawArrays(GL.GL_TRIANGLE_FAN, j, 4);
}
- } else {
+ } else {
gl.glDrawArrays(mode, first, count);
}
}
public void glDrawElements(GL2ES2 gl, int mode, int count, int type, java.nio.Buffer indices) {
- validate(gl, true);
+ validate(gl, true);
if ( GL2.GL_QUADS == mode && !gl.isGL2() ) {
final int idx0 = indices.position();
-
+
if( GL.GL_UNSIGNED_BYTE == type ) {
final ByteBuffer b = (ByteBuffer) indices;
for (int j = 0; j < count; j++) {
gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x000000ff & b.get(idx0+j)), 4);
- }
+ }
} else if( GL.GL_UNSIGNED_SHORT == type ){
final ShortBuffer b = (ShortBuffer) indices;
for (int j = 0; j < count; j++) {
gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x0000ffff & b.get(idx0+j)), 4);
- }
+ }
} else {
final IntBuffer b = (IntBuffer) indices;
for (int j = 0; j < count; j++) {
gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0xffffffff & b.get(idx0+j)), 4);
- }
+ }
}
} else {
// FIXME: Impl. VBO usage .. or unroll (see above)!
- if( !gl.getContext().isCPUDataSourcingAvail() ) {
+ if( !gl.getContext().isCPUDataSourcingAvail() ) {
throw new GLException("CPU data sourcing n/a w/ "+gl.getContext());
}
if( GL2ES1.GL_POINTS != mode ) {
@@ -756,17 +756,17 @@ public class FixedFuncPipeline {
}
}
public void glDrawElements(GL2ES2 gl, int mode, int count, int type, long indices_buffer_offset) {
- validate(gl, true);
+ validate(gl, true);
if ( GL2.GL_QUADS == mode && !gl.isGL2() ) {
throw new GLException("Cannot handle indexed QUADS on !GL2 w/ VBO due to lack of CPU index access");
- } else if( GL2ES1.GL_POINTS != mode ) {
+ } else if( GL2ES1.GL_POINTS != mode ) {
// FIXME GL_POINTS !
gl.glDrawElements(mode, count, type, indices_buffer_offset);
} else {
gl.glDrawElements(mode, count, type, indices_buffer_offset);
}
}
-
+
private final int textureEnabledCount() {
int n=0;
for(int i=MAX_TEXTURE_UNITS-1; i>=0; i--) {
@@ -776,12 +776,12 @@ public class FixedFuncPipeline {
}
return n;
}
-
+
public void validate(GL2ES2 gl, boolean selectShader) {
if( selectShader ) {
if( ShaderSelectionMode.AUTO == requestedShaderSelectionMode) {
final ShaderSelectionMode newMode;
-
+
// pre-validate shader switch
if( 0 != textureEnabledBits ) {
if(lightingEnabled) {
@@ -808,9 +808,9 @@ public class FixedFuncPipeline {
shaderState.useProgram(gl, true);
}
}
-
+
GLUniformData ud;
- if( pmvMatrix.update() ) {
+ if( pmvMatrix.update() ) {
ud = shaderState.getUniform(mgl_PMVMatrix);
if(null!=ud) {
final FloatBuffer m;
@@ -818,7 +818,7 @@ public class FixedFuncPipeline {
ShaderSelectionMode.COLOR_LIGHT_PER_VERTEX== currentShaderSelectionMode ) {
m = pmvMatrix.glGetPMvMvitMatrixf();
} else {
- m = pmvMatrix.glGetPMvMatrixf();
+ m = pmvMatrix.glGetPMvMatrixf();
}
if(m != ud.getBuffer()) {
ud.setData(m);
@@ -829,7 +829,7 @@ public class FixedFuncPipeline {
throw new GLException("Failed to update: mgl_PMVMatrix");
}
}
- if(colorVAEnabledDirty) {
+ if(colorVAEnabledDirty) {
ud = shaderState.getUniform(mgl_ColorEnabled);
if(null!=ud) {
int ca = true == shaderState.isVertexAttribArrayEnabled(GLPointerFuncUtil.mgl_Color) ? 1 : 0 ;
@@ -838,7 +838,7 @@ public class FixedFuncPipeline {
shaderState.uniform(gl, ud);
}
} else {
- throw new GLException("Failed to update: mgl_ColorEnabled");
+ throw new GLException("Failed to update: mgl_ColorEnabled");
}
colorVAEnabledDirty = false;
}
@@ -868,16 +868,16 @@ public class FixedFuncPipeline {
if(pointParamsDirty) {
ud = shaderState.getUniform(mgl_PointParams);
if(null!=ud) {
- // same data object
+ // same data object
shaderState.uniform(gl, ud);
}
pointParamsDirty = false;
}
-
+
if(lightsEnabledDirty) {
ud = shaderState.getUniform(mgl_LightsEnabled);
if(null!=ud) {
- // same data object
+ // same data object
shaderState.uniform(gl, ud);
}
lightsEnabledDirty=false;
@@ -886,41 +886,41 @@ public class FixedFuncPipeline {
if(textureCoordEnabledDirty) {
ud = shaderState.getUniform(mgl_TexCoordEnabled);
if(null!=ud) {
- // same data object
+ // same data object
shaderState.uniform(gl, ud);
}
textureCoordEnabledDirty=false;
- }
+ }
if(textureEnvModeDirty) {
ud = shaderState.getUniform(mgl_TexEnvMode);
if(null!=ud) {
- // same data object
+ // same data object
shaderState.uniform(gl, ud);
}
textureEnvModeDirty = false;
}
-
+
if(textureFormatDirty) {
for(int i = 0; i<MAX_TEXTURE_UNITS; i++) {
textureFormat.put(i, texID2Format.get(boundTextureObject[i]));
}
ud = shaderState.getUniform(mgl_TexFormat);
if(null!=ud) {
- // same data object
+ // same data object
shaderState.uniform(gl, ud);
- }
+ }
textureFormatDirty = false;
- }
+ }
if(textureEnabledDirty) {
ud = shaderState.getUniform(mgl_TextureEnabled);
if(null!=ud) {
- // same data object
+ // same data object
shaderState.uniform(gl, ud);
}
textureEnabledDirty=false;
}
-
+
if(verbose) {
System.err.println("validate: "+toString(null, DEBUG).toString());
}
@@ -944,8 +944,9 @@ public class FixedFuncPipeline {
sb.append("\n\t, ShaderState: ");
shaderState.toString(sb, alsoUnlocated);
sb.append("]");
- return sb;
+ return sb;
}
+ @Override
public String toString() {
return toString(null, DEBUG).toString();
}
@@ -954,19 +955,19 @@ public class FixedFuncPipeline {
private static final String constMaxTextures2 = "#define MAX_TEXTURE_UNITS 2\n";
private static final String constMaxTextures4 = "#define MAX_TEXTURE_UNITS 4\n";
private static final String constMaxTextures8 = "#define MAX_TEXTURE_UNITS 8\n";
-
+
private final void customizeShader(GL2ES2 gl, ShaderCode vp, ShaderCode fp, String maxTextureDefine) {
int rsVpPos = vp.defaultShaderCustomization(gl, true, true);
- int rsFpPos = fp.defaultShaderCustomization(gl, true, true);
+ int rsFpPos = fp.defaultShaderCustomization(gl, true, true);
vp.insertShaderSource(0, rsVpPos, maxTextureDefine);
- fp.insertShaderSource(0, rsFpPos, maxTextureDefine);
+ fp.insertShaderSource(0, rsFpPos, maxTextureDefine);
}
private final void loadShaderPoints(GL2ES2 gl) {
if( null != shaderProgramPoints ) {
return;
}
-
+
final ShaderCode vp = ShaderCode.create( gl, GL2ES2.GL_VERTEX_SHADER, shaderRootClass, shaderSrcRoot,
shaderBinRoot, shaderPointFileDef, true);
final ShaderCode fp = ShaderCode.create( gl, GL2ES2.GL_FRAGMENT_SHADER, shaderRootClass, shaderSrcRoot,
@@ -977,18 +978,18 @@ public class FixedFuncPipeline {
shaderProgramPoints.add(fp);
if(!shaderProgramPoints.link(gl, System.err)) {
throw new GLException("Couldn't link VertexColor program: "+shaderProgramPoints);
- }
+ }
}
-
+
private final void loadShader(GL2ES2 gl, ShaderSelectionMode mode) {
final boolean loadColor = ShaderSelectionMode.COLOR == mode;
final boolean loadColorTexture2 = ShaderSelectionMode.COLOR_TEXTURE2 == mode;
final boolean loadColorTexture4 = ShaderSelectionMode.COLOR_TEXTURE4 == mode;
final boolean loadColorTexture8 = ShaderSelectionMode.COLOR_TEXTURE8 == mode;
- final boolean loadColorTexture = loadColorTexture2 || loadColorTexture4 || loadColorTexture8 ;
+ final boolean loadColorTexture = loadColorTexture2 || loadColorTexture4 || loadColorTexture8 ;
final boolean loadColorLightPerVertex = ShaderSelectionMode.COLOR_LIGHT_PER_VERTEX == mode;
final boolean loadColorTexture8LightPerVertex = ShaderSelectionMode.COLOR_TEXTURE8_LIGHT_PER_VERTEX == mode;
-
+
if( null != shaderProgramColor && loadColor ||
null != shaderProgramColorTexture2 && loadColorTexture2 ||
null != shaderProgramColorTexture4 && loadColorTexture4 ||
@@ -997,7 +998,7 @@ public class FixedFuncPipeline {
null != shaderProgramColorTexture8Light && loadColorTexture8LightPerVertex ) {
return;
}
-
+
if( loadColor ) {
final ShaderCode vp = ShaderCode.create( gl, GL2ES2.GL_VERTEX_SHADER, shaderRootClass, shaderSrcRoot,
shaderBinRoot, vertexColorFile, true);
@@ -1014,7 +1015,7 @@ public class FixedFuncPipeline {
final ShaderCode vp = ShaderCode.create( gl, GL2ES2.GL_VERTEX_SHADER, shaderRootClass, shaderSrcRoot, shaderBinRoot, vertexColorFile, true);
final ShaderCode fp = ShaderCode.create( gl, GL2ES2.GL_FRAGMENT_SHADER, shaderRootClass, shaderSrcRoot,
shaderBinRoot, fragmentColorTextureFile, true);
-
+
if( loadColorTexture2 ) {
customizeShader(gl, vp, fp, constMaxTextures2);
shaderProgramColorTexture2 = new ShaderProgram();
@@ -1066,7 +1067,7 @@ public class FixedFuncPipeline {
}
}
}
-
+
private ShaderProgram selectShaderProgram(GL2ES2 gl, ShaderSelectionMode newMode) {
if(ShaderSelectionMode.AUTO == newMode) {
newMode = ShaderSelectionMode.COLOR;
@@ -1096,13 +1097,13 @@ public class FixedFuncPipeline {
currentShaderSelectionMode = newMode;
return sp;
}
-
- private void init(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix) {
+
+ private void init(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix) {
if(null==pmvMatrix) {
throw new GLException("PMVMatrix is null");
}
this.pmvMatrix=pmvMatrix;
- this.requestedShaderSelectionMode = mode;
+ this.requestedShaderSelectionMode = mode;
this.shaderState=new ShaderState();
this.shaderState.setVerbose(verbose);
@@ -1115,11 +1116,11 @@ public class FixedFuncPipeline {
shaderState.uniform(gl, new GLUniformData(mgl_ColorEnabled, 0));
shaderState.uniform(gl, new GLUniformData(mgl_ColorStatic, 4, colorStatic));
-
- texID2Format.setKeyNotFoundValue(0);
+
+ texID2Format.setKeyNotFoundValue(0);
shaderState.uniform(gl, new GLUniformData(mgl_TexCoordEnabled, 1, textureCoordEnabled));
shaderState.uniform(gl, new GLUniformData(mgl_TexEnvMode, 1, textureEnvMode));
- shaderState.uniform(gl, new GLUniformData(mgl_TexFormat, 1, textureFormat));
+ shaderState.uniform(gl, new GLUniformData(mgl_TexFormat, 1, textureFormat));
shaderState.uniform(gl, new GLUniformData(mgl_TextureEnabled, 1, textureEnabled));
for(int i=0; i<MAX_TEXTURE_UNITS; i++) {
shaderState.uniform(gl, new GLUniformData(mgl_Texture+i, i));
@@ -1128,7 +1129,7 @@ public class FixedFuncPipeline {
/** ES2 supports CullFace implicit
shaderState.uniform(gl, new GLUniformData(mgl_CullFace, cullFace)); */
shaderState.uniform(gl, new GLUniformData(mgl_AlphaTestFunc, alphaTestFunc));
- shaderState.uniform(gl, new GLUniformData(mgl_AlphaTestRef, alphaTestRef));
+ shaderState.uniform(gl, new GLUniformData(mgl_AlphaTestRef, alphaTestRef));
shaderState.uniform(gl, new GLUniformData(mgl_PointParams, 4, pointParams));
for(int i=0; i<MAX_LIGHTS; i++) {
shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].ambient", 4, defAmbient));
@@ -1141,7 +1142,7 @@ public class FixedFuncPipeline {
shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].constantAttenuation", defConstantAtten));
shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].linearAttenuation", defLinearAtten));
shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].quadraticAttenuation", defQuadraticAtten));
- }
+ }
shaderState.uniform(gl, new GLUniformData(mgl_LightModel+".ambient", 4, defLightModelAmbient));
shaderState.uniform(gl, new GLUniformData(mgl_LightsEnabled, 1, lightsEnabled));
shaderState.uniform(gl, new GLUniformData(mgl_FrontMaterial+".ambient", 4, defMatAmbient));
@@ -1159,11 +1160,11 @@ public class FixedFuncPipeline {
private String toHexString(int i) {
return "0x"+Integer.toHexString(i);
}
-
+
protected boolean verbose = DEBUG;
private final FloatBuffer colorStatic = Buffers.copyFloatBuffer(one4f);
-
+
private int activeTextureUnit=0;
private int clientActiveTextureUnit=0;
private final IntIntHashMap texID2Format = new IntIntHashMap();
@@ -1172,9 +1173,9 @@ public class FixedFuncPipeline {
private final IntBuffer textureEnabled = Buffers.newDirectIntBuffer(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }); // per unit
private boolean textureEnabledDirty = false;
private final IntBuffer textureCoordEnabled = Buffers.newDirectIntBuffer(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }); // per unit
- private boolean textureCoordEnabledDirty = false;
+ private boolean textureCoordEnabledDirty = false;
// textureEnvMode: 1 GL_ADD, 2 GL_MODULATE (default), 3 GL_DECAL, 4 GL_BLEND, 5 GL_REPLACE, 6 GL_COMBINE
- private final IntBuffer textureEnvMode = Buffers.newDirectIntBuffer(new int[] { 2, 2, 2, 2, 2, 2, 2, 2 });
+ private final IntBuffer textureEnvMode = Buffers.newDirectIntBuffer(new int[] { 2, 2, 2, 2, 2, 2, 2, 2 });
private boolean textureEnvModeDirty = false;
private final IntBuffer textureFormat = Buffers.newDirectIntBuffer(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }); // per unit
private boolean textureFormatDirty = false;
@@ -1192,11 +1193,11 @@ public class FixedFuncPipeline {
private boolean alphaTestDirty=false;
private int alphaTestFunc=-8; // <=0 disabled; 1 GL_NEVER, 2 GL_LESS, 3 GL_EQUAL, 4 GL_LEQUAL, 5 GL_GREATER, 6 GL_NOTEQUAL, 7 GL_GEQUAL, and 8 GL_ALWAYS (default)
private float alphaTestRef=0f;
-
+
private boolean pointParamsDirty = false;
/** ( pointSize, pointSmooth, attn. pointMinSize, attn. pointMaxSize ) , ( attenuation coefficients 1f 0f 0f, attenuation fade theshold 1f ) */
- private final FloatBuffer pointParams = Buffers.newDirectFloatBuffer(new float[] { 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f });
-
+ private final FloatBuffer pointParams = Buffers.newDirectFloatBuffer(new float[] { 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f });
+
private PMVMatrix pmvMatrix;
private ShaderState shaderState;
private ShaderProgram shaderProgramColor;
@@ -1204,7 +1205,7 @@ public class FixedFuncPipeline {
private ShaderProgram shaderProgramColorLight;
private ShaderProgram shaderProgramColorTexture8Light;
private ShaderProgram shaderProgramPoints;
-
+
private ShaderSelectionMode requestedShaderSelectionMode = ShaderSelectionMode.AUTO;
private ShaderSelectionMode currentShaderSelectionMode = requestedShaderSelectionMode;
@@ -1219,7 +1220,7 @@ public class FixedFuncPipeline {
private static final String mgl_LightsEnabled = "mgl_LightsEnabled"; // int mgl_LightsEnabled[MAX_LIGHTS];
private static final String mgl_AlphaTestFunc = "mgl_AlphaTestFunc"; // 1i (lowp int)
- private static final String mgl_AlphaTestRef = "mgl_AlphaTestRef"; // 1f
+ private static final String mgl_AlphaTestRef = "mgl_AlphaTestRef"; // 1f
private static final String mgl_ShadeModel = "mgl_ShadeModel"; // 1i
private static final String mgl_PointParams = "mgl_PointParams"; // vec4[2]: { (sz, smooth, attnMinSz, attnMaxSz), (attnCoeff(3), attnFadeTs) }
@@ -1231,7 +1232,7 @@ public class FixedFuncPipeline {
// private static final FloatBuffer zero4f = Buffers.newDirectFloatBuffer(new float[] { 0.0f, 0.0f, 0.0f, 0.0f });
private static final FloatBuffer neut4f = Buffers.newDirectFloatBuffer(new float[] { 0.0f, 0.0f, 0.0f, 1.0f });
- private static final FloatBuffer one4f = Buffers.newDirectFloatBuffer(new float[] { 1.0f, 1.0f, 1.0f, 1.0f });
+ private static final FloatBuffer one4f = Buffers.newDirectFloatBuffer(new float[] { 1.0f, 1.0f, 1.0f, 1.0f });
public static final FloatBuffer defAmbient = neut4f;
public static final FloatBuffer defDiffuseN = neut4f;
@@ -1245,7 +1246,7 @@ public class FixedFuncPipeline {
public static final float defQuadraticAtten = 0f;
public static final FloatBuffer defLightModelAmbient = Buffers.newDirectFloatBuffer(new float[] { 0.2f, 0.2f, 0.2f, 1.0f });
-
+
public static final FloatBuffer defMatAmbient = Buffers.newDirectFloatBuffer(new float[] { 0.2f, 0.2f, 0.2f, 1.0f });
public static final FloatBuffer defMatDiffuse = Buffers.newDirectFloatBuffer(new float[] { 0.8f, 0.8f, 0.8f, 1.0f });
public static final FloatBuffer defMatSpecular = neut4f;
@@ -1259,13 +1260,13 @@ public class FixedFuncPipeline {
private static final String shaderPointFileDef = "FixedFuncPoints";
private static final String shaderSrcRootDef = "shaders" ;
private static final String shaderBinRootDef = "shaders/bin" ;
-
+
private final Class<?> shaderRootClass;
- private final String shaderSrcRoot;
+ private final String shaderSrcRoot;
private final String shaderBinRoot;
private final String vertexColorFile;
private final String vertexColorLightFile;
private final String fragmentColorFile;
- private final String fragmentColorTextureFile;
+ private final String fragmentColorTextureFile;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java b/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java
index 833771dd1..d5b01ef54 100644
--- a/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java
+++ b/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java
@@ -1,16 +1,16 @@
/**
* Original JavaScript code from <https://github.com/notmasteryet/jpgjs/blob/master/jpg.js>,
* ported to Java for JogAmp Community.
- *
+ *
* Enhancements:
* * InputStream instead of memory buffer
* * User provided memory handler
- * * Fixed JPEG Component ID/Index mapping
+ * * Fixed JPEG Component ID/Index mapping
* * Color space conversion (YCCK, CMYK -> RGB)
* * More error tolerant
- *
+ *
* *****************
- *
+ *
* Copyright 2011 notmasteryet
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,21 +24,21 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* *****************
- *
+ *
* 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
@@ -48,7 +48,7 @@
* 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.
@@ -70,7 +70,7 @@ import com.jogamp.opengl.util.texture.TextureData;
import com.jogamp.opengl.util.texture.TextureData.ColorSpace;
/**
- *
+ *
* <ul>
* <li> The JPEG specification can be found in the ITU CCITT Recommendation T.81
* (www.w3.org/Graphics/JPEG/itu-t81.pdf) </li>
@@ -89,22 +89,22 @@ public class JPEGDecoder {
private static final boolean DEBUG = Debug.debug("JPEGImage");
private static final boolean DEBUG_IN = false;
- /** Allows user to hook a {@link ColorSink} to another toolkit to produce {@link TextureData}. */
+ /** Allows user to hook a {@link ColorSink} to another toolkit to produce {@link TextureData}. */
public static interface ColorSink {
/**
* @param width
* @param height
* @param sourceCS the color-space of the decoded JPEG
* @param sourceComponents number of components used for the given source color-space
- * @return Either {@link TextureData.ColorSpace#RGB} or {@link TextureData.ColorSpace#YCbCr}. {@link TextureData.ColorSpace#YCCK} and {@link TextureData.ColorSpace#CMYK} will throw an exception!
+ * @return Either {@link TextureData.ColorSpace#RGB} or {@link TextureData.ColorSpace#YCbCr}. {@link TextureData.ColorSpace#YCCK} and {@link TextureData.ColorSpace#CMYK} will throw an exception!
* @throws RuntimeException
*/
public TextureData.ColorSpace allocate(int width, int height, TextureData.ColorSpace sourceCS, int sourceComponents) throws RuntimeException;
public void store2(int x, int y, byte c1, byte c2);
public void storeRGB(int x, int y, byte r, byte g, byte b);
- public void storeYCbCr(int x, int y, byte Y, byte Cb, byte Cr);
+ public void storeYCbCr(int x, int y, byte Y, byte Cb, byte Cr);
}
-
+
public static class JFIF {
final VersionNumber version;
final int densityUnits;
@@ -138,11 +138,12 @@ public class JPEGDecoder {
} else {
return null;
}
- }
+ }
+ @Override
public final String toString() {
return "JFIF[ver "+version+", density[units "+densityUnits+", "+xDensity+"x"+yDensity+"], thumb "+thumbWidth+"x"+thumbHeight+"]";
- }
+ }
}
public static class Adobe {
@@ -151,7 +152,7 @@ public class JPEGDecoder {
final short flags1;
final short colorCode;
final ColorSpace colorSpace;
-
+
private Adobe(final byte[] data) {
version = data[6];
flags0 = (short) ( (data[7] << 8) | data[8] ) ;
@@ -172,9 +173,10 @@ public class JPEGDecoder {
return null;
}
}
+ @Override
public final String toString() {
return "Adobe[ver "+version+", flags["+toHexString(flags0)+", "+toHexString(flags1)+"], colorSpace/Code "+colorSpace+"/"+toHexString(colorCode)+"]";
- }
+ }
}
/** TODO */
public static class EXIF {
@@ -189,10 +191,11 @@ public class JPEGDecoder {
} else {
return null;
}
- }
+ }
+ @Override
public final String toString() {
return "EXIF[]";
- }
+ }
}
@SuppressWarnings("serial")
@@ -210,7 +213,7 @@ public class JPEGDecoder {
}
public int getMarker() { return marker; }
}
-
+
/** Start of Image */
private static final int M_SOI = 0xFFD8;
/** End of Image */
@@ -264,8 +267,8 @@ public class JPEGDecoder {
private static final int M_APP15 = 0xFFEF;
/** Annotation / Comment */
- private static final int M_ANO = 0xFFFE;
-
+ private static final int M_ANO = 0xFFFE;
+
static final int[] dctZigZag = new int[] {
0,
1, 8,
@@ -323,7 +326,7 @@ public class JPEGDecoder {
private final void checkBounds(int idx) {
if( 0 > idx || idx >= compCount ) {
throw new CodecException("Idx out of bounds "+idx+", "+this);
- }
+ }
}
public final void validateComponents() {
for(int i=0; i<compCount; i++) {
@@ -362,6 +365,7 @@ public class JPEGDecoder {
public final boolean hasCompID(int componentID) {
return compIDs.contains(componentID);
}
+ @Override
public final String toString() {
return "Frame[progressive "+progressive+", precision "+precision+", scanLines "+scanLines+", samplesPerLine "+samplesPerLine+
", components[count "+compCount+", maxID "+maxCompID+", componentIDs "+compIDs+", comps "+Arrays.asList(comps)+"]]";
@@ -378,7 +382,7 @@ public class JPEGDecoder {
int blocksPerLine;
int blocksPerLineForMcu;
/** [blocksPerColumnForMcu][blocksPerLineForMcu][64]; */
- int[][][] blocks;
+ int[][][] blocks;
int pred;
BinObj huffmanTableAC;
BinObj huffmanTableDC;
@@ -400,9 +404,10 @@ public class JPEGDecoder {
if( row >= blocksPerColumnForMcu || col >= blocksPerLineForMcu ) {
throw new CodecException("Out of bounds given ["+row+"]["+col+"] - "+this);
}
- return blocks[row][col];
+ return blocks[row][col];
}
-
+
+ @Override
public final String toString() {
return "CompIn[h "+h+", v "+v+", qttIdx "+qttIdx+", blocks["+blocksPerColumn+", mcu "+blocksPerColumnForMcu+"]["+blocksPerLine+", mcu "+blocksPerLineForMcu+"][64]]";
}
@@ -410,7 +415,7 @@ public class JPEGDecoder {
/** The decoded components */
class ComponentOut {
- private final ArrayList<byte[]> lines;
+ private final ArrayList<byte[]> lines;
final float scaleX;
final float scaleY;
@@ -419,18 +424,20 @@ public class JPEGDecoder {
this.scaleX = scaleX;
this.scaleY = scaleY;
}
-
+
/** Safely returning a line, if index exceeds number of lines, last line is returned. */
public final byte[] getLine(int i) {
final int sz = lines.size();
return lines.get( i < sz ? i : sz - 1);
}
-
+
+ @Override
public final String toString() {
return "CompOut[lines "+lines.size()+", scale "+scaleX+"x"+scaleY+"]";
}
}
+ @Override
public String toString() {
final String jfifS = null != jfif ? jfif.toString() : "JFIF nil";
final String exifS = null != exif ? exif.toString() : "Exif nil";
@@ -442,7 +449,7 @@ public class JPEGDecoder {
private BufferedInputStream istream;
private int _ipos = 0;
private int _iposSave = 0;
-
+
private int width = 0;
private int height = 0;
private JFIF jfif = null;
@@ -457,14 +464,14 @@ public class JPEGDecoder {
public final int getHeight() { return height; }
private final void resetInput(InputStream is) {
- if( is instanceof BufferedInputStream ) {
+ if( is instanceof BufferedInputStream ) {
istream = (BufferedInputStream) is;
} else {
istream = new BufferedInputStream(is);
}
_ipos = 0;
}
-
+
private final void markStream(int readLimit) {
istream.mark(readLimit);
_iposSave = _ipos;
@@ -480,7 +487,7 @@ public class JPEGDecoder {
if( -1 < r ) {
if(DEBUG_IN) { System.err.println("u8["+_ipos+"]: "+toHexString(r)); }
_ipos++;
- } else if(DEBUG_IN) {
+ } else if(DEBUG_IN) {
System.err.println("u8["+_ipos+"]: EOS");
}
return r;
@@ -519,7 +526,7 @@ public class JPEGDecoder {
}
if(DEBUG_IN) { System.err.println("JPEG.readDataBlock: net-len "+(len-2)+", "+this); dumpData(data, 0, len-2); }
return data;
- }
+ }
static final void dumpData(byte[] data, int offset, int len) {
for(int i=0; i<len; ) {
System.err.print(i%8+": ");
@@ -527,8 +534,8 @@ public class JPEGDecoder {
System.err.println(toHexString(0x000000FF & data[offset+i])+", ");
}
System.err.println("");
- }
- }
+ }
+ }
public synchronized void clear(InputStream inputStream) {
resetInput(inputStream);
@@ -536,17 +543,17 @@ public class JPEGDecoder {
height = 0;
jfif = null;
exif = null;
- adobe = null;
- components = null;
+ adobe = null;
+ components = null;
}
- public synchronized JPEGDecoder parse(final InputStream inputStream) throws IOException {
+ public synchronized JPEGDecoder parse(final InputStream inputStream) throws IOException {
clear(inputStream);
-
+
final int[][] quantizationTables = new int[0x0F][]; // 4 bits
final BinObj[] huffmanTablesAC = new BinObj[0x0F]; // Huffman table spec - 4 bits
final BinObj[] huffmanTablesDC = new BinObj[0x0F]; // Huffman table spec - 4 bits
// final ArrayList<Frame> frames = new ArrayList<Frame>(); // JAU: max 1-frame
-
+
Frame frame = null;
int resetInterval = 0;
int fileMarker = readUint16();
@@ -614,7 +621,7 @@ public class JPEGDecoder {
quantizationTables[tableIdx] = tableData;
if( DEBUG ) {
System.err.println("JPEG.parse.QTT["+tableIdx+"]: spec "+quantizationTableSpec+", precision "+precisionID+", data "+count+"/"+quantizationTablesLength);
- }
+ }
}
if(count!=quantizationTablesLength){
throw new CodecException("ERROR: QTT format error [count!=Length]: "+count+"/"+quantizationTablesLength);
@@ -660,7 +667,7 @@ public class JPEGDecoder {
}
break;
- case M_DHT: {
+ case M_DHT: {
int count = 0;
final int huffmanLength = readUint16(); count+=2;
int i=count, codeLengthTotal = 0;
@@ -675,7 +682,7 @@ public class JPEGDecoder {
for (int j = 0; j < codeLengthSum; j++) {
huffmanValues[j] = (byte)readUint8(); count++;
}
- codeLengthTotal += codeLengthSum;
+ codeLengthTotal += codeLengthSum;
i += 17 + codeLengthSum;
final BinObj[] table = ( huffmanTableSpec >> 4 ) == 0 ? huffmanTablesDC : huffmanTablesAC;
table[huffmanTableSpec & 0x0F] = buildHuffmanTable(codeLengths, huffmanValues);
@@ -699,7 +706,7 @@ public class JPEGDecoder {
final int sosLen = readUint16(); count+=2;
final int selectorsCount = readUint8(); count++;
ArrayList<ComponentIn> components = new ArrayList<ComponentIn>();
- if(DEBUG) { System.err.println("JPG.parse.SOS: selectorCount [0.."+(selectorsCount-1)+"]: "+frame); }
+ if(DEBUG) { System.err.println("JPG.parse.SOS: selectorCount [0.."+(selectorsCount-1)+"]: "+frame); }
for (int i = 0; i < selectorsCount; i++) {
final int compID = readUint8(); count++;
final ComponentIn component = frame.getCompByID(compID);
@@ -751,8 +758,8 @@ public class JPEGDecoder {
final ComponentIn component = frame.getCompByIndex(i);
// System.err.println("JPG.parse.buildComponentData["+i+"]: "+component); // JAU
// System.err.println("JPG.parse.buildComponentData["+i+"]: "+frame); // JAU
- this.components[i] = new ComponentOut( output.buildComponentData(frame, component),
- (float)component.h / (float)frame.maxH,
+ this.components[i] = new ComponentOut( output.buildComponentData(frame, component),
+ (float)component.h / (float)frame.maxH,
(float)component.v / (float)frame.maxV );
}
if(DEBUG) { System.err.println("JPG.parse.X: End of processing input "+this); }
@@ -797,7 +804,7 @@ public class JPEGDecoder {
final boolean isValue;
final BinObj[] tree;
final byte b;
-
+
BinObj(byte b) {
this.isValue= true;
this.b = b;
@@ -815,13 +822,13 @@ public class JPEGDecoder {
}
private BinObj buildHuffmanTable(int[] codeLengths, byte[] values) {
- int k = 0;
- int length = 16;
+ int k = 0;
+ int length = 16;
final ArrayList<BinObjIdxed> code = new ArrayList<BinObjIdxed>();
while (length > 0 && 0==codeLengths[length - 1]) {
length--;
}
- code.add(new BinObjIdxed());
+ code.add(new BinObjIdxed());
BinObjIdxed p = code.get(0), q;
for (int i = 0; i < length; i++) {
for (int j = 0; j < codeLengths[i]; j++) {
@@ -959,7 +966,7 @@ public class JPEGDecoder {
t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12;
v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12;
v6 = t;
-
+
// stage 1
p[0 + row] = v0 + v7;
p[7 + row] = v0 - v7;
@@ -1066,7 +1073,7 @@ public class JPEGDecoder {
private int successiveACState, successiveACNextValue;
private int decodeScan(Frame frame, ArrayList<ComponentIn> components, int resetInterval,
- int spectralStart, int spectralEnd, int successivePrev, int successive) throws IOException {
+ int spectralStart, int spectralEnd, int successivePrev, int successive) throws IOException {
// this.precision = frame.precision;
// this.samplesPerLine = frame.samplesPerLine;
// this.scanLines = frame.scanLines;
@@ -1079,7 +1086,7 @@ public class JPEGDecoder {
this.spectralStart = spectralStart;
this.spectralEnd = spectralEnd;
this.successive = successive;
-
+
final int componentsLength = components.size();
final DecoderFunction decodeFn;
@@ -1096,7 +1103,7 @@ public class JPEGDecoder {
int mcu = 0;
int mcuExpected;
if (componentsLength == 1) {
- final ComponentIn c = components.get(0);
+ final ComponentIn c = components.get(0);
mcuExpected = c.blocksPerLine * c.blocksPerColumn;
} else {
mcuExpected = mcusPerLine * frame.mcusPerColumn;
@@ -1153,14 +1160,14 @@ public class JPEGDecoder {
if( marker < 0xFF00 ) {
rewindStream();
throw new CodecException("marker not found @ mcu "+mcu+"/"+mcuExpected+", u16: "+toHexString(marker));
- }
+ }
final boolean isRSTx = 0xFFD0 <= marker && marker <= 0xFFD7; // !RSTx
if(DEBUG) {
System.err.println("JPEG.decodeScan: MCUs "+mcu+"/"+mcuExpected+", u16 "+toHexString(marker)+", RSTx "+isRSTx+", "+frame);
}
if ( !isRSTx ) {
break; // handle !RSTx marker in caller
- }
+ }
}
return marker;
}
@@ -1227,6 +1234,7 @@ public class JPEGDecoder {
final DecoderFunction decodeACSuccessive = new ACSuccessiveDecoder();
class BaselineDecoder implements DecoderFunction {
+ @Override
public void decode(ComponentIn component, int[] zz) throws IOException {
final int t = decodeHuffman(component.huffmanTableDC);
final int diff = ( t == 0 ) ? 0 : receiveAndExtend(t);
@@ -1250,6 +1258,7 @@ public class JPEGDecoder {
}
}
class DCFirstDecoder implements DecoderFunction {
+ @Override
public void decode(ComponentIn component, int[] zz) throws IOException {
final int t = decodeHuffman(component.huffmanTableDC);
final int diff = ( t == 0 ) ? 0 : (receiveAndExtend(t) << successive);
@@ -1257,12 +1266,14 @@ public class JPEGDecoder {
}
}
class DCSuccessiveDecoder implements DecoderFunction {
+ @Override
public void decode(ComponentIn component, int[] zz) throws IOException {
zz[0] |= readBit() << successive;
}
}
class ACFirstDecoder implements DecoderFunction {
+ @Override
public void decode(ComponentIn component, int[] zz) throws IOException {
if (eobrun > 0) {
eobrun--;
@@ -1288,6 +1299,7 @@ public class JPEGDecoder {
}
}
class ACSuccessiveDecoder implements DecoderFunction {
+ @Override
public void decode(ComponentIn component, int[] zz) throws IOException {
int k = spectralStart, e = spectralEnd, r = 0;
while (k <= e) {
@@ -1306,7 +1318,7 @@ public class JPEGDecoder {
successiveACState = 1;
}
} else {
- // if (s !== 1) {
+ // if (s !== 1) {
if (s != 1) {
throw new CodecException("invalid ACn encoding");
}
@@ -1380,18 +1392,18 @@ public class JPEGDecoder {
int R = Y + ( ( 91881 * Cr ) >> 16 );
if(R<0) R=0;
else if(R>255) R=255;
-
+
pixelStorage.storeRGB(x, y, (byte)R, (byte)G, (byte)B);
} */
-
+
public synchronized void getPixel(JPEGDecoder.ColorSink pixelStorage, int width, int height) {
final int scaleX = this.width / width, scaleY = this.height / height;
final int componentCount = this.components.length;
- final ColorSpace sourceCS = ( null != adobe ) ? adobe.colorSpace : ColorSpace.YCbCr;
+ final ColorSpace sourceCS = ( null != adobe ) ? adobe.colorSpace : ColorSpace.YCbCr;
final ColorSpace storageCS = pixelStorage.allocate(width, height, sourceCS, componentCount);
if( ColorSpace.RGB != storageCS && ColorSpace.YCbCr != storageCS ) {
- throw new IllegalArgumentException("Unsupported storage color space: "+storageCS);
+ throw new IllegalArgumentException("Unsupported storage color space: "+storageCS);
}
switch (componentCount) {
@@ -1504,7 +1516,7 @@ public class JPEGDecoder {
final byte G = clampTo8bit( ( cM * cK ) / 255f );
final byte B = clampTo8bit( ( cY * cK ) / 255f );
pixelStorage.storeRGB(x, y, R, G, B);
- }
+ }
} else { // ColorModel.YCCK == sourceCM
for (int x = 0; x < width; x++) {
final int xs = x * scaleX;
@@ -1525,7 +1537,7 @@ public class JPEGDecoder {
}
}
}
- }
+ }
break;
default:
throw new CodecException("Unsupported color model: Space "+sourceCS+", components "+componentCount);
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java b/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java
index 0fffc85b1..5e177b8c3 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java
@@ -4,7 +4,7 @@ import java.util.HashMap;
/**
* Internal PNG predictor filter, or strategy to select it.
- *
+ *
*/
public enum FilterType {
/**
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java
index e62134cd5..ac7b858e1 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java
@@ -98,7 +98,7 @@ public class ImageInfo {
/**
* Full constructor
- *
+ *
* @param cols
* Width in pixels
* @param rows
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java
index e34e6a226..e6afd8694 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java
@@ -25,7 +25,7 @@ public class ImageLine {
* Except for 'packed' formats (gray/indexed with 1-2-4 bitdepth) each
* <code>int</code> is a "sample" (one for channel), (0-255 or 0-65535) in
* the corresponding PNG sequence: <code>R G B R G B...</code> or
- * <code>R G B A R G B A...</tt>
+ * <code>R G B A R G B A...</tt>
* or <code>g g g ...</code> or <code>i i i</code> (palette index)
* <p>
* For bitdepth=1/2/4 , and if samplesUnpacked=false, each value is a PACKED
@@ -60,7 +60,7 @@ public class ImageLine {
/**
* true: each element of the scanline array represents a sample always, even
* for internally packed PNG formats
- *
+ *
* false: if the original image was of packed type (bit depth less than 8)
* we keep samples packed in a single array element
*/
@@ -74,7 +74,7 @@ public class ImageLine {
}
/**
- *
+ *
* @param imgInfo
* Inmutable ImageInfo, basic parameter of the image we are
* reading or writing
@@ -84,7 +84,7 @@ public class ImageLine {
* @param unpackedMode
* If true, we use unpacked format, even for packed original
* images
- *
+ *
*/
public ImageLine(ImageInfo imgInfo, SampleType stype, boolean unpackedMode) {
this(imgInfo, stype, unpackedMode, null, null);
@@ -124,13 +124,13 @@ public class ImageLine {
/*
* Unpacks scanline (for bitdepth 1-2-4)
- *
+ *
* Arrays must be prealocated. src : samplesPerRowPacked dst : samplesPerRow
- *
+ *
* This usually works in place (with src==dst and length=samplesPerRow)!
- *
+ *
* If not, you should only call this only when necesary (bitdepth <8)
- *
+ *
* If <code>scale==true<code>, it scales the value (just a bit shift) towards 0-255.
*/
static void unpackInplaceInt(final ImageInfo iminfo, final int[] src, final int[] dst, final boolean scale) {
@@ -165,15 +165,15 @@ public class ImageLine {
/*
* Unpacks scanline (for bitdepth 1-2-4)
- *
+ *
* Arrays must be prealocated. src : samplesPerRow dst : samplesPerRowPacked
- *
+ *
* This usually works in place (with src==dst and length=samplesPerRow)! If not, you should only call this only when
* necesary (bitdepth <8)
- *
+ *
* The trailing elements are trash
- *
- *
+ *
+ *
* If <code>scale==true<code>, it scales the value (just a bit shift) towards 0-255.
*/
static void packInplaceInt(final ImageInfo iminfo, final int[] src, final int[] dst, final boolean scaled) {
@@ -270,7 +270,7 @@ public class ImageLine {
/**
* Creates a new ImageLine similar to this, but unpacked
- *
+ *
* The caller must be sure that the original was really packed
*/
public ImageLine unpackToNewImageLine() {
@@ -284,7 +284,7 @@ public class ImageLine {
/**
* Creates a new ImageLine similar to this, but packed
- *
+ *
* The caller must be sure that the original was really unpacked
*/
public ImageLine packToNewImageLine() {
@@ -315,6 +315,7 @@ public class ImageLine {
/**
* Basic info
*/
+ @Override
public String toString() {
return "row=" + rown + " cols=" + imgInfo.cols + " bpc=" + imgInfo.bitDepth + " size=" + scanline.length;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java
index 91516a704..4636c3955 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java
@@ -23,7 +23,7 @@ public class ImageLineHelper {
/**
* Given an indexed line with a palette, unpacks as a RGB array, or RGBA if
* a non nul PngChunkTRNS chunk is passed
- *
+ *
* @param line
* ImageLine as returned from PngReader
* @param pal
@@ -92,6 +92,7 @@ public class ImageLineHelper {
public double[] maxdif = { BIG_VALUE_NEG, BIG_VALUE_NEG, BIG_VALUE_NEG, BIG_VALUE }; // maxima
public final int channels; // diferencia
+ @Override
public String toString() {
return channels == 3 ? String.format(
"prom=%.1f (%.1f %.1f %.1f) max=%.1f (%.1f %.1f %.1f) min=%.1f (%.1f %.1f %.1f)", promlum, prom[0],
@@ -143,7 +144,7 @@ public class ImageLineHelper {
/**
* integer packed R G B only for bitdepth=8! (does not check!)
- *
+ *
**/
public static int getPixelRGB8(ImageLine line, int column) {
int offset = column * line.channels;
@@ -252,7 +253,7 @@ public class ImageLineHelper {
* <code>scale==true<code>, it scales the value (just a bit shift) towards 0-255.
* <p>
* You probably should use {@link ImageLine#unpackToNewImageLine()}
- *
+ *
*/
public static int[] unpack(ImageInfo imgInfo, int[] src, int[] dst, boolean scale) {
int len1 = imgInfo.samplesPerRow;
@@ -282,7 +283,7 @@ public class ImageLineHelper {
* Packs scanline (for bitdepth 1-2-4) from array into the scanline
* <p>
* If <code>scale==true<code>, it scales the value (just a bit shift).
- *
+ *
* You probably should use {@link ImageLine#packToNewImageLine()}
*/
public static int[] pack(ImageInfo imgInfo, int[] src, int[] dst, boolean scale) {
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java
index feb50e7b6..fb2cf5910 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java
@@ -5,7 +5,7 @@ import jogamp.opengl.util.pngj.ImageLine.SampleType;
/**
* Wraps in a matrix a set of image rows, not necessarily contiguous - but
* equispaced.
- *
+ *
* The fields mirrors those of {@link ImageLine}, and you can access each row as
* a ImageLine backed by the matrix row, see
* {@link #getImageLineAtMatrixRow(int)}
@@ -28,7 +28,7 @@ public class ImageLines {
* Allocates a matrix to store {@code nRows} image rows. See
* {@link ImageLine} and {@link PngReader#readRowsInt()}
* {@link PngReader#readRowsByte()}
- *
+ *
* @param imgInfo
* @param stype
* @param unpackedMode
@@ -77,7 +77,7 @@ public class ImageLines {
/**
* Converts from matrix row number (0 : nRows-1) to image row number
- *
+ *
* @param mrow
* Matrix row number
* @return Image row number. Invalid only if mrow is invalid
@@ -88,7 +88,7 @@ public class ImageLines {
/**
* Returns a ImageLine is backed by the matrix, no allocation done
- *
+ *
* @param mrow
* Matrix row, from 0 to nRows This is not necessarily the image
* row, see {@link #imageRowToMatrixRow(int)} and
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java
index a950c6b33..9e64c3eb1 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java
@@ -49,7 +49,7 @@ public class PngHelperInternal {
/**
* -1 if eof
- *
+ *
* PNG uses "network byte order"
*/
public static int readInt2(InputStream is) {
@@ -186,6 +186,7 @@ public class PngHelperInternal {
}
private static final ThreadLocal<CRC32> crcProvider = new ThreadLocal<CRC32>() {
+ @Override
protected CRC32 initialValue() {
return new CRC32();
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java
index e42dd8733..0412beb8c 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java
@@ -92,13 +92,13 @@ public class PngReader {
* Constructs a PngReader from an InputStream.
* <p>
* See also <code>FileHelper.createPngReader(File f)</code> if available.
- *
+ *
* Reads only the signature and first chunk (IDHR)
- *
+ *
* @param filenameOrDescription
* : Optional, can be a filename or a description. Just for
* error/debug messages
- *
+ *
*/
public PngReader(InputStream inputStream, String filenameOrDescription) {
this.filename = filenameOrDescription == null ? "" : filenameOrDescription;
@@ -411,7 +411,7 @@ public class PngReader {
/**
* Determines which ancillary chunks (metada) are to be loaded
- *
+ *
* @param chunkLoadBehaviour
* {@link ChunkLoadBehaviour}
*/
@@ -427,7 +427,7 @@ public class PngReader {
* replaced by a single dummy-marker IDAT chunk. These might be copied to
* the PngWriter
* <p>
- *
+ *
* @see #getMetadata()
*/
public ChunksList getChunksList() {
@@ -442,7 +442,7 @@ public class PngReader {
/**
* High level wrapper over chunksList
- *
+ *
* @see #getChunksList()
*/
public PngMetadata getMetadata() {
@@ -456,7 +456,7 @@ public class PngReader {
* appropiate readRowInt/readRowByte
* <p>
* In general, specifying the concrete readRowInt/readRowByte is preferrable
- *
+ *
* @see #readRowInt(int) {@link #readRowByte(int)}
*/
public ImageLine readRow(int nrow) {
@@ -468,9 +468,9 @@ public class PngReader {
/**
* Reads the row as INT, storing it in the {@link #imgLine} property and
* returning it.
- *
+ *
* The row must be greater or equal than the last read row.
- *
+ *
* @param nrow
* Row number, from 0 to rows-1. Increasing order.
* @return ImageLine object, also available as field. Data is in
@@ -490,10 +490,10 @@ public class PngReader {
/**
* Reads the row as BYTES, storing it in the {@link #imgLine} property and
* returning it.
- *
+ *
* The row must be greater or equal than the last read row. This method
* allows to pass the same row that was last read.
- *
+ *
* @param nrow
* Row number, from 0 to rows-1. Increasing order.
* @return ImageLine object, also available as field. Data is in
@@ -524,13 +524,13 @@ public class PngReader {
* <p>
* If the bitdepth is less than 8, the bytes are packed - unless
* {@link #unpackedMode} is true.
- *
+ *
* @param buffer
* Prealocated buffer, or null.
* @param nrow
* Row number (0 is top). Most be strictly greater than the last
* read row.
- *
+ *
* @return The scanline in the same passwd buffer if it was allocated, a
* newly allocated one otherwise
*/
@@ -562,13 +562,13 @@ public class PngReader {
* {@link #unpackedMode} is true. <br>
* If the bitdepth is 16, the least significant byte is lost.
* <p>
- *
+ *
* @param buffer
* Prealocated buffer, or null.
* @param nrow
* Row number (0 is top). Most be strictly greater than the last
* read row.
- *
+ *
* @return The scanline in the same passwd buffer if it was allocated, a
* newly allocated one otherwise
*/
@@ -632,9 +632,9 @@ public class PngReader {
* <p>
* Notice that the columns in the matrix is not the pixel width of the
* image, but rather pixels x channels
- *
+ *
* @see #readRowInt(int) to read about the format of each row
- *
+ *
* @param rowOffset
* Number of rows to be skipped
* @param nRows
@@ -678,7 +678,7 @@ public class PngReader {
/**
* Same as readRowsInt(0, imgInfo.rows, 1)
- *
+ *
* @see #readRowsInt(int, int, int)
*/
public ImageLines readRowsInt() {
@@ -696,10 +696,10 @@ public class PngReader {
* <p>
* Notice that the columns in the matrix is not the pixel width of the
* image, but rather pixels x channels
- *
+ *
* @see #readRowByte(int) to read about the format of each row. Notice that
* if the bitdepth is 16 this will lose information
- *
+ *
* @param rowOffset
* Number of rows to be skipped
* @param nRows
@@ -743,7 +743,7 @@ public class PngReader {
/**
* Same as readRowsByte(0, imgInfo.rows, 1)
- *
+ *
* @see #readRowsByte(int, int, int)
*/
public ImageLines readRowsByte() {
@@ -752,13 +752,13 @@ public class PngReader {
/*
* For the interlaced case, nrow indicates the subsampled image - the pass must be set already.
- *
+ *
* This must be called in strict order, both for interlaced or no interlaced.
- *
+ *
* Updates rowNum.
- *
+ *
* Leaves raw result in rowb
- *
+ *
* Returns bytes actually read (not including the filter byte)
*/
private int readRowRaw(final int nrow) {
@@ -933,7 +933,7 @@ public class PngReader {
* scanline will be sample. This implies more processing and memory, but
* it's the most efficient option if you intend to read individual pixels. <br>
* This option should only be set before start reading.
- *
+ *
* @param unPackedMode
*/
public void setUnpackedMode(boolean unPackedMode) {
@@ -951,7 +951,7 @@ public class PngReader {
* Tries to reuse the allocated buffers from other already used PngReader
* object. This will have no effect if the buffers are smaller than necessary.
* It also reuses the inflater.
- *
+ *
* @param other A PngReader that has already finished reading pixels. Can be null.
*/
public void reuseBuffersFrom(PngReader other) {
@@ -977,7 +977,7 @@ public class PngReader {
/**
* Just for testing. TO be called after ending reading, only if
* initCrctest() was called before start
- *
+ *
* @return CRC of the raw pixels values
*/
long getCrctestVal() {
@@ -994,6 +994,7 @@ public class PngReader {
/**
* Basic info, for debugging.
*/
+ @Override
public String toString() { // basic info
return "filename=" + filename + " " + imgInfo.toString();
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java
index 3e684a881..2f475aab1 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java
@@ -88,7 +88,7 @@ public class PngWriter {
* filters) and queue chunks before start writing the pixels.
* <p>
* See also <code>FileHelper.createPngWriter()</code> if available.
- *
+ *
* @param outputStream
* Opened stream for binary writing
* @param imgInfo
@@ -422,7 +422,7 @@ public class PngWriter {
* Should be called when creating an image from another, before starting
* writing lines, to copy relevant chunks.
* <p>
- *
+ *
* @param reader
* : PngReader object, already opened.
* @param copy_mask
@@ -439,7 +439,7 @@ public class PngWriter {
* Should be called when creating an image from another, after writing all
* lines, before closing the writer, to copy additional chunks.
* <p>
- *
+ *
* @param reader
* : PngReader object, already opened and fully read.
* @param copy_mask
@@ -455,7 +455,7 @@ public class PngWriter {
* <p>
* Actually: compressed size = total size of IDAT data , raw size =
* uncompressed pixel bytes = rows * (bytesPerRow + 1).
- *
+ *
* This must be called after pngw.end()
*/
public double computeCompressionRatio() {
@@ -512,7 +512,7 @@ public class PngWriter {
* This must be called just after constructor, before starting writing.
* <p>
* See also setFilterType()
- *
+ *
* @param compLevel
* between 0 and 9 (default:6 , recommended: 6 or more)
*/
@@ -528,7 +528,7 @@ public class PngWriter {
* This must be called just after constructor, before starting writing.
* <p>
* See also setCompLevel()
- *
+ *
* @param filterType
* One of the five prediction types or strategy to choose it (see
* <code>PngFilterType</code>) Recommended values: DEFAULT
@@ -542,7 +542,7 @@ public class PngWriter {
* Sets maximum size of IDAT fragments. This has little effect on
* performance you should rarely call this
* <p>
- *
+ *
* @param idatMaxSize
* default=0 : use defaultSize (32K)
*/
@@ -572,7 +572,7 @@ public class PngWriter {
/**
* Writes line, checks that the row number is consistent with that of the
* ImageLine See writeRow(int[] newrow, int rown)
- *
+ *
* @deprecated Better use writeRow(ImageLine imgline, int rownumber)
*/
public void writeRow(ImageLine imgline) {
@@ -581,9 +581,9 @@ public class PngWriter {
/**
* Writes line. See writeRow(int[] newrow, int rown)
- *
+ *
* The <tt>packed</tt> flag of the imageline is honoured!
- *
+ *
* @see #writeRowInt(int[], int)
*/
public void writeRow(ImageLine imgline, int rownumber) {
@@ -596,7 +596,7 @@ public class PngWriter {
/**
* Same as writeRow(int[] newrow, int rown), but does not check row number
- *
+ *
* @param newrow
*/
public void writeRow(int[] newrow) {
@@ -605,7 +605,7 @@ public class PngWriter {
/**
* Alias to writeRowInt
- *
+ *
* @see #writeRowInt(int[], int)
*/
public void writeRow(int[] newrow, int rown) {
@@ -624,7 +624,7 @@ public class PngWriter {
* Warning: the array might be modified in some cases (unpacked row with low
* bitdepth)
* <p>
- *
+ *
* @param newrow
* Array of pixel values. Warning: the array size should be exact
* (samplesPerRowP)
@@ -642,7 +642,7 @@ public class PngWriter {
* Same semantics as writeRowInt but using bytes. Each byte is still a
* sample. If 16bitdepth, we are passing only the most significant byte (and
* hence losing some info)
- *
+ *
* @see PngWriter#writeRowInt(int[], int)
*/
public void writeRowByte(byte[] newrow, int rown) {
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java
index 4a45cb5bf..97e24fc73 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java
@@ -2,9 +2,9 @@ package jogamp.opengl.util.pngj;
/**
* Generic exception
- *
+ *
* @author Hernan J Gonzalez
- *
+ *
*/
public class PngjException extends RuntimeException {
private static final long serialVersionUID = 1L;
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java
index c429b893b..5da70de7b 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java
@@ -3,9 +3,9 @@ package jogamp.opengl.util.pngj;
/**
* Exception for anomalous internal problems (sort of asserts) that point to
* some issue with the library
- *
+ *
* @author Hernan J Gonzalez
- *
+ *
*/
public class PngjExceptionInternal extends RuntimeException {
private static final long serialVersionUID = 1L;
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java
index a995e4481..4e8bf5635 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java
@@ -47,19 +47,21 @@ public class ChunkHelper {
public static final String zTXt = "zTXt";
private static final ThreadLocal<Inflater> inflaterProvider = new ThreadLocal<Inflater>() {
+ @Override
protected Inflater initialValue() {
return new Inflater();
}
};
private static final ThreadLocal<Deflater> deflaterProvider = new ThreadLocal<Deflater>() {
+ @Override
protected Deflater initialValue() {
return new Deflater();
}
};
/*
- * static auxiliary buffer. any method that uses this should synchronize against this
+ * static auxiliary buffer. any method that uses this should synchronize against this
*/
private static byte[] tmpbuffer = new byte[4096];
@@ -136,7 +138,7 @@ public class ChunkHelper {
/**
* Finds position of null byte in array
- *
+ *
* @param b
* @return -1 if not found
*/
@@ -149,7 +151,7 @@ public class ChunkHelper {
/**
* Decides if a chunk should be loaded, according to a ChunkLoadBehaviour
- *
+ *
* @param id
* @param behav
* @return true/false
@@ -208,7 +210,7 @@ public class ChunkHelper {
/**
* Returns only the chunks that "match" the predicate
- *
+ *
* See also trimList()
*/
public static List<PngChunk> filterList(List<PngChunk> target, ChunkPredicate predicateKeep) {
@@ -223,7 +225,7 @@ public class ChunkHelper {
/**
* Remove (in place) the chunks that "match" the predicate
- *
+ *
* See also filterList
*/
public static int trimList(List<PngChunk> target, ChunkPredicate predicateRemove) {
@@ -244,10 +246,10 @@ public class ChunkHelper {
* they have same id and (perhaps, if multiple are allowed) if the match
* also in some "internal key" (eg: key for string values, palette for sPLT,
* etc)
- *
+ *
* Notice that the use of this is optional, and that the PNG standard allows
* Text chunks that have same key
- *
+ *
* @return true if "equivalent"
*/
public static final boolean equivalent(PngChunk c1, PngChunk c2) {
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java
index 82ab3bcf9..1fa00380a 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java
@@ -15,7 +15,7 @@ public enum ChunkLoadBehaviour {
*/
LOAD_CHUNK_KNOWN,
/**
- *
+ *
* Load chunk if "known" or "safe to copy".
*/
LOAD_CHUNK_IF_SAFE,
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkPredicate.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkPredicate.java
index a750ae34f..4695ccf44 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkPredicate.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkPredicate.java
@@ -6,7 +6,7 @@ package jogamp.opengl.util.pngj.chunks;
public interface ChunkPredicate {
/**
* The other chunk matches with this one
- *
+ *
* @param chunk
* @return true if match
*/
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java
index 3aba26cca..dcb1958df 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java
@@ -108,6 +108,7 @@ public class ChunkRaw {
return new ByteArrayInputStream(data);
}
+ @Override
public String toString() {
return "chunkid=" + ChunkHelper.toString(idbytes) + " len=" + len;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java
index 5ce94ff9f..75107d761 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java
@@ -24,7 +24,7 @@ public class ChunksList {
/**
* All chunks, read (or written)
- *
+ *
* But IDAT is a single pseudo chunk without data
*/
protected List<PngChunk> chunks = new ArrayList<PngChunk>();
@@ -37,7 +37,7 @@ public class ChunksList {
/**
* Keys of processed (read or writen) chunks
- *
+ *
* @return key:chunk id, val: number of occurrences
*/
public HashMap<String, Integer> getChunksKeys() {
@@ -59,12 +59,14 @@ public class ChunksList {
protected static List<PngChunk> getXById(final List<PngChunk> list, final String id, final String innerid) {
if (innerid == null)
return ChunkHelper.filterList(list, new ChunkPredicate() {
+ @Override
public boolean match(PngChunk c) {
return c.id.equals(id);
}
});
else
return ChunkHelper.filterList(list, new ChunkPredicate() {
+ @Override
public boolean match(PngChunk c) {
if (!c.id.equals(id))
return false;
@@ -87,7 +89,7 @@ public class ChunksList {
/**
* All chunks with this ID
- *
+ *
* @param id
* @return List, empty if none
*/
@@ -98,7 +100,7 @@ public class ChunksList {
/**
* If innerid!=null and the chunk is PngChunkTextVar or PngChunkSPLT, it's
* filtered by that id
- *
+ *
* @param id
* @return innerid Only used for text and SPLT chunks
* @return List, empty if none
@@ -109,7 +111,7 @@ public class ChunksList {
/**
* Returns only one chunk
- *
+ *
* @param id
* @return First chunk found, null if not found
*/
@@ -146,18 +148,20 @@ public class ChunksList {
/**
* Finds all chunks "equivalent" to this one
- *
+ *
* @param c2
* @return Empty if nothing found
*/
public List<PngChunk> getEquivalent(final PngChunk c2) {
return ChunkHelper.filterList(chunks, new ChunkPredicate() {
+ @Override
public boolean match(PngChunk c) {
return ChunkHelper.equivalent(c, c2);
}
});
}
+ @Override
public String toString() {
return "ChunkList: read: " + chunks.size();
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java
index e76456ad4..c502e9071 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java
@@ -67,7 +67,7 @@ public class ChunksListForWrite extends ChunksList {
/**
* Remove Chunk: only from queued
- *
+ *
* WARNING: this depends on c.equals() implementation, which is
* straightforward for SingleChunks. For MultipleChunks, it will normally
* check for reference equality!
@@ -78,9 +78,9 @@ public class ChunksListForWrite extends ChunksList {
/**
* Adds chunk to queue
- *
+ *
* Does not check for duplicated or anything
- *
+ *
* @param c
*/
public boolean queue(PngChunk c) {
@@ -149,6 +149,7 @@ public class ChunksListForWrite extends ChunksList {
return queuedChunks;
}
+ @Override
public String toString() {
return "ChunkList: written: " + chunks.size() + " queue: " + queuedChunks.size();
}
@@ -156,6 +157,7 @@ public class ChunksListForWrite extends ChunksList {
/**
* for debugging
*/
+ @Override
public String toStringFull() {
StringBuilder sb = new StringBuilder(toString());
sb.append("\n Written:\n");
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java
index a45979ec2..6cd86eb98 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java
@@ -248,7 +248,7 @@ public abstract class PngChunk {
/**
* Creates the physical chunk. This is used when writing (serialization).
* Each particular chunk class implements its own logic.
- *
+ *
* @return A newly allocated and filled raw chunk
*/
public abstract ChunkRaw createRawChunk();
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java
index 4a8502a3d..ea6235432 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java
@@ -70,7 +70,7 @@ public class PngChunkBKGD extends PngChunkSingle {
/**
* Set gray value (0-255 if bitdept=8)
- *
+ *
* @param gray
*/
public void setGray(int gray) {
@@ -87,7 +87,7 @@ public class PngChunkBKGD extends PngChunkSingle {
/**
* Set pallette index
- *
+ *
*/
public void setPaletteIndex(int i) {
if (!imgInfo.indexed)
@@ -103,7 +103,7 @@ public class PngChunkBKGD extends PngChunkSingle {
/**
* Set rgb values
- *
+ *
*/
public void setRGB(int r, int g, int b) {
if (imgInfo.greyscale || imgInfo.indexed)
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java
index d44250a2f..057f6c25e 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java
@@ -19,9 +19,9 @@ public abstract class PngChunkMultiple extends PngChunk {
/**
* NOTE: this chunk uses the default Object's equals() hashCode()
* implementation.
- *
+ *
* This is the right thing to do, normally.
- *
+ *
* This is important, eg see ChunkList.removeFromList()
*/
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java
index bc70c6e5e..3a490654a 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java
@@ -106,7 +106,7 @@ public class PngChunkSBIT extends PngChunkSingle {
/**
* Set rgb values
- *
+ *
*/
public void setRGB(int r, int g, int b) {
if (imgInfo.greyscale || imgInfo.indexed)
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java
index 5247169e0..7df5ba021 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java
@@ -12,6 +12,7 @@ public abstract class PngChunkSingle extends PngChunk {
super(id, imgInfo);
}
+ @Override
public final boolean allowsMultiple() {
return false;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java
index b68776477..867e34861 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java
@@ -82,7 +82,7 @@ public class PngChunkTRNS extends PngChunkSingle {
/**
* Set rgb values
- *
+ *
*/
public void setRGB(int r, int g, int b) {
if (imgInfo.greyscale || imgInfo.indexed)
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java
index ecf8b98c3..139603448 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java
@@ -41,6 +41,7 @@ public class PngMetadata {
throw new PngjException("cannot set chunk : readonly metadata");
if (lazyOverwrite) {
ChunkHelper.trimList(cl.getQueuedChunks(), new ChunkPredicate() {
+ @Override
public boolean match(PngChunk c2) {
return ChunkHelper.equivalent(c, c2);
}
@@ -87,7 +88,7 @@ public class PngMetadata {
/**
* Creates a time chunk with current time, less secsAgo seconds
* <p>
- *
+ *
* @return Returns the created-queued chunk, just in case you want to
* examine or modify it
*/
@@ -105,7 +106,7 @@ public class PngMetadata {
/**
* Creates a time chunk with diven date-time
* <p>
- *
+ *
* @return Returns the created-queued chunk, just in case you want to
* examine or modify it
*/
@@ -133,7 +134,7 @@ public class PngMetadata {
/**
* Creates a text chunk and queue it.
* <p>
- *
+ *
* @param k
* : key (latin1)
* @param val
@@ -201,7 +202,7 @@ public class PngMetadata {
/**
* Returns the palette chunk, if present
- *
+ *
* @return null if not present
*/
public PngChunkPLTE getPLTE() {
@@ -220,7 +221,7 @@ public class PngMetadata {
/**
* Returns the TRNS chunk, if present
- *
+ *
* @return null if not present
*/
public PngChunkTRNS getTRNS() {