aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java151
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java85
2 files changed, 156 insertions, 80 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java
index 5740dae4b..82951ab54 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java
@@ -33,6 +33,8 @@ import com.jogamp.opengl.GLException;
import jogamp.opengl.Debug;
+import java.util.List;
+
import com.jogamp.common.net.Uri;
import com.jogamp.opengl.util.texture.Texture;
import com.jogamp.opengl.util.texture.TextureSequence;
@@ -82,18 +84,18 @@ import com.jogamp.opengl.util.av.GLMediaPlayer.State;
* <a name="lifecycle"><h5>GLMediaPlayer Lifecycle</h5></a>
* <p>
* <table border="1">
- * <tr><th>Action</th> <th>{@link State} Before</th> <th>{@link State} After</th> <th>{@link GLMediaEventListener Event}</th></tr>
- * <tr><td>{@link #playStream(Uri, int, int, int)}</td> <td>{@link State#Uninitialized Uninitialized}</td> <td>{@link State#Initialized Initialized}<sup><a href="#streamworker">1</a></sup>, {@link State#Uninitialized Uninitialized}</td> <td>{@link GLMediaEventListener#EVENT_CHANGE_INIT EVENT_CHANGE_INIT} or ( {@link GLMediaEventListener#EVENT_CHANGE_ERR EVENT_CHANGE_ERR} + {@link GLMediaEventListener#EVENT_CHANGE_UNINIT EVENT_CHANGE_UNINIT} )</td></tr>
- * <tr><td>{@link #initGL(GL)}</td> <td>{@link State#Initialized Initialized}, {@link State#Uninitialized Uninitialized} </td> <td>{@link State#Playing Playing}, {@link State#Uninitialized Uninitialized}</td> <td>{@link GLMediaEventListener#EVENT_CHANGE_PLAY EVENT_CHANGE_PLAY} or ( {@link GLMediaEventListener#EVENT_CHANGE_ERR EVENT_CHANGE_ERR} + {@link GLMediaEventListener#EVENT_CHANGE_UNINIT EVENT_CHANGE_UNINIT} )</td></tr>
- * <tr><td>{@link #pause(boolean)}</td> <td>{@link State#Playing Playing}</td> <td>{@link State#Paused Paused}</td> <td>{@link GLMediaEventListener#EVENT_CHANGE_PAUSE EVENT_CHANGE_PAUSE}</td></tr>
- * <tr><td>{@link #resume()}</td> <td>{@link State#Paused Paused}</td> <td>{@link State#Playing Playing}</td> <td>{@link GLMediaEventListener#EVENT_CHANGE_PLAY EVENT_CHANGE_PLAY}</td></tr>
- * <tr><td>{@link #stop()}</td> <td>{@link State#Playing Playing}, {@link State#Paused Paused}</td> <td>{@link State#Uninitialized Uninitialized}</td> <td>{@link GLMediaEventListener#EVENT_CHANGE_PAUSE EVENT_CHANGE_PAUSE}</td></tr>
+ * <tr><th>Action</th> <th>{@link State} Before</th> <th>{@link State} After</th> <th>{@link EventMask#Bit Event}</th></tr>
+ * <tr><td>{@link #playStream(Uri, int, int, int)}</td> <td>{@link State#Uninitialized Uninitialized}</td> <td>{@link State#Initialized Initialized}<sup><a href="#streamworker">1</a></sup>, {@link State#Uninitialized Uninitialized}</td> <td>{@link EventMask.Bit#Init Init} or ( {@link EventMask.Bit#Error Error} + {@link EventMask.Bit#Uninit Uninit} )</td></tr>
+ * <tr><td>{@link #initGL(GL)}</td> <td>{@link State#Initialized Initialized}, {@link State#Uninitialized Uninitialized} </td> <td>{@link State#Playing Playing}, {@link State#Uninitialized Uninitialized}</td> <td>{@link EventMask.Bit#Play Play} or ( {@link EventMask.Bit#Error Error} + {@link EventMask.Bit#Uninit Uninit} )</td></tr>
+ * <tr><td>{@link #pause(boolean)}</td> <td>{@link State#Playing Playing}</td> <td>{@link State#Paused Paused}</td> <td>{@link EventMask.Bit#Pause Pause}</td></tr>
+ * <tr><td>{@link #resume()}</td> <td>{@link State#Paused Paused}</td> <td>{@link State#Playing Playing}</td> <td>{@link EventMask.Bit#Play Play}</td></tr>
+ * <tr><td>{@link #stop()}</td> <td>{@link State#Playing Playing}, {@link State#Paused Paused}</td> <td>{@link State#Uninitialized Uninitialized}</td> <td>{@link EventMask.Bit#Pause Pause}</td></tr>
* <tr><td>{@link #seek(int)}</td> <td>{@link State#Paused Paused}, {@link State#Playing Playing}</td> <td>{@link State#Paused Paused}, {@link State#Playing Playing}</td> <td>none</td></tr>
* <tr><td>{@link #getNextTexture(GL)}</td> <td><i>any</i></td> <td><i>same</i></td> <td>none</td></tr>
* <tr><td>{@link #getLastTexture()}</td> <td><i>any</i></td> <td><i>same</i></td> <td>none</td></tr>
- * <tr><td>{@link TextureFrame#END_OF_STREAM_PTS END_OF_STREAM}</td> <td>{@link State#Playing Playing}</td> <td>{@link State#Paused Paused}</td> <td>{@link GLMediaEventListener#EVENT_CHANGE_EOS EVENT_CHANGE_EOS} + {@link GLMediaEventListener#EVENT_CHANGE_PAUSE EVENT_CHANGE_PAUSE}</td></tr>
- * <tr><td>{@link StreamException}</td> <td><i>any</i></td> <td>{@link State#Paused Paused}, {@link State#Uninitialized Uninitialized}</td> <td>{@link GLMediaEventListener#EVENT_CHANGE_ERR EVENT_CHANGE_ERR} + ( {@link GLMediaEventListener#EVENT_CHANGE_PAUSE EVENT_CHANGE_PAUSE} or {@link GLMediaEventListener#EVENT_CHANGE_UNINIT EVENT_CHANGE_UNINIT} )</td></tr>
- * <tr><td>{@link #destroy(GL)}</td> <td><i>any</i></td> <td>{@link State#Uninitialized Uninitialized}</td> <td>{@link GLMediaEventListener#EVENT_CHANGE_UNINIT EVENT_CHANGE_UNINIT}</td></tr>
+ * <tr><td>{@link TextureFrame#END_OF_STREAM_PTS END_OF_STREAM}</td> <td>{@link State#Playing Playing}</td> <td>{@link State#Paused Paused}</td> <td>{@link EventMask.Bit#EOS EOS} + {@link EventMask.Bit#Pause Pause}</td></tr>
+ * <tr><td>{@link StreamException}</td> <td><i>any</i></td> <td>{@link State#Paused Paused}, {@link State#Uninitialized Uninitialized}</td> <td>{@link EventMask.Bit#Error Error} + ( {@link EventMask.Bit#Pause Pause} or {@link EventMask.Bit#Uninit Uninit} )</td></tr>
+ * <tr><td>{@link #destroy(GL)}</td> <td><i>any</i></td> <td>{@link State#Uninitialized Uninitialized}</td> <td>{@link EventMask.Bit#Uninit Uninit}</td></tr>
* </table>
* </p>
*
@@ -278,41 +280,112 @@ public interface GLMediaPlayer extends TextureSequence {
* </p>
*/
public interface GLMediaEventListener extends TexSeqEventListener<GLMediaPlayer> {
-
- /** State changed to {@link State#Initialized}. See <a href="#lifecycle">Lifecycle</a>.*/
- static final int EVENT_CHANGE_INIT = 1<<0;
- /** State changed to {@link State#Uninitialized}. See <a href="#lifecycle">Lifecycle</a>.*/
- static final int EVENT_CHANGE_UNINIT = 1<<1;
- /** State changed to {@link State#Playing}. See <a href="#lifecycle">Lifecycle</a>.*/
- static final int EVENT_CHANGE_PLAY = 1<<2;
- /** State changed to {@link State#Paused}. See <a href="#lifecycle">Lifecycle</a>.*/
- static final int EVENT_CHANGE_PAUSE = 1<<3;
- /** End of stream reached. See <a href="#lifecycle">Lifecycle</a>.*/
- static final int EVENT_CHANGE_EOS = 1<<4;
- /** An error occurred, e.g. during off-thread initialization. See {@link StreamException} and <a href="#lifecycle">Lifecycle</a>. */
- static final int EVENT_CHANGE_ERR = 1<<5;
-
- /** Stream video id change. */
- static final int EVENT_CHANGE_VID = 1<<16;
- /** Stream audio id change. */
- static final int EVENT_CHANGE_AID = 1<<17;
- /** TextureFrame size or vertical flip change. */
- static final int EVENT_CHANGE_SIZE = 1<<18;
- /** Stream fps change. */
- static final int EVENT_CHANGE_FPS = 1<<19;
- /** Stream bps change. */
- static final int EVENT_CHANGE_BPS = 1<<20;
- /** Stream length change. */
- static final int EVENT_CHANGE_LENGTH = 1<<21;
- /** Stream codec change. */
- static final int EVENT_CHANGE_CODEC = 1<<22;
-
/**
* @param mp the event source
* @param event_mask the changes attributes
* @param when system time in msec.
*/
- public void attributesChanged(GLMediaPlayer mp, int event_mask, long when);
+ public void attributesChanged(GLMediaPlayer mp, EventMask event_mask, long when);
+ }
+
+ /** Changes attributes event mask */
+ public static final class EventMask {
+
+ /** Attribute change bits */
+ public static enum Bit {
+ /** State changed to {@link State#Initialized}. See <a href="#lifecycle">Lifecycle</a>.*/
+ Init ( 1<<0 ),
+ /** State changed to {@link State#Uninitialized}. See <a href="#lifecycle">Lifecycle</a>.*/
+ Uninit ( 1<<1 ),
+ /** State changed to {@link State#Playing}. See <a href="#lifecycle">Lifecycle</a>.*/
+ Play ( 1<<2 ),
+ /** State changed to {@link State#Paused}. See <a href="#lifecycle">Lifecycle</a>.*/
+ Pause ( 1<<3 ),
+ /** End of stream reached. See <a href("#lifecycle">Lifecycle</a>.*/
+ EOS ( 1<<4 ),
+ /** An error occurred, e.g. during off-thread initialization. See {@link StreamException} and <a href("#lifecycle">Lifecycle</a>. */
+ Error ( 1<<5 ),
+
+ /** Stream video id change. */
+ VID ( 1<<16 ),
+ /** Stream audio id change. */
+ AID ( 1<<17 ),
+ /** TextureFrame size or vertical flip change. */
+ Size ( 1<<18 ),
+ /** Stream fps change. */
+ FPS ( 1<<19 ),
+ /** Stream bps change. */
+ BPS ( 1<<20 ),
+ /** Stream length change. */
+ Length ( 1<<21 ),
+ /** Stream codec change. */
+ Codec ( 1<<22 );
+
+ Bit(final int v) { value = v; }
+ public final int value;
+ }
+ public int mask;
+
+ public static int getBits(final List<Bit> v) {
+ int res = 0;
+ for(final Bit b : v) {
+ res |= b.value;
+ }
+ return res;
+ }
+ public EventMask(final List<Bit> v) {
+ mask = getBits(v);
+ }
+ public EventMask(final Bit v) {
+ mask = v.value;
+ }
+ public EventMask(final int v) {
+ mask = v;
+ }
+ public EventMask() {
+ mask = 0;
+ }
+
+ public boolean isSet(final Bit bit) { return bit.value == ( mask & bit.value ); }
+ public boolean isSet(final List<Bit> bits) { final int bits_i = getBits(bits); return bits_i == ( mask & bits_i ); }
+ public boolean isSet(final int bits) { return bits == ( mask & bits ); }
+ public boolean isZero() { return 0 == mask; }
+
+ public EventMask setBit(final Bit v) { mask |= v.value; return this; }
+ public EventMask setBits(final List<Bit> v) {
+ for(final Bit b : v) {
+ mask |= b.value;
+ }
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ int count = 0;
+ final StringBuilder out = new StringBuilder();
+ for (final Bit dt : Bit.values()) {
+ if( isSet(dt) ) {
+ if( 0 < count ) { out.append(", "); }
+ out.append(dt.name()); count++;
+ }
+ }
+ if( 0 == count ) {
+ out.append("None");
+ } else if( 1 < count ) {
+ out.insert(0, "[");
+ out.append("]");
+ }
+ return out.toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ return (other instanceof EventMask) &&
+ this.mask == ((EventMask)other).mask;
+ }
}
/**
diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
index 6408e3d6f..de949bbd6 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
@@ -363,7 +363,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
if( null != streamWorker ) {
streamWorker.doResume();
}
- changeState(0, State.Playing);
+ changeState(new GLMediaPlayer.EventMask(), State.Playing);
}
default:
}
@@ -375,13 +375,13 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
@Override
public final State pause(final boolean flush) {
- return pauseImpl(flush, 0);
+ return pauseImpl(flush, new GLMediaPlayer.EventMask());
}
- private final State pauseImpl(final boolean flush, int event_mask) {
+ private final State pauseImpl(final boolean flush, GLMediaPlayer.EventMask eventMask) {
synchronized( stateLock ) {
final State preState = state;
if( State.Playing == state ) {
- event_mask = addStateEventMask(event_mask, GLMediaPlayer.State.Paused);
+ eventMask = addStateEventMask(eventMask, GLMediaPlayer.State.Paused);
setState( State.Paused );
if( null != streamWorker ) {
streamWorker.doPause(true);
@@ -391,7 +391,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
} else if( null != audioSink ) {
audioSink.pause();
}
- attributesUpdated( event_mask );
+ attributesUpdated( eventMask );
if( !pauseImpl() ) {
resume();
}
@@ -412,7 +412,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
resetAVPTSAndFlush();
stopImpl();
- changeState(0, State.Uninitialized);
+ changeState(new GLMediaPlayer.EventMask(), State.Uninitialized);
// attachedObjects.clear();
if(DEBUG) { System.err.println("Stop: "+preState+" -> "+state+", "+toString()); }
return state;
@@ -422,9 +422,9 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
@Override
public final State destroy(final GL gl) {
- return destroyImpl(gl, 0, true);
+ return destroyImpl(gl, new GLMediaPlayer.EventMask(), true);
}
- private final State destroyImpl(final GL gl, final int event_mask, final boolean wait) {
+ private final State destroyImpl(final GL gl, final GLMediaPlayer.EventMask eventMask, final boolean wait) {
synchronized( stateLock ) {
if( null != streamWorker ) {
streamWorker.doStopImpl(wait);
@@ -435,7 +435,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
removeAllTextureFrames(gl);
lastFrame = null;
textureCount=0;
- changeState(event_mask, State.Uninitialized);
+ changeState(eventMask, State.Uninitialized);
attachedObjects.clear();
return state;
}
@@ -619,7 +619,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
initStreamImpl(vid, aid);
} catch (final Throwable t) {
streamErr = new StreamException(t.getClass().getSimpleName()+" while initializing: "+GLMediaPlayerImpl.this.toString(), t);
- changeState(GLMediaEventListener.EVENT_CHANGE_ERR, GLMediaPlayer.State.Uninitialized);
+ changeState(new GLMediaPlayer.EventMask(GLMediaPlayer.EventMask.Bit.Error), GLMediaPlayer.State.Uninitialized);
} // also initializes width, height, .. etc
}
}.start();
@@ -689,7 +689,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
streamWorker.initGL(gl);
streamWorker.doResume();
- changeState(0, State.Paused);
+ changeState(new GLMediaPlayer.EventMask(), State.Paused);
resume();
} else {
resetAVPTSAndFlush();
@@ -717,7 +717,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
// changeState(0, State.Paused);
}
} catch (final Throwable t) {
- destroyImpl(gl, GLMediaEventListener.EVENT_CHANGE_ERR, false /* wait */); // -> GLMediaPlayer.State.Uninitialized
+ destroyImpl(gl, new GLMediaPlayer.EventMask(GLMediaPlayer.EventMask.Bit.Error), false /* wait */); // -> GLMediaPlayer.State.Uninitialized
throw new GLException("Error initializing GL resources", t);
}
}
@@ -959,7 +959,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
if( DEBUG ) {
System.err.println( "AV-EOS (getNextTexture): EOS_PTS "+(TimeFrameI.END_OF_STREAM_PTS == video_pts)+", "+this);
}
- pauseImpl(true, GLMediaEventListener.EVENT_CHANGE_EOS);
+ pauseImpl(true, new GLMediaPlayer.EventMask(GLMediaPlayer.EventMask.Bit.EOS));
} else if( TimeFrameI.INVALID_PTS == video_pts ) { // no audio or video frame
if( null == videoFramesDecoded || !videoFramesDecoded.isEmpty() ) {
@@ -1413,7 +1413,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
if( DEBUG ) {
System.err.println( "AV-EOS (StreamWorker): EOS_PTS "+(TimeFrameI.END_OF_STREAM_PTS == vPTS)+", "+GLMediaPlayerImpl.this);
}
- pauseImpl(true, GLMediaEventListener.EVENT_CHANGE_EOS);
+ pauseImpl(true, new GLMediaPlayer.EventMask(GLMediaPlayer.EventMask.Bit.EOS));
}
}
} catch (final InterruptedException e) {
@@ -1438,7 +1438,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
isActive = false;
this.notifyAll(); // wake-up potential do*()
}
- pauseImpl(true, GLMediaEventListener.EVENT_CHANGE_ERR);
+ pauseImpl(true, new GLMediaPlayer.EventMask(GLMediaPlayer.EventMask.Bit.Error));
}
}
}
@@ -1457,46 +1457,49 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
private volatile StreamWorker streamWorker = null;
private volatile StreamException streamErr = null;
- protected final int addStateEventMask(int event_mask, final State newState) {
+ protected final GLMediaPlayer.EventMask addStateEventMask(final GLMediaPlayer.EventMask eventMask, final State newState) {
if( state != newState ) {
switch( newState ) {
case Uninitialized:
- event_mask |= GLMediaEventListener.EVENT_CHANGE_UNINIT;
+ eventMask.setBit(GLMediaPlayer.EventMask.Bit.Uninit);
break;
case Initialized:
- event_mask |= GLMediaEventListener.EVENT_CHANGE_INIT;
+ eventMask.setBit(GLMediaPlayer.EventMask.Bit.Init);
break;
case Playing:
- event_mask |= GLMediaEventListener.EVENT_CHANGE_PLAY;
+ eventMask.setBit(GLMediaPlayer.EventMask.Bit.Play);
break;
case Paused:
- event_mask |= GLMediaEventListener.EVENT_CHANGE_PAUSE;
+ eventMask.setBit(GLMediaPlayer.EventMask.Bit.Pause);
break;
}
}
- return event_mask;
+ return eventMask;
}
- protected final void attributesUpdated(final int event_mask) {
- if( 0 != event_mask ) {
+ protected final void attributesUpdated(final GLMediaPlayer.EventMask eventMask) {
+ if( !eventMask.isZero() ) {
final long now = Platform.currentTimeMillis();
+ if( DEBUG ) {
+ System.err.println("GLMediaPlayer.AttributesChanged: "+eventMask+", state "+state+", when "+now);
+ }
synchronized(eventListenersLock) {
for(final Iterator<GLMediaEventListener> i = eventListeners.iterator(); i.hasNext(); ) {
- i.next().attributesChanged(this, event_mask, now);
+ i.next().attributesChanged(this, eventMask, now);
}
}
}
}
- protected final void changeState(int event_mask, final State newState) {
- event_mask = addStateEventMask(event_mask, newState);
- if( 0 != event_mask ) {
+ protected final void changeState(GLMediaPlayer.EventMask eventMask, final State newState) {
+ eventMask = addStateEventMask(eventMask, newState);
+ if( !eventMask.isZero() ) {
setState( newState );
if(State.Uninitialized == state) {
textureLookupFunctionName = "texture2D";
textureFragmentShaderHashCode = 0;
}
- attributesUpdated( event_mask );
+ attributesUpdated( eventMask );
}
}
@@ -1513,34 +1516,34 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
protected final void updateAttributes(int vid, final int aid, final int width, final int height, final int bps_stream,
final int bps_video, final int bps_audio, final float fps,
final int videoFrames, final int audioFrames, final int duration, final String vcodec, final String acodec) {
- int event_mask = 0;
+ final GLMediaPlayer.EventMask eventMask = new GLMediaPlayer.EventMask();
final boolean wasUninitialized = state == State.Uninitialized;
if( wasUninitialized ) {
- event_mask |= GLMediaEventListener.EVENT_CHANGE_INIT;
+ eventMask.setBit(GLMediaPlayer.EventMask.Bit.Init);
setState( State.Initialized );
}
if( STREAM_ID_AUTO == vid ) {
vid = STREAM_ID_NONE;
}
if( this.vid != vid ) {
- event_mask |= GLMediaEventListener.EVENT_CHANGE_VID;
+ eventMask.setBit(GLMediaPlayer.EventMask.Bit.VID);
this.vid = vid;
}
if( STREAM_ID_AUTO == vid ) {
vid = STREAM_ID_NONE;
}
if( this.aid != aid ) {
- event_mask |= GLMediaEventListener.EVENT_CHANGE_AID;
+ eventMask.setBit(GLMediaPlayer.EventMask.Bit.AID);
this.aid = aid;
}
if( this.width != width || this.height != height ) {
- event_mask |= GLMediaEventListener.EVENT_CHANGE_SIZE;
+ eventMask.setBit(GLMediaPlayer.EventMask.Bit.Size);
this.width = width;
this.height = height;
}
if( this.fps != fps ) {
- event_mask |= GLMediaEventListener.EVENT_CHANGE_FPS;
+ eventMask.setBit(GLMediaPlayer.EventMask.Bit.FPS);
this.fps = fps;
if( 0 != fps ) {
this.frame_duration = 1000f / fps;
@@ -1556,26 +1559,26 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
}
if( this.bps_stream != bps_stream || this.bps_video != bps_video || this.bps_audio != bps_audio ) {
- event_mask |= GLMediaEventListener.EVENT_CHANGE_BPS;
+ eventMask.setBit(GLMediaPlayer.EventMask.Bit.BPS);
this.bps_stream = bps_stream;
this.bps_video = bps_video;
this.bps_audio = bps_audio;
}
if( this.videoFrames != videoFrames || this.audioFrames != audioFrames || this.duration != duration ) {
- event_mask |= GLMediaEventListener.EVENT_CHANGE_LENGTH;
+ eventMask.setBit(GLMediaPlayer.EventMask.Bit.Length);
this.videoFrames = videoFrames;
this.audioFrames = audioFrames;
this.duration = duration;
}
if( (null!=acodec && acodec.length()>0 && !this.acodec.equals(acodec)) ) {
- event_mask |= GLMediaEventListener.EVENT_CHANGE_CODEC;
+ eventMask.setBit(GLMediaPlayer.EventMask.Bit.Codec);
this.acodec = acodec;
}
if( (null!=vcodec && vcodec.length()>0 && !this.vcodec.equals(vcodec)) ) {
- event_mask |= GLMediaEventListener.EVENT_CHANGE_CODEC;
+ eventMask.setBit(GLMediaPlayer.EventMask.Bit.Codec);
this.vcodec = vcodec;
}
- if(0==event_mask) {
+ if( eventMask.isZero() ) {
return;
}
if( wasUninitialized ) {
@@ -1583,7 +1586,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
System.err.println("XXX Initialize @ updateAttributes: "+this);
}
}
- attributesUpdated(event_mask);
+ attributesUpdated(eventMask);
}
protected void setIsGLOriented(final boolean isGLOriented) {
@@ -1596,7 +1599,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
for(int i=0; i<videoFramesOrig.length; i++) {
videoFramesOrig[i].getTexture().setMustFlipVertically(!isGLOriented);
}
- attributesUpdated(GLMediaEventListener.EVENT_CHANGE_SIZE);
+ attributesUpdated(new GLMediaPlayer.EventMask(GLMediaPlayer.EventMask.Bit.Size));
}
}
}