Functions

buffer_get_max_memory ()

caps_features_from_string (features)

caps_from_string (string)

core_error_quark ()

debug_add_log_function (func, *user_data)

debug_add_ring_buffer_logger (max_size_per_thread, thread_timeout)

debug_bin_to_dot_data (bin, details)

debug_bin_to_dot_file (bin, details, file_name)

debug_bin_to_dot_file_with_ts (bin, details, file_name)

debug_construct_term_color (colorinfo)

debug_construct_win_color (colorinfo)

debug_get_all_categories ()

debug_get_color_mode ()

debug_get_default_threshold ()

debug_get_stack_trace (flags)

debug_is_active ()

debug_is_colored ()

debug_level_get_name (level)

debug_log_default (category, level, file, function, line, object, message, user_data)

debug_log_get_line (category, level, file, function, line, object, message)

debug_log_id_literal (category, level, file, function, line, id, message_string)

debug_log_literal (category, level, file, function, line, object, message_string)

debug_print_stack_trace ()

debug_remove_log_function (func)

debug_remove_log_function_by_data (data)

debug_remove_ring_buffer_logger ()

debug_ring_buffer_logger_get_logs ()

debug_set_active (active)

debug_set_color_mode (mode)

debug_set_color_mode_from_string (mode)

debug_set_colored (colored)

debug_set_default_threshold (level)

debug_set_threshold_for_name (name, level)

debug_set_threshold_from_string (list, reset)

debug_unset_threshold_for_name (name)

deinit ()

dynamic_type_register (plugin, type)

error_get_message (domain, code)

event_type_get_flags (type)

event_type_get_name (type)

event_type_to_quark (type)

event_type_to_sticky_ordering (type)

filename_to_uri (filename)

flow_get_name (ret)

flow_to_quark (ret)

format_get_by_nick (nick)

format_get_details (format)

format_get_name (format)

format_iterate_definitions ()

format_register (nick, description)

format_to_quark (format)

formats_contains (formats, format)

get_main_executable_path ()

init (argv)

init_check (argv)

is_caps_features (obj)

is_initialized ()

library_error_quark ()

message_type_get_name (type)

message_type_to_quark (type)

meta_api_type_get_tags (api)

meta_api_type_has_tag (api, tag)

meta_api_type_register (api, tags)

meta_get_info (impl)

meta_register (api, impl, size, init_func, free_func, transform_func)

meta_register_custom (name, tags, transform_func, *user_data)

mini_object_replace (olddata, newdata)

mini_object_take (olddata, newdata)

pad_mode_get_name (mode)

param_spec_array (name, nick, blurb, element_spec, flags)

param_spec_fraction (name, nick, blurb, min_num, min_denom, max_num, max_denom, default_num, default_denom, flags)

parent_buffer_meta_api_get_type ()

parent_buffer_meta_get_info ()

parse_bin_from_description (bin_description, ghost_unlinked_pads)

parse_bin_from_description_full (bin_description, ghost_unlinked_pads, context, flags)

parse_error_quark ()

parse_launch (pipeline_description)

parse_launch_full (pipeline_description, context, flags)

parse_launchv (argv)

parse_launchv_full (argv, context, flags)

plugin_error_quark ()

preset_get_app_dir ()

preset_set_app_dir (app_dir)

protection_filter_systems_by_available_decryptors (system_identifiers)

protection_meta_api_get_type ()

protection_meta_get_info ()

protection_select_system (system_identifiers)

query_type_get_flags (type)

query_type_get_name (type)

query_type_to_quark (type)

reference_timestamp_meta_api_get_type ()

reference_timestamp_meta_get_info ()

resource_error_quark ()

segtrap_is_enabled ()

segtrap_set_enabled (enabled)

state_change_get_name (transition)

static_caps_get_type ()

static_pad_template_get_type ()

stream_error_quark ()

stream_type_get_name (stype)

structure_take (oldstr_ptr, newstr)

tag_exists (tag)

tag_get_description (tag)

tag_get_flag (tag)

tag_get_nick (tag)

tag_get_type (tag)

tag_is_fixed (tag)

tag_list_copy_value (list, tag)

tag_merge_strings_with_comma (src)

tag_merge_use_first (src)

toc_entry_type_get_nick (type)

tracing_get_active_tracers ()

tracing_register_hook (tracer, detail, func)

type_find_get_type ()

type_find_register (plugin, name, rank, func, extensions, possible_caps, *data)

type_is_plugin_api (type)

type_mark_as_plugin_api (type, flags)

update_registry ()

uri_construct (protocol, location)

uri_error_quark ()

uri_from_string (uri)

uri_from_string_escaped (uri)

uri_get_location (uri)

uri_get_protocol (uri)

uri_has_protocol (uri, protocol)

uri_is_valid (uri)

uri_join_strings (base_uri, ref_uri)

uri_protocol_is_supported (type, protocol)

uri_protocol_is_valid (protocol)

util_array_binary_search (array, num_elements, element_size, search_func, mode, search_data, *user_data)

util_double_to_fraction (src)

util_dump_buffer (buf)

util_dump_mem (mem)

util_fraction_add (a_n, a_d, b_n, b_d)

util_fraction_compare (a_n, a_d, b_n, b_d)

util_fraction_multiply (a_n, a_d, b_n, b_d)

util_fraction_to_double (src_n, src_d)

util_gdouble_to_guint64 (value)

util_get_object_array (object, name)

util_get_timestamp ()

util_greatest_common_divisor (a, b)

util_greatest_common_divisor_int64 (a, b)

util_group_id_next ()

util_guint64_to_gdouble (value)

util_seqnum_compare (s1, s2)

util_seqnum_next ()

util_set_object_arg (object, name, value)

util_set_object_array (object, name, array)

util_set_value_from_string (value_str)

util_uint64_scale (val, num, denom)

util_uint64_scale_ceil (val, num, denom)

util_uint64_scale_int (val, num, denom)

util_uint64_scale_int_ceil (val, num, denom)

util_uint64_scale_int_round (val, num, denom)

util_uint64_scale_round (val, num, denom)

value_can_compare (value1, value2)

value_can_intersect (value1, value2)

value_can_subtract (minuend, subtrahend)

value_can_union (value1, value2)

value_compare (value1, value2)

value_deserialize (src)

value_deserialize_with_pspec (src, pspec)

value_fixate (dest, src)

value_fraction_multiply (product, factor1, factor2)

value_fraction_subtract (dest, minuend, subtrahend)

value_get_bitmask (value)

value_get_caps (value)

value_get_caps_features (value)

value_get_double_range_max (value)

value_get_double_range_min (value)

value_get_flagset_flags (value)

value_get_flagset_mask (value)

value_get_fraction_denominator (value)

value_get_fraction_numerator (value)

value_get_fraction_range_max (value)

value_get_fraction_range_min (value)

value_get_int64_range_max (value)

value_get_int64_range_min (value)

value_get_int64_range_step (value)

value_get_int_range_max (value)

value_get_int_range_min (value)

value_get_int_range_step (value)

value_get_structure (value)

value_init_and_copy (src)

value_intersect (value1, value2)

value_is_fixed (value)

value_is_subset (value1, value2)

value_register (table)

value_serialize (value)

value_set_bitmask (value, bitmask)

value_set_caps (value, caps)

value_set_caps_features (value, features)

value_set_double_range (value, start, end)

value_set_flagset (value, flags, mask)

value_set_fraction (value, numerator, denominator)

value_set_fraction_range (value, start, end)

value_set_fraction_range_full (value, numerator_start, denominator_start, numerator_end, denominator_end)

value_set_int64_range (value, start, end)

value_set_int64_range_step (value, start, end, step)

value_set_int_range (value, start, end)

value_set_int_range_step (value, start, end, step)

value_set_structure (value, structure)

value_subtract (minuend, subtrahend)

value_union (value1, value2)

version ()

version_string ()

Details

Gst.buffer_get_max_memory()[source]
Returns:

the maximum amount of memory blocks that a buffer can hold.

Return type:

int

Gets the maximum amount of memory blocks that a buffer can hold. This is a compile time constant that can be queried with the function.

When more memory blocks are added, existing memory blocks will be merged together to make room for the new block.

New in version 1.2.

Gst.caps_features_from_string(features)[source]
Parameters:

features (str) – a string representation of a Gst.CapsFeatures.

Returns:

a new Gst.CapsFeatures or None when the string could not be parsed.

Return type:

Gst.CapsFeatures or None

Creates a Gst.CapsFeatures from a string representation.

New in version 1.2.

Gst.caps_from_string(string)[source]
Parameters:

string (str) – a string to convert to Gst.Caps

Returns:

a newly allocated Gst.Caps

Return type:

Gst.Caps or None

Converts caps from a string representation.

The implementation of serialization up to 1.20 would lead to unexpected results when there were nested Gst.Caps / Gst.Structure deeper than one level.

Gst.core_error_quark()[source]
Return type:

int

Gst.debug_add_log_function(func, *user_data)[source]
Parameters:

Adds the logging function to the list of logging functions. Be sure to use #G_GNUC_NO_INSTRUMENT on that function, it is needed.

