gstreamermm 1.10.0

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gst::VideoOverlay Class Reference
gstreamermm Interfaces

An interface for setting/getting a Window on elements supporting it. More...

`#include <gstreamermm/videooverlay.h>`

Inheritance diagram for Gst::VideoOverlay:
[legend]

## Public Member Functions
| VideoOverlay (VideoOverlay&& src) noexcept
VideoOverlay& | operator= (VideoOverlay&& src) noexcept
| ~VideoOverlay () noexcept override
GstVideoOverlay* | gobj ()
| Provides access to the underlying C GObject. More...
const GstVideoOverlay* | gobj () const
| Provides access to the underlying C GObject. More...
void | set_window_handle (guintptr window_handle)
| This will call the video overlay's set_window_handle method. More...
void | got_window_handle (guintptr window_handle)
| This will post a "have-window-handle" element message on the bus. More...
void | prepare_window_handle ()
| This will post a "prepare-window-handle" element message on the bus to give applications an opportunity to call gst_video_overlay_set_window_handle() before a plugin creates its own window. More...
void | expose ()
| Tell an overlay that it has been exposed. More...
void | handle_events (bool handle_events)
| Tell an overlay that it should handle events from the window system. More...
bool | set_render_rectangle (int x, int y, int width, int height)
| Configure a subregion as a video target within the window set by gst_video_overlay_set_window_handle(). More...
virtual void | set_window_handle_vfunc (guintptr handle)
| Virtual method to configure the window handle. More...
virtual void | expose_vfunc ()
| Virtual method to handle expose events. More...
virtual void | handle_events_vfunc (bool handle_events)
| Virtual method to handle events. More...
virtual void | set_render_rectangle_vfunc (int x, int y, int width, int height)
| Virtual method to set the render rectangle. More...
Public Member Functions inherited from Glib::Interface
| Interface ()
| Interface (Interface &&src) noexcept
Interface & | operator= (Interface &&src) noexcept
| Interface (const Glib::Interface_Class &interface_class)
| Interface (GObject *castitem)
| ~Interface () noexcept override
| Interface (const Interface &)=delete
Interface & | operator= (const Interface &)=delete
GObject * | gobj ()
const GObject * | gobj () const
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
void | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
void | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void > &&slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, sigc::slot< void > &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src)
| ~trackable ()
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src)
void | remove_destroy_notify_callback (void *data) const

## Static Public Member Functions
static void | add_interface (GType gtype_implementer)
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...

