1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
package com.jogamp.opengl.av;
import java.io.IOException;
import java.net.URL;
import javax.media.opengl.GL;
import jogamp.opengl.Debug;
import com.jogamp.opengl.util.texture.Texture;
/**
* Lifecycle of an GLMediaPlayer:
* <ul>
* <li>{@link #setStream(GL, URL)}</li>
* <li>{@link #start()}</li>
* <li>{@link #stop()}</li>
* <li>{@link #destroy(GL)}</li>
* </ul>
*/
public interface GLMediaPlayer {
public static final boolean DEBUG = Debug.debug("GLMediaPlayer");
public enum State {
Uninitialized(0), Stopped(1), Playing(2), Paused(3);
public final int id;
State(int id){
this.id = id;
}
}
public static class TextureFrame {
public TextureFrame(Texture t) {
texture = t;
// stMatrix = new float[4*4];
// ProjectFloat.makeIdentityf(stMatrix, 0);
}
public final Texture getTexture() { return texture; }
// public final float[] getSTMatrix() { return stMatrix; }
public String toString() {
return "TextureFrame[" + texture + "]";
}
protected final Texture texture;
// protected final float[] stMatrix;
}
public int getTextureCount();
public int getTextureTarget();
/** Sets the texture min-mag filter, defaults to {@link GL#GL_NEAREST}. */
public void setTextureMinMagFilter(int[] minMagFilter);
public int[] getTextureMinMagFilter();
/** Sets the texture min-mag filter, defaults to {@link GL#GL_CLAMP_TO_EDGE}. */
public void setTextureWrapST(int[] wrapST);
public int[] getTextureWrapST();
/**
* Sets the stream to be used. Initializes all stream related states and GL resources.
* <ul>
* <li>ANY -> Uninitialized - invokes destroy(GL)</li>
* <li>Uninitialized -> Stopped</li>
* </ul>
*/
public void setStream(GL gl, URL url) throws IOException;
/**
* Releases the GL and stream resources.
* <p>
* <code>ANY</code> -> Uninitialized
* </p>
*/
public void destroy(GL gl);
public void setPlaySpeed(float rate);
public float getPlaySpeed();
/**
* Stopped/Paused -> Playing
*/
public State start();
/**
* Playing -> Paused
*/
public State pause();
/**
* Playing/Paused -> Stopped
*/
public State stop();
/**
* @return the current state, either Uninitialized, Stopped, Playing, Paused
*/
public State getState();
/**
* @return time current position in milliseconds
**/
public long getCurrentPosition();
/**
* @param msec absolute desired time position in milliseconds
* @return time current position in milliseconds, after seeking to the desired position
**/
public long seek(long msec);
/**
* @return the last updated texture. Not blocking.
*/
public TextureFrame getLastTexture();
/**
* @return the next texture, which should be rendered. May block, depending on implementation.
*
* @see #addEventListener(GLMediaEventListener)
* @see GLMediaEventListener#newFrameAvailable(GLMediaPlayer, TextureFrame)
*/
public TextureFrame getNextTexture();
public boolean isValid();
public URL getURL();
/**
* <i>Warning:</i> Optional information, may not be supported by implementation.
* @return the code of the video stream, if available
*/
public String getVideoCodec();
/**
* <i>Warning:</i> Optional information, may not be supported by implementation.
* @return the code of the audio stream, if available
*/
public String getAudioCodec();
/**
* <i>Warning:</i> Optional information, may not be supported by implementation.
* @return the total number of video frames
*/
public long getTotalFrames();
/**
* @return total duration of stream in msec.
*/
public long getDuration();
/**
* <i>Warning:</i> Optional information, may not be supported by implementation.
* @return the overall bitrate of the stream.
*/
public long getBitrate();
/**
* <i>Warning:</i> Optional information, may not be supported by implementation.
* @return the framerate of the video
*/
public int getFramerate();
public int getWidth();
public int getHeight();
public String toString();
public void addEventListener(GLMediaEventListener l);
public void removeEventListener(GLMediaEventListener l);
public GLMediaEventListener[] getEventListeners();
}
|