QtGStreamer  0.10.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
xoverlay.cpp
1 /*
2  Copyright (C) 2010 George Kiagiadakis <kiagiadakis.george@gmail.com>
3 
4  This library is free software; you can redistribute it and/or modify
5  it under the terms of the GNU Lesser General Public License as published
6  by the Free Software Foundation; either version 2.1 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17 #include "xoverlay.h"
18 #include <gst/interfaces/xoverlay.h>
19 #include <QtCore/QRect>
20 
21 namespace QGst {
22 
23 void XOverlay::expose()
24 {
25  gst_x_overlay_expose(object<GstXOverlay>());
26 }
27 
28 void XOverlay::setWindowHandle(WId id)
29 {
30 #if defined(Q_WS_WIN)
31  QGLIB_STATIC_ASSERT(sizeof(WId) == sizeof(guintptr),
32  "Size of WId doesn't match guintptr. Please file a bug report.");
33  gst_x_overlay_set_window_handle(object<GstXOverlay>(), *reinterpret_cast<guintptr*>(&id));
34 #else
35  gst_x_overlay_set_window_handle(object<GstXOverlay>(), id);
36 #endif
37 }
38 
39 void XOverlay::enableEventHandling(bool enabled)
40 {
41  gst_x_overlay_handle_events(object<GstXOverlay>(), enabled);
42 }
43 
44 bool XOverlay::setRenderRectangle(int x, int y, int width, int height)
45 {
46  return gst_x_overlay_set_render_rectangle(object<GstXOverlay>(), x, y, width, height);
47 }
48 
49 bool XOverlay::setRenderRectangle(const QRect& rect)
50 {
51  return setRenderRectangle(rect.x(), rect.y(), rect.width(), rect.height());
52 }
53 
54 } //namespace QGst