QtGStreamer  1.2.0
videooverlay.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 
18 #include "videooverlay.h"
19 #include "message.h"
20 #include <gst/video/videooverlay.h>
21 #include <QtCore/QRect>
22 
23 namespace QGst {
24 
25 void VideoOverlay::expose()
26 {
27  gst_video_overlay_expose(object<GstVideoOverlay>());
28 }
29 
30 void VideoOverlay::setWindowHandle(WId id)
31 {
32 #if defined(Q_WS_WIN)
33  QGLIB_STATIC_ASSERT(sizeof(WId) == sizeof(guintptr),
34  "Size of WId doesn't match guintptr. Please file a bug report.");
35  gst_video_overlay_set_window_handle(object<GstVideoOverlay>(), *reinterpret_cast<guintptr*>(&id));
36 #else
37  gst_video_overlay_set_window_handle(object<GstVideoOverlay>(), id);
38 #endif
39 }
40 
41 void VideoOverlay::enableEventHandling(bool enabled)
42 {
43  gst_video_overlay_handle_events(object<GstVideoOverlay>(), enabled);
44 }
45 
46 bool VideoOverlay::setRenderRectangle(int x, int y, int width, int height)
47 {
48  return gst_video_overlay_set_render_rectangle(object<GstVideoOverlay>(), x, y, width, height);
49 }
50 
51 bool VideoOverlay::setRenderRectangle(const QRect& rect)
52 {
53  return setRenderRectangle(rect.x(), rect.y(), rect.width(), rect.height());
54 }
55 
56 bool VideoOverlay::isPrepareWindowHandleMessage(const MessagePtr & msg)
57 {
58  return gst_is_video_overlay_prepare_window_handle_message(msg);
59 }
60 
61 } //namespace QGst
Wrappers for GStreamer classes.