Gst.debug_add_ring_buffer_logger(max_size_per_thread, thread_timeout)[source]
Parameters:
  • max_size_per_thread (int) – Maximum size of log per thread in bytes

  • thread_timeout (int) – Timeout for threads in seconds

Adds a memory ringbuffer based debug logger that stores up to max_size_per_thread bytes of logs per thread and times out threads after thread_timeout seconds of inactivity.

Logs can be fetched with Gst.debug_ring_buffer_logger_get_logs() and the logger can be removed again with Gst.debug_remove_ring_buffer_logger(). Only one logger at a time is possible.

New in version 1.14.

Gst.debug_bin_to_dot_data(bin, details)[source]
Parameters:
Returns:

a string containing the pipeline in graphviz dot format.

Return type:

str

To aid debugging applications one can use this method to obtain the whole network of gstreamer elements that form the pipeline into a dot file. This data can be processed with graphviz to get an image.

Gst.debug_bin_to_dot_file(bin, details, file_name)[source]
Parameters:

To aid debugging applications one can use this method to write out the whole network of gstreamer elements that form the pipeline into a dot file. This file can be processed with graphviz to get an image.

`` shell

dot -Tpng -oimage.png graph_lowlevel.dot

``

Gst.debug_bin_to_dot_file_with_ts(bin, details, file_name)[source]
Parameters:

This works like Gst.debug_bin_to_dot_file(), but adds the current timestamp to the filename, so that it can be used to take multiple snapshots.

Gst.debug_construct_term_color(colorinfo)[source]
Parameters:

colorinfo (int) – the color info

Returns:

a string containing the color definition

Return type:

str

Constructs a string that can be used for getting the desired color in color terminals. You need to free the string after use.

Gst.debug_construct_win_color(colorinfo)[source]
Parameters:

colorinfo (int) – the color info

Returns:

an integer containing the color definition

Return type:

int

Constructs an integer that can be used for getting the desired color in windows’ terminals (cmd.exe). As there is no mean to underline, we simply ignore this attribute.

This function returns 0 on non-windows machines.

Gst.debug_get_all_categories()[source]
Returns:

the list of debug categories

Return type:

[Gst.DebugCategory]

Returns a snapshot of a all categories that are currently in use . This list may change anytime. The caller has to free the list after use.

Gst.debug_get_color_mode()[source]
Returns:

see GstDebugColorMode for possible values.

Return type:

Gst.DebugColorMode

Changes the coloring mode for debug output.

New in version 1.2.

Gst.debug_get_default_threshold()[source]
Returns:

the default threshold level

Return type:

Gst.DebugLevel

Returns the default threshold that is used for new categories.

Gst.debug_get_stack_trace(flags)[source]
Parameters:

flags (Gst.StackTraceFlags) – A set of Gst.StackTraceFlags to determine how the stack trace should look like. Pass Gst.StackTraceFlags.NONE to retrieve a minimal backtrace.

Returns:

a stack trace, if libunwind or glibc backtrace are present, else None.

Return type:

str or None

New in version 1.12.

Gst.debug_is_active()[source]
Returns:

True, if debugging is activated

Return type:

bool

Checks if debugging output is activated.

Gst.debug_is_colored()[source]
Returns:

True, if the debug output should be colored.

Return type:

bool

Checks if the debugging output should be colored.

Gst.debug_level_get_name(level)[source]
Parameters:

level (Gst.DebugLevel) – the level to get the name for

Returns:

the name

Return type:

str

Get the string representation of a debugging level

Gst.debug_log_default(category, level, file, function, line, object, message, user_data)[source]
Parameters:
  • category (Gst.DebugCategory) – category to log

  • level (Gst.DebugLevel) – level of the message

  • file (str) – the file that emitted the message, usually the __FILE__ identifier

  • function (str) – the function that emitted the message

  • line (int) – the line from that the message was emitted, usually __LINE__

  • object (GObject.Object or None) – the object this message relates to, or None if none

  • message (Gst.DebugMessage) – the actual message

  • user_data (object or None) – the FILE* to log to

The default logging handler used by GStreamer. Logging functions get called whenever a macro like GST_DEBUG or similar is used. By default this function is setup to output the message and additional info to stderr (or the log file specified via the GST_DEBUG_FILE environment variable) as received via user_data.

You can add other handlers by using Gst.debug_add_log_function(). And you can remove this handler by calling Gst.debug_remove_log_function(Gst.debug_log_default);

Gst.debug_log_get_line(category, level, file, function, line, object, message)[source]
Parameters:
  • category (Gst.DebugCategory) – category to log

  • level (Gst.DebugLevel) – level of the message

  • file (str) – the file that emitted the message, usually the __FILE__ identifier

  • function (str) – the function that emitted the message

  • line (int) – the line from that the message was emitted, usually __LINE__

  • object (GObject.Object or None) – the object this message relates to, or None if none

  • message (Gst.DebugMessage) – the actual message

Return type:

str

Returns the string representation for the specified debug log message formatted in the same way as Gst.debug_log_default() (the default handler), without color. The purpose is to make it easy for custom log output handlers to get a log output that is identical to what the default handler would write out.

New in version 1.18.

Gst.debug_log_id_literal(category, level, file, function, line, id, message_string)[source]
Parameters:
  • category (Gst.DebugCategory) – category to log

  • level (Gst.DebugLevel) – level of the message is in

  • file (str) – the file that emitted the message, usually the __FILE__ identifier

  • function (str) – the function that emitted the message

  • line (int) – the line from that the message was emitted, usually __LINE__

  • id (str or None) – the identifier of the object this message relates to or None if none

  • message_string (str) – a message string

Logs the given message using the currently registered debugging handlers.

New in version 1.22.

Gst.debug_log_literal(category, level, file, function, line, object, message_string)[source]
Parameters:
  • category (Gst.DebugCategory) – category to log

  • level (Gst.DebugLevel) – level of the message is in

  • file (str) – the file that emitted the message, usually the __FILE__ identifier

  • function (str) – the function that emitted the message

  • line (int) – the line from that the message was emitted, usually __LINE__

  • object (GObject.Object or None) – the object this message relates to, or None if none

  • message_string (str) – a message string

Logs the given message using the currently registered debugging handlers.

New in version 1.20.

Gst.debug_print_stack_trace()[source]

If libunwind, glibc backtrace or DbgHelp are present a stack trace is printed.

Gst.debug_remove_log_function(func)[source]
Parameters:

func (Gst.LogFunction or None) – the log function to remove, or None to remove the default log function

Returns:

How many instances of the function were removed

Return type:

int

Removes all registered instances of the given logging functions.

Gst.debug_remove_log_function_by_data(data)[source]
Parameters:

data (object or None) – user data of the log function to remove

Returns:

How many instances of the function were removed

Return type:

int

Removes all registered instances of log functions with the given user data.

Gst.debug_remove_ring_buffer_logger()[source]

Removes any previously added ring buffer logger with Gst.debug_add_ring_buffer_logger().

New in version 1.14.

Gst.debug_ring_buffer_logger_get_logs()[source]
Returns:

None-terminated array of strings with the debug output per thread

Return type:

[str]

Fetches the current logs per thread from the ring buffer logger. See Gst.debug_add_ring_buffer_logger() for details.

New in version 1.14.

Gst.debug_set_active(active)[source]
Parameters:

active (bool) – Whether to use debugging output or not

If activated, debugging messages are sent to the debugging handlers. It makes sense to deactivate it for speed issues.

This function is not threadsafe. It makes sense to only call it during initialization.

Gst.debug_set_color_mode(mode)[source]
Parameters:

mode (Gst.DebugColorMode) – The coloring mode for debug output. See GstDebugColorMode.

Changes the coloring mode for debug output.

This function may be called before Gst.init().

New in version 1.2.

Gst.debug_set_color_mode_from_string(mode)[source]
Parameters:

mode (str) – The coloring mode for debug output. One of the following: “on”, “auto”, “off”, “disable”, “unix”.

Changes the coloring mode for debug output.

This function may be called before Gst.init().

New in version 1.2.

Gst.debug_set_colored(colored)[source]
Parameters:

colored (bool) – Whether to use colored output or not

Sets or unsets the use of coloured debugging output. Same as Gst.debug_set_color_mode () with the argument being being Gst.DebugColorMode.ON or Gst.DebugColorMode.OFF.

This function may be called before Gst.init().

Gst.debug_set_default_threshold(level)[source]
Parameters:

level (Gst.DebugLevel) – level to set

Sets the default threshold to the given level and updates all categories to use this threshold.

This function may be called before Gst.init().

Gst.debug_set_threshold_for_name(name, level)[source]
Parameters:
  • name (str) – name of the categories to set

  • level (Gst.DebugLevel) – level to set them to

Sets all categories which match the given glob style pattern to the given level.

Gst.debug_set_threshold_from_string(list, reset)[source]
Parameters:
  • list (str) – comma-separated list of “category:level” pairs to be used as debug logging levels

  • reset (bool) – True to clear all previously-set debug levels before setting new thresholds False if adding the threshold described by list to the one already set.

