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