Functions¶
Details¶
- GstVideo.buffer_add_ancillary_meta(buffer)[source]¶
- Parameters:
buffer (
Gst.Buffer) – AGst.Buffer- Returns:
A new
GstVideo.AncillaryMeta, orNoneif an error happened.- Return type:
Adds a new
GstVideo.AncillaryMetato 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.Bufferfield (
int) – 0 for progressive or field 1 and 1 for field 2spec (
GstVideo.VideoAFDSpec) –GstVideo.VideoAFDSpecthat applies to AFD valueafd (
GstVideo.VideoAFDValue) –GstVideo.VideoAFDValueAFD enumeration
- Returns:
the
GstVideo.VideoAFDMetaon buffer.- Return type:
Attaches
GstVideo.VideoAFDMetametadata 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.VideoAffineTransformationMetaon buffer.- Return type:
Attaches
GstVideo.VideoAffineTransformationMetametadata 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.Bufferfield (
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.VideoBarMetaon 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.VideoBarMetametadata to buffer with the given parameters.New in version 1.18.
- GstVideo.buffer_add_video_caption_meta(buffer, caption_type, data)[source]¶
- Parameters:
buffer (
Gst.Buffer) – aGst.Buffercaption_type (
GstVideo.VideoCaptionType) – The type of Closed Caption to adddata (
bytes) – The Closed Caption data
- Returns:
the
GstVideo.VideoCaptionMetaon buffer.- Return type:
Attaches
GstVideo.VideoCaptionMetametadata 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.Bufferalpha_buffer (
Gst.Buffer) – aGst.Buffer
- Returns:
the
GstVideo.VideoCodecAlphaMetaon buffer.- Return type:
Attaches a
GstVideo.VideoCodecAlphaMetametadata 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.Buffertexture_orientation (
GstVideo.VideoGLTextureOrientation) – theGstVideo.VideoGLTextureOrientationn_textures (
int) – the number of texturestexture_type (
GstVideo.VideoGLTextureType) – array ofGstVideo.VideoGLTextureTypeupload (
GstVideo.VideoGLTextureUpload) – the function to upload the buffer to a specific texture IDuser_data (
objectorNone) – 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.VideoGLTextureUploadMetaon buffer.- Return type:
Attaches
GstVideo.VideoGLTextureUploadMetametadata to buffer with the given parameters.
- GstVideo.buffer_add_video_meta(buffer, flags, format, width, height)[source]¶
- Parameters:
buffer (
Gst.Buffer) – aGst.Bufferformat (
GstVideo.VideoFormat) – aGstVideo.VideoFormatwidth (
int) – the widthheight (
int) – the height
- Returns:
the
GstVideo.VideoMetaon buffer.- Return type:
Attaches
GstVideo.VideoMetametadata 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.Bufferformat (
GstVideo.VideoFormat) – aGstVideo.VideoFormatwidth (
int) – the widthheight (
int) – the heightn_planes (
int) – number of planesoffset ([
int]) – offset of each planestride ([
int]) – stride of each plane
- Returns:
the
GstVideo.VideoMetaon buffer.- Return type:
Attaches
GstVideo.VideoMetametadata to buffer with the given parameters.
- GstVideo.buffer_add_video_overlay_composition_meta(buf, comp)[source]¶
- Parameters:
buf (
Gst.Buffer) – aGst.Buffercomp (
GstVideo.VideoOverlayCompositionorNone) – 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.Bufferroi_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.VideoRegionOfInterestMetaon buffer.- Return type:
Attaches
GstVideo.VideoRegionOfInterestMetametadata 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.Bufferroi_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.VideoRegionOfInterestMetaon buffer.- Return type:
Attaches
GstVideo.VideoRegionOfInterestMetametadata 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.Bufferuuid (
int) – User Data Unregistered UUIDsize (
int) – size of the data buffer
- Returns:
the
GstVideo.VideoSEIUserDataUnregisteredMetaon buffer.- Return type:
Attaches
GstVideo.VideoSEIUserDataUnregisteredMetametadata 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.VideoTimeCodeMetaon buffer, or (since 1.16)Noneif the timecode was invalid.- Return type:
Attaches
GstVideo.VideoTimeCodeMetametadata 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.Bufferfps_n (
int) – framerate numeratorfps_d (
int) – framerate denominatorlatest_daily_jam (
GLib.DateTime) – aGLib.DateTimefor the latest daily jamflags (
GstVideo.VideoTimeCodeFlags) – aGstVideo.VideoTimeCodeFlagshours (
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.VideoTimeCodeMetaon buffer, or (since 1.16)Noneif the timecode was invalid.- Return type:
Attaches
GstVideo.VideoTimeCodeMetametadata 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.VideoMetawith lowest id (usually 0) orNonewhen there is no such metadata on buffer.- Return type:
Find the
GstVideo.VideoMetaon buffer with the lowest id.Buffers can contain multiple
GstVideo.VideoMetametadata items when dealing with multiview buffers.
- GstVideo.buffer_get_video_meta_id(buffer, id)[source]¶
- Parameters:
buffer (
Gst.Buffer) – aGst.Bufferid (
int) – a metadata id
- Returns:
the
GstVideo.VideoMetawith id orNonewhen there is no such metadata on buffer.- Return type:
Find the
GstVideo.VideoMetaon buffer with the given id.Buffers can contain multiple
GstVideo.VideoMetametadata items when dealing with multiview buffers.
- GstVideo.buffer_get_video_region_of_interest_meta_id(buffer, id)[source]¶
- Parameters:
buffer (
Gst.Buffer) – aGst.Bufferid (
int) – a metadata id
- Returns:
the
GstVideo.VideoRegionOfInterestMetawith id orNonewhen there is no such metadata on buffer.- Return type:
Find the
GstVideo.VideoRegionOfInterestMetaon buffer with the given id.Buffers can contain multiple
GstVideo.VideoRegionOfInterestMetametadata 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.Structurealign (
GstVideo.VideoAlignment) – aGstVideo.VideoAlignment
- Returns:
Trueif 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.Structurealign (
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.Navigationevent.New in version 1.22.
- Parameters:
- Return type:
Inspect a
Gst.Eventand return theGstVideo.NavigationEventTypeof the event, orGstVideo.NavigationEventType.INVALIDif the event is not aGstVideo.Navigationevent.
- 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:
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 double click.
New in version 1.26.
- 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:
Trueif the navigation command could be extracted, otherwiseFalse.- command:
Pointer to
GstVideo.NavigationCommandto receive the type of the navigation event.
- Return type:
(
bool, command:GstVideo.NavigationCommand)
Inspect a
GstVideo.Navigationcommand 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:
Trueif the event is aGstVideo.Navigationevent with associated modifiers state, otherwiseFalse.- Return type:
New in version 1.22.
- Parameters:
- Returns:
Trueif the button number and both coordinates could be extracted, otherwiseFalse.- Return type:
Retrieve the details of either a
GstVideo.Navigationmouse 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.Navigationmouse movement event and extract the coordinates of the event.
- Parameters:
- Returns:
Trueif all coordinates could be extracted, otherwiseFalse.- x:
Pointer to a
floatto receive the x coordinate of the mouse movement.- y:
Pointer to a
floatto receive the y coordinate of the mouse movement.- delta_x:
Pointer to a
floatto receive the delta_x coordinate of the mouse movement.- delta_y:
Pointer to a
floatto receive the delta_y coordinate of the mouse movement.
- Return type:
Inspect a
GstVideo.Navigationmouse scroll event and extract the coordinates of the event.New in version 1.18.
- Parameters:
- Returns:
Trueif all details could be extracted, otherwiseFalse.- identifier:
Pointer to a
intthat will receive the identifier unique to this touch point.- x:
Pointer to a
floatthat will receive the x coordinate of the touch event.- y:
Pointer to a
floatthat will receive the y coordinate of the touch event.- pressure:
Pointer to a
floatthat 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.Navigationtouch-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.Navigationtouch-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.Navigationevent. The event must be writable.New in version 1.22.
- Parameters:
message (
Gst.Message) – AGst.Messageto inspect.- Returns:
The type of the
Gst.Message, orGstVideo.NavigationMessageType.INVALIDif the message is not aGstVideo.Navigationnotification.- Return type:
Check a bus message to see if it is a
GstVideo.Navigationevent, and return theGstVideo.NavigationMessageTypeidentifying the type of the message if so.
- Parameters:
src (
Gst.Object) – AGst.Objectto 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.Navigationmessage with typeGstVideo.NavigationMessageType.ANGLES_CHANGEDfor notifying an application that the current angle, or current number of angles available in a multiangle video has changed.
- Parameters:
src (
Gst.Object) – AGst.Objectto set as source of the new message.- Returns:
The new
Gst.Message.- Return type:
Creates a new
GstVideo.Navigationmessage with typeGstVideo.NavigationMessageType.COMMANDS_CHANGED
- Parameters:
src (
Gst.Object) – AGst.Objectto set as source of the new message.
- Returns:
The new
Gst.Message.- Return type:
Creates a new
GstVideo.Navigationmessage with typeGstVideo.NavigationMessageType.EVENT.New in version 1.6.
- Parameters:
src (
Gst.Object) – AGst.Objectto set as source of the new message.active (
bool) –Trueif the mouse has entered a clickable area of the display.Falseif it over a non-clickable area.
- Returns:
The new
Gst.Message.- Return type:
Creates a new
GstVideo.Navigationmessage with typeGstVideo.NavigationMessageType.MOUSE_OVER.
- Parameters:
message (
Gst.Message) – AGst.Messageto inspect.- Returns:
Trueif the message could be successfully parsed.Falseif not.- Return type:
Parse a
GstVideo.Navigationmessage of typeGstVideo.NavigationMessageType.ANGLES_CHANGEDand extract the cur_angle and n_angles parameters.
- Parameters:
message (
Gst.Message) – AGst.Messageto inspect.- Returns:
Trueif the message could be successfully parsed.Falseif not.- event:
a pointer to a
Gst.Eventto receive the contained navigation event.
- Return type:
Parse a
GstVideo.Navigationmessage of typeGstVideo.NavigationMessageType.EVENTand extract containedGst.Event. The caller must unref the event when done with it.New in version 1.6.
- Parameters:
message (
Gst.Message) – AGst.Messageto inspect.- Returns:
Trueif the message could be successfully parsed.Falseif not.- Return type:
Parse a
GstVideo.Navigationmessage of typeGstVideo.NavigationMessageType.MOUSE_OVERand 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.NavigationQueryTypeof the query, orGstVideo.NavigationQueryType.INVALID- Return type:
Inspect a
Gst.Queryand return theGstVideo.NavigationQueryTypeassociated with it if it is aGstVideo.Navigationquery.
- Returns:
The new query.
- Return type:
Create a new
GstVideo.Navigationangles 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.Navigationcommands query. When executed, it will query the pipeline for the set of currently available commands.
-
Parse the current angle number in the
GstVideo.Navigationangles query into theintpointed to by the cur_angle variable, and the number of available angles into theintpointed to by the n_angles variable.
- Parameters:
- Returns:
Trueif the query could be successfully parsed.Falseif not.- n_cmds:
the number of commands in this query.
- Return type:
Parse the number of commands in the
GstVideo.Navigationcommands query.
- Parameters:
- Returns:
Trueif the query could be successfully parsed.Falseif not.- cmd:
a pointer to store the nth command into.
- Return type:
(
bool, cmd:GstVideo.NavigationCommand)
Parse the
GstVideo.Navigationcommand 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.Navigationangles query result field in query.
- Parameters:
cmds ([
GstVideo.NavigationCommand]) – An array containing n_cmds GstNavigationCommand values.
Set the
GstVideo.Navigationcommand 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.VideoFramewhere to blend src insrc (
GstVideo.VideoFrame) – theGstVideo.VideoFramethat 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.VideoInfodescribing 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.VideoInfostructure that will be filled in with the details for dest_buffer- dest_buffer:
a pointer to a
Gst.Buffervariable, 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.VideoScalerto 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
Falsein 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.
- GstVideo.video_caption_type_from_caps(caps)[source]¶
- Parameters:
- Returns:
- Return type:
Parses fixed Closed Caption
Gst.Capsand returns the corresponding caption type, orGstVideo.VideoCaptionType.UNKNOWN.New in version 1.16.
- GstVideo.video_caption_type_to_caps(type)[source]¶
- 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.VideoRectangledescribing the source areadst (
GstVideo.VideoRectangle) – a pointer toGstVideo.VideoRectangledescribing the destination areascaling (
bool) – aboolindicating if scaling should be applied or not
- Returns:
a pointer to a
GstVideo.VideoRectanglewhich 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.VideoChromaSiteorGstVideo.VideoChromaSite.UNKNOWNwhen s does not contain a valid chroma description.- Return type:
Convert s to a
GstVideo.VideoChromaSiteDeprecated since version 1.20: Use
GstVideo.VideoChromaSite.from_string() instead.
- GstVideo.video_chroma_resample(resample, lines, width)[source]¶
- Parameters:
resample (
GstVideo.VideoChromaResample) – aGstVideo.VideoChromaResamplewidth (
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.VideoChromaSiteorGstVideo.VideoChromaSite.UNKNOWNwhen s does not contain a valid chroma-site description.- Return type:
Convert s to a
GstVideo.VideoChromaSiteNew 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
Noneif 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.GTypefor theGstVideo.VideoCodecAlphaMetastructure.- Return type:
New in version 1.20.
- GstVideo.video_codec_alpha_meta_get_info()[source]¶
- Returns:
Gst.MetaInfopointer 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.VideoColorMatrixThe 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:
Trueif 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.VideoColorMatrixto 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.VideoColorPrimariesThe 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.VideoColorPrimariesInfofor 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.VideoColorPrimariesother (
GstVideo.VideoColorPrimaries) – anotherGstVideo.VideoColorPrimaries
- Returns:
Trueif 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.VideoColorPrimariesto 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.VideoColorRangeinfo (
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.VideoTransferFunctionval (
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.VideoTransferFunctionval (
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.Sampletimeout (
int) – the maximum amount of time allowed for the processing.
- Raises:
- Returns:
The converted
Gst.Sample, orNoneif an error happened (in which case err will point to theGLib.Error).- Return type:
Gst.SampleorNone
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.Sampletimeout (
int) – the maximum amount of time allowed for the processing.callback (
GstVideo.VideoConvertSampleCallback) –GstVideo.VideoConvertSampleCallbackthat will be called after conversion.user_data (
objectorNone) – 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_format_from_gst_format(format, modifier)[source]¶
- Parameters:
format (
GstVideo.VideoFormat) – aGstVideo.VideoFormat
- Returns:
the DRM_FORMAT_* corresponding to format.
- Return type:
Converting the video format into dma drm fourcc/modifier pair. If no matching fourcc found, then DRM_FORMAT_INVALID is returned and modifier will be set to DRM_FORMAT_MOD_INVALID.
New in version 1.26.
- GstVideo.video_dma_drm_format_to_gst_format(fourcc, modifier)[source]¶
- Parameters:
- Returns:
the GST_VIDEO_FORMAT_* corresponding to the fourcc and modifier pair.
- Return type:
Converting a dma drm fourcc and modifier pair into a
GstVideo.VideoFormat. If no matching video format is found, thenGstVideo.VideoFormat.UNKNOWNis returned.New in version 1.26.
- 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
Noneto 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.UNKNOWNis 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
Noneotherwise.New in version 1.24.
- GstVideo.video_event_is_force_key_unit(event)[source]¶
- Parameters:
- Returns:
Trueif 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) –Trueto 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:
Trueif 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:
Trueif the event is a valid still-frame event.Falseif 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 passNonefor 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:
Trueif the event is a valid upstream force-key-unit event.Falseif 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.VideoFieldOrderof order orGstVideo.VideoFieldOrder.UNKNOWNwhen order is not a valid string representation for aGstVideo.VideoFieldOrder.- Return type:
Convert order to a
GstVideo.VideoFieldOrderNew 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.VideoFormatdescribing the FOURCC value- Return type:
Converts a FOURCC value into the corresponding
GstVideo.VideoFormat. If the FOURCC cannot be represented byGstVideo.VideoFormat,GstVideo.VideoFormat.UNKNOWNis 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_ENDIANorGLib.BIG_ENDIANred_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.VideoFormatorGstVideo.VideoFormat.UNKNOWNwhen the parameters to not specify a known format.- Return type:
Find the
GstVideo.VideoFormatfor the given parameters.
- GstVideo.video_format_from_string(format)[source]¶
- Parameters:
format (
str) – a format string- Returns:
the
GstVideo.VideoFormatfor format orGstVideo.VideoFormat.UNKNOWNwhen 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.VideoFormatInfofor format.- Return type:
Get the
GstVideo.VideoFormatInfofor format
- GstVideo.video_format_get_palette(format)[source]¶
- Parameters:
format (
GstVideo.VideoFormat) – aGstVideo.VideoFormat- Returns:
the default palette of format or
Nonewhen 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.VideoFormatvideo format- Returns:
the FOURCC corresponding to format
- Return type:
Converts a
GstVideo.VideoFormatvalue 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.VideoFormatvideo format- Returns:
the name corresponding to format
- Return type:
Returns a string containing a descriptive name for the
GstVideo.VideoFormat.Since 1.26 this can also be used with
GstVideo.VideoFormat.UNKNOWN, previous versions were printing a critical warning and returnedNone.
- 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_DRMfor 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.VideoInfobuffer (
Gst.Buffer) – the buffer to mapflags (
Gst.MapFlags) –Gst.MapFlags
- Returns:
Trueon 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.VideoFramestructure 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.VideoMetaon each buffer). This function will just fill theGstVideo.VideoFramestructure 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.VideoInfobuffer (
Gst.Buffer) – the buffer to mapid (
int) – the frame id to mapflags (
Gst.MapFlags) –Gst.MapFlags
- Returns:
Trueon 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
Falsewhen there is noGstVideo.VideoMetawith 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:
Trueif a close “standard” framerate was recognised, andFalseotherwise.- 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
Falseif a duration of 0 is passed.New in version 1.6.
- GstVideo.video_info_dma_drm_from_caps(caps)[source]¶
- Parameters:
- Returns:
Trueif 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.VideoInfomodifier (
int) – the associated modifier value.
- Returns:
Trueif 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:
Trueif 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.VideoInterlaceModeof mode orGstVideo.VideoInterlaceMode.PROGRESSIVEwhen mode is not a valid string representation for aGstVideo.VideoInterlaceMode.- Return type:
Convert mode to a
GstVideo.VideoInterlaceModeNew 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:
Trueif a known “standard” aspect ratio was recognised, andFalseotherwise.- 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:
Trueif 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
Nonereturns 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, orNonefeatures (
Gst.CapsFeaturesorNone) – theGst.CapsFeaturesto 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
Nonereturns 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.StructurerepresentingGstVideo.VideoMasteringDisplayInfo- Returns:
Trueif minfo was filled with mastering- minfo:
- Return type:
(
bool, minfo:GstVideo.VideoMasteringDisplayInfo)
Extract
GstVideo.VideoMasteringDisplayInfofrom 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.Valuecontaining a list of stereo video modesUtility function that returns a
GObject.Valuewith 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.Valuecontaining a list of stereo video modesUtility function that returns a
GObject.Valuewith 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.Valuecontaining a list of stereo video modesUtility function that returns a
GObject.Valuewith 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.Valuecontaining a list of mono video modesUtility function that returns a
GObject.Valuewith 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.Valuecontaining a list of ‘unpacked’ stereo video modesUtility function that returns a
GObject.Valuewith 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.VideoMultiviewModewidth (
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_ASPECTflag 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.VideoMultiviewModevalueGiven a string from a caps multiview-mode field, output the corresponding
GstVideo.VideoMultiviewModeorGstVideo.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.VideoMultiviewModevalue- Returns:
The caps string representation of the mode, or
Noneif invalid.- Return type:
Given a
GstVideo.VideoMultiviewModereturns 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.VideoInfostructure to operate onout_mview_mode (
GstVideo.VideoMultiviewMode) – AGstVideo.VideoMultiviewModevalueout_mview_flags (
GstVideo.VideoMultiviewFlags) – A set ofGstVideo.VideoMultiviewFlags
Utility function that transforms the width/height/PAR and multiview mode and flags of a
GstVideo.VideoInfointo the requested mode.New in version 1.6.
- GstVideo.video_orientation_from_tag(taglist)[source]¶
- Parameters:
taglist (
Gst.TagList) – AGst.TagList- Returns:
Trueif 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.VideoOrientationMethodenum.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.VideoOverlayinterface 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.Valueto be set
- Returns:
Trueif the property_id matches theGstVideo.VideoOverlayproperty- Return type:
This helper shall be used by classes implementing the
GstVideo.VideoOverlayinterface 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.GTypefor theGstVideo.VideoSEIUserDataUnregisteredMetastructure.- Return type:
New in version 1.22.
- GstVideo.video_sei_user_data_unregistered_meta_get_info()[source]¶
- Returns:
Gst.MetaInfopointer 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.VideoTileModex (
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.VideoTransferFunctionval (
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' ^ gammaDepending 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.VideoTransferFunctionval (
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.VideoTransferFunctionThe 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.VideoTransferFunctionto convert fromfrom_bpp (
int) – bits per pixel to convert fromto_func (
GstVideo.VideoTransferFunction) –GstVideo.VideoTransferFunctionto convert intoto_bpp (
int) – bits per pixel to convert into
- Returns:
Trueif 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.VideoTransferFunctionto 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.