Sets the debug logging wanted in the same form as with the GST_DEBUG environment variable. You can use wildcards such as *, but note that the order matters when you use wild cards, e.g. foosrc:6,*src:3,*:2 sets everything to log level 2.

New in version 1.2.

Gst.debug_unset_threshold_for_name(name)[source]
Parameters:

name (str) – name of the categories to set

Resets all categories with the given name back to the default level.

Gst.deinit()[source]

Clean up any resources created by GStreamer in Gst.init().

It is normally not needed to call this function in a normal application as the resources will automatically be freed when the program terminates. This function is therefore mostly used by testsuites and other memory profiling tools.

After this call GStreamer (including this method) should not be used anymore.

Gst.dynamic_type_register(plugin, type)[source]
Parameters:
Return type:

bool

Registers a new Gst.DynamicTypeFactory in the registry

New in version 1.12.

Gst.error_get_message(domain, code)[source]
Parameters:
  • domain (int) – the GStreamer error domain this error belongs to.

  • code (int) – the error code belonging to the domain.

Returns:

a newly allocated string describing the error message (in UTF-8 encoding)

Return type:

str

Get a string describing the error message in the current locale.

Gst.event_type_get_flags(type)[source]
Parameters:

type (Gst.EventType) – a Gst.EventType

Returns:

a Gst.EventTypeFlags.

Return type:

Gst.EventTypeFlags

Gets the Gst.EventTypeFlags associated with type.

Gst.event_type_get_name(type)[source]
Parameters:

type (Gst.EventType) – the event type

Returns:

a reference to the static name of the event.

Return type:

str

Get a printable name for the given event type. Do not modify or free.

Gst.event_type_to_quark(type)[source]
Parameters:

type (Gst.EventType) – the event type

Returns:

the quark associated with the event type

Return type:

int

Get the unique quark for the given event type.

Gst.event_type_to_sticky_ordering(type)[source]
Parameters:

type (Gst.EventType) – a Gst.EventType

Returns:

an unsigned integer

Return type:

int

Converts the Gst.EventType to an unsigned integer that represents the ordering of sticky events when re-sending them. A lower value represents a higher-priority event.

New in version 1.22.

Gst.filename_to_uri(filename)[source]
Parameters:

filename (str) – absolute or relative file name path

Raises:

GLib.Error

Returns:

newly-allocated URI string, or None on error. The caller must free the URI string with GLib.free() when no longer needed.

Return type:

str or None

Similar to GLib.filename_to_uri(), but attempts to handle relative file paths as well. Before converting filename into an URI, it will be prefixed by the current working directory if it is a relative path, and then the path will be canonicalised so that it doesn’t contain any ‘./’ or ‘../’ segments.

On Windows filename should be in UTF-8 encoding.

Gst.flow_get_name(ret)[source]
Parameters:

ret (Gst.FlowReturn) – a Gst.FlowReturn to get the name of.

Returns:

a static string with the name of the flow return.

Return type:

str

Gets a string representing the given flow return.

Gst.flow_to_quark(ret)[source]
Parameters:

ret (Gst.FlowReturn) – a Gst.FlowReturn to get the quark of.

Returns:

the quark associated with the flow return or 0 if an invalid return was specified.

Return type:

int

Get the unique quark for the given Gst.FlowReturn.

Gst.format_get_by_nick(nick)[source]
Parameters:

nick (str) – The nick of the format

Returns:

The format with nick or Gst.Format.UNDEFINED if the format was not registered.

Return type:

Gst.Format

Return the format registered with the given nick.

Gst.format_get_details(format)[source]
Parameters:

format (Gst.Format) – The format to get details of

Returns:

The Gst.FormatDefinition for format or None on failure.

MT safe.

Return type:

Gst.FormatDefinition or None

Get details about the given format.

Gst.format_get_name(format)[source]
Parameters:

format (Gst.Format) – a Gst.Format

Returns:

a reference to the static name of the format or None if the format is unknown.

Return type:

str or None

Get a printable name for the given format. Do not modify or free.

Gst.format_iterate_definitions()[source]
Returns:

a Gst.Iterator of Gst.FormatDefinition.

Return type:

Gst.Iterator

Iterate all the registered formats. The format definition is read only.

Gst.format_register(nick, description)[source]
Parameters:
  • nick (str) – The nick of the new format

  • description (str) – The description of the new format

Returns:

A new Gst.Format or an already registered format with the same nick.

MT safe.

Return type:

Gst.Format

Create a new Gst.Format based on the nick or return an already registered format with that nick.

Gst.format_to_quark(format)[source]
Parameters:

format (Gst.Format) – a Gst.Format

Returns:

the quark associated with the format or 0 if the format is unknown.

Return type:

int

Get the unique quark for the given format.

Gst.formats_contains(formats, format)[source]
Parameters:
Returns:

True if the format is found inside the array

Return type:

bool

See if the given format is inside the format array.

Gst.get_main_executable_path()[source]
Returns:

The path of the executable that initialized GStreamer, or None if it could not be determined.

Return type:

str or None

This helper is mostly helpful for plugins that need to inspect the folder of the main executable to determine their set of features.

When a plugin is initialized from the gst-plugin-scanner external process, the returned path will be the same as from the parent process.

New in version 1.14.

Gst.init(argv)[source]
Parameters:

argv ([str] or None) – pointer to application’s argv

Returns:

pointer to application’s argv

Return type:

argv: [str]

Initializes the GStreamer library, setting up internal path lists, registering built-in elements, and loading standard plugins.

Unless the plugin registry is disabled at compile time, the registry will be loaded. By default this will also check if the registry cache needs to be updated and rescan all plugins if needed. See Gst.update_registry() for details and section

‘Running GStreamer Applications [gst-running]’ for how to disable automatic registry updates.

WARNING: This function will terminate your program if it was unable to initialize GStreamer for some reason. If you want your program to fall back, use Gst.init_check() instead.

Gst.init_check(argv)[source]
Parameters:

argv ([str] or None) – pointer to application’s argv

Raises:

GLib.Error

Returns:

True if GStreamer could be initialized.

argv:

pointer to application’s argv

Return type:

(bool, argv: [str])

Initializes the GStreamer library, setting up internal path lists, registering built-in elements, and loading standard plugins.

This function will return False if GStreamer could not be initialized for some reason. If you want your program to fail fatally, use Gst.init() instead.

Gst.is_caps_features(obj)[source]
Parameters:

obj (object or None) –

Returns:

True if obj is a Gst.CapsFeatures False otherwise

Return type:

bool

Checks if obj is a Gst.CapsFeatures

Gst.is_initialized()[source]
Returns:

True if initialization has been done, False otherwise.

Return type:

bool

Use this function to check if GStreamer has been initialized with Gst.init() or Gst.init_check().

Gst.library_error_quark()[source]
Return type:

int

Gst.message_type_get_name(type)[source]
Parameters:

type (Gst.MessageType) – the message type

Returns:

a reference to the static name of the message.

Return type:

str

Get a printable name for the given message type. Do not modify or free.

Gst.message_type_to_quark(type)[source]
Parameters:

type (Gst.MessageType) – the message type

Returns:

the quark associated with the message type

Return type:

int

Get the unique quark for the given message type.

Gst.meta_api_type_get_tags(api)[source]
Parameters:

api (GObject.GType) – an API

Returns:

an array of tags as strings.

Return type:

[str]

New in version 1.2.

Gst.meta_api_type_has_tag(api, tag)[source]
Parameters:
Returns:

True if api was registered with tag.

Return type:

bool

Check if api was registered with tag.

Gst.meta_api_type_register(api, tags)[source]
Parameters:
  • api (str) – an API to register

  • tags ([str]) – tags for api

Returns:

a unique GObject.GType for api.

Return type:

GObject.GType

Register and return a GObject.GType for the api and associate it with tags.

Gst.meta_get_info(impl)[source]
Parameters:

impl (str) – the name

Returns:

a Gst.MetaInfo with impl, or None when no such metainfo exists.

Return type:

Gst.MetaInfo or None

Lookup a previously registered meta info structure by its implementation name impl.

Gst.meta_register(api, impl, size, init_func, free_func, transform_func)[source]
Parameters:
Returns:

a Gst.MetaInfo that can be used to access metadata.

Return type:

Gst.MetaInfo

Register a new Gst.Meta implementation.

The same info can be retrieved later with Gst.Meta.get_info() by using impl as the key.

Gst.meta_register_custom(name, tags, transform_func, *user_data)[source]
Parameters:
Returns:

a Gst.MetaInfo that can be used to access metadata.

Return type:

Gst.MetaInfo

Register a new custom Gst.Meta implementation, backed by an opaque structure holding a Gst.Structure.

The registered info can be retrieved later with Gst.Meta.get_info() by using name as the key.

The backing Gst.Structure can be retrieved with Gst.CustomMeta.get_structure(), its mutability is conditioned by the writability of the buffer the meta is attached to.

When transform_func is None, the meta and its backing Gst.Structure will always be copied when the transform operation is copy, other operations are discarded, copy regions are ignored.

New in version 1.20.

Gst.mini_object_replace(olddata, newdata)[source]
Parameters:
Returns:

