GstGL.GLWindow

g GObject.InitiallyUnowned GObject.InitiallyUnowned Gst.Object Gst.Object GObject.InitiallyUnowned->Gst.Object GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned GstGL.GLWindow GstGL.GLWindow Gst.Object->GstGL.GLWindow

Subclasses:

None

Methods

Inherited:

Gst.Object (27), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (display)

controls_viewport ()

draw ()

get_context ()

get_display ()

get_surface_dimensions ()

get_window_handle ()

handle_events (handle_events)

has_output_surface ()

queue_resize ()

quit ()

resize (width, height)

run ()

send_key_event (event_type, key_str)

send_message (callback, *data)

send_message_async (callback, *data)

send_mouse_event (event_type, button, posx, posy)

send_scroll_event (posx, posy, delta_x, delta_y)

set_close_callback (callback, *data)

set_draw_callback (callback, *data)

set_preferred_size (width, height)

set_render_rectangle (x, y, width, height)

set_resize_callback (callback, *data)

set_window_handle (handle)

show ()

Virtual Methods

Inherited:

Gst.Object (1), GObject.Object (7)

do_close ()

do_controls_viewport ()

do_draw ()

do_get_display ()

do_get_window_handle ()

do_handle_events (handle_events)

do_has_output_surface ()

do_open ()

do_queue_resize ()

do_quit ()

do_run ()

do_send_message (callback, data)

do_send_message_async (callback, data)

do_set_preferred_size (width, height)

do_set_render_rectangle (x, y, width, height)

do_set_window_handle (handle)

do_show ()

Properties

Inherited:

Gst.Object (2)

Signals

Inherited:

Gst.Object (1), GObject.Object (1)

Name

Short Description

key-event

Will be emitted when a key event is received by the GstGLwindow.

mouse-event

Will be emitted when a mouse event is received by the GstGLwindow.

scroll-event

Will be emitted when a mouse scroll event is received by the GstGLwindow.

window-handle-changed

Will be emitted when the window handle has been set into the native implementation, but before the context is re-activated.

Fields

Inherited:

Gst.Object (1), GObject.Object (1)

Name

Type

Access

Description

close

GstGL.GLWindowCB

r

close_data

object

r

close_notify

GLib.DestroyNotify

r

context_ref

GObject.WeakRef

r

display

GstGL.GLDisplay

r

draw_data

object

r

draw_notify

GLib.DestroyNotify

r

is_drawing

bool

r

lock

GLib.Mutex

r

main_context

GLib.MainContext

r

parent

Gst.Object

r

resize_data

object

r

resize_notify

GLib.DestroyNotify

r

Class Details

class GstGL.GLWindow(**kwargs)
Bases:

Gst.Object

Abstract:

Yes

Structure:

GstGL.GLWindowClass

GstGL.GLWindow represents a window that elements can render into. A window can either be a user visible window (onscreen) or hidden (offscreen).

classmethod new(display)[source]
Parameters:

display (GstGL.GLDisplay) – a GstGL.GLDisplay

Returns:

a new GstGL.GLWindow using display's connection

Return type:

GstGL.GLWindow

New in version 1.4.

controls_viewport()[source]
Returns:

True if self controls the GL viewport, otherwise False

Return type:

bool

Checks if self controls the GL viewport.

New in version 1.16.

draw()[source]

Redraw the window contents. Implementations should invoke the draw callback.

New in version 1.4.

get_context()[source]
Returns:

the GstGL.GLContext associated with this self

Return type:

GstGL.GLContext

New in version 1.4.

get_display()[source]
Returns:

the windowing system display handle for this self

Return type:

int

New in version 1.4.

get_surface_dimensions()[source]
Returns:

width:

resulting surface width

height:

resulting surface height

Return type:

(width: int, height: int)

New in version 1.6.

get_window_handle()[source]
Returns:

the window handle we are currently rendering into

Return type:

int

New in version 1.4.

handle_events(handle_events)[source]
Parameters:

handle_events (bool) – a bool indicating if events should be handled or not.

Tell a self that it should handle events from the window system. These events are forwarded upstream as navigation events. In some window systems 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 self.

has_output_surface()[source]
Returns:

True if self has useable output surface

Return type:

bool

Query whether self has output surface or not

New in version 1.18.

queue_resize()[source]

Queue resizing of self.

quit()[source]

Quit the runloop’s execution.

New in version 1.4.

resize(width, height)[source]
Parameters:
  • width (int) – new width

  • height (int) – new height

Resize self to the given width and height.

run()[source]

Start the execution of the runloop.

New in version 1.4.

send_key_event(event_type, key_str)[source]
Parameters:
  • event_type (str) –

  • key_str (str) –

send_message(callback, *data)[source]
Parameters:

Invoke callback with data on the window thread. callback is guaranteed to have executed when this function returns.

New in version 1.4.

send_message_async(callback, *data)[source]
Parameters:

Invoke callback with data on the window thread. The callback may not have been executed when this function returns.

New in version 1.4.

send_mouse_event(event_type, button, posx, posy)[source]
Parameters:
send_scroll_event(posx, posy, delta_x, delta_y)[source]
Parameters:
  • posx (float) – x position of the mouse cursor

  • posy (float) – y position of the mouse cursor

  • delta_x (float) – the x offset of the scroll event

  • delta_y (float) – the y offset of the scroll event

Notify a self about a scroll event. A scroll signal holding the event coordinates will be emitted.

New in version 1.18.

