Functions¶
Details¶
- GstVideo.buffer_add_ancillary_meta(buffer)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – AGst.Buffer
- Returns:
A new
GstVideo.AncillaryMeta
, orNone
if an error happened.- Return type:
Adds a new
GstVideo.AncillaryMeta
to the buffer. The caller is responsible for setting the appropriate fields.New in version 1.24.
- GstVideo.buffer_add_video_afd_meta(buffer, field, spec, afd)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
field (
int
) – 0 for progressive or field 1 and 1 for field 2spec (
GstVideo.VideoAFDSpec
) –GstVideo.VideoAFDSpec
that applies to AFD valueafd (
GstVideo.VideoAFDValue
) –GstVideo.VideoAFDValue
AFD enumeration
- Returns:
the
GstVideo.VideoAFDMeta
on buffer.- Return type:
Attaches
GstVideo.VideoAFDMeta
metadata to buffer with the given parameters.New in version 1.18.
- GstVideo.buffer_add_video_affine_transformation_meta(buffer)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
- Returns:
the
GstVideo.VideoAffineTransformationMeta
on buffer.- Return type:
Attaches
GstVideo.VideoAffineTransformationMeta
metadata to buffer with the given parameters.New in version 1.8.
- GstVideo.buffer_add_video_bar_meta(buffer, field, is_letterbox, bar_data1, bar_data2)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
field (
int
) – 0 for progressive or field 1 and 1 for field 2is_letterbox (
bool
) – if true then bar data specifies letterbox, otherwise pillarboxbar_data1 (
int
) – If is_letterbox is true, then the value specifies the last line of a horizontal letterbox bar area at top of reconstructed frame. Otherwise, it specifies the last horizontal luminance sample of a vertical pillarbox bar area at the left side of the reconstructed framebar_data2 (
int
) – If is_letterbox is true, then the value specifies the first line of a horizontal letterbox bar area at bottom of reconstructed frame. Otherwise, it specifies the first horizontal luminance sample of a vertical pillarbox bar area at the right side of the reconstructed frame.
- Returns:
the
GstVideo.VideoBarMeta
on buffer.See Table 6.11 Bar Data Syntax
https://www.atsc.org/wp-content/uploads/2015/03/a_53-Part-4-2009.pdf
- Return type:
Attaches
GstVideo.VideoBarMeta
metadata to buffer with the given parameters.New in version 1.18.
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
caption_type (
GstVideo.VideoCaptionType
) – The type of Closed Caption to adddata (
bytes
) – The Closed Caption data
- Returns:
the
GstVideo.VideoCaptionMeta
on buffer.- Return type:
Attaches
GstVideo.VideoCaptionMeta
metadata to buffer with the given parameters.New in version 1.16.
- GstVideo.buffer_add_video_codec_alpha_meta(buffer, alpha_buffer)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
alpha_buffer (
Gst.Buffer
) – aGst.Buffer
- Returns:
the
GstVideo.VideoCodecAlphaMeta
on buffer.- Return type:
Attaches a
GstVideo.VideoCodecAlphaMeta
metadata to buffer with the given alpha buffer.New in version 1.20.
- GstVideo.buffer_add_video_gl_texture_upload_meta(buffer, texture_orientation, n_textures, texture_type, upload, user_data, user_data_copy, user_data_free)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
texture_orientation (
GstVideo.VideoGLTextureOrientation
) – theGstVideo.VideoGLTextureOrientation
n_textures (
int
) – the number of texturestexture_type (
GstVideo.VideoGLTextureType
) – array ofGstVideo.VideoGLTextureType
upload (
GstVideo.VideoGLTextureUpload
) – the function to upload the buffer to a specific texture IDuser_data (
object
orNone
) – user data for the implementor of uploaduser_data_copy (
GObject.BoxedCopyFunc
) – function to copy user_datauser_data_free (
GObject.BoxedFreeFunc
) – function to free user_data
- Returns:
the
GstVideo.VideoGLTextureUploadMeta
on buffer.- Return type:
Attaches
GstVideo.VideoGLTextureUploadMeta
metadata to buffer with the given parameters.
- GstVideo.buffer_add_video_meta(buffer, flags, format, width, height)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
format (
GstVideo.VideoFormat
) – aGstVideo.VideoFormat
width (
int
) – the widthheight (
int
) – the height
- Returns:
the
GstVideo.VideoMeta
on buffer.- Return type:
Attaches
GstVideo.VideoMeta
metadata to buffer with the given parameters and the default offsets and strides for format and width x height.This function calculates the default offsets and strides and then calls
GstVideo.buffer_add_video_meta_full
() with them.
- GstVideo.buffer_add_video_meta_full(buffer, flags, format, width, height, n_planes, offset, stride)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
format (
GstVideo.VideoFormat
) – aGstVideo.VideoFormat
width (
int
) – the widthheight (
int
) – the heightn_planes (
int
) – number of planesoffset ([
int
]) – offset of each planestride ([
int
]) – stride of each plane
- Returns:
the
GstVideo.VideoMeta
on buffer.- Return type:
Attaches
GstVideo.VideoMeta
metadata to buffer with the given parameters.
- GstVideo.buffer_add_video_overlay_composition_meta(buf, comp)[source]¶
- Parameters:
buf (
Gst.Buffer
) – aGst.Buffer
comp (
GstVideo.VideoOverlayComposition
orNone
) – aGstVideo.VideoOverlayComposition
- Returns:
- Return type:
Sets an overlay composition on a buffer. The buffer will obtain its own reference to the composition, meaning this function does not take ownership of comp.
- GstVideo.buffer_add_video_region_of_interest_meta(buffer, roi_type, x, y, w, h)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
roi_type (
str
) – Type of the region of interest (e.g. “face”)x (
int
) – X positiony (
int
) – Y positionw (
int
) – widthh (
int
) – height
- Returns:
the
GstVideo.VideoRegionOfInterestMeta
on buffer.- Return type:
Attaches
GstVideo.VideoRegionOfInterestMeta
metadata to buffer with the given parameters.
- GstVideo.buffer_add_video_region_of_interest_meta_id(buffer, roi_type, x, y, w, h)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
roi_type (
int
) – Type of the region of interest (e.g. “face”)x (
int
) – X positiony (
int
) – Y positionw (
int
) – widthh (
int
) – height
- Returns:
the
GstVideo.VideoRegionOfInterestMeta
on buffer.- Return type:
Attaches
GstVideo.VideoRegionOfInterestMeta
metadata to buffer with the given parameters.
- GstVideo.buffer_add_video_sei_user_data_unregistered_meta(buffer, uuid, data, size)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
uuid (
int
) – User Data Unregistered UUIDdata (
int
) – SEI User Data Unregistered buffersize (
int
) – size of the data buffer
- Returns:
the
GstVideo.VideoSEIUserDataUnregisteredMeta
on buffer.- Return type:
Attaches
GstVideo.VideoSEIUserDataUnregisteredMeta
metadata to buffer with the given parameters.New in version 1.22.
- GstVideo.buffer_add_video_time_code_meta(buffer, tc)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
- Returns:
the
GstVideo.VideoTimeCodeMeta
on buffer, or (since 1.16)None
if the timecode was invalid.- Return type:
Attaches
GstVideo.VideoTimeCodeMeta
metadata to buffer with the given parameters.New in version 1.10.
- GstVideo.buffer_add_video_time_code_meta_full(buffer, fps_n, fps_d, latest_daily_jam, flags, hours, minutes, seconds, frames, field_count)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
fps_n (
int
) – framerate numeratorfps_d (
int
) – framerate denominatorlatest_daily_jam (
GLib.DateTime
) – aGLib.DateTime
for the latest daily jamflags (
GstVideo.VideoTimeCodeFlags
) – aGstVideo.VideoTimeCodeFlags
hours (
int
) – hours since the daily jamminutes (
int
) – minutes since the daily jamseconds (
int
) – seconds since the daily jamframes (
int
) – frames since the daily jamfield_count (
int
) – fields since the daily jam
- Returns:
the
GstVideo.VideoTimeCodeMeta
on buffer, or (since 1.16)None
if the timecode was invalid.- Return type:
Attaches
GstVideo.VideoTimeCodeMeta
metadata to buffer with the given parameters.New in version 1.10.
- GstVideo.buffer_get_video_meta(buffer)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
- Returns:
the
GstVideo.VideoMeta
with lowest id (usually 0) orNone
when there is no such metadata on buffer.- Return type:
Find the
GstVideo.VideoMeta
on buffer with the lowest id.Buffers can contain multiple
GstVideo.VideoMeta
metadata items when dealing with multiview buffers.
- GstVideo.buffer_get_video_meta_id(buffer, id)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
id (
int
) – a metadata id
- Returns:
the
GstVideo.VideoMeta
with id orNone
when there is no such metadata on buffer.- Return type:
Find the
GstVideo.VideoMeta
on buffer with the given id.Buffers can contain multiple
GstVideo.VideoMeta
metadata items when dealing with multiview buffers.
- GstVideo.buffer_get_video_region_of_interest_meta_id(buffer, id)[source]¶
- Parameters:
buffer (
Gst.Buffer
) – aGst.Buffer
id (
int
) – a metadata id
- Returns:
the
GstVideo.VideoRegionOfInterestMeta
with id orNone
when there is no such metadata on buffer.- Return type:
Find the
GstVideo.VideoRegionOfInterestMeta
on buffer with the given id.Buffers can contain multiple
GstVideo.VideoRegionOfInterestMeta
metadata items if multiple regions of interests are marked on a frame.
- GstVideo.buffer_pool_config_get_video_alignment(config, align)[source]¶
- Parameters:
config (
Gst.Structure
) – aGst.Structure
align (
GstVideo.VideoAlignment
) – aGstVideo.VideoAlignment
- Returns:
True
if config could be parsed correctly.- Return type:
Get the video alignment from the bufferpool configuration config in in align
- GstVideo.buffer_pool_config_set_video_alignment(config, align)[source]¶
- Parameters:
config (
Gst.Structure
) – aGst.Structure
align (
GstVideo.VideoAlignment
) – aGstVideo.VideoAlignment
Set the video alignment in align to the bufferpool configuration config
- GstVideo.is_video_overlay_prepare_window_handle_message(msg)[source]¶
- Parameters:
msg (
Gst.Message
) – aGst.Message
- Returns:
whether msg is a “prepare-window-handle” message
- Return type:
Convenience function to check if the given message is a “prepare-window-handle” message from a
GstVideo.VideoOverlay
.
- Parameters:
- Returns:
A boolean indicating success.
- Return type:
Try to retrieve x and y coordinates of a
GstVideo.Navigation
event.New in version 1.22.
- Parameters:
- Return type:
Inspect a
Gst.Event
and return theGstVideo.NavigationEventType
of the event, orGstVideo.NavigationEventType.INVALID
if the event is not aGstVideo.Navigation
event.
- Parameters:
command (
GstVideo.NavigationCommand
) – The navigation command to use.- Returns:
a new
Gst.Event
- Return type:
Create a new navigation event given navigation command..
New in version 1.22.
- Parameters:
key (
str
) – A string identifying the key press.state (
GstVideo.NavigationModifierType
) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).
- Returns:
a new
Gst.Event
- Return type:
Create a new navigation event for the given key press.
New in version 1.22.
- Parameters:
key (
str
) – A string identifying the released key.state (
GstVideo.NavigationModifierType
) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).
- Returns:
a new
Gst.Event
- Return type:
Create a new navigation event for the given key release.
New in version 1.22.
- Parameters:
button (
int
) – The number of the pressed mouse button.x (
float
) – The x coordinate of the mouse cursor.y (
float
) – The y coordinate of the mouse cursor.state (
GstVideo.NavigationModifierType
) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).
- Returns:
a new
Gst.Event
- Return type:
Create a new navigation event for the given key mouse button press.
New in version 1.22.
- Parameters:
button (
int
) – The number of the released mouse button.x (
float
) – The x coordinate of the mouse cursor.y (
float
) – The y coordinate of the mouse cursor.state (
GstVideo.NavigationModifierType
) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).
- Returns:
a new
Gst.Event
- Return type:
Create a new navigation event for the given key mouse button release.
New in version 1.22.
- Parameters:
x (
float
) – The x coordinate of the mouse cursor.y (
float
) – The y coordinate of the mouse cursor.state (
GstVideo.NavigationModifierType
) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).
- Returns:
a new
Gst.Event
- Return type:
Create a new navigation event for the new mouse location.
New in version 1.22.
- Parameters:
x (
float
) – The x coordinate of the mouse cursor.y (
float
) – The y coordinate of the mouse cursor.delta_x (
float
) – The x component of the scroll movement.delta_y (
float
) – The y component of the scroll movement.state (
GstVideo.NavigationModifierType
) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).
- Returns:
a new
Gst.Event
- Return type:
Create a new navigation event for the mouse scroll.
New in version 1.22.
- Parameters:
state (
GstVideo.NavigationModifierType
) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).- Returns:
a new
Gst.Event
- Return type:
Create a new navigation event signalling that all currently active touch points are cancelled and should be discarded. For example, under Wayland this event might be sent when a swipe passes the threshold to be recognized as a gesture by the compositor.
New in version 1.22.
- Parameters:
identifier (
int
) – A number uniquely identifying this touch point. It must stay unique to this touch point at least until an up event is sent for the same identifier, or all touch points are cancelled.x (
float
) – The x coordinate of the new touch point.y (
float
) – The y coordinate of the new touch point.pressure (
float
) – Pressure data of the touch point, from 0.0 to 1.0, or NaN if no data is available.state (
GstVideo.NavigationModifierType
) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).
- Returns:
a new
Gst.Event
- Return type:
Create a new navigation event for an added touch point.
New in version 1.22.
- Parameters:
state (
GstVideo.NavigationModifierType
) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).- Returns:
a new
Gst.Event
- Return type:
Create a new navigation event signalling the end of a touch frame. Touch frames signal that all previous down, motion and up events not followed by another touch frame event already should be considered simultaneous.
New in version 1.22.
- Parameters:
identifier (
int
) – A number uniquely identifying this touch point. It must correlate to exactly one previous touch_start event.x (
float
) – The x coordinate of the touch point.y (
float
) – The y coordinate of the touch point.pressure (
float
) – Pressure data of the touch point, from 0.0 to 1.0, or NaN if no data is available.state (
GstVideo.NavigationModifierType
) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).
- Returns:
a new
Gst.Event
- Return type:
Create a new navigation event for a moved touch point.
New in version 1.22.
- Parameters:
identifier (
int
) – A number uniquely identifying this touch point. It must correlate to exactly one previous down event, but can be reused after sending this event.x (
float
) – The x coordinate of the touch point.y (
float
) – The y coordinate of the touch point.state (
GstVideo.NavigationModifierType
) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).
- Returns:
a new
Gst.Event
- Return type:
Create a new navigation event for a removed touch point.
New in version 1.22.
- Parameters:
- Returns:
True
if the navigation command could be extracted, otherwiseFalse
.- command:
Pointer to
GstVideo.NavigationCommand
to receive the type of the navigation event.
- Return type:
(
bool
, command:GstVideo.NavigationCommand
)
Inspect a
GstVideo.Navigation
command event and retrieve the enum value of the associated command.
- Parameters:
- Returns:
- key:
A pointer to a location to receive the string identifying the key press. The returned string is owned by the event, and valid only until the event is unreffed.
- Return type:
Note: Modifier keys (as defined in
GstVideo.NavigationModifierType
) press and release events are generated even if those states are present on all other related events
- Parameters:
state (
GstVideo.NavigationModifierType
) – a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).
- Returns:
True
if the event is aGstVideo.Navigation
event with associated modifiers state, otherwiseFalse
.- Return type:
New in version 1.22.
- Parameters:
- Returns:
True
if the button number and both coordinates could be extracted, otherwiseFalse
.- Return type:
Retrieve the details of either a
GstVideo.Navigation
mouse button press event or a mouse button release event. Determine which type the event is usingGstVideo.Navigation.event_get_type
() to retrieve theGstVideo.NavigationEventType
.
-
Inspect a
GstVideo.Navigation
mouse movement event and extract the coordinates of the event.
- Parameters:
- Returns:
True
if all coordinates could be extracted, otherwiseFalse
.- x:
Pointer to a
float
to receive the x coordinate of the mouse movement.- y:
Pointer to a
float
to receive the y coordinate of the mouse movement.- delta_x:
Pointer to a
float
to receive the delta_x coordinate of the mouse movement.- delta_y:
Pointer to a
float
to receive the delta_y coordinate of the mouse movement.
- Return type:
Inspect a
GstVideo.Navigation
mouse scroll event and extract the coordinates of the event.New in version 1.18.
- Parameters:
- Returns:
True
if all details could be extracted, otherwiseFalse
.- identifier:
Pointer to a
int
that will receive the identifier unique to this touch point.- x:
Pointer to a
float
that will receive the x coordinate of the touch event.- y:
Pointer to a
float
that will receive the y coordinate of the touch event.- pressure:
Pointer to a
float
that will receive the force of the touch event, in the range from 0.0 to 1.0. If pressure data is not available, NaN will be set instead.
- Return type:
(
bool
, identifier:int
, x:float
, y:float
, pressure:float
)
Retrieve the details of a
GstVideo.Navigation
touch-down or touch-motion event. Determine which type the event is usingGstVideo.Navigation.event_get_type
() to retrieve theGstVideo.NavigationEventType
.New in version 1.22.
- Parameters:
- Returns:
- Return type:
Retrieve the details of a
GstVideo.Navigation
touch-up event.New in version 1.22.
- Parameters:
- Returns:
A boolean indicating success.
- Return type:
Try to set x and y coordinates on a
GstVideo.Navigation
event. The event must be writable.New in version 1.22.
- Parameters:
message (
Gst.Message
) – AGst.Message
to inspect.- Returns:
The type of the
Gst.Message
, orGstVideo.NavigationMessageType.INVALID
if the message is not aGstVideo.Navigation
notification.- Return type:
Check a bus message to see if it is a
GstVideo.Navigation
event, and return theGstVideo.NavigationMessageType
identifying the type of the message if so.
- Parameters:
src (
Gst.Object
) – AGst.Object
to set as source of the new message.cur_angle (
int
) – The currently selected angle.n_angles (
int
) – The number of viewing angles now available.
- Returns:
The new
Gst.Message
.- Return type:
Creates a new
GstVideo.Navigation
message with typeGstVideo.NavigationMessageType.ANGLES_CHANGED
for notifying an application that the current angle, or current number of angles available in a multiangle video has changed.
- Parameters:
src (
Gst.Object
) – AGst.Object
to set as source of the new message.- Returns:
The new
Gst.Message
.- Return type:
Creates a new
GstVideo.Navigation
message with typeGstVideo.NavigationMessageType.COMMANDS_CHANGED
- Parameters:
src (
Gst.Object
) – AGst.Object
to set as source of the new message.
- Returns:
The new
Gst.Message
.- Return type:
Creates a new
GstVideo.Navigation
message with typeGstVideo.NavigationMessageType.EVENT
.New in version 1.6.
- Parameters:
src (
Gst.Object
) – AGst.Object
to set as source of the new message.active (
bool
) –True
if the mouse has entered a clickable area of the display.False
if it over a non-clickable area.
- Returns:
The new
Gst.Message
.- Return type:
Creates a new
GstVideo.Navigation
message with typeGstVideo.NavigationMessageType.MOUSE_OVER
.
- Parameters:
message (
Gst.Message
) – AGst.Message
to inspect.- Returns:
True
if the message could be successfully parsed.False
if not.- Return type:
Parse a
GstVideo.Navigation
message of typeGstVideo.NavigationMessageType.ANGLES_CHANGED
and extract the cur_angle and n_angles parameters.
- Parameters:
message (
Gst.Message
) – AGst.Message
to inspect.- Returns:
True
if the message could be successfully parsed.False
if not.- event:
a pointer to a
Gst.Event
to receive the contained navigation event.
- Return type:
Parse a
GstVideo.Navigation
message of typeGstVideo.NavigationMessageType.EVENT
and extract containedGst.Event
. The caller must unref the event when done with it.New in version 1.6.
- Parameters:
message (
Gst.Message
) – AGst.Message
to inspect.- Returns:
True
if the message could be successfully parsed.False
if not.- Return type:
Parse a
GstVideo.Navigation
message of typeGstVideo.NavigationMessageType.MOUSE_OVER
and extract the active/inactive flag. If the mouse over event is marked active, it indicates that the mouse is over a clickable area.
- Parameters:
query (
Gst.Query
) – The query to inspect- Returns:
The
GstVideo.NavigationQueryType
of the query, orGstVideo.NavigationQueryType.INVALID
- Return type:
Inspect a
Gst.Query
and return theGstVideo.NavigationQueryType
associated with it if it is aGstVideo.Navigation
query.
- Returns:
The new query.
- Return type:
Create a new
GstVideo.Navigation
angles query. When executed, it will query the pipeline for the set of currently available angles, which may be greater than one in a multiangle video.
- Returns:
The new query.
- Return type:
Create a new
GstVideo.Navigation
commands query. When executed, it will query the pipeline for the set of currently available commands.
-
Parse the current angle number in the
GstVideo.Navigation
angles query into theint
pointed to by the cur_angle variable, and the number of available angles into theint
pointed to by the n_angles variable.
- Parameters:
- Returns:
True
if the query could be successfully parsed.False
if not.- n_cmds:
the number of commands in this query.
- Return type:
Parse the number of commands in the
GstVideo.Navigation
commands query.
- Parameters:
- Returns:
True
if the query could be successfully parsed.False
if not.- cmd:
a pointer to store the nth command into.
- Return type:
(
bool
, cmd:GstVideo.NavigationCommand
)
Parse the
GstVideo.Navigation
command query and retrieve the nth command from it into cmd. If the list contains less elements than nth, cmd will be set toGstVideo.NavigationCommand.INVALID
.
- Parameters:
Set the
GstVideo.Navigation
angles query result field in query.
- Parameters:
cmds ([
GstVideo.NavigationCommand
]) – An array containing n_cmds GstNavigationCommand values.
Set the
GstVideo.Navigation
command query result fields in query. The number of commands passed must be equal to n_commands.
- GstVideo.video_blend(dest, src, x, y, global_alpha)[source]¶
- Parameters:
dest (
GstVideo.VideoFrame
) – TheGstVideo.VideoFrame
where to blend src insrc (
GstVideo.VideoFrame
) – theGstVideo.VideoFrame
that we want to blend intox (
int
) – The x offset in pixel where the src image should be blendedy (
int
) – the y offset in pixel where the src image should be blendedglobal_alpha (
float
) – the global_alpha each per-pixel alpha value is multiplied with
- Return type:
Lets you blend the src image into the dest image
- GstVideo.video_blend_scale_linear_RGBA(src, src_buffer, dest_height, dest_width)[source]¶
- Parameters:
src (
GstVideo.VideoInfo
) – theGstVideo.VideoInfo
describing the video data in src_buffersrc_buffer (
Gst.Buffer
) – the source buffer containing video pixels to scaledest_height (
int
) – the height in pixels to scale the video data in src_buffer todest_width (
int
) – the width in pixels to scale the video data in src_buffer to
- Returns:
- dest:
pointer to a
GstVideo.VideoInfo
structure that will be filled in with the details for dest_buffer- dest_buffer:
a pointer to a
Gst.Buffer
variable, which will be set to a newly-allocated buffer containing the scaled pixels.
- Return type:
(dest:
GstVideo.VideoInfo
, dest_buffer:Gst.Buffer
)
Scales a buffer containing RGBA (or AYUV) video. This is an internal helper function which is used to scale subtitle overlays, and may be deprecated in the near future. Use
GstVideo.VideoScaler
to scale video buffers instead.
- GstVideo.video_calculate_display_ratio(video_width, video_height, video_par_n, video_par_d, display_par_n, display_par_d)[source]¶
- Parameters:
video_width (
int
) – Width of the video frame in pixelsvideo_height (
int
) – Height of the video frame in pixelsvideo_par_n (
int
) – Numerator of the pixel aspect ratio of the input video.video_par_d (
int
) – Denominator of the pixel aspect ratio of the input video.display_par_n (
int
) – Numerator of the pixel aspect ratio of the display devicedisplay_par_d (
int
) – Denominator of the pixel aspect ratio of the display device
- Returns:
A boolean indicating success and a calculated Display Ratio in the dar_n and dar_d parameters. The return value is
False
in the case of integer overflow or other error.- dar_n:
Numerator of the calculated display_ratio
- dar_d:
Denominator of the calculated display_ratio
- Return type:
Given the Pixel Aspect Ratio and size of an input video frame, and the pixel aspect ratio of the intended display device, calculates the actual display ratio the video will be rendered with.
- Return type:
- Return type:
- Parameters:
- Returns:
- Return type:
Parses fixed Closed Caption
Gst.Caps
and returns the corresponding caption type, orGstVideo.VideoCaptionType.UNKNOWN
.New in version 1.16.
- Parameters:
type (
GstVideo.VideoCaptionType
) –GstVideo.VideoCaptionType
- Returns:
new
Gst.Caps
- Return type:
Creates new caps corresponding to type.
New in version 1.16.
- GstVideo.video_center_rect(src, dst, scaling)[source]¶
- Parameters:
src (
GstVideo.VideoRectangle
) – a pointer toGstVideo.VideoRectangle
describing the source areadst (
GstVideo.VideoRectangle
) – a pointer toGstVideo.VideoRectangle
describing the destination areascaling (
bool
) – abool
indicating if scaling should be applied or not
- Returns:
a pointer to a
GstVideo.VideoRectangle
which will receive the result area- Return type:
result:
GstVideo.VideoRectangle
Takes src rectangle and position it at the center of dst rectangle with or without scaling. It handles clipping if the src rectangle is bigger than the dst one and scaling is set to
False
.New in version 1.20.
- GstVideo.video_chroma_from_string(s)[source]¶
- Parameters:
s (
str
) – a chromasite string- Returns:
a
GstVideo.VideoChromaSite
orGstVideo.VideoChromaSite.UNKNOWN
when s does not contain a valid chroma description.- Return type:
Convert s to a
GstVideo.VideoChromaSite
Deprecated since version 1.20: Use
GstVideo.VideoChromaSite.from_string
() instead.
- GstVideo.video_chroma_resample(resample, lines, width)[source]¶
- Parameters:
resample (
GstVideo.VideoChromaResample
) – aGstVideo.VideoChromaResample
width (
int
) – the number of pixels on one line
Perform resampling of width chroma pixels in lines.
- GstVideo.video_chroma_site_from_string(s)[source]¶
- Parameters:
s (
str
) – a chromasite string- Returns:
a
GstVideo.VideoChromaSite
orGstVideo.VideoChromaSite.UNKNOWN
when s does not contain a valid chroma-site description.- Return type:
Convert s to a
GstVideo.VideoChromaSite
New in version 1.20.
- GstVideo.video_chroma_site_to_string(site)[source]¶
- Parameters:
site (
GstVideo.VideoChromaSite
) – aGstVideo.VideoChromaSite
- Returns:
a string representation of site or
None
if site contains undefined value or is equal toGstVideo.VideoChromaSite.UNKNOWN
- Return type:
Converts site to its string representation.
New in version 1.20.
- GstVideo.video_chroma_to_string(site)[source]¶
- Parameters:
site (
GstVideo.VideoChromaSite
) – aGstVideo.VideoChromaSite
- Returns:
a string describing site.
- Return type:
Converts site to its string representation.
Deprecated since version 1.20: Use
GstVideo.VideoChromaSite.to_string
() instead.
- GstVideo.video_codec_alpha_meta_api_get_type()[source]¶
- Returns:
GObject.GType
for theGstVideo.VideoCodecAlphaMeta
structure.- Return type:
New in version 1.20.
- GstVideo.video_codec_alpha_meta_get_info()[source]¶
- Returns:
Gst.MetaInfo
pointer that describesGstVideo.VideoCodecAlphaMeta
.- Return type:
New in version 1.20.
- GstVideo.video_color_matrix_from_iso(value)[source]¶
- Parameters:
value (
int
) – a ITU-T H.273 matrix coefficients value- Returns:
the matched
GstVideo.VideoColorMatrix
- Return type:
Converts the value to the
GstVideo.VideoColorMatrix
The matrix coefficients (MatrixCoefficients) value is defined by “ISO/IEC 23001-8 Section 7.3 Table 4” and “ITU-T H.273 Table 4”. “H.264 Table E-5” and “H.265 Table E.5” share the identical values.New in version 1.18.
- GstVideo.video_color_matrix_get_Kr_Kb(matrix)[source]¶
- Parameters:
matrix (
GstVideo.VideoColorMatrix
) – aGstVideo.VideoColorMatrix
- Returns:
True
if matrix was a YUV color format and Kr and Kb contain valid values.- Kr:
result red channel coefficient
- Kb:
result blue channel coefficient
- Return type:
Get the coefficients used to convert between Y’PbPr and R’G’B’ using matrix.
When:
0.0 <= [Y',R',G',B'] <= 1.0) (-0.5 <= [Pb,Pr] <= 0.5)
the general conversion is given by:
Y' = Kr*R' + (1-Kr-Kb)*G' + Kb*B' Pb = (B'-Y')/(2*(1-Kb)) Pr = (R'-Y')/(2*(1-Kr))
and the other way around:
R' = Y' + Cr*2*(1-Kr) G' = Y' - Cb*2*(1-Kb)*Kb/(1-Kr-Kb) - Cr*2*(1-Kr)*Kr/(1-Kr-Kb) B' = Y' + Cb*2*(1-Kb)
New in version 1.6.
- GstVideo.video_color_matrix_to_iso(matrix)[source]¶
- Parameters:
matrix (
GstVideo.VideoColorMatrix
) – aGstVideo.VideoColorMatrix
- Returns:
The value of ISO/IEC 23001-8 matrix coefficients.
- Return type:
Converts
GstVideo.VideoColorMatrix
to the “matrix coefficients” (MatrixCoefficients) value defined by “ISO/IEC 23001-8 Section 7.3 Table 4” and “ITU-T H.273 Table 4”. “H.264 Table E-5” and “H.265 Table E.5” share the identical values.New in version 1.18.
- GstVideo.video_color_primaries_from_iso(value)[source]¶
- Parameters:
value (
int
) – a ITU-T H.273 colour primaries value- Returns:
the matched
GstVideo.VideoColorPrimaries
- Return type:
Converts the value to the
GstVideo.VideoColorPrimaries
The colour primaries (ColourPrimaries) value is defined by “ISO/IEC 23001-8 Section 7.1 Table 2” and “ITU-T H.273 Table 2”. “H.264 Table E-3” and “H.265 Table E.3” share the identical values.New in version 1.18.
- GstVideo.video_color_primaries_get_info(primaries)[source]¶
- Parameters:
primaries (
GstVideo.VideoColorPrimaries
) – aGstVideo.VideoColorPrimaries
- Returns:
a
GstVideo.VideoColorPrimariesInfo
for primaries.- Return type:
Get information about the chromaticity coordinates of primaries.
New in version 1.6.
- GstVideo.video_color_primaries_is_equivalent(primaries, other)[source]¶
- Parameters:
primaries (
GstVideo.VideoColorPrimaries
) – aGstVideo.VideoColorPrimaries
other (
GstVideo.VideoColorPrimaries
) – anotherGstVideo.VideoColorPrimaries
- Returns:
True
if primaries and other can be considered equivalent.- Return type:
Checks whether primaries and other are functionally equivalent
New in version 1.22.
- GstVideo.video_color_primaries_to_iso(primaries)[source]¶
- Parameters:
primaries (
GstVideo.VideoColorPrimaries
) – aGstVideo.VideoColorPrimaries
- Returns:
The value of ISO/IEC 23001-8 colour primaries.
- Return type:
Converts
GstVideo.VideoColorPrimaries
to the “colour primaries” (ColourPrimaries) value defined by “ISO/IEC 23001-8 Section 7.1 Table 2” and “ITU-T H.273 Table 2”. “H.264 Table E-3” and “H.265 Table E.3” share the identical values.New in version 1.18.
- GstVideo.video_color_range_offsets(range, info)[source]¶
- Parameters:
range (
GstVideo.VideoColorRange
) – aGstVideo.VideoColorRange
info (
GstVideo.VideoFormatInfo
) – aGstVideo.VideoFormatInfo
- Returns:
- offset:
output offsets
- scale:
output scale
- Return type:
Compute the offset and scale values for each component of info. For each component, (c[i] - offset[i]) / scale[i] will scale the component c[i] to the range [0.0 .. 1.0].
The reverse operation (c[i] * scale[i]) + offset[i] can be used to convert the component values in range [0.0 .. 1.0] back to their representation in info and range.
- GstVideo.video_color_transfer_decode(func, val)[source]¶
- Parameters:
func (
GstVideo.VideoTransferFunction
) – aGstVideo.VideoTransferFunction
val (
float
) – a value
- Return type:
New in version 1.6.
Deprecated since version 1.20: Use
GstVideo.VideoTransferFunction.decode
() instead.
- GstVideo.video_color_transfer_encode(func, val)[source]¶
- Parameters:
func (
GstVideo.VideoTransferFunction
) – aGstVideo.VideoTransferFunction
val (
float
) – a value
- Return type:
New in version 1.6.
Deprecated since version 1.20: Use
GstVideo.VideoTransferFunction.encode
() instead.
- GstVideo.video_convert_sample(sample, to_caps, timeout)[source]¶
- Parameters:
sample (
Gst.Sample
) – aGst.Sample
timeout (
int
) – the maximum amount of time allowed for the processing.
- Raises:
- Returns:
The converted
Gst.Sample
, orNone
if an error happened (in which case err will point to theGLib.Error
).- Return type:
Gst.Sample
orNone
Converts a raw video buffer into the specified output caps.
The output caps can be any raw video formats or any image formats (jpeg, png, …).
The width, height and pixel-aspect-ratio can also be specified in the output caps.
- GstVideo.video_convert_sample_async(sample, to_caps, timeout, callback, *user_data)[source]¶
- Parameters:
sample (
Gst.Sample
) – aGst.Sample
timeout (
int
) – the maximum amount of time allowed for the processing.callback (
GstVideo.VideoConvertSampleCallback
) –GstVideo.VideoConvertSampleCallback
that will be called after conversion.user_data (
object
orNone
) – extra data that will be passed to the callback
Converts a raw video buffer into the specified output caps.
The output caps can be any raw video formats or any image formats (jpeg, png, …).
The width, height and pixel-aspect-ratio can also be specified in the output caps.
callback will be called after conversion, when an error occurred or if conversion didn’t finish after timeout. callback will always be called from the thread default
GLib.MainContext
, seeGLib.MainContext.get_thread_default
(). If GLib before 2.22 is used, this will always be the global default main context.destroy_notify will be called after the callback was called and user_data is not needed anymore.
- GstVideo.video_dma_drm_fourcc_from_format(format)[source]¶
- Parameters:
format (
GstVideo.VideoFormat
) – aGstVideo.VideoFormat
- Returns:
the DRM_FORMAT_* corresponding to the format.
- Return type:
Converting the video format into dma drm fourcc. If no matching fourcc found, then DRM_FORMAT_INVALID is returned.
New in version 1.24.
- GstVideo.video_dma_drm_fourcc_from_string(format_str)[source]¶
- Parameters:
format_str (
str
) – a drm format string- Returns:
The drm fourcc value or DRM_FORMAT_INVALID if format_str is invalid.
- modifier:
Return the modifier in format or
None
to ignore.
- Return type:
Convert the format_str string into the drm fourcc value. The modifier is also parsed if we want. Please note that the format_str should follow the fourcc:modifier kind style, such as NV12:0x0100000000000002
New in version 1.24.
- GstVideo.video_dma_drm_fourcc_to_format(fourcc)[source]¶
- Parameters:
fourcc (
int
) – the dma drm value.- Returns:
the GST_VIDEO_FORMAT_* corresponding to the fourcc.
- Return type:
Converting a dma drm fourcc into the video format. If no matching video format found, then
GstVideo.VideoFormat.UNKNOWN
is returned.New in version 1.24.
- GstVideo.video_dma_drm_fourcc_to_string(fourcc, modifier)[source]¶
- Parameters:
- Returns:
the drm kind string composed of to fourcc and modifier.
- Return type:
Returns a string containing drm kind format, such as NV12:0x0100000000000002, or
None
otherwise.New in version 1.24.
- GstVideo.video_event_is_force_key_unit(event)[source]¶
- Parameters:
- Returns:
True
if the event is a valid force key unit event- Return type:
Checks if an event is a force key unit event. Returns true for both upstream and downstream force key unit events.
- GstVideo.video_event_new_downstream_force_key_unit(timestamp, stream_time, running_time, all_headers, count)[source]¶
- Parameters:
timestamp (
int
) – the timestamp of the buffer that starts a new key unitstream_time (
int
) – the stream_time of the buffer that starts a new key unitrunning_time (
int
) – the running_time of the buffer that starts a new key unitall_headers (
bool
) –True
to produce headers when starting a new key unitcount (
int
) – integer that can be used to number key units
- Returns:
The new
Gst.Event
- Return type:
Creates a new downstream force key unit event. A downstream force key unit event can be sent down the pipeline to request downstream elements to produce a key unit. A downstream force key unit event must also be sent when handling an upstream force key unit event to notify downstream that the latter has been handled.
To parse an event created by
GstVideo.video_event_new_downstream_force_key_unit
() useGstVideo.video_event_parse_downstream_force_key_unit
().
- GstVideo.video_event_new_still_frame(in_still)[source]¶
- Parameters:
in_still (
bool
) – boolean value for the still-frame state of the event.- Returns:
The new
Gst.Event
- Return type:
Creates a new Still Frame event. If in_still is
True
, then the event represents the start of a still frame sequence. If it isFalse
, then the event ends a still frame sequence.To parse an event created by
GstVideo.video_event_new_still_frame
() useGstVideo.video_event_parse_still_frame
().
- GstVideo.video_event_new_upstream_force_key_unit(running_time, all_headers, count)[source]¶
- Parameters:
- Returns:
The new
Gst.Event
- Return type:
Creates a new upstream force key unit event. An upstream force key unit event can be sent to request upstream elements to produce a key unit.
running_time can be set to request a new key unit at a specific running_time. If set to
Gst.CLOCK_TIME_NONE
, upstream elements will produce a new key unit as soon as possible.To parse an event created by
GstVideo.video_event_new_downstream_force_key_unit
() useGstVideo.video_event_parse_downstream_force_key_unit
().
- GstVideo.video_event_parse_downstream_force_key_unit(event)[source]¶
- Parameters:
- Returns:
True
if the event is a valid downstream force key unit event.- timestamp:
A pointer to the timestamp in the event
- stream_time:
A pointer to the stream-time in the event
- running_time:
A pointer to the running-time in the event
- all_headers:
A pointer to the all_headers flag in the event
- count:
A pointer to the count field of the event
- Return type:
(
bool
, timestamp:int
, stream_time:int
, running_time:int
, all_headers:bool
, count:int
)
Get timestamp, stream-time, running-time, all-headers and count in the force key unit event. See
GstVideo.video_event_new_downstream_force_key_unit
() for a full description of the downstream force key unit event.running_time will be adjusted for any pad offsets of pads it was passing through.
- GstVideo.video_event_parse_still_frame(event)[source]¶
- Parameters:
- Returns:
True
if the event is a valid still-frame event.False
if not- in_still:
A boolean to receive the still-frame status from the event, or
None
- Return type:
Parse a
Gst.Event
, identify if it is a Still Frame event, and return the still-frame state from the event if it is. If the event represents the start of a still frame, the in_still variable will be set toTrue
, otherwiseFalse
. It is OK to passNone
for the in_still variable order to just check whether the event is a valid still-frame event.Create a still frame event using
GstVideo.video_event_new_still_frame
()
- GstVideo.video_event_parse_upstream_force_key_unit(event)[source]¶
- Parameters:
- Returns:
True
if the event is a valid upstream force-key-unit event.False
if not- running_time:
A pointer to the running_time in the event
- all_headers:
A pointer to the all_headers flag in the event
- count:
A pointer to the count field in the event
- Return type:
Get running-time, all-headers and count in the force key unit event. See
GstVideo.video_event_new_upstream_force_key_unit
() for a full description of the upstream force key unit event.Create an upstream force key unit event using
GstVideo.video_event_new_upstream_force_key_unit
()running_time will be adjusted for any pad offsets of pads it was passing through.
- GstVideo.video_field_order_from_string(order)[source]¶
- Parameters:
order (
str
) – a field order- Returns:
the
GstVideo.VideoFieldOrder
of order orGstVideo.VideoFieldOrder.UNKNOWN
when order is not a valid string representation for aGstVideo.VideoFieldOrder
.- Return type:
Convert order to a
GstVideo.VideoFieldOrder
New in version 1.12.
- GstVideo.video_field_order_to_string(order)[source]¶
- Parameters:
order (
GstVideo.VideoFieldOrder
) – aGstVideo.VideoFieldOrder
- Returns:
order as a string.
- Return type:
Convert order to its string representation.
New in version 1.12.
- GstVideo.video_format_from_fourcc(fourcc)[source]¶
- Parameters:
fourcc (
int
) – a FOURCC value representing raw YUV video- Returns:
the
GstVideo.VideoFormat
describing the FOURCC value- Return type:
Converts a FOURCC value into the corresponding
GstVideo.VideoFormat
. If the FOURCC cannot be represented byGstVideo.VideoFormat
,GstVideo.VideoFormat.UNKNOWN
is returned.
- GstVideo.video_format_from_masks(depth, bpp, endianness, red_mask, green_mask, blue_mask, alpha_mask)[source]¶
- Parameters:
depth (
int
) – the amount of bits used for a pixelbpp (
int
) – the amount of bits used to store a pixel. This value is bigger than depthendianness (
int
) – the endianness of the masks,GLib.LITTLE_ENDIAN
orGLib.BIG_ENDIAN
red_mask (
int
) – the red maskgreen_mask (
int
) – the green maskblue_mask (
int
) – the blue maskalpha_mask (
int
) – the alpha mask, or 0 if no alpha mask
- Returns:
a
GstVideo.VideoFormat
orGstVideo.VideoFormat.UNKNOWN
when the parameters to not specify a known format.- Return type:
Find the
GstVideo.VideoFormat
for the given parameters.
- GstVideo.video_format_from_string(format)[source]¶
- Parameters:
format (
str
) – a format string- Returns:
the
GstVideo.VideoFormat
for format orGstVideo.VideoFormat.UNKNOWN
when the string is not a known format.- Return type:
Convert the format string to its
GstVideo.VideoFormat
.
- GstVideo.video_format_get_info(format)[source]¶
- Parameters:
format (
GstVideo.VideoFormat
) – aGstVideo.VideoFormat
- Returns:
The
GstVideo.VideoFormatInfo
for format.- Return type:
Get the
GstVideo.VideoFormatInfo
for format
- GstVideo.video_format_get_palette(format)[source]¶
- Parameters:
format (
GstVideo.VideoFormat
) – aGstVideo.VideoFormat
- Returns:
the default palette of format or
None
when format does not have a palette.- size:
size of the palette in bytes
- Return type:
Get the default palette of format. This the palette used in the pack function for paletted formats.
New in version 1.2.
- GstVideo.video_format_to_fourcc(format)[source]¶
- Parameters:
format (
GstVideo.VideoFormat
) – aGstVideo.VideoFormat
video format- Returns:
the FOURCC corresponding to format
- Return type:
Converts a
GstVideo.VideoFormat
value into the corresponding FOURCC. Only a few YUV formats have corresponding FOURCC values. If format has no corresponding FOURCC value, 0 is returned.
- GstVideo.video_format_to_string(format)[source]¶
- Parameters:
format (
GstVideo.VideoFormat
) – aGstVideo.VideoFormat
video format- Returns:
the name corresponding to format
- Return type:
Returns a string containing a descriptive name for the
GstVideo.VideoFormat
if there is one, orNone
otherwise.
- GstVideo.video_formats_any()[source]¶
- Returns:
an array of
GstVideo.VideoFormat
- Return type:
Return all the raw video formats supported by GStreamer including special opaque formats such as
GstVideo.VideoFormat.DMA_DRM
for which no software conversion exists. This should be use for passthrough template cpas.New in version 1.24.
- GstVideo.video_formats_raw()[source]¶
- Returns:
an array of
GstVideo.VideoFormat
- Return type:
Return all the raw video formats supported by GStreamer.
New in version 1.18.
- GstVideo.video_frame_map(info, buffer, flags)[source]¶
- Parameters:
info (
GstVideo.VideoInfo
) – aGstVideo.VideoInfo
buffer (
Gst.Buffer
) – the buffer to mapflags (
Gst.MapFlags
) –Gst.MapFlags
- Returns:
True
on success.- frame:
pointer to
GstVideo.VideoFrame
- Return type:
(
bool
, frame:GstVideo.VideoFrame
)
Use info and buffer to fill in the values of frame. frame is usually allocated on the stack, and you will pass the address to the
GstVideo.VideoFrame
structure allocated on the stack;GstVideo.VideoFrame.map
() will then fill in the structures with the various video-specific information you need to access the pixels of the video buffer. You can then use accessor macros such as GST_VIDEO_FRAME_COMP_DATA(), GST_VIDEO_FRAME_PLANE_DATA(), GST_VIDEO_FRAME_COMP_STRIDE(), GST_VIDEO_FRAME_PLANE_STRIDE() etc. to get to the pixels.GstVideoFrame vframe; ... // set RGB pixels to black one at a time if (gst_video_frame_map (&vframe, video_info, video_buffer, GST_MAP_WRITE)) { guint8 *pixels = GST_VIDEO_FRAME_PLANE_DATA (vframe, 0); guint stride = GST_VIDEO_FRAME_PLANE_STRIDE (vframe, 0); guint pixel_stride = GST_VIDEO_FRAME_COMP_PSTRIDE (vframe, 0); for (h = 0; h < height; ++h) { for (w = 0; w < width; ++w) { guint8 *pixel = pixels + h * stride + w * pixel_stride; memset (pixel, 0, pixel_stride); } } gst_video_frame_unmap (&vframe); } ...
All video planes of buffer will be mapped and the pointers will be set in frame->data.
The purpose of this function is to make it easy for you to get to the video pixels in a generic way, without you having to worry too much about details such as whether the video data is allocated in one contiguous memory chunk or multiple memory chunks (e.g. one for each plane); or if custom strides and custom plane offsets are used or not (as signalled by
GstVideo.VideoMeta
on each buffer). This function will just fill theGstVideo.VideoFrame
structure with the right values and if you use the accessor macros everything will just work and you can access the data easily. It also maps the underlying memory chunks for you.
- GstVideo.video_frame_map_id(info, buffer, id, flags)[source]¶
- Parameters:
info (
GstVideo.VideoInfo
) – aGstVideo.VideoInfo
buffer (
Gst.Buffer
) – the buffer to mapid (
int
) – the frame id to mapflags (
Gst.MapFlags
) –Gst.MapFlags
- Returns:
True
on success.- frame:
pointer to
GstVideo.VideoFrame
- Return type:
(
bool
, frame:GstVideo.VideoFrame
)
Use info and buffer to fill in the values of frame with the video frame information of frame id.
When id is -1, the default frame is mapped. When id != -1, this function will return
False
when there is noGstVideo.VideoMeta
with that id.All video planes of buffer will be mapped and the pointers will be set in frame->data.
- GstVideo.video_guess_framerate(duration)[source]¶
- Parameters:
duration (
int
) – Nominal duration of one frame- Returns:
True
if a close “standard” framerate was recognised, andFalse
otherwise.- dest_n:
Numerator of the calculated framerate
- dest_d:
Denominator of the calculated framerate
- Return type:
Given the nominal duration of one video frame, this function will check some standard framerates for a close match (within 0.1%) and return one if possible,
It will calculate an arbitrary framerate if no close match was found, and return
False
.It returns
False
if a duration of 0 is passed.New in version 1.6.
- GstVideo.video_info_dma_drm_from_caps(caps)[source]¶
- Parameters:
- Returns:
True
if caps could be parsed- drm_info:
- Return type:
(
bool
, drm_info:GstVideo.VideoInfoDmaDrm
)
Parse caps and update info. Please note that the caps should be a dma drm caps. The
GstVideo.video_is_dma_drm_caps
() can be used to verify it before calling this function.New in version 1.24.
- GstVideo.video_info_dma_drm_from_video_info(info, modifier)[source]¶
- Parameters:
info (
GstVideo.VideoInfo
) – aGstVideo.VideoInfo
modifier (
int
) – the associated modifier value.
- Returns:
True
if drm_info is filled correctly.- drm_info:
- Return type:
(
bool
, drm_info:GstVideo.VideoInfoDmaDrm
)
Fills drm_info if info's format has a valid drm format and modifier is also valid
New in version 1.24.
- GstVideo.video_info_dma_drm_init()[source]¶
- Returns:
- Return type:
drm_info:
GstVideo.VideoInfoDmaDrm
Initialize drm_info with default values.
New in version 1.24.
- GstVideo.video_info_from_caps(caps)[source]¶
- Parameters:
- Returns:
True
if caps could be parsed- info:
- Return type:
(
bool
, info:GstVideo.VideoInfo
)
Parse caps and update info.
- GstVideo.video_info_init()[source]¶
- Returns:
- Return type:
info:
GstVideo.VideoInfo
Initialize info with default values.
- GstVideo.video_interlace_mode_from_string(mode)[source]¶
- Parameters:
mode (
str
) – a mode- Returns:
the
GstVideo.VideoInterlaceMode
of mode orGstVideo.VideoInterlaceMode.PROGRESSIVE
when mode is not a valid string representation for aGstVideo.VideoInterlaceMode
.- Return type:
Convert mode to a
GstVideo.VideoInterlaceMode
New in version 1.6.
- GstVideo.video_interlace_mode_to_string(mode)[source]¶
- Parameters:
mode (
GstVideo.VideoInterlaceMode
) – aGstVideo.VideoInterlaceMode
- Returns:
mode as a string.
- Return type:
Convert mode to its string representation.
New in version 1.6.
- GstVideo.video_is_common_aspect_ratio(width, height, par_n, par_d)[source]¶
- Parameters:
- Returns:
True
if a known “standard” aspect ratio was recognised, andFalse
otherwise.- Return type:
Given a frame’s dimensions and pixel aspect ratio, this function will calculate the frame’s aspect ratio and compare it against a set of common well-known “standard” aspect ratios.
New in version 1.22.
- GstVideo.video_is_dma_drm_caps(caps)[source]¶
- Parameters:
- Returns:
True
if the caps is a dma drm caps.- Return type:
Check whether the caps is a dma drm kind caps. Please note that the caps should be fixed.
New in version 1.24.
- GstVideo.video_make_raw_caps(formats)[source]¶
- Parameters:
formats ([
GstVideo.VideoFormat
] orNone
) – an array of rawGstVideo.VideoFormat
, orNone
- Returns:
a video GstCaps
- Return type:
Return a generic raw video caps for formats defined in formats. If formats is
None
returns a caps for all the supported raw video formats, seeGstVideo.video_formats_raw
().New in version 1.18.
- GstVideo.video_make_raw_caps_with_features(formats, features)[source]¶
- Parameters:
formats ([
GstVideo.VideoFormat
] orNone
) – an array of rawGstVideo.VideoFormat
, orNone
features (
Gst.CapsFeatures
orNone
) – theGst.CapsFeatures
to set on the caps
- Returns:
a video GstCaps
- Return type:
Return a generic raw video caps for formats defined in formats with features features. If formats is
None
returns a caps for all the supported video formats, seeGstVideo.video_formats_raw
().New in version 1.18.
- GstVideo.video_mastering_display_info_from_string(mastering)[source]¶
- Parameters:
mastering (
str
) – aGst.Structure
representingGstVideo.VideoMasteringDisplayInfo
- Returns:
True
if minfo was filled with mastering- minfo:
- Return type:
(
bool
, minfo:GstVideo.VideoMasteringDisplayInfo
)
Extract
GstVideo.VideoMasteringDisplayInfo
from masteringNew in version 1.18.
- GstVideo.video_meta_transform_scale_get_quark()[source]¶
- Returns:
a #GQuark
- Return type:
Get the #GQuark for the “gst-video-scale” metadata transform operation.
- GstVideo.video_multiview_get_doubled_height_modes()[source]¶
- Returns:
A const
GObject.Value
containing a list of stereo video modesUtility function that returns a
GObject.Value
with a GstList of packed stereo video modes with double the height of a single view for use in caps negotiations. Currently this is top-bottom and row-interleaved.- Return type:
New in version 1.6.
- GstVideo.video_multiview_get_doubled_size_modes()[source]¶
- Returns:
A const
GObject.Value
containing a list of stereo video modesUtility function that returns a
GObject.Value
with a GstList of packed stereo video modes that have double the width/height of a single view for use in caps negotiation. Currently this is just ‘checkerboard’ layout.- Return type:
New in version 1.6.
- GstVideo.video_multiview_get_doubled_width_modes()[source]¶
- Returns:
A const
GObject.Value
containing a list of stereo video modesUtility function that returns a
GObject.Value
with a GstList of packed stereo video modes with double the width of a single view for use in caps negotiations. Currently this is side-by-side, side-by-side-quincunx and column-interleaved.- Return type:
New in version 1.6.
- GstVideo.video_multiview_get_mono_modes()[source]¶
- Returns:
A const
GObject.Value
containing a list of mono video modesUtility function that returns a
GObject.Value
with a GstList of mono video modes (mono/left/right) for use in caps negotiations.- Return type:
New in version 1.6.
- GstVideo.video_multiview_get_unpacked_modes()[source]¶
- Returns:
A const
GObject.Value
containing a list of ‘unpacked’ stereo video modesUtility function that returns a
GObject.Value
with a GstList of unpacked stereo video modes (separated/frame-by-frame/frame-by-frame-multiview) for use in caps negotiations.- Return type:
New in version 1.6.
- GstVideo.video_multiview_guess_half_aspect(mv_mode, width, height, par_n, par_d)[source]¶
- Parameters:
mv_mode (
GstVideo.VideoMultiviewMode
) – AGstVideo.VideoMultiviewMode
width (
int
) – Video frame width in pixelsheight (
int
) – Video frame height in pixelspar_n (
int
) – Numerator of the video pixel-aspect-ratiopar_d (
int
) – Denominator of the video pixel-aspect-ratio
- Returns:
A boolean indicating whether the
GstVideo.VideoMultiviewFlags.HALF_ASPECT
flag should be set.Utility function that heuristically guess whether a frame-packed stereoscopic video contains half width/height encoded views, or full-frame views by looking at the overall display aspect ratio.
- Return type:
New in version 1.6.
- GstVideo.video_multiview_mode_from_caps_string(caps_mview_mode)[source]¶
- Parameters:
caps_mview_mode (
str
) – multiview-mode field string from caps- Returns:
The
GstVideo.VideoMultiviewMode
valueGiven a string from a caps multiview-mode field, output the corresponding
GstVideo.VideoMultiviewMode
orGstVideo.VideoMultiviewMode.NONE
- Return type:
New in version 1.6.
- GstVideo.video_multiview_mode_to_caps_string(mview_mode)[source]¶
- Parameters:
mview_mode (
GstVideo.VideoMultiviewMode
) – AGstVideo.VideoMultiviewMode
value- Returns:
The caps string representation of the mode, or
None
if invalid.- Return type:
Given a
GstVideo.VideoMultiviewMode
returns the multiview-mode caps string for insertion into a caps structureNew in version 1.6.
- GstVideo.video_multiview_video_info_change_mode(info, out_mview_mode, out_mview_flags)[source]¶
- Parameters:
info (
GstVideo.VideoInfo
) – AGstVideo.VideoInfo
structure to operate onout_mview_mode (
GstVideo.VideoMultiviewMode
) – AGstVideo.VideoMultiviewMode
valueout_mview_flags (
GstVideo.VideoMultiviewFlags
) – A set ofGstVideo.VideoMultiviewFlags
Utility function that transforms the width/height/PAR and multiview mode and flags of a
GstVideo.VideoInfo
into the requested mode.New in version 1.6.
- GstVideo.video_orientation_from_tag(taglist)[source]¶
- Parameters:
taglist (
Gst.TagList
) – AGst.TagList
- Returns:
True
if there was a valid “image-orientation” tag in the taglist.- method:
The location where to return the orientation.
- Return type:
(
bool
, method:GstVideo.VideoOrientationMethod
)
Parses the “image-orientation” tag and transforms it into the
GstVideo.VideoOrientationMethod
enum.New in version 1.20.
- GstVideo.video_overlay_install_properties(oclass, last_prop_id)[source]¶
- Parameters:
oclass (
GObject.ObjectClass
) – The class on which the properties will be installedlast_prop_id (
int
) – The first free property ID to use
This helper shall be used by classes implementing the
GstVideo.VideoOverlay
interface that want the render rectangle to be controllable using properties. This helper will install “render-rectangle” property into the class.New in version 1.14.
- GstVideo.video_overlay_set_property(object, last_prop_id, property_id, value)[source]¶
- Parameters:
object (
GObject.Object
) – The instance on which the property is setlast_prop_id (
int
) – The highest property ID.property_id (
int
) – The property IDvalue (
GObject.Value
) – TheGObject.Value
to be set
- Returns:
True
if the property_id matches theGstVideo.VideoOverlay
property- Return type:
This helper shall be used by classes implementing the
GstVideo.VideoOverlay
interface that want the render rectangle to be controllable using properties. This helper will parse and set the render rectangle callingGstVideo.VideoOverlay.set_render_rectangle
().New in version 1.14.
- GstVideo.video_sei_user_data_unregistered_meta_api_get_type()[source]¶
- Returns:
GObject.GType
for theGstVideo.VideoSEIUserDataUnregisteredMeta
structure.- Return type:
New in version 1.22.
- GstVideo.video_sei_user_data_unregistered_meta_get_info()[source]¶
- Returns:
Gst.MetaInfo
pointer that describesGstVideo.VideoSEIUserDataUnregisteredMeta
.- Return type:
New in version 1.22.
- GstVideo.video_sei_user_data_unregistered_parse_precision_time_stamp(user_data)[source]¶
- Parameters:
user_data (
GstVideo.VideoSEIUserDataUnregisteredMeta
) – aGstVideo.VideoSEIUserDataUnregisteredMeta
- Returns:
True if data is a Precision Time Stamp and it was parsed correctly
- status:
User Data Unregistered UUID
- precision_time_stamp:
The parsed Precision Time Stamp SEI
- Return type:
Parses and returns the Precision Time Stamp (ST 0604) from the SEI User Data Unregistered buffer
New in version 1.22.
- GstVideo.video_tile_get_index(mode, x, y, x_tiles, y_tiles)[source]¶
- Parameters:
mode (
GstVideo.VideoTileMode
) – aGstVideo.VideoTileMode
x (
int
) – x coordinatey (
int
) – y coordinatex_tiles (
int
) – number of horizintal tilesy_tiles (
int
) – number of vertical tiles
- Returns:
the index of the tile at x and y in the tiled image of x_tiles by y_tiles.
- Return type:
Get the tile index of the tile at coordinates x and y in the tiled image of x_tiles by y_tiles.
Use this method when mode is of type
GstVideo.VideoTileType.INDEXED
.New in version 1.4.
- GstVideo.video_transfer_function_decode(func, val)[source]¶
- Parameters:
func (
GstVideo.VideoTransferFunction
) – aGstVideo.VideoTransferFunction
val (
float
) – a value
- Returns:
the gamma decoded value of val
- Return type:
Convert val to its gamma decoded value. This is the inverse operation of
GstVideo.video_color_transfer_encode
().For a non-linear value L’ in the range [0..1], conversion to the linear L is in general performed with a power function like:
L = L' ^ gamma
Depending on func, different formulas might be applied. Some formulas encode a linear segment in the lower range.
New in version 1.20.
- GstVideo.video_transfer_function_encode(func, val)[source]¶
- Parameters:
func (
GstVideo.VideoTransferFunction
) – aGstVideo.VideoTransferFunction
val (
float
) – a value
- Returns:
the gamma encoded value of val
- Return type:
Convert val to its gamma encoded value.
For a linear value L in the range [0..1], conversion to the non-linear (gamma encoded) L’ is in general performed with a power function like:
L' = L ^ (1 / gamma)
Depending on func, different formulas might be applied. Some formulas encode a linear segment in the lower range.
New in version 1.20.
- GstVideo.video_transfer_function_from_iso(value)[source]¶
- Parameters:
value (
int
) – a ITU-T H.273 transfer characteristics value- Returns:
the matched
GstVideo.VideoTransferFunction
- Return type:
Converts the value to the
GstVideo.VideoTransferFunction
The transfer characteristics (TransferCharacteristics) value is defined by “ISO/IEC 23001-8 Section 7.2 Table 3” and “ITU-T H.273 Table 3”. “H.264 Table E-4” and “H.265 Table E.4” share the identical values.New in version 1.18.
- GstVideo.video_transfer_function_is_equivalent(from_func, from_bpp, to_func, to_bpp)[source]¶
- Parameters:
from_func (
GstVideo.VideoTransferFunction
) –GstVideo.VideoTransferFunction
to convert fromfrom_bpp (
int
) – bits per pixel to convert fromto_func (
GstVideo.VideoTransferFunction
) –GstVideo.VideoTransferFunction
to convert intoto_bpp (
int
) – bits per pixel to convert into
- Returns:
True
if from_func and to_func can be considered equivalent.- Return type:
Returns whether from_func and to_func are equivalent. There are cases (e.g. BT601, BT709, and BT2020_10) where several functions are functionally identical. In these cases, when doing conversion, we should consider them as equivalent. Also, BT2020_12 is the same as the aforementioned three for less than 12 bits per pixel.
New in version 1.18.
- GstVideo.video_transfer_function_to_iso(func)[source]¶
- Parameters:
func (
GstVideo.VideoTransferFunction
) – aGstVideo.VideoTransferFunction
- Returns:
The value of ISO/IEC 23001-8 transfer characteristics.
- Return type:
Converts
GstVideo.VideoTransferFunction
to the “transfer characteristics” (TransferCharacteristics) value defined by “ISO/IEC 23001-8 Section 7.2 Table 3” and “ITU-T H.273 Table 3”. “H.264 Table E-4” and “H.265 Table E.4” share the identical values.New in version 1.18.