True if newdata was different from olddata

olddata:

pointer to a pointer to a mini-object to be replaced

Return type:

(bool, olddata: Gst.MiniObject or None)

Atomically modifies a pointer to point to a new mini-object. The reference count of olddata is decreased and the reference count of newdata is increased.

Either newdata and the value pointed to by olddata may be None.

Gst.mini_object_take(olddata, newdata)[source]
Parameters:
Returns:

True if newdata was different from olddata

olddata:

pointer to a pointer to a mini-object to be replaced

Return type:

(bool, olddata: Gst.MiniObject)

Modifies a pointer to point to a new mini-object. The modification is done atomically. This version is similar to Gst.MiniObject.replace() except that it does not increase the refcount of newdata and thus takes ownership of newdata.

Either newdata and the value pointed to by olddata may be None.

Gst.pad_mode_get_name(mode)[source]
Parameters:

mode (Gst.PadMode) – the pad mode

Returns:

short mnemonic for pad mode mode

Return type:

str

Return the name of a pad mode, for use in debug messages mostly.

Gst.param_spec_array(name, nick, blurb, element_spec, flags)[source]
Parameters:
Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

This function creates a GstArray GObject.ParamSpec for use by objects/elements that want to expose properties of GstArray type. This function is typically * used in connection with GObject.ObjectClass.install_property() in a GObjects’s instance_init function.

New in version 1.14.

Gst.param_spec_fraction(name, nick, blurb, min_num, min_denom, max_num, max_denom, default_num, default_denom, flags)[source]
Parameters:
  • name (str) – canonical name of the property specified

  • nick (str) – nick name for the property specified

  • blurb (str) – description of the property specified

  • min_num (int) – minimum value (fraction numerator)

  • min_denom (int) – minimum value (fraction denominator)

  • max_num (int) – maximum value (fraction numerator)

  • max_denom (int) – maximum value (fraction denominator)

  • default_num (int) – default value (fraction numerator)

  • default_denom (int) – default value (fraction denominator)

  • flags (GObject.ParamFlags) – flags for the property specified

Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec or None

This function creates a fraction GObject.ParamSpec for use by objects/elements that want to expose properties of fraction type. This function is typically used in connection with GObject.ObjectClass.install_property() in a GObjects’s instance_init function.

Gst.parent_buffer_meta_api_get_type()[source]
Return type:

GObject.GType

Gst.parent_buffer_meta_get_info()[source]
Returns:

The Gst.MetaInfo

Return type:

Gst.MetaInfo

Gets the global Gst.MetaInfo describing the Gst.ParentBufferMeta meta.

New in version 1.6.

Gst.parse_bin_from_description(bin_description, ghost_unlinked_pads)[source]
Parameters:
  • bin_description (str) – command line describing the bin

  • ghost_unlinked_pads (bool) – whether to automatically create ghost pads for unlinked source or sink pads within the bin

Raises:

GLib.Error

Returns:

a newly-created bin, or None if an error occurred.

Return type:

Gst.Bin

This is a convenience wrapper around Gst.parse_launch() to create a Gst.Bin from a gst-launch-style pipeline description. See Gst.parse_launch() and the gst-launch man page for details about the syntax. Ghost pads on the bin for unlinked source or sink pads within the bin can automatically be created (but only a maximum of one ghost pad for each direction will be created; if you expect multiple unlinked source pads or multiple unlinked sink pads and want them all ghosted, you will have to create the ghost pads yourself).

Gst.parse_bin_from_description_full(bin_description, ghost_unlinked_pads, context, flags)[source]
Parameters:
Raises:

GLib.Error

Returns:

a newly-created element, which is guaranteed to be a bin unless Gst.ParseFlags.NO_SINGLE_ELEMENT_BINS was passed, or None if an error occurred.

Return type:

Gst.Element

This is a convenience wrapper around Gst.parse_launch() to create a Gst.Bin from a gst-launch-style pipeline description. See Gst.parse_launch() and the gst-launch man page for details about the syntax. Ghost pads on the bin for unlinked source or sink pads within the bin can automatically be created (but only a maximum of one ghost pad for each direction will be created; if you expect multiple unlinked source pads or multiple unlinked sink pads and want them all ghosted, you will have to create the ghost pads yourself).

Gst.parse_error_quark()[source]
Returns:

the quark of the parse errors.

Return type:

int

Get the error quark used by the parsing subsystem.

Gst.parse_launch(pipeline_description)[source]
Parameters:

pipeline_description (str) – the command line describing the pipeline

Raises:

GLib.Error

Returns:

a new element on success, None on failure. If more than one toplevel element is specified by the pipeline_description, all elements are put into a Gst.Pipeline, which than is returned.

Return type:

Gst.Element

Create a new pipeline based on command line syntax. Please note that you might get a return value that is not None even though the error is set. In this case there was a recoverable parsing error and you can try to play the pipeline.

To create a sub-pipeline (bin) for embedding into an existing pipeline use Gst.parse_bin_from_description().

Gst.parse_launch_full(pipeline_description, context, flags)[source]
Parameters:
Raises:

GLib.Error

Returns:

a new element on success, None on failure. If more than one toplevel element is specified by the pipeline_description, all elements are put into a Gst.Pipeline, which then is returned (unless the Gst.ParseFlags.PLACE_IN_BIN flag is set, in which case they are put in a Gst.Bin instead).

Return type:

Gst.Element

Create a new pipeline based on command line syntax. Please note that you might get a return value that is not None even though the error is set. In this case there was a recoverable parsing error and you can try to play the pipeline.

To create a sub-pipeline (bin) for embedding into an existing pipeline use Gst.parse_bin_from_description_full().

Gst.parse_launchv(argv)[source]
Parameters:

argv ([str]) – null-terminated array of arguments

Raises:

GLib.Error

Returns:

a new element on success and None on failure.

Return type:

Gst.Element

Create a new element based on command line syntax. error will contain an error message if an erroneous pipeline is specified. An error does not mean that the pipeline could not be constructed.

Gst.parse_launchv_full(argv, context, flags)[source]
Parameters:
Raises:

GLib.Error

Returns:

a new element on success; on failure, either None or a partially-constructed bin or element will be returned and error will be set (unless you passed Gst.ParseFlags.FATAL_ERRORS in flags, then None will always be returned on failure)

Return type:

Gst.Element

Create a new element based on command line syntax. error will contain an error message if an erroneous pipeline is specified. An error does not mean that the pipeline could not be constructed.

Gst.plugin_error_quark()[source]
Returns:

The error quark used in GLib.Error messages

Return type:

int

Get the error quark.

Gst.preset_get_app_dir()[source]
Returns:

the directory or None, don’t free or modify the string

Return type:

str or None

Gets the directory for application specific presets if set by the application.

Gst.preset_set_app_dir(app_dir)[source]
Parameters:

app_dir (str) – the application specific preset dir

Returns:

True for success, False if the dir already has been set

Return type:

bool

Sets an extra directory as an absolute path that should be considered when looking for presets. Any presets in the application dir will shadow the system presets.

Gst.protection_filter_systems_by_available_decryptors(system_identifiers)[source]
Parameters:

system_identifiers ([str]) – A null terminated array of strings that contains the UUID values of each protection system that is to be checked.

Returns:

A null terminated array containing all the system_identifiers supported by the set of available decryptors, or None if no matches were found.

Return type:

[str] or None

Iterates the supplied list of UUIDs and checks the Gst.Registry for all the decryptors supporting one of the supplied UUIDs.

New in version 1.14.

Gst.protection_meta_api_get_type()[source]
Return type:

GObject.GType

Gst.protection_meta_get_info()[source]
Return type:

Gst.MetaInfo

Gst.protection_select_system(system_identifiers)[source]
Parameters:

system_identifiers ([str]) – A null terminated array of strings that contains the UUID values of each protection system that is to be checked.

Returns:

One of the strings from system_identifiers that indicates the highest ranked element that implements the protection system indicated by that system ID, or None if no element has been found.

Return type:

str or None

Iterates the supplied list of UUIDs and checks the Gst.Registry for an element that supports one of the supplied UUIDs. If more than one element matches, the system ID of the highest ranked element is selected.

New in version 1.6.

Gst.query_type_get_flags(type)[source]
Parameters:

type (Gst.QueryType) – a Gst.QueryType

Returns:

a Gst.QueryTypeFlags.

Return type:

Gst.QueryTypeFlags

Gets the Gst.QueryTypeFlags associated with type.

Gst.query_type_get_name(type)[source]
Parameters:

type (Gst.QueryType) – the query type

Returns:

a reference to the static name of the query.

Return type:

str

Get a printable name for the given query type. Do not modify or free.

Gst.query_type_to_quark(type)[source]
Parameters:

type (Gst.QueryType) – the query type

Returns:

the quark associated with the query type

Return type:

int

Get the unique quark for the given query type.

Gst.reference_timestamp_meta_api_get_type()[source]
Return type:

GObject.GType

Gst.reference_timestamp_meta_get_info()[source]
Returns:

The Gst.MetaInfo

Return type:

Gst.MetaInfo

Gets the global Gst.MetaInfo describing the Gst.ReferenceTimestampMeta meta.

