sbGStreamerPlatformBase.h
Go to the documentation of this file.
1 /*
2 //
3 // BEGIN SONGBIRD GPL
4 //
5 // This file is part of the Songbird web player.
6 //
7 // Copyright(c) 2005-2008 POTI, Inc.
8 // http://songbirdnest.com
9 //
10 // This file may be licensed under the terms of of the
11 // GNU General Public License Version 2 (the "GPL").
12 //
13 // Software distributed under the License is distributed
14 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
15 // express or implied. See the GPL for the specific language
16 // governing rights and limitations.
17 //
18 // You should have received a copy of the GPL along with this
19 // program. If not, go to http://www.gnu.org/licenses/gpl.html
20 // or write to the Free Software Foundation, Inc.,
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //
23 // END SONGBIRD GPL
24 //
25 */
26 
27 #ifndef _SB_GSTREAMER_PLATFORM_BASE_H_
28 #define _SB_GSTREAMER_PLATFORM_BASE_H_
29 
30 #include <nsCOMPtr.h>
31 #include <nsIBoxObject.h>
32 #include <nsIWidget.h>
33 
34 #include <gst/gst.h>
35 #include <gst/interfaces/xoverlay.h>
36 
38 
40 
42 {
43 public:
45  virtual ~BasePlatformInterface ();
46 
47  // Implementation of (some parts of) the sbIGstPlatformInterface interface
48  //
49  virtual void ResizeToWindow();
50  bool GetFullscreen();
51  void SetFullscreen(bool aFullscreen);
52  void SetDisplayAspectRatio(int aNumerator, int aDenominator);
53  virtual void PrepareVideoWindow(GstMessage *aMessage);
54 
55 protected:
56  virtual nsresult SetVideoBox(nsIBoxObject *aVideoBox, nsIWidget *aWidget);
57 
58  // Set the display area available for rendering the video to
59  void SetDisplayArea(int x, int y, int width, int height);
60  // Resize the video to an appropriate (aspect-ratio preserving) subrectangle
61  // of the currently set display area.
62  void ResizeVideo();
63 
64  // Set the owning DOM document
65  virtual nsresult SetDocument(nsIDOMDocument *aDocument);
66 
67  // Create a DOM mouse event
68  nsresult CreateDOMMouseEvent(nsIDOMMouseEvent **aMouseEvent);
69  // Create a DOM key event
70  nsresult CreateDOMKeyEvent(nsIDOMKeyEvent **aKeyEvent);
71  // Dispatch a DOM event
72  nsresult DispatchDOMEvent(nsIDOMEvent *aEvent);
73 
74  // Actually render the video window in this precise area, which has been
75  // aspect-ratio corrected.
76  virtual void MoveVideoWindow(int x, int y, int width, int height) = 0;
77 
78  // Set the window ID (as appropriate to the particular platform) on this
79  // XOverlay object.
80  virtual void SetXOverlayWindowID(GstXOverlay *aXOverlay) = 0;
81 
82  // Switch from windowed mode to full screen mode.
83  virtual void FullScreen() = 0;
84 
85  // Set to windowed mode from full screen mode.
86  virtual void UnFullScreen() = 0;
87 
88  int mDisplayWidth; // Width of current display area
89  int mDisplayHeight; // Height of current display area
90  int mDisplayX; // X coordinate of current display area
91  int mDisplayY; // Y coordinate of current display area
92 
93  int mDARNum; // Current Display Aspect Ratio as a fraction
94  int mDARDenom; // (numerator and denominator)
95 
96  bool mFullscreen; // Are we currently in fullscreen mode?
97 
98  // The box object for the video display area, access to this object
99  // is proxied to the main thread.
100  nsCOMPtr<nsIBoxObject> mVideoBox;
101  // The widget corresponding to this box object, also main-thread only.
102  nsCOMPtr<nsIWidget> mWidget;
103  // The owning document of the box object.
104  nsCOMPtr<nsIDOMDocument> mDocument;
105 
106  GstElement *mVideoSink; // The GStreamer video sink we created
107  GstElement *mAudioSink; // The GStreamer audio sink we created
108 
109  sbGStreamerMediacore *mCore; // The core associated with this object.
110 };
111 
112 #endif // _SB_GSTREAMER_PLATFORM_BASE_H_
sbGStreamerMediacore * mCore
virtual void UnFullScreen()=0
void SetDisplayAspectRatio(int aNumerator, int aDenominator)
nsresult DispatchDOMEvent(nsIDOMEvent *aEvent)
function width(ele) rect(ele).width
virtual nsresult SetVideoBox(nsIBoxObject *aVideoBox, nsIWidget *aWidget)
virtual void SetXOverlayWindowID(GstXOverlay *aXOverlay)=0
void SetFullscreen(bool aFullscreen)
void SetDisplayArea(int x, int y, int width, int height)
_collectFormDataForFrame aDocument
virtual nsresult SetDocument(nsIDOMDocument *aDocument)
nsresult CreateDOMMouseEvent(nsIDOMMouseEvent **aMouseEvent)
BasePlatformInterface(sbGStreamerMediacore *aCore)
_updateDatepicker height
nsCOMPtr< nsIWidget > mWidget
virtual void MoveVideoWindow(int x, int y, int width, int height)=0
nsCOMPtr< nsIBoxObject > mVideoBox
nsCOMPtr< nsIDOMDocument > mDocument
virtual void PrepareVideoWindow(GstMessage *aMessage)
virtual void FullScreen()=0
nsresult CreateDOMKeyEvent(nsIDOMKeyEvent **aKeyEvent)