GstPlayer.Player¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
Virtual Methods¶
- Inherited:
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
The synchronisation offset between audio and video in nanoseconds |
||
r |
Current audio track information |
||
r |
Current audio subtitle information |
||
r |
Current video track information |
||
r |
Duration |
||
r |
Current media information |
||
r/w |
Mute |
||
r |
GStreamer pipeline that is used |
||
r |
Current Position |
||
r/w |
Playback rate |
||
w/co |
Dispatcher for the signals to e.g. event loops |
||
r/w |
The synchronisation offset between text and video in nanoseconds |
||
r/w |
Current Subtitle URI |
||
r/w |
Current URI |
||
r/w |
Override details of the multiview frame layout |
||
r/w |
Re-interpret a video stream as one of several frame-packed stereoscopic modes. |
||
r/w/co |
Video renderer to use for rendering videos |
||
r/w |
Volume |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Fields¶
- Inherited:
Class Details¶
- class GstPlayer.Player(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Starting from GStreamer 1.20, application developers are strongly advised to migrate to #GstPlay.
GstPlayer.Player
will be deprecated in 1.20 and most likely removed by 1.24.- classmethod config_get_position_update_interval(config)¶
- Parameters:
config (
Gst.Structure
) – aGstPlayer.Player
configuration- Returns:
current position update interval in milliseconds
- Return type:
New in version 1.10.
- classmethod config_get_seek_accurate(config)¶
- Parameters:
config (
Gst.Structure
) – aGstPlayer.Player
configuration- Returns:
True
if accurate seeking is enabled- Return type:
New in version 1.12.
- classmethod config_get_user_agent(config)¶
- Parameters:
config (
Gst.Structure
) – aGstPlayer.Player
configuration- Returns:
the configured agent, or
None
- Return type:
Return the user agent which has been configured using
GstPlayer.Player.config_set_user_agent
() if any.New in version 1.10.
- classmethod config_set_position_update_interval(config, interval)¶
- Parameters:
config (
Gst.Structure
) – aGstPlayer.Player
configurationinterval (
int
) – interval in ms
set interval in milliseconds between two position-updated signals. pass 0 to stop updating the position.
New in version 1.10.
- classmethod config_set_seek_accurate(config, accurate)¶
- Parameters:
config (
Gst.Structure
) – aGstPlayer.Player
configurationaccurate (
bool
) – accurate seek or not
Enable or disable accurate seeking. When enabled, elements will try harder to seek as accurately as possible to the requested seek position. Generally it will be slower especially for formats that don’t have any indexes or timestamp markers in the stream.
If accurate seeking is disabled, elements will seek as close as the request position without slowing down seeking too much.
Accurate seeking is disabled by default.
New in version 1.12.
- classmethod config_set_user_agent(config, agent)¶
- Parameters:
config (
Gst.Structure
) – aGstPlayer.Player
configuration
Set the user agent to pass to the server if player needs to connect to a server during playback. This is typically used when playing HTTP or RTSP streams.
New in version 1.10.
- classmethod get_audio_streams(info)¶
- Parameters:
info (
GstPlayer.PlayerMediaInfo
) – aGstPlayer.PlayerMediaInfo
- Returns:
A
GLib.List
of matchingGstPlayer.PlayerAudioInfo
.- Return type:
- classmethod get_subtitle_streams(info)¶
- Parameters:
info (
GstPlayer.PlayerMediaInfo
) – aGstPlayer.PlayerMediaInfo
- Returns:
A
GLib.List
of matchingGstPlayer.PlayerSubtitleInfo
.- Return type:
- classmethod get_video_streams(info)¶
- Parameters:
info (
GstPlayer.PlayerMediaInfo
) – aGstPlayer.PlayerMediaInfo
- Returns:
A
GLib.List
of matchingGstPlayer.PlayerVideoInfo
.- Return type:
- classmethod new(video_renderer, signal_dispatcher)¶
- Parameters:
video_renderer (
GstPlayer.PlayerVideoRenderer
orNone
) –GstPlayer.PlayerVideoRenderer
to usesignal_dispatcher (
GstPlayer.PlayerSignalDispatcher
orNone
) –GstPlayer.PlayerSignalDispatcher
to use
- Returns:
a new
GstPlayer.Player
instance- Return type:
Creates a new
GstPlayer.Player
instance that uses signal_dispatcher to dispatch signals to some event loop system, or emits signals directly ifNone
is passed. SeeGstPlayer.PlayerGMainContextSignalDispatcher.new
().Video is going to be rendered by video_renderer, or if
None
is provided no special video set up will be done and some default handling will be performed.This also initializes GStreamer via
gst_init()
on the first call if this didn’t happen before.
- classmethod visualizations_free(viss)¶
- Parameters:
viss (
GstPlayer.PlayerVisualization
) – aNone
terminated array ofGstPlayer.PlayerVisualization
to free
Frees a
None
terminated array ofGstPlayer.PlayerVisualization
.
- classmethod visualizations_get()¶
- Returns:
a
None
terminated array containing all available visualizations. UseGstPlayer.Player.visualizations_free
() after usage.- Return type:
- get_audio_video_offset()¶
- Returns:
The current value of audio-video-offset in nanoseconds
- Return type:
Retrieve the current value of audio-video-offset property
New in version 1.10.
- get_color_balance(type)¶
- Parameters:
type (
GstPlayer.PlayerColorBalanceType
) –GstPlayer.PlayerColorBalanceType
- Returns:
The current value of type, between [0,1]. In case of error -1 is returned.
- Return type:
Retrieve the current value of the indicated type.
- get_config()¶
- Returns:
a copy of the current configuration of self. Use
Gst.Structure.free
() after usage orGstPlayer.Player.set_config
().- Return type:
Get a copy of the current configuration of the player. This configuration can either be modified and used for the
GstPlayer.Player.set_config
() call or it must be freed after usage.New in version 1.10.
- get_current_audio_track()¶
- Returns:
current audio track.
The caller should free it with
GObject.Object.unref
()- Return type:
A Function to get current audio
GstPlayer.PlayerAudioInfo
instance.
- get_current_subtitle_track()¶
- Returns:
current subtitle track.
The caller should free it with
GObject.Object.unref
()- Return type:
A Function to get current subtitle
GstPlayer.PlayerSubtitleInfo
instance.
- get_current_video_track()¶
- Returns:
current video track.
The caller should free it with
GObject.Object.unref
()- Return type:
A Function to get current video
GstPlayer.PlayerVideoInfo
instance.
- get_current_visualization()¶
- get_duration()¶
- Returns:
the duration of the currently-playing media stream, in nanoseconds.
- Return type:
Retrieves the duration of the media stream that self represents.
- get_media_info()¶
- Returns:
media info instance.
The caller should free it with
GObject.Object.unref
()- Return type:
A Function to get the current media info
GstPlayer.PlayerMediaInfo
instance.
- get_multiview_flags()¶
- Returns:
The current value of type, Default: 0x00000000 “none
- Return type:
Retrieve the current value of the indicated type.
New in version 1.10.
- get_multiview_mode()¶
- Returns:
The current value of type, Default: -1 “none”
- Return type:
Retrieve the current value of the indicated type.
New in version 1.10.
- get_pipeline()¶
- Returns:
The internal playbin instance.
The caller should free it with
GObject.Object.unref
()- Return type:
- get_position()¶
- Returns:
the absolute position time, in nanoseconds, of the currently-playing stream.
- Return type:
- get_subtitle_uri()¶
-
current subtitle URI
- get_subtitle_video_offset()¶
- Returns:
The current value of subtitle-video-offset in nanoseconds
- Return type:
Retrieve the current value of subtitle-video-offset property
New in version 1.16.
- get_uri()¶
- Returns:
a string containing the URI of the currently-playing stream.
GLib.free
() after usage.- Return type:
Gets the URI of the currently-playing stream.
- get_video_snapshot(format, config)¶
- Parameters:
format (
GstPlayer.PlayerSnapshotFormat
) – output format of the video snapshotconfig (
Gst.Structure
orNone
) – Additional configuration
- Returns:
Current video snapshot sample or
None
on failure- Return type:
Gst.Sample
orNone
Get a snapshot of the currently selected video stream, if any. The format can be selected with format and optional configuration is possible with config Currently supported settings are:
width, height of type
GObject.TYPE_INT
pixel-aspect-ratio of type GST_TYPE_FRACTION Except for
GstPlayer.PlayerSnapshotFormat.RAW_NATIVE
format, if no config is set, pixel-aspect-ratio would be 1/1
New in version 1.12.
- get_volume()¶
- Returns:
the volume as percentage between 0 and 1.
- Return type:
Returns the current volume level, as a percentage between 0 and 1.
- has_color_balance()¶
-
Checks whether the self has color balance support available.
- pause()¶
Pauses the current stream.
- play()¶
Request to play the loaded stream.
- seek(position)¶
- Parameters:
position (
int
) – position to seek in nanoseconds
Seeks the currently-playing stream to the absolute position time in nanoseconds.
- set_audio_track(stream_index)¶
- set_audio_track_enabled(enabled)¶
-
Enable or disable the current audio track.
- set_audio_video_offset(offset)¶
- Parameters:
offset (
int
) – #gint64 in nanoseconds
Sets audio-video-offset property by value of offset
New in version 1.10.
- set_color_balance(type, value)¶
- Parameters:
type (
GstPlayer.PlayerColorBalanceType
) –GstPlayer.PlayerColorBalanceType
value (
float
) – The new value for the type, ranged [0,1]
Sets the current value of the indicated channel type to the passed value.
- set_config(config)¶
- Parameters:
config (
Gst.Structure
) – aGst.Structure
- Returns:
True
when the configuration could be set.- Return type:
Set the configuration of the player. If the player is already configured, and the configuration haven’t change, this function will return
True
. If the player is not in theGstPlayer.PlayerState.STOPPED
, this method will returnFalse
and active configuration will remain.config is a
Gst.Structure
that contains the configuration parameters for the player.This function takes ownership of config.
New in version 1.10.
- set_multiview_flags(flags)¶
- Parameters:
flags (
GstVideo.VideoMultiviewFlags
) – The new value for the type
Sets the current value of the indicated mode type to the passed value.
New in version 1.10.
- set_multiview_mode(mode)¶
- Parameters:
mode (
GstVideo.VideoMultiviewFramePacking
) – The new value for the type
Sets the current value of the indicated mode type to the passed value.
New in version 1.10.
- set_mute(val)¶
- Parameters:
val (
bool
) – Mute state the should be set
True
if the currently-playing stream should be muted.
- set_subtitle_track(stream_index)¶
- set_subtitle_track_enabled(enabled)¶
-
Enable or disable the current subtitle track.
- set_subtitle_uri(uri)¶
-
Sets the external subtitle URI. This should be combined with a call to
GstPlayer.Player.set_subtitle_track_enabled
(self,True
) so the subtitles are actually rendered.
- set_subtitle_video_offset(offset)¶
- Parameters:
offset (
int
) – #gint64 in nanoseconds
Sets subtitle-video-offset property by value of offset
New in version 1.16.
- set_video_track(stream_index)¶
- set_video_track_enabled(enabled)¶
-
Enable or disable the current video track.
- set_visualization(name)¶
- set_visualization_enabled(enabled)¶
-
Enable or disable the visualization.
- set_volume(val)¶
- Parameters:
val (
float
) – the new volume level, as a percentage between 0 and 1
Sets the volume level of the stream as a percentage between 0 and 1.
This volume is a linear factor. For showing the volume in a GUI it might make sense to first convert from a different format. Volume sliders should usually use a cubic volume. See
GstAudio.StreamVolume.convert_volume
().
- stop()¶
Stops playing the current stream and resets to the first position in the stream.
Signal Details¶
- GstPlayer.Player.signals.buffering(player, object)¶
- Signal Name:
buffering
- Flags:
- Parameters:
player (
GstPlayer.Player
) – The object which received the signalobject (
int
) –
- GstPlayer.Player.signals.duration_changed(player, object)¶
- Signal Name:
duration-changed
- Flags:
- Parameters:
player (
GstPlayer.Player
) – The object which received the signalobject (
int
) –
- GstPlayer.Player.signals.end_of_stream(player)¶
- Signal Name:
end-of-stream
- Flags:
- Parameters:
player (
GstPlayer.Player
) – The object which received the signal
- GstPlayer.Player.signals.error(player, object)¶
- Signal Name:
error
- Flags:
- Parameters:
player (
GstPlayer.Player
) – The object which received the signalobject (
GLib.Error
) –
- GstPlayer.Player.signals.media_info_updated(player, object)¶
- Signal Name:
media-info-updated
- Flags:
- Parameters:
player (
GstPlayer.Player
) – The object which received the signalobject (
GstPlayer.PlayerMediaInfo
) –
- GstPlayer.Player.signals.mute_changed(player)¶
- Signal Name:
mute-changed
- Flags:
- Parameters:
player (
GstPlayer.Player
) – The object which received the signal
- GstPlayer.Player.signals.position_updated(player, object)¶
- Signal Name:
position-updated
- Flags:
- Parameters:
player (
GstPlayer.Player
) – The object which received the signalobject (
int
) –
- GstPlayer.Player.signals.seek_done(player, object)¶
- Signal Name:
seek-done
- Flags:
- Parameters:
player (
GstPlayer.Player
) – The object which received the signalobject (
int
) –
- GstPlayer.Player.signals.state_changed(player, object)¶
- Signal Name:
state-changed
- Flags:
- Parameters:
player (
GstPlayer.Player
) – The object which received the signalobject (
GstPlayer.PlayerState
) –
- GstPlayer.Player.signals.uri_loaded(player, object)¶
- Signal Name:
uri-loaded
- Flags:
- Parameters:
player (
GstPlayer.Player
) – The object which received the signalobject (
str
) –
- GstPlayer.Player.signals.video_dimensions_changed(player, object, p0)¶
- Signal Name:
video-dimensions-changed
- Flags:
- Parameters:
player (
GstPlayer.Player
) – The object which received the signalobject (
int
) –p0 (
int
) –
- GstPlayer.Player.signals.volume_changed(player)¶
- Signal Name:
volume-changed
- Flags:
- Parameters:
player (
GstPlayer.Player
) – The object which received the signal
- GstPlayer.Player.signals.warning(player, object)¶
- Signal Name:
warning
- Flags:
- Parameters:
player (
GstPlayer.Player
) – The object which received the signalobject (
GLib.Error
) –
Property Details¶
- GstPlayer.Player.props.audio_video_offset¶
-
The synchronisation offset between audio and video in nanoseconds
- GstPlayer.Player.props.current_audio_track¶
- Name:
current-audio-track
- Type:
- Default Value:
- Flags:
Current audio track information
- GstPlayer.Player.props.current_subtitle_track¶
- Name:
current-subtitle-track
- Type:
- Default Value:
- Flags:
Current audio subtitle information
- GstPlayer.Player.props.current_video_track¶
- Name:
current-video-track
- Type:
- Default Value:
- Flags:
Current video track information
- GstPlayer.Player.props.duration¶
-
Duration
- GstPlayer.Player.props.media_info¶
- Name:
media-info
- Type:
- Default Value:
- Flags:
Current media information
- GstPlayer.Player.props.mute¶
-
Mute
- GstPlayer.Player.props.pipeline¶
- Name:
pipeline
- Type:
- Default Value:
- Flags:
GStreamer pipeline that is used
- GstPlayer.Player.props.position¶
-
Current Position
- GstPlayer.Player.props.rate¶
-
Playback rate
- GstPlayer.Player.props.signal_dispatcher¶
- Name:
signal-dispatcher
- Type:
- Default Value:
- Flags:
Dispatcher for the signals to e.g. event loops
- GstPlayer.Player.props.subtitle_video_offset¶
-
The synchronisation offset between text and video in nanoseconds
- GstPlayer.Player.props.suburi¶
-
Current Subtitle URI
- GstPlayer.Player.props.uri¶
-
Current URI
- GstPlayer.Player.props.video_multiview_flags¶
- Name:
video-multiview-flags
- Type:
- Default Value:
- Flags:
Override details of the multiview frame layout
- GstPlayer.Player.props.video_multiview_mode¶
- Name:
video-multiview-mode
- Type:
- Default Value:
- Flags:
Re-interpret a video stream as one of several frame-packed stereoscopic modes.
- GstPlayer.Player.props.video_renderer¶
- Name:
video-renderer
- Type:
- Default Value:
- Flags:
Video renderer to use for rendering videos