Blame docs/libs/html/GstVideoOverlay.html

Packit 0652a1
Packit 0652a1
<html>
Packit 0652a1
<head>
Packit 0652a1
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Packit 0652a1
<title>GstVideoOverlay: GStreamer Base Plugins 1.0 Library Reference Manual</title>
Packit 0652a1
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
Packit 0652a1
<link rel="home" href="index.html" title="GStreamer Base Plugins 1.0 Library Reference Manual">
Packit 0652a1
<link rel="up" href="gstreamer-video.html" title="Video Library">
Packit 0652a1
<link rel="prev" href="GstVideoOrientation.html" title="GstVideoOrientation">
Packit 0652a1
<link rel="next" href="GstVideoDecoder.html" title="GstVideoDecoder">
Packit 0652a1
<meta name="generator" content="GTK-Doc V1.28 (XML mode)">
Packit 0652a1
<link rel="stylesheet" href="style.css" type="text/css">
Packit 0652a1
</head>
Packit 0652a1
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit 0652a1
Packit 0652a1
Packit 0652a1
Top  | 
Packit 0652a1
                  Description  | 
Packit 0652a1
                  Object Hierarchy
Packit 0652a1
Packit 0652a1
Home
Packit 0652a1
Up
Packit 0652a1
Prev
Packit 0652a1
Next
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1

GstVideoOverlay

Packit 0652a1

GstVideoOverlay — Interface for setting/getting a window system resource

Packit 0652a1
   on elements supporting it to configure a window into which to render a
Packit 0652a1
   video.

Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1

Functions

Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
void
Packit 0652a1
Packit 0652a1
Packit 0652a1
gst_video_overlay_got_window_handle ()
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
void
Packit 0652a1
Packit 0652a1
Packit 0652a1
gst_video_overlay_set_window_handle ()
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
void
Packit 0652a1
Packit 0652a1
Packit 0652a1
gst_video_overlay_prepare_window_handle ()
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
void
Packit 0652a1
Packit 0652a1
Packit 0652a1
gst_video_overlay_expose ()
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
void
Packit 0652a1
Packit 0652a1
Packit 0652a1
gst_video_overlay_handle_events ()
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
gboolean
Packit 0652a1
Packit 0652a1
Packit 0652a1
gst_video_overlay_set_render_rectangle ()
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
gboolean
Packit 0652a1
Packit 0652a1
Packit 0652a1
gst_is_video_overlay_prepare_window_handle_message ()
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
void
Packit 0652a1
Packit 0652a1
Packit 0652a1
gst_video_overlay_install_properties ()
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
gboolean
Packit 0652a1
Packit 0652a1
Packit 0652a1
gst_video_overlay_set_property ()
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1

Types and Values

Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
 
Packit 0652a1
GstVideoOverlay
Packit 0652a1
Packit 0652a1
Packit 0652a1
struct
Packit 0652a1
GstVideoOverlayInterface
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1

Object Hierarchy

Packit 0652a1
    GInterface
Packit 0652a1
    ╰── GstVideoOverlay
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1

Includes

Packit 0652a1
#include <gst/video/video.h>
Packit 0652a1
Packit 0652a1
Packit 0652a1
Packit 0652a1

Description

Packit 0652a1

The GstVideoOverlay interface is used for 2 main purposes :

