aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/av/GLMediaPlayer.java
blob: 71e0e16d95cb7853841def8d481408b3b8140b57 (plain)
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
package com.jogamp.opengl.av;

import java.io.IOException;
import java.net.URL;

import javax.media.opengl.GL;

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 class TextureFrame {
        public TextureFrame(Texture t) {
            texture = t;
        }
        
        public final Texture getTexture() { return texture; }
        
        public String toString() {
            return "TextureFrame[" + texture + "]";
        }
        protected final Texture texture;
    }
    
    /** Sets the stream to be used. Initializes all stream related states and GL resources. */
    public void setStream(GL gl, URL url) throws IOException;

    /** Releases the GL and stream resources. */
    public void destroy(GL gl);

    public void setPlaySpeed(float rate);

    public float getPlaySpeed();

    public void start();

    public void pause();

    public void stop();

    /**
     * @return time current position in milliseconds 
     **/
    public int getCurrentPosition();

    /**
     * @param msec absolute desired time position in milliseconds 
     * @return time current position in milliseconds, after seeking to the desired position  
     **/
    public int seek(int msec);

    public Texture getLastTextureID();

    public Texture getNextTextureID();

    public boolean isValid();

    public URL getURL();

    public String getVideoCodec();

    public String getAudioCodec();

    public long getTotalFrames();

    public long getBitrate();

    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();
}