## Protected Member Functions
| VideoOverlay ()
| You should derive from this class to use it. More...
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gst::VideoOverlay > | wrap (GstVideoOverlay* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Additional Inherited Members
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify

## Detailed Description

An interface for setting/getting a Window on elements supporting it.

The VideoOverlay interface is used for 2 main purposes :

- To get a grab on the Window where the video sink element is going to render. This is achieved by either being informed about the Window identifier that the video sink element generated, or by forcing the video sink element to use a specific Window identifier for rendering.
- To force a redrawing of the latest video frame the video sink element displayed on the Window. Indeed if the Pipeline is in STATE_PAUSED state, moving the Window around will damage its content. Application developers will want to handle the Expose events themselves and force the video sink element to refresh the Window's content.

Using the Window created by the video sink is probably the simplest scenario, in some cases, though, it might not be flexible enough for application developers if they need to catch events such as mouse moves and button clicks.

Setting a specific Window identifier on the video sink element is the most flexible solution but it has some issues. Indeed the application needs to set its Window identifier at the right time to avoid internal Window creation from the video sink element. To solve this issue a Message is posted on the bus to inform the application that it should set the Window identifier immediately. Here is an example on how to do that correctly:

#include <gdk/gdkx.h>
...
void PlayerWindow::on_bus_message_sync(
const Glib::RefPtr<Gst::Message>& message)
{
// ignore anything but 'prepare-xwindow-id' element messages
if(message->get_message_type() != Gst::MESSAGE_ELEMENT)
return;
if(!message->get_structure().has_name("prepare-xwindow-id"))
return;
Glib::RefPtr<Gst::Element> element =
Glib::RefPtr<Gst::Element>::cast_dynamic(message->get_source());
Glib::RefPtr< Gst::ElementInterfaced<Gst::XOverlay> > xoverlay =
Gst::Interface::cast <Gst::XOverlay>(element);
if(xoverlay)
{
const gulong xWindowId =
GDK_WINDOW_XID(widget->get_window()->gobj());
xoverlay->set_xwindow_id(xWindowId);
}
}
...
int main (int argc, char *argv[])
{
...
// Get the bus from the pipeline:
Glib::RefPtr<Gst::Bus> bus = pipeline->get_bus();
// Enable synchronous message emission:
bus->enable_sync_message_emission();
// Connect to bus's synchronous message signal:
bus->signal_sync_message().connect(
sigc::mem_fun(*this, &PlayerWindow::on_bus_message_sync));
...
}

## Constructor & Destructor Documentation

## ◆ VideoOverlay() [1/2]

Gst::VideoOverlay::VideoOverlay | ( |  | ) |
| protected

You should derive from this class to use it.

## ◆ VideoOverlay() [2/2]

Gst::VideoOverlay::VideoOverlay | ( | VideoOverlay&& | src | ) |
| noexcept

## ◆ ~VideoOverlay()

Gst::VideoOverlay::~VideoOverlay | ( |  | ) |
| override noexcept

## Member Function Documentation

## ◆ add_interface()

static void Gst::VideoOverlay::add_interface | ( | GType | gtype_implementer | ) |
| static

## ◆ expose()

void Gst::VideoOverlay::expose | ( |  | ) |

Tell an overlay that it has been exposed.

This will redraw the current frame in the drawable even if the pipeline is PAUSED.

## ◆ expose_vfunc()

virtual void Gst::VideoOverlay::expose_vfunc | ( |  | ) |
| virtual

Virtual method to handle expose events.

## ◆ get_type()

static GType Gst::VideoOverlay::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ gobj() [1/2]

GstVideoOverlay* Gst::VideoOverlay::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GstVideoOverlay* Gst::VideoOverlay::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ got_window_handle()

void Gst::VideoOverlay::got_window_handle | ( | guintptr | window_handle | ) |

This will post a "have-window-handle" element message on the bus.

This function should only be used by video overlay plugin developers.

Parameters

  window_handle | A platform-specific handle referencing the window.

## ◆ handle_events()

void Gst::VideoOverlay::handle_events | ( | bool | handle_events | ) |

Tell an overlay that it should handle events from the window system.

These events are forwarded upstream as navigation events. In some window system, events are not propagated in the window hierarchy if a client is listening for them. This method allows you to disable events handling completely from the Gst::VideoOverlay.

Parameters

  handle_events | A `bool` indicating if events should be handled or not.

## ◆ handle_events_vfunc()

virtual void Gst::VideoOverlay::handle_events_vfunc | ( | bool | handle_events | ) |
| virtual

Virtual method to handle events.

## ◆ operator=()

VideoOverlay& Gst::VideoOverlay::operator= | ( | VideoOverlay&& | src | ) |
| noexcept

## ◆ prepare_window_handle()

void Gst::VideoOverlay::prepare_window_handle | ( |  | ) |

This will post a "prepare-window-handle" element message on the bus to give applications an opportunity to call gst_video_overlay_set_window_handle() before a plugin creates its own window.

This function should only be used by video overlay plugin developers.

## ◆ set_render_rectangle()

bool Gst::VideoOverlay::set_render_rectangle | ( | int | x,
|  | int | y,
|  | int | width,
|  | int | height
| ) |  |

Configure a subregion as a video target within the window set by gst_video_overlay_set_window_handle().

If this is not used or not supported the video will fill the area of the window set as the overlay to 100%. By specifying the rectangle, the video can be overlayed to a specific region of that window only. After setting the new rectangle one should call gst_video_overlay_expose() to force a redraw. To unset the region pass -1 for the width and height parameters.

This method is needed for non fullscreen video overlay in UI toolkits that do not support subwindows.

Parameters

  x | The horizontal offset of the render area inside the window.
  y | The vertical offset of the render area inside the window.
  width | The width of the render area inside the window.
  height | The height of the render area inside the window.

Returns
  `false` if not supported by the sink.

## ◆ set_render_rectangle_vfunc()

virtual void Gst::VideoOverlay::set_render_rectangle_vfunc | ( | int | x,
|  | int | y,
|  | int | width,
|  | int | height
| ) |  |
| virtual

Virtual method to set the render rectangle.

## ◆ set_window_handle()

void Gst::VideoOverlay::set_window_handle | ( | guintptr | window_handle | ) |

This will call the video overlay's set_window_handle method.

You should use this method to tell to an overlay to display video output to a specific window (e.g. an XWindow on X11). Passing 0 as the window_handle will tell the overlay to stop using that window and create an internal one.

Parameters

  window_handle | A handle referencing the window.

## ◆ set_window_handle_vfunc()

virtual void Gst::VideoOverlay::set_window_handle_vfunc | ( | guintptr | handle | ) |
| virtual

Virtual method to configure the window handle.

## Friends And Related Function Documentation

## ◆ wrap()

Glib::RefPtr< Gst::VideoOverlay > wrap | ( | GstVideoOverlay * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.

Glib::RefPtr::cast_dynamic
static RefPtr cast_dynamic(const RefPtr< T_CastFrom > &src) noexcept
Gst::MESSAGE_ELEMENT
@ MESSAGE_ELEMENT
Definition: message.h:238
Glib::RefPtr
sigc::mem_fun
bound_const_volatile_mem_functor0< T_return, T_obj > mem_fun(T_obj &_A_obj, T_return(T_obj2::*_A_func)() const volatile)