blob: b69cfc450872b0c408c83c184e0bd18a7150866b (
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
|
package NET.worlds.scape;
import java.util.Hashtable;
public class VideoManager {
static Hashtable streams = new Hashtable();
public static VideoSurface get(String url, int rows, int w, int h) {
Object ob = streams.get(url);
VideoSurface stream;
if (ob == null) {
stream = new VideoSurface(null, rows, w, h);
streams.put(url, stream);
} else {
stream = (VideoSurface)ob;
}
stream.incReferenceCount();
stream.open(url);
return stream;
}
public static void release(VideoSurface stream) {
stream.decReferenceCount();
if (stream.getReferenceCount() == 0) {
streams.remove(stream.getVideoUrl());
}
}
}
|