Packit 0652a1
    Packit 0652a1
  • To get a grab on the Window where the video sink element is going to render.

  • Packit 0652a1
    This is achieved by either being informed about the Window identifier that
    Packit 0652a1
    the video sink element generated, or by forcing the video sink element to use
    Packit 0652a1
    a specific Window identifier for rendering.

    Packit 0652a1
  • To force a redrawing of the latest video frame the video sink element

  • Packit 0652a1
    displayed on the Window. Indeed if the GstPipeline is in GST_STATE_PAUSED
    Packit 0652a1
    state, moving the Window around will damage its content. Application
    Packit 0652a1
    developers will want to handle the Expose events themselves and force the
    Packit 0652a1
    video sink element to refresh the Window's content.

    Packit 0652a1
    Packit 0652a1

    Using the Window created by the video sink is probably the simplest scenario,

    Packit 0652a1
    in some cases, though, it might not be flexible enough for application
    Packit 0652a1
    developers if they need to catch events such as mouse moves and button
    Packit 0652a1
    clicks.

    Packit 0652a1

    Setting a specific Window identifier on the video sink element is the most

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

    Packit 0652a1
    Packit 0652a1
      
    Packit 0652a1
        
    Packit 0652a1
          
    Packit 0652a1
            
    1
    Packit 0652a1
    2
    Packit 0652a1
    3
    Packit 0652a1
    4
    Packit 0652a1
    5
    Packit 0652a1
    6
    Packit 0652a1
    7
    Packit 0652a1
    8
    Packit 0652a1
    9
    Packit 0652a1
    10
    Packit 0652a1
    11
    Packit 0652a1
    12
    Packit 0652a1
    13
    Packit 0652a1
    14
    Packit 0652a1
    15
    Packit 0652a1
    16
    Packit 0652a1
    17
    Packit 0652a1
    18
    Packit 0652a1
    19
    Packit 0652a1
    20
    Packit 0652a1
    21
    Packit 0652a1
    22
    Packit 0652a1
    23
    Packit 0652a1
    24
    Packit 0652a1
    25
    Packit 0652a1
    26
    Packit 0652a1
    27
    Packit 0652a1
    28
    Packit 0652a1
    29
    Packit 0652a1
    30
    Packit 0652a1
    31
    Packit 0652a1
    32
    Packit 0652a1
            
    static GstBusSyncReply
    Packit 0652a1
    create_window (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
    Packit 0652a1
    {
    Packit 0652a1
     // ignore anything but 'prepare-window-handle' element messages
    Packit 0652a1
     if (!gst_is_video_overlay_prepare_window_handle_message (message))
    Packit 0652a1
       return GST_BUS_PASS;
    Packit 0652a1
    Packit 0652a1
     win = XCreateSimpleWindow (disp, root, 0, 0, 320, 240, 0, 0, 0);
    Packit 0652a1
    Packit 0652a1
     XSetWindowBackgroundPixmap (disp, win, None);
    Packit 0652a1
    Packit 0652a1
     XMapRaised (disp, win);
    Packit 0652a1
    Packit 0652a1
     XSync (disp, FALSE);
    Packit 0652a1
    Packit 0652a1
     gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message)),
    Packit 0652a1
         win);
    Packit 0652a1
    Packit 0652a1
     gst_message_unref (message);
    Packit 0652a1
    Packit 0652a1
     return GST_BUS_DROP;
    Packit 0652a1
    }
    Packit 0652a1
    ...
    Packit 0652a1
    int
    Packit 0652a1
    main (int argc, char **argv)
    Packit 0652a1
    {
    Packit 0652a1
    ...
    Packit 0652a1
     bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
    Packit 0652a1
     gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, pipeline,
    Packit 0652a1
            NULL);
    Packit 0652a1
    ...
    Packit 0652a1
    }
    Packit 0652a1
          
    Packit 0652a1
        
    Packit 0652a1
      
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    Packit 0652a1
    Packit 0652a1

    Two basic usage scenarios

    Packit 0652a1

    There are two basic usage scenarios: in the simplest case, the application

    Packit 0652a1
    uses playbin or plasink or knows exactly what particular element is used
    Packit 0652a1
    for video output, which is usually the case when the application creates
    Packit 0652a1
    the videosink to use (e.g. xvimagesink, ximagesink, etc.) itself; in this
    Packit 0652a1
    case, the application can just create the videosink element, create and
    Packit 0652a1
    realize the window to render the video on and then
    Packit 0652a1
    call gst_video_overlay_set_window_handle() directly with the XID or native
    Packit 0652a1
    window handle, before starting up the pipeline.
    Packit 0652a1
    As playbin and playsink implement the video overlay interface and proxy
    Packit 0652a1
    it transparently to the actual video sink even if it is created later, this
    Packit 0652a1
    case also applies when using these elements.

    Packit 0652a1

    In the other and more common case, the application does not know in advance

    Packit 0652a1
    what GStreamer video sink element will be used for video output. This is
    Packit 0652a1
    usually the case when an element such as autovideosink is used.
    Packit 0652a1
    In this case, the video sink element itself is created
    Packit 0652a1
    asynchronously from a GStreamer streaming thread some time after the
    Packit 0652a1
    pipeline has been started up. When that happens, however, the video sink
    Packit 0652a1
    will need to know right then whether to render onto an already existing
    Packit 0652a1
    application window or whether to create its own window. This is when it
    Packit 0652a1
    posts a prepare-window-handle message, and that is also why this message needs
    Packit 0652a1
    to be handled in a sync bus handler which will be called from the streaming
    Packit 0652a1
    thread directly (because the video sink will need an answer right then).

    Packit 0652a1

    As response to the prepare-window-handle element message in the bus sync

    Packit 0652a1
    handler, the application may use gst_video_overlay_set_window_handle() to tell
    Packit 0652a1
    the video sink to render onto an existing window surface. At this point the
    Packit 0652a1
    application should already have obtained the window handle / XID, so it
    Packit 0652a1
    just needs to set it. It is generally not advisable to call any GUI toolkit
    Packit 0652a1
    functions or window system functions from the streaming thread in which the
    Packit 0652a1
    prepare-window-handle message is handled, because most GUI toolkits and
    Packit 0652a1
    windowing systems are not thread-safe at all and a lot of care would be
    Packit 0652a1
    required to co-ordinate the toolkit and window system calls of the
    Packit 0652a1
    different threads (Gtk+ users please note: prior to Gtk+ 2.18
    Packit 0652a1
    GDK_WINDOW_XID() was just a simple structure access, so generally fine to do
    Packit 0652a1
    within the bus sync handler; this macro was changed to a function call in
    Packit 0652a1
    Gtk+ 2.18 and later, which is likely to cause problems when called from a
    Packit 0652a1
    sync handler; see below for a better approach without GDK_WINDOW_XID()
    Packit 0652a1
    used in the callback).

    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    GstVideoOverlay and Gtk+

    Packit 0652a1
    Packit 0652a1
      
    Packit 0652a1
        
    Packit 0652a1
          
    Packit 0652a1
            
    1
    Packit 0652a1
    2
    Packit 0652a1
    3
    Packit 0652a1
    4
    Packit 0652a1
    5
    Packit 0652a1
    6
    Packit 0652a1
    7
    Packit 0652a1
    8
    Packit 0652a1
    9
    Packit 0652a1
    10
    Packit 0652a1
    11
    Packit 0652a1
    12
    Packit 0652a1
    13
    Packit 0652a1
    14
    Packit 0652a1
    15
    Packit 0652a1
    16
    Packit 0652a1
    17
    Packit 0652a1
    18
    Packit 0652a1
    19
    Packit 0652a1
    20
    Packit 0652a1
    21
    Packit 0652a1
    22
    Packit 0652a1
    23
    Packit 0652a1
    24
    Packit 0652a1
    25
    Packit 0652a1
    26
    Packit 0652a1
    27
    Packit 0652a1
    28
    Packit 0652a1
    29
    Packit 0652a1
    30
    Packit 0652a1
    31
    Packit 0652a1
    32
    Packit 0652a1
    33
    Packit 0652a1
    34
    Packit 0652a1
    35
    Packit 0652a1
    36
    Packit 0652a1
    37
    Packit 0652a1
    38
    Packit 0652a1
    39
    Packit 0652a1
    40
    Packit 0652a1
    41
    Packit 0652a1
    42
    Packit 0652a1
    43
    Packit 0652a1
    44
    Packit 0652a1
    45
    Packit 0652a1
    46
    Packit 0652a1
    47
    Packit 0652a1
    48
    Packit 0652a1
    49
    Packit 0652a1
    50
    Packit 0652a1
    51
    Packit 0652a1
    52
    Packit 0652a1
    53
    Packit 0652a1
    54
    Packit 0652a1
    55
    Packit 0652a1
    56
    Packit 0652a1
    57
    Packit 0652a1
    58
    Packit 0652a1
    59
    Packit 0652a1
    60
    Packit 0652a1
    61
    Packit 0652a1
    62
    Packit 0652a1
    63
    Packit 0652a1
    64
    Packit 0652a1
    65
    Packit 0652a1
    66
    Packit 0652a1
    67
    Packit 0652a1
    68
    Packit 0652a1
    69
    Packit 0652a1
    70
    Packit 0652a1
    71
    Packit 0652a1
    72
    Packit 0652a1
    73
    Packit 0652a1
    74
    Packit 0652a1
    75
    Packit 0652a1
    76
    Packit 0652a1
    77
    Packit 0652a1
    78
    Packit 0652a1
    79
    Packit 0652a1
    80
    Packit 0652a1
    81
    Packit 0652a1
    82
    Packit 0652a1
    83
    Packit 0652a1
    84
    Packit 0652a1
    85
    Packit 0652a1
    86
    Packit 0652a1
    87
    Packit 0652a1
    88
    Packit 0652a1
    89
    Packit 0652a1
    90
    Packit 0652a1
    91
    Packit 0652a1
    92
    Packit 0652a1
    93
    Packit 0652a1
    94
    Packit 0652a1
    95
    Packit 0652a1
    96
    Packit 0652a1
            
    #include <gst/video/videooverlay.h>
    Packit 0652a1
    #include <gtk/gtk.h>
    Packit 0652a1
    #ifdef GDK_WINDOWING_X11
    Packit 0652a1
    #include <gdk/gdkx.h>  // for GDK_WINDOW_XID
    Packit 0652a1
    #endif
    Packit 0652a1
    #ifdef GDK_WINDOWING_WIN32
    Packit 0652a1
    #include <gdk/gdkwin32.h>  // for GDK_WINDOW_HWND
    Packit 0652a1
    #endif
    Packit 0652a1
    ...
    Packit 0652a1
    static guintptr video_window_handle = 0;
    Packit 0652a1
    ...
    Packit 0652a1
    static GstBusSyncReply
    Packit 0652a1
    bus_sync_handler (GstBus * bus, GstMessage * message, gpointer user_data)
    Packit 0652a1
    {
    Packit 0652a1
     // ignore anything but 'prepare-window-handle' element messages
    Packit 0652a1
     if (!gst_is_video_overlay_prepare_window_handle_message (message))
    Packit 0652a1
       return GST_BUS_PASS;
    Packit 0652a1
    Packit 0652a1
     if (video_window_handle != 0) {
    Packit 0652a1
       GstVideoOverlay *overlay;
    Packit 0652a1
    Packit 0652a1
       // GST_MESSAGE_SRC (message) will be the video sink element
    Packit 0652a1
       overlay = GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message));
    Packit 0652a1
       gst_video_overlay_set_window_handle (overlay, video_window_handle);
    Packit 0652a1
     } else {
    Packit 0652a1
       g_warning ("Should have obtained video_window_handle by now!");
    Packit 0652a1
     }
    Packit 0652a1
    Packit 0652a1
     gst_message_unref (message);
    Packit 0652a1
     return GST_BUS_DROP;
    Packit 0652a1
    }
    Packit 0652a1
    ...
    Packit 0652a1
    static void
    Packit 0652a1
    video_widget_realize_cb (GtkWidget * widget, gpointer data)
    Packit 0652a1
    {
    Packit 0652a1
    #if GTK_CHECK_VERSION(2,18,0)
    Packit 0652a1
      // Tell Gtk+/Gdk to create a native window for this widget instead of
    Packit 0652a1
      // drawing onto the parent widget.
    Packit 0652a1
      // This is here just for pedagogical purposes, GDK_WINDOW_XID will call
    Packit 0652a1
      // it as well in newer Gtk versions
    Packit 0652a1
      if (!gdk_window_ensure_native (widget->window))
    Packit 0652a1
        g_error ("Couldn't create native window needed for GstVideoOverlay!");
    Packit 0652a1
    #endif
    Packit 0652a1
    Packit 0652a1
    #ifdef GDK_WINDOWING_X11
    Packit 0652a1
      {
    Packit 0652a1
        gulong xid = GDK_WINDOW_XID (gtk_widget_get_window (video_window));
    Packit 0652a1
        video_window_handle = xid;
    Packit 0652a1
      }
    Packit 0652a1
    #endif
    Packit 0652a1
    #ifdef GDK_WINDOWING_WIN32
    Packit 0652a1
      {
    Packit 0652a1
        HWND wnd = GDK_WINDOW_HWND (gtk_widget_get_window (video_window));
    Packit 0652a1
        video_window_handle = (guintptr) wnd;
    Packit 0652a1
      }
    Packit 0652a1
    #endif
    Packit 0652a1
    }
    Packit 0652a1
    ...
    Packit 0652a1
    int
    Packit 0652a1
    main (int argc, char **argv)
    Packit 0652a1
    {
    Packit 0652a1
      GtkWidget *video_window;
    Packit 0652a1
      GtkWidget *app_window;
    Packit 0652a1
      ...
    Packit 0652a1
      app_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    Packit 0652a1
      ...
    Packit 0652a1
      video_window = gtk_drawing_area_new ();
    Packit 0652a1
      g_signal_connect (video_window, "realize",
    Packit 0652a1
          G_CALLBACK (video_widget_realize_cb), NULL);
    Packit 0652a1
      gtk_widget_set_double_buffered (video_window, FALSE);
    Packit 0652a1
      ...
    Packit 0652a1
      // usually the video_window will not be directly embedded into the
    Packit 0652a1
      // application window like this, but there will be many other widgets
    Packit 0652a1
      // and the video window will be embedded in one of them instead
    Packit 0652a1
      gtk_container_add (GTK_CONTAINER (ap_window), video_window);
    Packit 0652a1
      ...
    Packit 0652a1
      // show the GUI
    Packit 0652a1
      gtk_widget_show_all (app_window);
    Packit 0652a1
    Packit 0652a1
      // realize window now so that the video window gets created and we can
    Packit 0652a1
      // obtain its XID/HWND before the pipeline is started up and the videosink
    Packit 0652a1
      // asks for the XID/HWND of the window to render onto
    Packit 0652a1
      gtk_widget_realize (video_window);
    Packit 0652a1
    Packit 0652a1
      // we should have the XID/HWND now
    Packit 0652a1
      g_assert (video_window_handle != 0);
    Packit 0652a1
      ...
    Packit 0652a1
      // set up sync handler for setting the xid once the pipeline is started
    Packit 0652a1
      bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
    Packit 0652a1
      gst_bus_set_sync_handler (bus, (GstBusSyncHandler) bus_sync_handler, NULL,
    Packit 0652a1
          NULL);
    Packit 0652a1
      gst_object_unref (bus);
    Packit 0652a1
      ...
    Packit 0652a1
      gst_element_set_state (pipeline, GST_STATE_PLAYING);
    Packit 0652a1
      ...
    Packit 0652a1
    }
    Packit 0652a1
          
    Packit 0652a1
        
    Packit 0652a1
      
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    GstVideoOverlay and Qt

    Packit 0652a1
    Packit 0652a1
      
    Packit 0652a1
        
    Packit 0652a1
          
    Packit 0652a1
            
    1
    Packit 0652a1
    2
    Packit 0652a1
    3
    Packit 0652a1
    4
    Packit 0652a1
    5
    Packit 0652a1
    6
    Packit 0652a1
    7
    Packit 0652a1
    8
    Packit 0652a1
    9
    Packit 0652a1
    10
    Packit 0652a1
    11
    Packit 0652a1
    12
    Packit 0652a1
    13
    Packit 0652a1
    14
    Packit 0652a1
    15
    Packit 0652a1
    16
    Packit 0652a1
    17
    Packit 0652a1
    18
    Packit 0652a1
    19
    Packit 0652a1
    20
    Packit 0652a1
    21
    Packit 0652a1
    22
    Packit 0652a1
    23
    Packit 0652a1
    24
    Packit 0652a1
    25
    Packit 0652a1
    26
    Packit 0652a1
    27
    Packit 0652a1
    28
    Packit 0652a1
    29
    Packit 0652a1
    30
    Packit 0652a1
    31
    Packit 0652a1
    32
    Packit 0652a1
    33
    Packit 0652a1
    34
    Packit 0652a1
    35
    Packit 0652a1
    36
    Packit 0652a1
    37
    Packit 0652a1
    38
    Packit 0652a1
    39
    Packit 0652a1
    40
    Packit 0652a1
    41
    Packit 0652a1
    42
    Packit 0652a1
    43
    Packit 0652a1
    44
    Packit 0652a1
    45
    Packit 0652a1
    46
    Packit 0652a1
    47
    Packit 0652a1
    48
    Packit 0652a1
    49
    Packit 0652a1
    50
    Packit 0652a1
    51
    Packit 0652a1
    52
    Packit 0652a1
    53
    Packit 0652a1
            
    #include <glib.h>
    Packit 0652a1
    #include <gst/gst.h>
    Packit 0652a1
    #include <gst/video/videooverlay.h>
    Packit 0652a1
    Packit 0652a1
    #include <QApplication>
    Packit 0652a1
    #include <QTimer>
    Packit 0652a1
    #include <QWidget>
    Packit 0652a1
    Packit 0652a1
    int main(int argc, char *argv[])
    Packit 0652a1
    {
    Packit 0652a1
      if (!g_thread_supported ())
    Packit 0652a1
        g_thread_init (NULL);
    Packit 0652a1
    Packit 0652a1
      gst_init (&argc, &argv);
    Packit 0652a1
      QApplication app(argc, argv);
    Packit 0652a1
      app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit ()));
    Packit 0652a1
    Packit 0652a1
      // prepare the pipeline
    Packit 0652a1
    Packit 0652a1
      GstElement *pipeline = gst_pipeline_new ("xvoverlay");
    Packit 0652a1
      GstElement *src = gst_element_factory_make ("videotestsrc", NULL);
    Packit 0652a1
      GstElement *sink = gst_element_factory_make ("xvimagesink", NULL);
    Packit 0652a1
      gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
    Packit 0652a1
      gst_element_link (src, sink);
    Packit 0652a1
    Packit 0652a1
      // prepare the ui
    Packit 0652a1
    Packit 0652a1
      QWidget window;
    Packit 0652a1
      window.resize(320, 240);
    Packit 0652a1
      window.show();
    Packit 0652a1
    Packit 0652a1
      WId xwinid = window.winId();
    Packit 0652a1
      gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (sink), xwinid);
    Packit 0652a1
    Packit 0652a1
      // run the pipeline
    Packit 0652a1
    Packit 0652a1
      GstStateChangeReturn sret = gst_element_set_state (pipeline,
    Packit 0652a1
          GST_STATE_PLAYING);
    Packit 0652a1
      if (sret == GST_STATE_CHANGE_FAILURE) {
    Packit 0652a1
        gst_element_set_state (pipeline, GST_STATE_NULL);
    Packit 0652a1
        gst_object_unref (pipeline);
    Packit 0652a1
        // Exit application
    Packit 0652a1
        QTimer::singleShot(0, QApplication::activeWindow(), SLOT(quit()));
    Packit 0652a1
      }
    Packit 0652a1
    Packit 0652a1
      int ret = app.exec();
    Packit 0652a1
    Packit 0652a1
      window.hide();
    Packit 0652a1
      gst_element_set_state (pipeline, GST_STATE_NULL);
    Packit 0652a1
      gst_object_unref (pipeline);
    Packit 0652a1
    Packit 0652a1
      return ret;
    Packit 0652a1
    }
    Packit 0652a1
          
    Packit 0652a1
        
    Packit 0652a1
      
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    Functions

    Packit 0652a1
    Packit 0652a1

    gst_video_overlay_got_window_handle ()

    Packit 0652a1
    void
    Packit 0652a1
    gst_video_overlay_got_window_handle (GstVideoOverlay *overlay,
    Packit 0652a1
                                         guintptr handle);
    Packit 0652a1

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

    Packit 0652a1

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

    Packit 0652a1
    Packit 0652a1

    Parameters

    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    overlay

    Packit 0652a1

    a GstVideoOverlay which got a window

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    handle

    Packit 0652a1

    a platform-specific handle referencing the window

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    Packit 0652a1
    Packit 0652a1

    gst_video_overlay_set_window_handle ()

    Packit 0652a1
    void
    Packit 0652a1
    gst_video_overlay_set_window_handle (GstVideoOverlay *overlay,
    Packit 0652a1
                                         guintptr handle);
    Packit 0652a1

    This will call the video overlay's set_window_handle method. You

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

    Packit 0652a1
    Packit 0652a1

    Parameters

    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    overlay

    Packit 0652a1

    a GstVideoOverlay to set the window on.

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    handle

    Packit 0652a1

    a handle referencing the window.

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    Packit 0652a1
    Packit 0652a1

    gst_video_overlay_prepare_window_handle ()

    Packit 0652a1
    void
    Packit 0652a1
    gst_video_overlay_prepare_window_handle
    Packit 0652a1
                                   (GstVideoOverlay *overlay);
    Packit 0652a1

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

    Packit 0652a1
    to give applications an opportunity to call
    Packit 0652a1
    gst_video_overlay_set_window_handle() before a plugin creates its own
    Packit 0652a1
    window.

    Packit 0652a1

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

    Packit 0652a1
    Packit 0652a1

    Parameters

    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    overlay

    Packit 0652a1

    a GstVideoOverlay which does not yet have an Window handle set

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    Packit 0652a1
    Packit 0652a1

    gst_video_overlay_expose ()

    Packit 0652a1
    void
    Packit 0652a1
    gst_video_overlay_expose (GstVideoOverlay *overlay);
    Packit 0652a1

    Tell an overlay that it has been exposed. This will redraw the current frame

    Packit 0652a1
    in the drawable even if the pipeline is PAUSED.

    Packit 0652a1
    Packit 0652a1

    Parameters

    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    overlay

    Packit 0652a1

    a GstVideoOverlay to expose.

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    Packit 0652a1
    Packit 0652a1

    gst_video_overlay_handle_events ()

    Packit 0652a1
    void
    Packit 0652a1
    gst_video_overlay_handle_events (GstVideoOverlay *overlay,
    Packit 0652a1
                                     gboolean handle_events);
    Packit 0652a1

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

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

    Packit 0652a1
    Packit 0652a1

    Parameters

    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    overlay

    Packit 0652a1

    a GstVideoOverlay to expose.

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    handle_events

    Packit 0652a1

    a gboolean indicating if events should be handled or not.

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    Packit 0652a1
    Packit 0652a1

    gst_video_overlay_set_render_rectangle ()

    Packit 0652a1
    gboolean
    Packit 0652a1
    gst_video_overlay_set_render_rectangle
    Packit 0652a1
                                   (GstVideoOverlay *overlay,
    Packit 0652a1
                                    gint x,
    Packit 0652a1
                                    gint y,
    Packit 0652a1
                                    gint width,
    Packit 0652a1
                                    gint height);
    Packit 0652a1

    Configure a subregion as a video target within the window set by

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

    Packit 0652a1

    This method is needed for non fullscreen video overlay in UI toolkits that

    Packit 0652a1
    do not support subwindows.

    Packit 0652a1
    Packit 0652a1

    Parameters

    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    overlay

    Packit 0652a1

    a GstVideoOverlay

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    x

    Packit 0652a1

    the horizontal offset of the render area inside the window

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    y

    Packit 0652a1

    the vertical offset of the render area inside the window

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    width

    Packit 0652a1

    the width of the render area inside the window

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    height

    Packit 0652a1

    the height of the render area inside the window

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    Returns

    Packit 0652a1

    FALSE if not supported by the sink.

    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    Packit 0652a1
    Packit 0652a1

    gst_is_video_overlay_prepare_window_handle_message ()

    Packit 0652a1
    gboolean
    Packit 0652a1
    gst_is_video_overlay_prepare_window_handle_message
    Packit 0652a1
                                   (GstMessage *msg);
    Packit 0652a1

    Convenience function to check if the given message is a

    Packit 0652a1
    "prepare-window-handle" message from a GstVideoOverlay.

    Packit 0652a1
    Packit 0652a1

    Parameters

    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    msg

    Packit 0652a1

    a GstMessage

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    Returns

    Packit 0652a1

    whether msg

    Packit 0652a1
    is a "prepare-window-handle" message

    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    Packit 0652a1
    Packit 0652a1

    gst_video_overlay_install_properties ()

    Packit 0652a1
    void
    Packit 0652a1
    gst_video_overlay_install_properties (GObjectClass *oclass,
    Packit 0652a1
                                          gint last_prop_id);
    Packit 0652a1

    This helper shall be used by classes implementing the GstVideoOverlay

    Packit 0652a1
    interface that want the render rectangle to be controllable using
    Packit 0652a1
    properties. This helper will install "render-rectangle" property into the
    Packit 0652a1
    class.

    Packit 0652a1
    Packit 0652a1

    Parameters

    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    oclass

    Packit 0652a1

    The class on which the properties will be installed

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    last_prop_id

    Packit 0652a1

    The first free property ID to use

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    Since: 1.14

    Packit 0652a1
    Packit 0652a1

    Packit 0652a1
    Packit 0652a1

    gst_video_overlay_set_property ()

    Packit 0652a1
    gboolean
    Packit 0652a1
    gst_video_overlay_set_property (GObject *object,
    Packit 0652a1
                                    gint last_prop_id,
    Packit 0652a1
                                    guint property_id,
    Packit 0652a1
                                    const GValue *value);
    Packit 0652a1

    This helper shall be used by classes implementing the GstVideoOverlay

    Packit 0652a1
    interface that want the render rectangle to be controllable using
    Packit 0652a1
    properties. This helper will parse and set the render rectangle calling
    Packit 0652a1
    gst_video_overlay_set_render_rectangle().

    Packit 0652a1
    Packit 0652a1

    Parameters

    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    object

    Packit 0652a1

    The instance on which the property is set

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    last_prop_id

    Packit 0652a1

    The highest property ID.

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    property_id

    Packit 0652a1

    The property ID

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    value

    Packit 0652a1

    The GValue to be set

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    Returns

    Packit 0652a1

    TRUE if the property_id

    Packit 0652a1
    matches the GstVideoOverlay property

    Packit 0652a1
    Packit 0652a1

    Since: 1.14

    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    Types and Values

    Packit 0652a1
    Packit 0652a1

    GstVideoOverlay

    Packit 0652a1
    typedef struct _GstVideoOverlay GstVideoOverlay;
    Packit 0652a1

    Opaque GstVideoOverlay interface structure

    Packit 0652a1
    Packit 0652a1

    Packit 0652a1
    Packit 0652a1

    struct GstVideoOverlayInterface

    Packit 0652a1
    struct GstVideoOverlayInterface {
    Packit 0652a1
      GTypeInterface iface;
    Packit 0652a1
    Packit 0652a1
      /* virtual functions */
    Packit 0652a1
      void (*expose)               (GstVideoOverlay *overlay);
    Packit 0652a1
    Packit 0652a1
      void (*handle_events)        (GstVideoOverlay *overlay, gboolean handle_events);
    Packit 0652a1
    Packit 0652a1
      void (*set_render_rectangle) (GstVideoOverlay *overlay,
    Packit 0652a1
                                    gint x, gint y,
    Packit 0652a1
                                    gint width, gint height);
    Packit 0652a1
    Packit 0652a1
      void (*set_window_handle)    (GstVideoOverlay *overlay, guintptr handle);
    Packit 0652a1
    };
    Packit 0652a1
    Packit 0652a1

    GstVideoOverlay interface

    Packit 0652a1
    Packit 0652a1

    Members

    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    GTypeInterface iface;

    Packit 0652a1

    parent interface type.

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    expose ()

    Packit 0652a1

    virtual method to handle expose events

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    handle_events ()

    Packit 0652a1

    virtual method to handle events

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    set_render_rectangle ()

    Packit 0652a1

    virtual method to set the render rectangle

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    set_window_handle ()

    Packit 0652a1

    virtual method to configure the window handle

    Packit 0652a1
     
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1
    Packit 0652a1

    Generated by GTK-Doc V1.28
    Packit 0652a1
    </body>
    Packit 0652a1
    </html>