New in version 1.14.

Gst.resource_error_quark()[source]
Return type:

int

Gst.segtrap_is_enabled()[source]
Returns:

True if GStreamer is allowed to install a custom SIGSEGV handler.

Return type:

bool

Some functions in the GStreamer core might install a custom SIGSEGV handler to better catch and report errors to the application. Currently this feature is enabled by default when loading plugins.

Applications might want to disable this behaviour with the Gst.segtrap_set_enabled() function. This is typically done if the application wants to install its own handler without GStreamer interfering.

Gst.segtrap_set_enabled(enabled)[source]
Parameters:

enabled (bool) – whether a custom SIGSEGV handler should be installed.

Applications might want to disable/enable the SIGSEGV handling of the GStreamer core. See Gst.segtrap_is_enabled() for more information.

Gst.state_change_get_name(transition)[source]
Parameters:

transition (Gst.StateChange) – a Gst.StateChange to get the name of.

Returns:

a string with the name of the state result.

Return type:

str

Gets a string representing the given state transition.

New in version 1.14.

Gst.static_caps_get_type()[source]
Return type:

GObject.GType

Gst.static_pad_template_get_type()[source]
Return type:

GObject.GType

Gst.stream_error_quark()[source]
Return type:

int

Gst.stream_type_get_name(stype)[source]
Parameters:

stype (Gst.StreamType) – a Gst.StreamType

Returns:

A string describing the stream type

Return type:

str

Get a descriptive string for a given Gst.StreamType

New in version 1.10.

Gst.structure_take(oldstr_ptr, newstr)[source]
Parameters:
Returns:

True if newstr was different from oldstr_ptr

oldstr_ptr:

pointer to a place of a Gst.Structure to take

Return type:

(bool, oldstr_ptr: Gst.Structure or None)

Atomically modifies a pointer to point to a new structure. The Gst.Structure oldstr_ptr is pointing to is freed and newstr is taken ownership over.

Either newstr and the value pointed to by oldstr_ptr may be None.

It is a programming error if both newstr and the value pointed to by oldstr_ptr refer to the same, non-None structure.

New in version 1.18.

Gst.tag_exists(tag)[source]
Parameters:

tag (str) – name of the tag

Returns:

True if the type is already registered

Return type:

bool

Checks if the given type is already registered.

Gst.tag_get_description(tag)[source]
Parameters:

tag (str) – the tag

Returns:

the human-readable description of this tag

Return type:

str

Returns the human-readable description of this tag, You must not change or free this string.

Gst.tag_get_flag(tag)[source]
Parameters:

tag (str) – the tag

Returns:

the flag of this tag.

Return type:

Gst.TagFlag

Gets the flag of tag.

Gst.tag_get_nick(tag)[source]
Parameters:

tag (str) – the tag

Returns:

the human-readable name of this tag

Return type:

str

Returns the human-readable name of this tag, You must not change or free this string.

Gst.tag_get_type(tag)[source]
Parameters:

tag (str) – the tag

Returns:

the GObject.GType of this tag

Return type:

GObject.GType

Gets the GObject.GType used for this tag.

Gst.tag_is_fixed(tag)[source]
Parameters:

tag (str) – tag to check

Returns:

True, if the given tag is fixed.

Return type:

bool

Checks if the given tag is fixed. A fixed tag can only contain one value. Unfixed tags can contain lists of values.

Gst.tag_list_copy_value(list, tag)[source]
Parameters:
  • list (Gst.TagList) – list to get the tag from

  • tag (str) – tag to read out

Returns:

True, if a value was copied, False if the tag didn’t exist in the given list.

dest:

uninitialized GObject.Value to copy into

Return type:

(bool, dest: GObject.Value)

Copies the contents for the given tag into the value, merging multiple values into one if multiple values are associated with the tag. You must GObject.Value.unset() the value after use.

Gst.tag_merge_strings_with_comma(src)[source]
Parameters:

src (GObject.Value) – GObject.Value to copy from

Returns:

uninitialized GObject.Value to store result in

Return type:

dest: GObject.Value

This is a convenience function for the func argument of gst_tag_register(). It concatenates all given strings using a comma. The tag must be registered as a GObject.TYPE_STRING or this function will fail.

Gst.tag_merge_use_first(src)[source]
Parameters:

src (GObject.Value) – GObject.Value to copy from

Returns:

uninitialized GObject.Value to store result in

Return type:

dest: GObject.Value

This is a convenience function for the func argument of gst_tag_register(). It creates a copy of the first value from the list.

Gst.toc_entry_type_get_nick(type)[source]
Parameters:

type (Gst.TocEntryType) – a Gst.TocEntryType.

Returns:

Returns a human-readable string for type. This string is only for debugging purpose and should not be displayed in a user interface.

Return type:

str

Converts type to a string representation.

Gst.tracing_get_active_tracers()[source]
Returns:

A GLib.List of Gst.Tracer objects

Return type:

[Gst.Tracer]

Get a list of all active tracer objects owned by the tracing framework for the entirety of the run-time of the process or till Gst.deinit() is called.

New in version 1.18.

Gst.tracing_register_hook(tracer, detail, func)[source]
Parameters:

Register func to be called when the trace hook detail is getting invoked. Use None for detail to register to all hooks.

New in version 1.8.

Gst.type_find_get_type()[source]
Return type:

GObject.GType

Gst.type_find_register(plugin, name, rank, func, extensions, possible_caps, *data)[source]
Parameters:
  • plugin (Gst.Plugin or None) – A Gst.Plugin, or None for a static typefind function

  • name (str) – The name for registering

  • rank (int) – The rank (or importance) of this typefind function

  • func (Gst.TypeFindFunction) – The Gst.TypeFindFunction to use

  • extensions (str or None) – Optional comma-separated list of extensions that could belong to this type

  • possible_caps (Gst.Caps or None) – Optionally the caps that could be returned when typefinding succeeds

  • data (object or None) – Optional user data. This user data must be available until the plugin is unloaded.

Returns:

True on success, False otherwise

Return type:

bool

Registers a new typefind function to be used for typefinding. After registering this function will be available for typefinding. This function is typically called during an element’s plugin initialization.

Gst.type_is_plugin_api(type)[source]
Parameters:

type (GObject.GType) – a GObject.GType

Returns:

True if type is plugin API or False otherwise.

flags:

What Gst.PluginAPIFlags the plugin was marked with

Return type:

(bool, flags: Gst.PluginAPIFlags)

Checks if type is plugin API. See Gst.type_mark_as_plugin_api() for details.

New in version 1.18.

Gst.type_mark_as_plugin_api(type, flags)[source]
Parameters:

Marks type as plugin API. This should be called in class_init of elements that expose new types (i.e. enums, flags or internal GObjects) via properties, signals or pad templates.

Types exposed by plugins are not automatically added to the documentation as they might originate from another library and should in that case be documented via that library instead.

By marking a type as plugin API it will be included in the documentation of the plugin that defines it.

New in version 1.18.

Gst.update_registry()[source]
Returns:

True if the registry has been updated successfully (does not imply that there were changes), otherwise False.

Return type:

bool

Forces GStreamer to re-scan its plugin paths and update the default plugin registry.

Applications will almost never need to call this function, it is only useful if the application knows new plugins have been installed (or old ones removed) since the start of the application (or, to be precise, the first call to Gst.init()) and the application wants to make use of any newly-installed plugins without restarting the application.

Applications should assume that the registry update is neither atomic nor thread-safe and should therefore not have any dynamic pipelines running (including the playbin and decodebin elements) and should also not create any elements or access the GStreamer registry while the update is in progress.

Note that this function may block for a significant amount of time.

Gst.uri_construct(protocol, location)[source]
Parameters:
  • protocol (str) – Protocol for URI

  • location (str) – Location for URI

Returns:

a new string for this URI.

Return type:

str

Constructs a URI for a given valid protocol and location.

Free-function: GLib.free

Deprecated since version ???: Use GstURI instead.

Gst.uri_error_quark()[source]
Return type:

int

Gst.uri_from_string(uri)[source]
Parameters:

uri (str) – The URI string to parse.

Returns:

A new Gst.Uri object, or None.

Return type:

Gst.Uri or None

Parses a URI string into a new Gst.Uri object. Will return None if the URI cannot be parsed.

New in version 1.6.

Gst.uri_from_string_escaped(uri)[source]
Parameters:

uri (str) – The URI string to parse.

Returns:

A new Gst.Uri object, or None.

Return type:

Gst.Uri or None

Parses a URI string into a new Gst.Uri object. Will return None if the URI cannot be parsed. This is identical to Gst.Uri.from_string() except that the userinfo and fragment components of the URI will not be unescaped while parsing.

Use this when you need to extract a username and password from the userinfo such as https://user:password`example`.com since either may contain a URI-escaped ‘:’ character. Gst.Uri.from_string() will unescape the entire userinfo component, which will make it impossible to know which ‘:’ delineates the username and password.

The same applies to the fragment component of the URI, such as https://example.com/path#fragment which may contain a URI-escaped ‘#’.

New in version 1.18.

