01: /*
02: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
04: *
05: * This program is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU General Public License version
07: * 2 only, as published by the Free Software Foundation.
08: *
09: * This program is distributed in the hope that it will be useful, but
10: * WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * General Public License version 2 for more details (a copy is
13: * included at /legal/license.txt).
14: *
15: * You should have received a copy of the GNU General Public License
16: * version 2 along with this work; if not, write to the Free Software
17: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18: * 02110-1301 USA
19: *
20: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
21: * Clara, CA 95054 or visit www.sun.com if you need additional
22: * information or have any questions.
23: */
24: package com.sun.mmedia;
25:
26: import javax.microedition.lcdui.*;
27:
28: /**
29: * This is a helper interface to communicate between the LCDUI <code>Canvas
30: * </code> and
31: * the MMAPI video players. It has methods to register and unregister
32: * <code>MIDPVideoPainter</code>s with an LCDUI Canvas.
33: */
34: public abstract class MMHelper {
35: static private MMHelper mmh = null;
36:
37: /**
38: * This is the link to the LCDUI canvas implementation for special
39: * repaint events. This is called by javax.microedition.lcdui.MMHelperImpl.
40: */
41: public static void setMMHelper(MMHelper mmhelper) {
42: // Safeguard to make sure its called only once
43: if (mmh == null)
44: mmh = mmhelper;
45: }
46:
47: /**
48: * This method is called by MIDPVideoPainter implementation
49: * to get a hold of the MMHelper...
50: */
51: static MMHelper getMMHelper() {
52: return mmh;
53: }
54:
55: /**
56: * Registers a video control (which implements MIDPVideoPainter) with
57: * the corresponding Canvas where the video is to show up.
58: */
59: public abstract void registerPlayer(Canvas c, MIDPVideoPainter vp);
60:
61: /**
62: * Unregisters a video control so that it doesn't get paint callbacks
63: * anymore after the player is closed. This also reduces load on the
64: * Canvas repaint mechanism.
65: */
66: public abstract void unregisterPlayer(Canvas c, MIDPVideoPainter vp);
67:
68: /**
69: * Get Display being used for Item painting. Platform-dependent.
70: */
71: public abstract Display getItemDisplay(Item item);
72:
73: };
|