Debian Codegraph @

gstreamer/gstreamermm/videooverlay.h

raw symbols SCIP
1 // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!
2 #ifndef _GSTREAMERMM_VIDEOOVERLAY_H
3 #define _GSTREAMERMM_VIDEOOVERLAY_H
4
5
6 #include <glibmm/ustring.h>
7 #include <sigc++/sigc++.h>
8
9 /* gstreamermm - a C++ wrapper for gstreamer
10 *
11 * Copyright 2008 The gstreamermm Development Team
12 *
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 2.1 of the License, or (at your option) any later version.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27
28 #include <gst/video/videooverlay.h>
29 #include <glibmm/interface.h>
30
31
32 #ifndef DOXYGEN_SHOULD_SKIP_THIS
33 using GstVideoOverlay = struct _GstVideoOverlay;
34 using GstVideoOverlayClass = struct _GstVideoOverlayClass;
35 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
36
37
38 #ifndef DOXYGEN_SHOULD_SKIP_THIS
39 namespace Gst
40 { class VideoOverlay_Class; } // namespace Gst
41 #endif // DOXYGEN_SHOULD_SKIP_THIS
42
43 namespace Gst
44 {
45
46 /** An interface for setting/getting a Window on elements supporting it.
47 * The VideoOverlay interface is used for 2 main purposes :
48 *
49 * - To get a grab on the Window where the video sink element is going to
50 * render. This is achieved by either being informed about the Window
51 * identifier that the video sink element generated, or by forcing the video
52 * sink element to use a specific Window identifier for rendering.
53 *
54 * - To force a redrawing of the latest video frame the video sink element
55 * displayed on the Window. Indeed if the Pipeline is in STATE_PAUSED state,
56 * moving the Window around will damage its content. Application developers
57 * will want to handle the Expose events themselves and force the video sink
58 * element to refresh the Window's content.
59 *
60 * Using the Window created by the video sink is probably the simplest
61 * scenario, in some cases, though, it might not be flexible enough for
62 * application developers if they need to catch events such as mouse moves and
63 * button clicks.
64 *
65 * Setting a specific Window identifier on the video sink element is the most
66 * flexible solution but it has some issues. Indeed the application needs to
67 * set its Window identifier at the right time to avoid internal Window
68 * creation from the video sink element. To solve this issue a Message is
69 * posted on the bus to inform the application that it should set the Window
70 * identifier immediately. Here is an example on how to do that correctly:
71 *
72 * @code
73 * #include <gdk/gdkx.h>
74 * ...
75 * void PlayerWindow::on_bus_message_sync(
76 * const Glib::RefPtr<Gst::Message>& message)
77 * {
78 * // ignore anything but 'prepare-xwindow-id' element messages
79 * if(message->get_message_type() != Gst::MESSAGE_ELEMENT)
80 * return;
81 *
82 * if(!message->get_structure().has_name("prepare-xwindow-id"))
83 * return;
84 *
85 * Glib::RefPtr<Gst::Element> element =
86 * Glib::RefPtr<Gst::Element>::cast_dynamic(message->get_source());
87 *
88 * Glib::RefPtr< Gst::ElementInterfaced<Gst::XOverlay> > xoverlay =
89 * Gst::Interface::cast <Gst::XOverlay>(element);
90 *
91 * if(xoverlay)
92 * {
93 * const gulong xWindowId =
94 * GDK_WINDOW_XID(widget->get_window()->gobj());
95 * xoverlay->set_xwindow_id(xWindowId);
96 * }
97 * }
98 * ...
99 * int main (int argc, char *argv[])
100 * {
101 * ...
102 * // Get the bus from the pipeline:
103 * Glib::RefPtr<Gst::Bus> bus = pipeline->get_bus();
104 *
105 * // Enable synchronous message emission:
106 * bus->enable_sync_message_emission();
107 *
108 * // Connect to bus's synchronous message signal:
109 * bus->signal_sync_message().connect(
110 * sigc::mem_fun(*this, &PlayerWindow::on_bus_message_sync));
111 * ...
112 * }
113 * @endcode
114 * @ingroup GstInterfaces
115 */
116
117 class VideoOverlay : public Glib::Interface
118 {
119
120 #ifndef DOXYGEN_SHOULD_SKIP_THIS
121
122 public:
123 using CppObjectType = VideoOverlay;
124 using CppClassType = VideoOverlay_Class;
125 using BaseObjectType = GstVideoOverlay;
126 using BaseClassType = GstVideoOverlayInterface;
127
128 // noncopyable
129 VideoOverlay(const VideoOverlay&) = delete;
130 VideoOverlay& operator=(const VideoOverlay&) = delete;
131
132 private:
133 friend class VideoOverlay_Class;
134 static CppClassType videooverlay_class_;
135
136 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
137 protected:
138 /**
139 * You should derive from this class to use it.
140 */
141 VideoOverlay();
142
143 #ifndef DOXYGEN_SHOULD_SKIP_THIS
144 /** Called by constructors of derived classes. Provide the result of
145 * the Class init() function to ensure that it is properly
146 * initialized.
147 *
148 * @param interface_class The Class object for the derived type.
149 */
150 explicit VideoOverlay(const Glib::Interface_Class& interface_class);
151
152 public:
153 // This is public so that C++ wrapper instances can be
154 // created for C instances of unwrapped types.
155 // For instance, if an unexpected C type implements the C interface.
156 explicit VideoOverlay(GstVideoOverlay* castitem);
157
158 protected:
159 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
160
161 public:
162
163 VideoOverlay(VideoOverlay&& src) noexcept;
164 VideoOverlay& operator=(VideoOverlay&& src) noexcept;
165
166 ~VideoOverlay() noexcept override;
167
168 static void add_interface(GType gtype_implementer);
169
170 /** Get the GType for this class, for use with the underlying GObject type system.
171 */
172 static GType get_type() G_GNUC_CONST;
173
174 #ifndef DOXYGEN_SHOULD_SKIP_THIS
175 static GType get_base_type() G_GNUC_CONST;
176 #endif
177
178 ///Provides access to the underlying C GObject.
179 GstVideoOverlay* gobj() { return reinterpret_cast<GstVideoOverlay*>(gobject_); }
180
181 ///Provides access to the underlying C GObject.
182 const GstVideoOverlay* gobj() const { return reinterpret_cast<GstVideoOverlay*>(gobject_); }
183
184 private:
185
186
187 public:
188
189 /** This will call the video overlay's set_window_handle method. You
190 * should use this method to tell to an overlay to display video output to a
191 * specific window (e.g. an XWindow on X11). Passing 0 as the @a window_handle will
192 * tell the overlay to stop using that window and create an internal one.
193 *
194 * @param window_handle A handle referencing the window.
195 */
196 void set_window_handle(guintptr window_handle);
197
198 /** This will post a "have-window-handle" element message on the bus.
199 *
200 * This function should only be used by video overlay plugin developers.
201 *
202 * @param window_handle A platform-specific handle referencing the window.
203 */
204 void got_window_handle(guintptr window_handle);
205
206 /** This will post a "prepare-window-handle" element message on the bus
207 * to give applications an opportunity to call
208 * gst_video_overlay_set_window_handle() before a plugin creates its own
209 * window.
210 *
211 * This function should only be used by video overlay plugin developers.
212 */
213 void prepare_window_handle();
214
215 /** Tell an overlay that it has been exposed. This will redraw the current frame
216 * in the drawable even if the pipeline is PAUSED.
217 */
218 void expose();
219
220 /** Tell an overlay that it should handle events from the window system. These
221 * events are forwarded upstream as navigation events. In some window system,
222 * events are not propagated in the window hierarchy if a client is listening
223 * for them. This method allows you to disable events handling completely
224 * from the Gst::VideoOverlay.
225 *
226 * @param handle_events A <tt>bool</tt> indicating if events should be handled or not.
227 */
228 void handle_events(bool handle_events);
229
230 /** Configure a subregion as a video target within the window set by
231 * gst_video_overlay_set_window_handle(). If this is not used or not supported
232 * the video will fill the area of the window set as the overlay to 100%.
233 * By specifying the rectangle, the video can be overlayed to a specific region
234 * of that window only. After setting the new rectangle one should call
235 * gst_video_overlay_expose() to force a redraw. To unset the region pass -1 for
236 * the @a width and @a height parameters.
237 *
238 * This method is needed for non fullscreen video overlay in UI toolkits that
239 * do not support subwindows.
240 *
241 * @param x The horizontal offset of the render area inside the window.
242 * @param y The vertical offset of the render area inside the window.
243 * @param width The width of the render area inside the window.
244 * @param height The height of the render area inside the window.
245 * @return <tt>false</tt> if not supported by the sink.
246 */
247 bool set_render_rectangle(int x, int y, int width, int height);
248
249 /** Virtual method to configure the window handle.
250 */
251 virtual void set_window_handle_vfunc(guintptr handle);
252
253
254 /** Virtual method to handle expose events.
255 */
256 virtual void expose_vfunc();
257
258
259 /** Virtual method to handle events.
260 */
261 virtual void handle_events_vfunc(bool handle_events);
262
263
264 /** Virtual method to set the render rectangle.
265 */
266 virtual void set_render_rectangle_vfunc(int x, int y, int width, int height);
267
268
269 public:
270
271 public:
272 //C++ methods used to invoke GTK+ virtual functions:
273
274 protected:
275 //GTK+ Virtual Functions (override these to change behaviour):
276
277 //Default Signal Handlers::
278
279
280 };
281
282 } // namespace Gst
283
284
285 namespace Glib
286 {
287 /** A Glib::wrap() method for this object.
288 *
289 * @param object The C instance.
290 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
291 * @result A C++ instance that wraps this C instance.
292 *
293 * @relates Gst::VideoOverlay
294 */
295 Glib::RefPtr<Gst::VideoOverlay> wrap(GstVideoOverlay* object, bool take_copy = false);
296
297 } // namespace Glib
298
299
300 #endif /* _GSTREAMERMM_VIDEOOVERLAY_H */
301