summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/VideoSurface.java
blob: 0bf252823d6f5473a90474f353def4bec2eee2bc (plain) (blame)
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
package NET.worlds.scape;

public class VideoSurface extends TextureSurface {
   protected DirectShow _ds;
   protected String _currentURL;
   protected int referenceCount = 0;

   public VideoSurface(Texture[] texList, int rows, int w, int h) {
      super(texList, rows, w, h);
      this._ds = new DirectShow(this.getHwnd());
   }

   public void incReferenceCount() {
      this.referenceCount++;
   }

   public void decReferenceCount() {
      this.referenceCount--;
   }

   public int getReferenceCount() {
      return this.referenceCount;
   }

   public int tick() {
      return this._ds.nTick();
   }

   public String getVideoUrl() {
      return this._currentURL;
   }

   public void open(String url) {
      if (this._currentURL == null || !this._currentURL.equals(url)) {
         this._ds.nStop();
         this._ds.nOpen(url);
         this._currentURL = url;
      }
   }

   public void stop() {
      this._ds.nStop();
   }

   public void play(int repeat) {
      this._ds.nPlay(repeat);
   }

   public synchronized void draw(Texture[] texList, int rows) {
      this.setTextures(texList, rows);
      this.draw(this._ds);
   }
}