Gst.uri_get_location(uri)[source]
Parameters:

uri (str) – A URI string

Returns:

the location for this URI. Returns None if the URI isn’t valid. If the URI does not contain a location, an empty string is returned.

Return type:

str or None

Extracts the location out of a given valid URI, ie. the protocol and “://” are stripped from the URI, which means that the location returned includes the hostname if one is specified. The returned string must be freed using GLib.free().

Free-function: GLib.free

Gst.uri_get_protocol(uri)[source]
Parameters:

uri (str) – A URI string

Returns:

The protocol for this URI.

Return type:

str or None

Extracts the protocol out of a given valid URI. The returned string must be freed using GLib.free().

Gst.uri_has_protocol(uri, protocol)[source]
Parameters:
  • uri (str) – a URI string

  • protocol (str) – a protocol string (e.g. “http”)

Returns:

True if the protocol matches.

Return type:

bool

Checks if the protocol of a given valid URI matches protocol.

Gst.uri_is_valid(uri)[source]
Parameters:

uri (str) – A URI string

Returns:

True if the string is a valid URI

Return type:

bool

Tests if the given string is a valid URI identifier. URIs start with a valid scheme followed by “:” and maybe a string identifying the location.

Gst.uri_join_strings(base_uri, ref_uri)[source]
Parameters:
  • base_uri (str) – The percent-encoded base URI.

  • ref_uri (str) – The percent-encoded reference URI to join to the base_uri.

Returns:

A string representing the percent-encoded join of the two URIs.

Return type:

str or None

This is a convenience function to join two URI strings and return the result. The returned string should be GLib.free()’d after use.

New in version 1.6.

Gst.uri_protocol_is_supported(type, protocol)[source]
Parameters:
  • type (Gst.URIType) – Whether to check for a source or a sink

  • protocol (str) – Protocol that should be checked for (e.g. “http” or “smb”)

Returns:

True

Return type:

bool

Checks if an element exists that supports the given URI protocol. Note that a positive return value does not imply that a subsequent call to Gst.Element.make_from_uri() is guaranteed to work.

Gst.uri_protocol_is_valid(protocol)[source]
Parameters:

protocol (str) – A string

Returns:

True if the string is a valid protocol identifier, False otherwise.

Return type:

bool

Tests if the given string is a valid protocol identifier. Protocols must consist of alphanumeric characters, ‘+’, ‘-’ and ‘.’ and must start with a alphabetic character. See RFC 3986 Section 3.1.

Parameters:
  • array (object or None) – the sorted input array

  • num_elements (int) – number of elements in the array

  • element_size (int) – size of every element in bytes

  • search_func (GLib.CompareDataFunc) – function to compare two elements, search_data will always be passed as second argument

  • mode (Gst.SearchMode) – search mode that should be used

  • search_data (object or None) – element that should be found

  • user_data (object or None) – data to pass to search_func

Returns:

The address of the found element or None if nothing was found

Return type:

object or None

Searches inside array for search_data by using the comparison function search_func. array must be sorted ascending.

As search_data is always passed as second argument to search_func it’s not required that search_data has the same type as the array elements.

The complexity of this search function is O(log (num_elements)).

Gst.util_double_to_fraction(src)[source]
Parameters:

src (float) – float to transform

Returns:

dest_n:

pointer to a int to hold the result numerator

dest_d:

pointer to a int to hold the result denominator

Return type:

(dest_n: int, dest_d: int)

Transforms a float to a fraction and simplifies the result.

Gst.util_dump_buffer(buf)[source]
Parameters:

buf (Gst.Buffer) – a Gst.Buffer whose memory to dump

Dumps the buffer memory into a hex representation. Useful for debugging.

New in version 1.14.

Gst.util_dump_mem(mem)[source]
Parameters:

mem (bytes) – a pointer to the memory to dump

Dumps the memory block into a hex representation. Useful for debugging.

Gst.util_fraction_add(a_n, a_d, b_n, b_d)[source]
Parameters:
  • a_n (int) – Numerator of first value

  • a_d (int) – Denominator of first value

  • b_n (int) – Numerator of second value

  • b_d (int) – Denominator of second value

Returns:

False on overflow, True otherwise.

res_n:

Pointer to int to hold the result numerator

res_d:

Pointer to int to hold the result denominator

Return type:

(bool, res_n: int, res_d: int)

Adds the fractions a_n/a_d and b_n/b_d and stores the result in res_n and res_d.

Gst.util_fraction_compare(a_n, a_d, b_n, b_d)[source]
Parameters:
  • a_n (int) – Numerator of first value

  • a_d (int) – Denominator of first value

  • b_n (int) – Numerator of second value

  • b_d (int) – Denominator of second value

Returns:

-1 if a < b; 0 if a = b; 1 if a > b.

Return type:

int

Compares the fractions a_n/a_d and b_n/b_d and returns -1 if a < b, 0 if a = b and 1 if a > b.

Gst.util_fraction_multiply(a_n, a_d, b_n, b_d)[source]
Parameters:
  • a_n (int) – Numerator of first value

  • a_d (int) – Denominator of first value

  • b_n (int) – Numerator of second value

  • b_d (int) – Denominator of second value

Returns:

False on overflow, True otherwise.

res_n:

Pointer to int to hold the result numerator

res_d:

Pointer to int to hold the result denominator

Return type:

(bool, res_n: int, res_d: int)

Multiplies the fractions a_n/a_d and b_n/b_d and stores the result in res_n and res_d.

Gst.util_fraction_to_double(src_n, src_d)[source]
Parameters:
  • src_n (int) – Fraction numerator as int

  • src_d (int) – Fraction denominator int

Returns:

pointer to a float for the result

Return type:

dest: float

Transforms a fraction to a float.

Gst.util_gdouble_to_guint64(value)[source]
Parameters:

value (float) – The float value to convert guint64 double

Returns:

value casted to #guint64

Return type:

int

Gst.util_get_object_array(object, name)[source]
Parameters:
  • object (GObject.Object) – the object to set the array to

  • name (str) – the name of the property to set

Returns:

array:

a return GObject.ValueArray

Return type:

(bool, array: GObject.ValueArray)

Get a property of type %GST_TYPE_ARRAY and transform it into a GObject.ValueArray. This allow language bindings to get GST_TYPE_ARRAY properties which are otherwise not an accessible type.

New in version 1.12.

Gst.util_get_timestamp()[source]
Returns:

the timestamp

Return type:

int

Get a timestamp as GstClockTime to be used for interval measurements. The timestamp should not be interpreted in any other way.

Gst.util_greatest_common_divisor(a, b)[source]
Parameters:
  • a (int) – First value as int

  • b (int) – Second value as int

Returns:

Greatest common divisor of a and b

Return type:

int

Calculates the greatest common divisor of a and b.

Gst.util_greatest_common_divisor_int64(a, b)[source]
Parameters:
  • a (int) – First value as #gint64

  • b (int) – Second value as #gint64

Returns:

Greatest common divisor of a and b

Return type:

int

Calculates the greatest common divisor of a and b.

Gst.util_group_id_next()[source]
Returns:

A constantly incrementing unsigned integer, which might overflow back to 0 at some point.

Return type:

int

Return a constantly incrementing group id.

This function is used to generate a new group-id for the stream-start event.

This function never returns Gst.GROUP_ID_INVALID (which is 0)

Gst.util_guint64_to_gdouble(value)[source]
Parameters:

value (int) – The #guint64 value to convert to double

Returns:

value casted to float

Return type:

float

Gst.util_seqnum_compare(s1, s2)[source]
Parameters:
  • s1 (int) – A sequence number.

  • s2 (int) – Another sequence number.

Returns:

A negative number if s1 is before s2, 0 if they are equal, or a positive number if s1 is after s2.

Return type:

int

Compare two sequence numbers, handling wraparound.

The current implementation just returns (gint32)(s1 - s2).

Gst.util_seqnum_next()[source]
Returns:

A constantly incrementing 32-bit unsigned integer, which might overflow at some point. Use Gst.util_seqnum_compare() to make sure you handle wraparound correctly.

Return type:

int

Return a constantly incrementing sequence number.

This function is used internally to GStreamer to be able to determine which events and messages are “the same”. For example, elements may set the seqnum on a segment-done message to be the same as that of the last seek event, to indicate that event and the message correspond to the same segment.

This function never returns Gst.SEQNUM_INVALID (which is 0).

Gst.util_set_object_arg(object, name, value)[source]
Parameters:
  • object (GObject.Object) – the object to set the argument of

  • name (str) – the name of the argument to set

  • value (str) – the string value to set

Converts the string value to the type of the objects argument and sets the argument with it.

Note that this function silently returns if object has no property named name or when value cannot be converted to the type of the property.

Gst.util_set_object_array(object, name, array)[source]
Parameters:
Return type:

bool

Transfer a GObject.ValueArray to %GST_TYPE_ARRAY and set this value on the specified property name. This allow language bindings to set GST_TYPE_ARRAY properties which are otherwise not an accessible type.

New in version 1.12.

Gst.util_set_value_from_string(value_str)[source]
Parameters:

value_str (str) – the string to get the value from