set_close_callback(callback, *data)[source]
Parameters:

Sets the callback called when the window is about to close.

New in version 1.4.

set_draw_callback(callback, *data)[source]
Parameters:

Sets the draw callback called every time GstGL.GLWindow.draw() is called

New in version 1.4.

set_preferred_size(width, height)[source]
Parameters:
  • width (int) – new preferred width

  • height (int) – new preferred height

Set the preferred width and height of the window. Implementations are free to ignore this information.

New in version 1.6.

set_render_rectangle(x, y, width, height)[source]
Parameters:
  • x (int) – x position

  • y (int) – y position

  • width (int) – width

  • height (int) – height

Returns:

whether the specified region could be set

Return type:

bool

Tell a self that it should render into a specific region of the window according to the GstVideo.VideoOverlay interface.

set_resize_callback(callback, *data)[source]
Parameters:

Sets the resize callback called every time a resize of the window occurs.

New in version 1.4.

set_window_handle(handle)[source]
Parameters:

handle (int) – handle to the window

Sets the window that this self should render into. Some implementations require this to be called with a valid handle before drawing can commence.

New in version 1.4.

show()[source]

Present the window to the screen.

New in version 1.6.

do_close() virtual

close the connection to the display

do_controls_viewport() virtual
Returns:

True if window controls the GL viewport, otherwise False

Return type:

bool

Checks if window controls the GL viewport.

New in version 1.16.

do_draw() virtual

Redraw the window contents. Implementations should invoke the draw callback.

New in version 1.4.

do_get_display() virtual
Returns:

the windowing system display handle for this window

Return type:

int

Gets the current windowing system display connection

New in version 1.4.

do_get_window_handle() virtual
Returns:

the window handle we are currently rendering into

Return type:

int

Gets the current window handle that this GstGL.GLWindow is rendering into. This may return a different value to what is passed into set_window_handle

New in version 1.4.

do_handle_events(handle_events) virtual
Parameters:

handle_events (bool) – a bool indicating if events should be handled or not.

Tell a window that it should handle events from the window system. These events are forwarded upstream as navigation events. In some window systems 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 window.

do_has_output_surface() virtual
Returns:

True if window has useable output surface

Return type:

bool

Query whether window has output surface or not

New in version 1.18.

do_open() virtual
Return type:

bool

open the connection to the display

do_queue_resize() virtual

Queue resizing of window.

do_quit() virtual

Quit the runloop’s execution.

New in version 1.4.

do_run() virtual

Start the execution of the runloop.

New in version 1.4.

do_send_message(callback, data) virtual
Parameters:

Invoke callback with data on the window thread. callback is guaranteed to have executed when this function returns.

New in version 1.4.

do_send_message_async(callback, data) virtual
Parameters:

Invoke callback with data on the window thread. The callback may not have been executed when this function returns.

New in version 1.4.

do_set_preferred_size(width, height) virtual
Parameters:
  • width (int) – new preferred width

  • height (int) – new preferred height

Set the preferred width and height of the window. Implementations are free to ignore this information.

New in version 1.6.

do_set_render_rectangle(x, y, width, height) virtual
Parameters:
  • x (int) – x position

  • y (int) – y position

  • width (int) – width

  • height (int) – height

Returns:

whether the specified region could be set

Return type:

bool

Tell a window that it should render into a specific region of the window according to the GstVideo.VideoOverlay interface.

do_set_window_handle(handle) virtual
Parameters:

handle (int) – handle to the window

Sets the window that this window should render into. Some implementations require this to be called with a valid handle before drawing can commence.

New in version 1.4.

do_show() virtual

Present the window to the screen.

New in version 1.6.

Signal Details

GstGL.GLWindow.signals.key_event(g_l_window, id, key)
Signal Name:

key-event

Flags:

RUN_LAST

Parameters:
  • g_l_window (GstGL.GLWindow) – The object which received the signal

  • id (str) – the name of the event

  • key (str) – the id of the key pressed

Will be emitted when a key event is received by the GstGLwindow.

New in version 1.6.

GstGL.GLWindow.signals.mouse_event(g_l_window, id, button, x, y)
Signal Name:

mouse-event

Flags:

RUN_LAST

Parameters:
  • g_l_window (GstGL.GLWindow) – The object which received the signal

  • id (str) – the name of the event

  • button (int) – the id of the button

  • x (float) – the x coordinate of the mouse event

  • y (float) – the y coordinate of the mouse event

Will be emitted when a mouse event is received by the GstGLwindow.

New in version 1.6.

GstGL.GLWindow.signals.scroll_event(g_l_window, x, y, delta_x, delta_y)
Signal Name:

scroll-event

Flags:

RUN_LAST

Parameters:
  • g_l_window (GstGL.GLWindow) – The object which received the signal

  • x (float) – the x coordinate of the mouse event

  • y (float) – the y coordinate of the mouse event

  • delta_x (float) – the x offset of the scroll event

  • delta_y (float) – the y offset of the scroll event

Will be emitted when a mouse scroll event is received by the GstGLwindow.

New in version 1.18.

GstGL.GLWindow.signals.window_handle_changed(g_l_window)
Signal Name:

window-handle-changed

Flags:

RUN_LAST

Parameters:

g_l_window (GstGL.GLWindow) – The object which received the signal

Will be emitted when the window handle has been set into the native implementation, but before the context is re-activated. By using this signal, elements can refresh associated resource without relying on direct handle comparision.

New in version 1.20.