Returns:

the value to set

Return type:

value: GObject.Value

Converts the string to the type of the value and sets the value with it.

Note that this function is dangerous as it does not return any indication if the conversion worked or not.

Gst.util_uint64_scale(val, num, denom)[source]
Parameters:
  • val (int) – the number to scale

  • num (int) – the numerator of the scale ratio

  • denom (int) – the denominator of the scale ratio

Returns:

val * num / denom. In the case of an overflow, this function returns GObject.G_MAXUINT64. If the result is not exactly representable as an integer it is truncated. See also Gst.util_uint64_scale_round(), Gst.util_uint64_scale_ceil(), Gst.util_uint64_scale_int(), Gst.util_uint64_scale_int_round(), Gst.util_uint64_scale_int_ceil().

Return type:

int

Scale val by the rational number num / denom, avoiding overflows and underflows and without loss of precision.

This function can potentially be very slow if val and num are both greater than GObject.G_MAXUINT32.

Gst.util_uint64_scale_ceil(val, num, denom)[source]
Parameters:
  • val (int) – the number to scale

  • num (int) – the numerator of the scale ratio

  • denom (int) – the denominator of the scale ratio

Returns:

val * num / denom. In the case of an overflow, this function returns GObject.G_MAXUINT64. If the result is not exactly representable as an integer, it is rounded up. See also Gst.util_uint64_scale(), Gst.util_uint64_scale_round(), Gst.util_uint64_scale_int(), Gst.util_uint64_scale_int_round(), Gst.util_uint64_scale_int_ceil().

Return type:

int

Scale val by the rational number num / denom, avoiding overflows and underflows and without loss of precision.

This function can potentially be very slow if val and num are both greater than GObject.G_MAXUINT32.

Gst.util_uint64_scale_int(val, num, denom)[source]
Parameters:
  • val (int) – guint64 (such as a #GstClockTime) to scale.

  • num (int) – numerator of the scale factor.

  • denom (int) – denominator of the scale factor.

Returns:

val * num / denom. In the case of an overflow, this function returns GObject.G_MAXUINT64. If the result is not exactly representable as an integer, it is truncated. See also Gst.util_uint64_scale_int_round(), Gst.util_uint64_scale_int_ceil(), Gst.util_uint64_scale(), Gst.util_uint64_scale_round(), Gst.util_uint64_scale_ceil().

Return type:

int

Scale val by the rational number num / denom, avoiding overflows and underflows and without loss of precision. num must be non-negative and denom must be positive.

Gst.util_uint64_scale_int_ceil(val, num, denom)[source]
Parameters:
  • val (int) – guint64 (such as a #GstClockTime) to scale.

  • num (int) – numerator of the scale factor.

  • denom (int) – denominator of the scale factor.

Returns:

val * num / denom. In the case of an overflow, this function returns GObject.G_MAXUINT64. If the result is not exactly representable as an integer, it is rounded up. See also Gst.util_uint64_scale_int(), Gst.util_uint64_scale_int_round(), Gst.util_uint64_scale(), Gst.util_uint64_scale_round(), Gst.util_uint64_scale_ceil().

Return type:

int

Scale val by the rational number num / denom, avoiding overflows and underflows and without loss of precision. num must be non-negative and denom must be positive.

Gst.util_uint64_scale_int_round(val, num, denom)[source]
Parameters:
  • val (int) – guint64 (such as a #GstClockTime) to scale.

  • num (int) – numerator of the scale factor.

  • denom (int) – denominator of the scale factor.

Returns:

val * num / denom. In the case of an overflow, this function returns GObject.G_MAXUINT64. If the result is not exactly representable as an integer, it is rounded to the nearest integer (half-way cases are rounded up). See also Gst.util_uint64_scale_int(), Gst.util_uint64_scale_int_ceil(), Gst.util_uint64_scale(), Gst.util_uint64_scale_round(), Gst.util_uint64_scale_ceil().

Return type:

int

Scale val by the rational number num / denom, avoiding overflows and underflows and without loss of precision. num must be non-negative and denom must be positive.

Gst.util_uint64_scale_round(val, num, denom)[source]
Parameters:
  • val (int) – the number to scale

  • num (int) – the numerator of the scale ratio

  • denom (int) – the denominator of the scale ratio

Returns:

val * num / denom. In the case of an overflow, this function returns GObject.G_MAXUINT64. If the result is not exactly representable as an integer, it is rounded to the nearest integer (half-way cases are rounded up). See also Gst.util_uint64_scale(), Gst.util_uint64_scale_ceil(), Gst.util_uint64_scale_int(), Gst.util_uint64_scale_int_round(), Gst.util_uint64_scale_int_ceil().

Return type:

int

Scale val by the rational number num / denom, avoiding overflows and underflows and without loss of precision.

This function can potentially be very slow if val and num are both greater than GObject.G_MAXUINT32.

Gst.value_can_compare(value1, value2)[source]
Parameters:
Returns:

True if the values can be compared

Return type:

bool

Determines if value1 and value2 can be compared.

Gst.value_can_intersect(value1, value2)[source]
Parameters:
Returns:

True if the values can intersect

Return type:

bool

Determines if intersecting two values will produce a valid result. Two values will produce a valid intersection if they have the same type.

Gst.value_can_subtract(minuend, subtrahend)[source]
Parameters:
Returns:

True if a subtraction is possible

Return type:

bool

Checks if it’s possible to subtract subtrahend from minuend.

Gst.value_can_union(value1, value2)[source]
Parameters:
Returns:

True if there is a function allowing the two values to be unioned.

Return type:

bool

Determines if value1 and value2 can be non-trivially unioned. Any two values can be trivially unioned by adding both of them to a Gst.ValueList. However, certain types have the possibility to be unioned in a simpler way. For example, an integer range and an integer can be unioned if the integer is a subset of the integer range. If there is the possibility that two values can be unioned, this function returns True.

Gst.value_compare(value1, value2)[source]
Parameters:
Returns:

comparison result

Return type:

int

Compares value1 and value2. If value1 and value2 cannot be compared, the function returns Gst.VALUE_UNORDERED. Otherwise, if value1 is greater than value2, Gst.VALUE_GREATER_THAN is returned. If value1 is less than value2, Gst.VALUE_LESS_THAN is returned. If the values are equal, Gst.VALUE_EQUAL is returned.

Gst.value_deserialize(src)[source]
Parameters:

src (str) – string to deserialize

Returns:

True on success

dest:

GObject.Value to fill with contents of deserialization

Return type:

(bool, dest: GObject.Value)

Tries to deserialize a string into the type specified by the given GObject.Value. If the operation succeeds, True is returned, False otherwise.

Gst.value_deserialize_with_pspec(src, pspec)[source]
Parameters:
Returns:

True on success

dest:

GObject.Value to fill with contents of deserialization

Return type:

(bool, dest: GObject.Value)

Tries to deserialize a string into the type specified by the given GObject.Value. pspec may be used to guide the deserializing of nested members. If the operation succeeds, True is returned, False otherwise.

New in version 1.20.

Gst.value_fixate(dest, src)[source]
Parameters:
Returns:

True if dest contains a fixated version of src.

Return type:

bool

Fixate src into a new value dest. For ranges, the first element is taken. For lists and arrays, the first item is fixated and returned. If src is already fixed, this function returns False.

Gst.value_fraction_multiply(product, factor1, factor2)[source]
Parameters:
Returns:

False in case of an error (like integer overflow), True otherwise.

Return type:

bool

Multiplies the two GObject.Value items containing a #GST_TYPE_FRACTION and sets product to the product of the two fractions.

Gst.value_fraction_subtract(dest, minuend, subtrahend)[source]
Parameters:
Returns:

False in case of an error (like integer overflow), True otherwise.

Return type:

bool

Subtracts the subtrahend from the minuend and sets dest to the result.

Gst.value_get_bitmask(value)[source]
Parameters:

value (GObject.Value) – a GObject.Value initialized to #GST_TYPE_BITMASK

Returns:

the bitmask.

Return type:

int

Gets the bitmask specified by value.

Gst.value_get_caps(value)[source]
Parameters:

value (GObject.Value) – a GObject.Value initialized to GST_TYPE_CAPS

Returns:

the contents of value

Return type:

Gst.Caps

Gets the contents of value. The reference count of the returned Gst.Caps will not be modified, therefore the caller must take one before getting rid of the value.

Gst.value_get_caps_features(value)[source]
Parameters:

value (GObject.Value) – a GObject.Value initialized to GST_TYPE_CAPS_FEATURES

Returns:

the contents of value

Return type:

Gst.CapsFeatures

Gets the contents of value.

Gst.value_get_double_range_max(value)[source]
Parameters:

value (GObject.Value) – a GObject.Value initialized to GST_TYPE_DOUBLE_RANGE

Returns:

the maximum of the range

Return type:

float

Gets the maximum of the range specified by value.

Gst.value_get_double_range_min(value)[source]
Parameters:

value (GObject.Value) – a GObject.Value initialized to GST_TYPE_DOUBLE_RANGE

Returns:

the minimum of the range

Return type:

float

Gets the minimum of the range specified by value.

Gst.value_get_flagset_flags(value)[source]
Parameters:

value (GObject.Value) – a GObject.Value initialized to #GST_TYPE_FLAG_SET

Returns:

the flags field of the flagset instance.

Return type:

int

Retrieve the flags field of a Gst.FlagSet value.

New in version 1.6.

Gst.value_get_flagset_mask(value)[source]
Parameters:

value (GObject.Value) – a GObject.Value initialized to #GST_TYPE_FLAG_SET

Returns:

the mask field of the flagset instance.

Return type:

int

Retrieve the mask field of a Gst.FlagSet value.

New in version 1.6.

Gst.value_get_fraction_denominator(value)[source]
Parameters:

value (GObject.Value) – a GObject.Value initialized to #GST_TYPE_FRACTION

Returns:

the denominator of the fraction.

Return type:

int

Gets the denominator of the fraction specified by value.

Gst.value_get_fraction_numerator(value)[source]
Parameters:

value (GObject.Value) – a GObject.Value initialized to #GST_TYPE_FRACTION

Returns:

the numerator of the fraction.

Return type:

int

Gets the numerator of the fraction specified by value.

Gst.value_get_fraction_range_max(value)[source]
Parameters:

value (GObject.Value) – a GObject.Value initialized to GST_TYPE_FRACTION_RANGE

Returns:

the maximum of the range

Return type:

GObject.Value or None

Gets the maximum of the range specified by value.

Gst.value_get_fraction_range_min(value)[source]
Parameters:

value (GObject.Value) – a GObject.Value initialized to GST_TYPE_FRACTION_RANGE

Returns:

the minimum of the range

Return type:

GObject.Value or None

Gets the minimum of the range specified by value.

Gst.value_get_int64_range_max(value)[source]
Parameters:

value (GObject.Value) – a GObject.Value initialized to GST_TYPE_INT64_RANGE

Returns:

the maximum of the range

Return type:

int

Gets the maximum of the range specified by value.

Gst.value_get_int64_range_min(value)[source]
Parameters:

value (GObject.Value) – a GObject.Value initialized to GST_TYPE_INT64_RANGE

Returns:

the minimum of the range

Return type:

int

Gets the minimum of the range specified by value.

Gst.value_get_int64_range_step(value)[source]
Parameters:

value (GObject.Value) – a GObject.Value initialized to GST_TYPE_INT64_RANGE

Returns:

the step of the range

Return type:

int

Gets the step of the range specified by value.

Gst.value_get_int_range_max(value)[source]
Parameters:

value (GObject.Value) – a GObject.Value initialized to GST_TYPE_INT_RANGE

Returns:

the maximum of the range

Return type:

int

Gets the maximum of the range specified by value.

Gst.value_get_int_range_min(value)[source]
Parameters:

value (GObject.Value) – a GObject.Value initialized to GST_TYPE_INT_RANGE

Returns:

the minimum of the range

Return type:

int

Gets the minimum of the range specified by value.

Gst.value_get_int_range_step(value)[source]
Parameters:

value (GObject.Value) – a GObject.Value initialized to GST_TYPE_INT_RANGE

Returns:

the step of the range

Return type:

int

Gets the step of the range specified by value.

Gst.value_get_structure(value)[source]
Parameters:

value (GObject.Value) – a GObject.Value initialized to GST_TYPE_STRUCTURE

Returns:

the contents of value

Return type:

Gst.Structure

Gets the contents of value.

Gst.value_init_and_copy(src)[source]
Parameters:

src (GObject.Value) – the source value

Returns:

the target value

Return type:

dest: GObject.Value

Initialises the target value to be of the same type as source and then copies the contents from source to target.

Gst.value_intersect(value1, value2)[source]
Parameters:
Returns:

True if the intersection is non-empty

dest:

a uninitialized GObject.Value that will hold the calculated intersection value. May be None if the resulting set if not needed.

Return type:

(bool, dest: GObject.Value)

Calculates the intersection of two values. If the values have a non-empty intersection, the value representing the intersection is placed in dest, unless None. If the intersection is non-empty, dest is not modified.

Gst.value_is_fixed(value)[source]
Parameters:

value (GObject.Value) – the GObject.Value to check

Returns:

true if the value is “fixed”.

Return type:

bool

Tests if the given GObject.Value, if available in a Gst.Structure (or any other container) contains a “fixed” (which means: one value) or an “unfixed” (which means: multiple possible values, such as data lists or data ranges) value.

Gst.value_is_subset(value1, value2)[source]
Parameters:
Returns:

True is value1 is a subset of value2

Return type:

bool

Check that value1 is a subset of value2.

Gst.value_register(table)[source]
Parameters:

table (Gst.ValueTable) – structure containing functions to register

Registers functions to perform calculations on GObject.Value items of a given type. Each type can only be added once.

Gst.value_serialize(value)[source]
Parameters:

value (GObject.Value) – a GObject.Value to serialize

Returns:

the serialization for value or None if none exists

Return type:

str or None

tries to transform the given value into a string representation that allows getting back this string later on using Gst.value_deserialize().

Free-function: GLib.free

Gst.value_set_bitmask(value, bitmask)[source]
Parameters:

Sets value to the bitmask specified by bitmask.

Gst.value_set_caps(value, caps)[source]
Parameters:

Sets the contents of value to caps. A reference to the provided caps will be taken by the value.

Gst.value_set_caps_features(value, features)[source]
Parameters:

Sets the contents of value to features.

Gst.value_set_double_range(value, start, end)[source]
Parameters:

Sets value to the range specified by start and end.

Gst.value_set_flagset(value, flags, mask)[source]
Parameters:
  • value (GObject.Value) – a GObject.Value initialized to %GST_TYPE_FLAG_SET

  • flags (int) – The value of the flags set or unset

  • mask (int) – The mask indicate which flags bits must match for comparisons

Sets value to the flags and mask values provided in flags and mask. The flags value indicates the values of flags, the mask represents which bits in the flag value have been set, and which are “don’t care”

New in version 1.6.

Gst.value_set_fraction(value, numerator, denominator)[source]
Parameters:
  • value (GObject.Value) – a GObject.Value initialized to #GST_TYPE_FRACTION

  • numerator (int) – the numerator of the fraction

  • denominator (int) – the denominator of the fraction

Sets value to the fraction specified by numerator over denominator. The fraction gets reduced to the smallest numerator and denominator, and if necessary the sign is moved to the numerator.

Gst.value_set_fraction_range(value, start, end)[source]
Parameters:

Sets value to the range specified by start and end.

Gst.value_set_fraction_range_full(value, numerator_start, denominator_start, numerator_end, denominator_end)[source]
Parameters:
  • value (GObject.Value) – a GObject.Value initialized to GST_TYPE_FRACTION_RANGE

  • numerator_start (int) – the numerator start of the range

  • denominator_start (int) – the denominator start of the range

  • numerator_end (int) – the numerator end of the range

  • denominator_end (int) – the denominator end of the range

Sets value to the range specified by numerator_start/denominator_start and numerator_end/denominator_end.

Gst.value_set_int64_range(value, start, end)[source]
Parameters:

Sets value to the range specified by start and end.

Gst.value_set_int64_range_step(value, start, end, step)[source]
Parameters:
  • value (GObject.Value) – a GObject.Value initialized to GST_TYPE_INT64_RANGE

  • start (int) – the start of the range

  • end (int) – the end of the range

  • step (int) – the step of the range

Sets value to the range specified by start, end and step.

Gst.value_set_int_range(value, start, end)[source]
Parameters:

Sets value to the range specified by start and end.

Gst.value_set_int_range_step(value, start, end, step)[source]
Parameters:
  • value (GObject.Value) – a GObject.Value initialized to GST_TYPE_INT_RANGE

  • start (int) – the start of the range

  • end (int) – the end of the range

  • step (int) – the step of the range

Sets value to the range specified by start, end and step.

Gst.value_set_structure(value, structure)[source]
Parameters:

Sets the contents of value to structure.

Gst.value_subtract(minuend, subtrahend)[source]
Parameters:
Returns:

True if the subtraction is not empty

dest:

the destination value for the result if the subtraction is not empty. May be None, in which case the resulting set will not be computed, which can give a fair speedup.

Return type:

(bool, dest: GObject.Value)

Subtracts subtrahend from minuend and stores the result in dest. Note that this means subtraction as in sets, not as in mathematics.

Gst.value_union(value1, value2)[source]
Parameters:
Returns:

True if the union succeeded.

dest:

the destination value

Return type:

(bool, dest: GObject.Value)

Creates a GObject.Value corresponding to the union of value1 and value2.

Gst.version()[source]
Returns:

major:

pointer to a int to store the major version number

minor:

pointer to a int to store the minor version number

micro:

pointer to a int to store the micro version number

nano:

pointer to a int to store the nano version number

Return type:

(major: int, minor: int, micro: int, nano: int)

Gets the version number of the GStreamer library.

Gst.version_string()[source]
Returns:

a newly allocated string describing this version of GStreamer.

Return type:

str

This function returns a string that is useful for describing this version of GStreamer to the outside world: user agent strings, logging, …