manpagez: man pages & more
html files: gst-plugins-bad-libs-1.0
Home | html | info | man

GstPlayer

GstPlayer — Player

Functions

GstPlayer * gst_player_new ()
void gst_player_play ()
void gst_player_pause ()
void gst_player_stop ()
void gst_player_seek ()
void gst_player_set_uri ()
gchar * gst_player_get_uri ()
GstClockTime gst_player_get_duration ()
GstClockTime gst_player_get_position ()
void gst_player_set_volume ()
void gst_player_set_mute ()
gdouble gst_player_get_volume ()
gboolean gst_player_get_mute ()
GstElement * gst_player_get_pipeline ()
gboolean gst_player_set_config ()
GstStructure * gst_player_get_config ()
const gchar * gst_player_state_get_name ()
const gchar * gst_player_error_get_name ()
GstPlayerMediaInfo * gst_player_get_media_info ()
gboolean gst_player_set_audio_track ()
gboolean gst_player_set_video_track ()
gboolean gst_player_set_subtitle_track ()
GstPlayerAudioInfo * gst_player_get_current_audio_track ()
GstPlayerVideoInfo * gst_player_get_current_video_track ()
GstPlayerSubtitleInfo * gst_player_get_current_subtitle_track ()
void gst_player_set_audio_track_enabled ()
void gst_player_set_video_track_enabled ()
void gst_player_set_subtitle_track_enabled ()
void gst_player_set_subtitle_uri ()
gchar * gst_player_get_subtitle_uri ()
gboolean gst_player_set_visualization ()
void gst_player_set_visualization_enabled ()
gchar * gst_player_get_current_visualization ()
const gchar * gst_player_color_balance_type_get_name ()
gboolean gst_player_has_color_balance ()
void gst_player_set_color_balance ()
gdouble gst_player_get_color_balance ()
GstVideoMultiviewFramePacking gst_player_get_multiview_mode ()
void gst_player_set_multiview_mode ()
GstVideoMultiviewFlags gst_player_get_multiview_flags ()
void gst_player_set_multiview_flags ()
gint64 gst_player_get_audio_video_offset ()
void gst_player_set_audio_video_offset ()
gdouble gst_player_get_rate ()
void gst_player_set_rate ()
GstSample * gst_player_get_video_snapshot ()
void gst_player_config_set_position_update_interval ()
guint gst_player_config_get_position_update_interval ()
void gst_player_config_set_user_agent ()
gchar * gst_player_config_get_user_agent ()
void gst_player_config_set_seek_accurate ()
gboolean gst_player_config_get_seek_accurate ()

Object Hierarchy

    GEnum
    ├── GstPlayerColorBalanceType
    ├── GstPlayerError
    ╰── GstPlayerState
    GInterface
    ├── GstPlayerSignalDispatcher
    ╰── GstPlayerVideoRenderer
    GObject
    ╰── GInitiallyUnowned
        ╰── GstObject
            ╰── GstPlayer

Prerequisites

GstPlayerSignalDispatcher requires GObject.

GstPlayerVideoRenderer requires GObject.

Known Implementations

GstPlayerVideoRenderer is implemented by GstPlayerVideoOverlayVideoRenderer.

Includes

#include <gst/codecparsers/gstmpeg4parser.h>

Description

Functions

gst_player_new ()

GstPlayer *
gst_player_new (GstPlayerVideoRenderer *video_renderer,
                GstPlayerSignalDispatcher *signal_dispatcher);

Creates a new GstPlayer instance that uses signal_dispatcher to dispatch signals to some event loop system, or emits signals directly if NULL is passed. See gst_player_g_main_context_signal_dispatcher_new().

Video is going to be rendered by video_renderer , or if NULL is provided no special video set up will be done and some default handling will be performed.

Parameters

video_renderer

GstPlayerVideoRenderer to use.

[transfer full][allow-none]

signal_dispatcher

GstPlayerSignalDispatcher to use.

[transfer full][allow-none]

Returns

a new GstPlayer instance.

[transfer full]


gst_player_play ()

void
gst_player_play (GstPlayer *player);

Request to play the loaded stream.

Parameters

player

GstPlayer instance

 

gst_player_pause ()

void
gst_player_pause (GstPlayer *player);

Pauses the current stream.

Parameters

player

GstPlayer instance

 

gst_player_stop ()

void
gst_player_stop (GstPlayer *player);

Stops playing the current stream and resets to the first position in the stream.

Parameters

player

GstPlayer instance

 

gst_player_seek ()

void
gst_player_seek (GstPlayer *player,
                 GstClockTime position);

Seeks the currently-playing stream to the absolute position time in nanoseconds.

Parameters

player

GstPlayer instance

 

position

position to seek in nanoseconds

 

gst_player_set_uri ()

void
gst_player_set_uri (GstPlayer *player,
                    const gchar *uri);

Sets the next URI to play.

Parameters

player

GstPlayer instance

 

uri

next URI to play.

 

gst_player_get_uri ()

gchar *
gst_player_get_uri (GstPlayer *player);

Gets the URI of the currently-playing stream.

Parameters

player

GstPlayer instance

 

Returns

a string containing the URI of the currently-playing stream. g_free() after usage.

[transfer full]


gst_player_get_duration ()

GstClockTime
gst_player_get_duration (GstPlayer *player);

Retrieves the duration of the media stream that self represents.

Parameters

player

GstPlayer instance

 

Returns

the duration of the currently-playing media stream, in nanoseconds.


gst_player_get_position ()

GstClockTime
gst_player_get_position (GstPlayer *player);

Parameters

player

GstPlayer instance

 

Returns

the absolute position time, in nanoseconds, of the currently-playing stream.


gst_player_set_volume ()

void
gst_player_set_volume (GstPlayer *player,
                       gdouble val);

Sets the volume level of the stream as a percentage between 0 and 1.

Parameters

player

GstPlayer instance

 

val

the new volume level, as a percentage between 0 and 1

 

gst_player_set_mute ()

void
gst_player_set_mute (GstPlayer *player,
                     gboolean val);

TRUE if the currently-playing stream should be muted.

Parameters

player

GstPlayer instance

 

val

Mute state the should be set

 

gst_player_get_volume ()

gdouble
gst_player_get_volume (GstPlayer *player);

Returns the current volume level, as a percentage between 0 and 1.

Parameters

player

GstPlayer instance

 

Returns

the volume as percentage between 0 and 1.


gst_player_get_mute ()

gboolean
gst_player_get_mute (GstPlayer *player);

Parameters

player

GstPlayer instance

 

Returns

TRUE if the currently-playing stream is muted.


gst_player_get_pipeline ()

GstElement *
gst_player_get_pipeline (GstPlayer *player);

Parameters

player

GstPlayer instance

 

Returns

The internal playbin instance.

[transfer full]


gst_player_set_config ()

gboolean
gst_player_set_config (GstPlayer *player,
                       GstStructure *config);

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 the GST_PLAYER_STATE_STOPPED, this method will return FALSE and active configuration will remain.

config is a GstStructure that contains the configuration parameters for the player.

This function takes ownership of config .

Parameters

player

GstPlayer instance

 

config

a GstStructure.

[transfer full]

Returns

TRUE when the configuration could be set. Since 1.10


gst_player_get_config ()

GstStructure *
gst_player_get_config (GstPlayer *player);

Get a copy of the current configuration of the player. This configuration can either be modified and used for the gst_player_set_config() call or it must be freed after usage.

Parameters

player

GstPlayer instance

 

Returns

a copy of the current configuration of player . Use gst_structure_free() after usage or gst_player_set_config().

Since 1.10.

[transfer full]


gst_player_state_get_name ()

const gchar *
gst_player_state_get_name (GstPlayerState state);

Gets a string representing the given state.

Parameters

state

a GstPlayerState

 

Returns

a string with the name of the state.

[transfer none]


gst_player_error_get_name ()

const gchar *
gst_player_error_get_name (GstPlayerError error);

Gets a string representing the given error.

Parameters

error

a GstPlayerError

 

Returns

a string with the given error.

[transfer none]


gst_player_get_media_info ()

GstPlayerMediaInfo *
gst_player_get_media_info (GstPlayer *player);

A Function to get the current media info GstPlayerMediaInfo instance.

Parameters

player

GstPlayer instance

 

Returns

media info instance.

The caller should free it with g_object_unref().

[transfer full]


gst_player_set_audio_track ()

gboolean
gst_player_set_audio_track (GstPlayer *player,
                            gint stream_index);

Parameters

player

GstPlayer instance

 

stream_index

stream index

 

Returns

TRUE or FALSE

Sets the audio track stream_idex .


gst_player_set_video_track ()

gboolean
gst_player_set_video_track (GstPlayer *player,
                            gint stream_index);

Parameters

player

GstPlayer instance

 

stream_index

stream index

 

Returns

TRUE or FALSE

Sets the video track stream_index .


gst_player_set_subtitle_track ()

gboolean
gst_player_set_subtitle_track (GstPlayer *player,
                               gint stream_index);

Parameters

player

GstPlayer instance

 

stream_index

stream index

 

Returns

TRUE or FALSE

Sets the subtitle strack stream_index .


gst_player_get_current_audio_track ()

GstPlayerAudioInfo *
gst_player_get_current_audio_track (GstPlayer *player);

A Function to get current audio GstPlayerAudioInfo instance.

Parameters

player

GstPlayer instance

 

Returns

current audio track.

The caller should free it with g_object_unref().

[transfer full]


gst_player_get_current_video_track ()

GstPlayerVideoInfo *
gst_player_get_current_video_track (GstPlayer *player);

A Function to get current video GstPlayerVideoInfo instance.

Parameters

player

GstPlayer instance

 

Returns

current video track.

The caller should free it with g_object_unref().

[transfer full]


gst_player_get_current_subtitle_track ()

GstPlayerSubtitleInfo *
gst_player_get_current_subtitle_track (GstPlayer *player);

A Function to get current subtitle GstPlayerSubtitleInfo instance.

Parameters

player

GstPlayer instance

 

Returns

current subtitle track.

The caller should free it with g_object_unref().

[transfer none]


gst_player_set_audio_track_enabled ()

void
gst_player_set_audio_track_enabled (GstPlayer *player,
                                    gboolean enabled);

Enable or disable the current audio track.

Parameters

player

GstPlayer instance

 

enabled

TRUE or FALSE

 

gst_player_set_video_track_enabled ()

void
gst_player_set_video_track_enabled (GstPlayer *player,
                                    gboolean enabled);

Enable or disable the current video track.

Parameters

player

GstPlayer instance

 

enabled

TRUE or FALSE

 

gst_player_set_subtitle_track_enabled ()

void
gst_player_set_subtitle_track_enabled (GstPlayer *player,
                                       gboolean enabled);

Enable or disable the current subtitle track.

Parameters

player

GstPlayer instance

 

enabled

TRUE or FALSE

 

gst_player_set_subtitle_uri ()

void
gst_player_set_subtitle_uri (GstPlayer *player,
                             const gchar *uri);

Sets the external subtitle URI. This should be combined with a call to gst_player_set_subtitle_track_enabled(player , TRUE) so the subtitles are actually rendered.

Parameters

player

GstPlayer instance

 

uri

subtitle URI

 

gst_player_get_subtitle_uri ()

gchar *
gst_player_get_subtitle_uri (GstPlayer *player);

current subtitle URI

Parameters

player

GstPlayer instance

 

Returns

URI of the current external subtitle. g_free() after usage.

[transfer full]


gst_player_set_visualization ()

gboolean
gst_player_set_visualization (GstPlayer *player,
                              const gchar *name);

Parameters

player

GstPlayer instance

 

name

visualization element obtained from gst_player_visualizations_get()

 

Returns

TRUE if the visualizations was set correctly. Otherwise, FALSE.


gst_player_set_visualization_enabled ()

void
gst_player_set_visualization_enabled (GstPlayer *player,
                                      gboolean enabled);

Enable or disable the visualization.

Parameters

player

GstPlayer instance

 

enabled

TRUE or FALSE

 

gst_player_get_current_visualization ()

gchar *
gst_player_get_current_visualization (GstPlayer *player);

Parameters

player

GstPlayer instance

 

Returns

Name of the currently enabled visualization. g_free() after usage.

[transfer full]


gst_player_color_balance_type_get_name ()

const gchar *
gst_player_color_balance_type_get_name
                               (GstPlayerColorBalanceType type);

Gets a string representing the given color balance type.

Parameters

Returns

a string with the name of the color balance type.

[transfer none]


gst_player_has_color_balance ()

gboolean
gst_player_has_color_balance (GstPlayer *player);

Checks whether the player has color balance support available.

Parameters

player

GstPlayer instance

 

Returns

TRUE if player has color balance support. Otherwise, FALSE.


gst_player_set_color_balance ()

void
gst_player_set_color_balance (GstPlayer *player,
                              GstPlayerColorBalanceType type,
                              gdouble value);

Sets the current value of the indicated channel type to the passed value.

Parameters

player

GstPlayer instance

 

type

GstPlayerColorBalanceType

 

value

The new value for the type , ranged [0,1]

 

gst_player_get_color_balance ()

gdouble
gst_player_get_color_balance (GstPlayer *player,
                              GstPlayerColorBalanceType type);

Retrieve the current value of the indicated type .

Parameters

player

GstPlayer instance

 

type

GstPlayerColorBalanceType

 

Returns

The current value of type , between [0,1]. In case of error -1 is returned.


gst_player_get_multiview_mode ()

GstVideoMultiviewFramePacking
gst_player_get_multiview_mode (GstPlayer *player);

Retrieve the current value of the indicated type .

Parameters

player

GstPlayer instance

 

Returns

The current value of type , Default: -1 "none"

Since: 1.10


gst_player_set_multiview_mode ()

void
gst_player_set_multiview_mode (GstPlayer *player,
                               GstVideoMultiviewFramePacking mode);

Sets the current value of the indicated mode type to the passed value.

Parameters

player

GstPlayer instance

 

mode

The new value for the type

 

Since: 1.10


gst_player_get_multiview_flags ()

GstVideoMultiviewFlags
gst_player_get_multiview_flags (GstPlayer *player);

Retrieve the current value of the indicated type .

Parameters

player

GstPlayer instance

 

Returns

The current value of type , Default: 0x00000000 "none

Since: 1.10


gst_player_set_multiview_flags ()

void
gst_player_set_multiview_flags (GstPlayer *player,
                                GstVideoMultiviewFlags flags);

Sets the current value of the indicated mode type to the passed value.

Parameters

player

GstPlayer instance

 

flags

The new value for the type

 

Since: 1.10


gst_player_get_audio_video_offset ()

gint64
gst_player_get_audio_video_offset (GstPlayer *player);

Retrieve the current value of audio-video-offset property

Parameters

player

GstPlayer instance

 

Returns

The current value of audio-video-offset in nanoseconds

Since 1.10


gst_player_set_audio_video_offset ()

void
gst_player_set_audio_video_offset (GstPlayer *player,
                                   gint64 offset);

Sets audio-video-offset property by value of offset

Since 1.10

Parameters

player

GstPlayer instance

 

offset

gint64 in nanoseconds

 

gst_player_get_rate ()

gdouble
gst_player_get_rate (GstPlayer *player);

Parameters

player

GstPlayer instance

 

Returns

current playback rate


gst_player_set_rate ()

void
gst_player_set_rate (GstPlayer *player,
                     gdouble rate);

Playback at specified rate

Parameters

player

GstPlayer instance

 

rate

playback rate

 

gst_player_get_video_snapshot ()

GstSample *
gst_player_get_video_snapshot (GstPlayer *player,
                               GstPlayerSnapshotFormat format,
                               const GstStructure *config);

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 G_TYPE_INT

  • pixel-aspect-ratio of type GST_TYPE_FRACTION Except for GST_PLAYER_THUMBNAIL_RAW_NATIVE format, if no config is set, pixel-aspect-ratio would be 1/1

Parameters

player

GstPlayer instance

 

format

output format of the video snapshot

 

config

Additional configuration.

[allow-none]

Returns

Current video snapshot sample or NULL on failure

Since 1.12.

[transfer full]


gst_player_config_set_position_update_interval ()

void
gst_player_config_set_position_update_interval
                               (GstStructure *config,
                                guint interval);

set interval in milliseconds between two position-updated signals. pass 0 to stop updating the position. Since 1.10

Parameters

config

a GstPlayer configuration

 

interval

interval in ms

 

gst_player_config_get_position_update_interval ()

guint
gst_player_config_get_position_update_interval
                               (const GstStructure *config);

Parameters

config

a GstPlayer configuration

 

Returns

current position update interval in milliseconds

Since 1.10


gst_player_config_set_user_agent ()

void
gst_player_config_set_user_agent (GstStructure *config,
                                  const gchar *agent);

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.

Since 1.10

Parameters

config

a GstPlayer configuration

 

agent

the string to use as user agent

 

gst_player_config_get_user_agent ()

gchar *
gst_player_config_get_user_agent (const GstStructure *config);

Return the user agent which has been configured using gst_player_config_set_user_agent() if any.

Parameters

config

a GstPlayer configuration

 

Returns

the configured agent, or NULL Since 1.10.

[transfer full]


gst_player_config_set_seek_accurate ()

void
gst_player_config_set_seek_accurate (GstStructure *config,
                                     gboolean accurate);

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.

Parameters

config

a GstPlayer configuration

 

accurate

accurate seek or not

 

Since: 1.12


gst_player_config_get_seek_accurate ()

gboolean
gst_player_config_get_seek_accurate (const GstStructure *config);

Parameters

config

a GstPlayer configuration

 

Returns

TRUE if accurate seeking is enabled

Since 1.12

Types and Values

GstPlayer

typedef struct _GstPlayer GstPlayer;

enum GstPlayerState

Members

GST_PLAYER_STATE_STOPPED

the player is stopped.

 

GST_PLAYER_STATE_BUFFERING

the player is buffering.

 

GST_PLAYER_STATE_PAUSED

the player is paused.

 

GST_PLAYER_STATE_PLAYING

the player is currently playing a stream.

 

GST_PLAYER_ERROR

#define      GST_PLAYER_ERROR                         (gst_player_error_quark ())

enum GstPlayerError

Members

GST_PLAYER_ERROR_FAILED

generic error.

 

enum GstPlayerColorBalanceType

Members

GST_PLAYER_COLOR_BALANCE_BRIGHTNESS

brightness or black level.

 

GST_PLAYER_COLOR_BALANCE_CONTRAST

contrast or luma gain.

 

GST_PLAYER_COLOR_BALANCE_SATURATION

color saturation or chroma gain.

 

GST_PLAYER_COLOR_BALANCE_HUE

hue or color balance.

 

enum GstPlayerSnapshotFormat

Members

GST_PLAYER_THUMBNAIL_RAW_NATIVE

   

GST_PLAYER_THUMBNAIL_RAW_xRGB

   

GST_PLAYER_THUMBNAIL_RAW_BGRx

   

GST_PLAYER_THUMBNAIL_JPG

   

GST_PLAYER_THUMBNAIL_PNG

   

GstPlayerSignalDispatcher

typedef struct _GstPlayerSignalDispatcher GstPlayerSignalDispatcher;

struct GstPlayerSignalDispatcherInterface

struct GstPlayerSignalDispatcherInterface {
  GTypeInterface parent_iface;

  void (*dispatch) (GstPlayerSignalDispatcher * self,
                    GstPlayer * player,
                    GstPlayerSignalDispatcherFunc emitter,
                    gpointer data,
                    GDestroyNotify destroy);
};

GstPlayerVideoRenderer

typedef struct _GstPlayerVideoRenderer GstPlayerVideoRenderer;

struct GstPlayerVideoRendererInterface

struct GstPlayerVideoRendererInterface {
  GTypeInterface parent_iface;

  GstElement * (*create_video_sink) (GstPlayerVideoRenderer * self, GstPlayer * player);
};

Property Details

The “audio-video-offset” property

  “audio-video-offset”       gint64

The synchronisation offset between audio and video in nanoseconds.

Flags: Read / Write

Default value: 0


The “current-audio-track” property

  “current-audio-track”      GstPlayerAudioInfo *

Current audio track information.

Flags: Read


The “current-subtitle-track” property

  “current-subtitle-track”   GstPlayerSubtitleInfo *

Current audio subtitle information.

Flags: Read


The “current-video-track” property

  “current-video-track”      GstPlayerVideoInfo *

Current video track information.

Flags: Read


The “duration” property

  “duration”                 guint64

Duration.

Flags: Read

Default value: 18446744073709551615


The “media-info” property

  “media-info”               GstPlayerMediaInfo *

Current media information.

Flags: Read


The “mute” property

  “mute”                     gboolean

Mute.

Flags: Read / Write

Default value: FALSE


The “pipeline” property

  “pipeline”                 GstElement *

GStreamer pipeline that is used.

Flags: Read


The “position” property

  “position”                 guint64

Current Position.

Flags: Read

Default value: 18446744073709551615


The “rate” property

  “rate”                     gdouble

Playback rate.

Flags: Read / Write

Allowed values: [-64,64]

Default value: 1


The “signal-dispatcher” property

  “signal-dispatcher”        GstPlayerSignalDispatcher *

Dispatcher for the signals to e.g. event loops.

Flags: Write / Construct Only


The “suburi” property

  “suburi”                   gchar *

Current Subtitle URI.

Flags: Read / Write

Default value: NULL


The “uri” property

  “uri”                      gchar *

Current URI.

Flags: Read / Write

Default value: NULL


The “video-multiview-flags” property

  “video-multiview-flags”    GstVideoMultiviewFlags

Override details of the multiview frame layout.

Flags: Read / Write


The “video-multiview-mode” property

  “video-multiview-mode”     GstVideoMultiviewFramePacking

Re-interpret a video stream as one of several frame-packed stereoscopic modes.

Flags: Read / Write

Default value: GST_VIDEO_MULTIVIEW_FRAME_PACKING_NONE


The “video-renderer” property

  “video-renderer”           GstPlayerVideoRenderer *

Video renderer to use for rendering videos.

Flags: Write / Construct Only


The “volume” property

  “volume”                   gdouble

Volume.

Flags: Read / Write

Allowed values: [0,10]

Default value: 1

Signal Details

The “buffering” signal

void
user_function (GstPlayer *gstplayer,
               gint       arg1,
               gpointer   user_data)

Flags: No Hooks


The “duration-changed” signal

void
user_function (GstPlayer *gstplayer,
               guint64    arg1,
               gpointer   user_data)

Flags: No Hooks


The “end-of-stream” signal

void
user_function (GstPlayer *gstplayer,
               gpointer   user_data)

Flags: No Hooks


The “error” signal

void
user_function (GstPlayer *gstplayer,
               GError    *arg1,
               gpointer   user_data)

Flags: No Hooks


The “media-info-updated” signal

void
user_function (GstPlayer          *gstplayer,
               GstPlayerMediaInfo *arg1,
               gpointer            user_data)

Flags: No Hooks


The “mute-changed” signal

void
user_function (GstPlayer *gstplayer,
               gpointer   user_data)

Flags: No Hooks


The “position-updated” signal

void
user_function (GstPlayer *gstplayer,
               guint64    arg1,
               gpointer   user_data)

Flags: No Hooks


The “seek-done” signal

void
user_function (GstPlayer *gstplayer,
               guint64    arg1,
               gpointer   user_data)

Flags: No Hooks


The “state-changed” signal

void
user_function (GstPlayer     *gstplayer,
               GstPlayerState arg1,
               gpointer       user_data)

Flags: No Hooks


The “uri-loaded” signal

void
user_function (GstPlayer *gstplayer,
               gchar     *arg1,
               gpointer   user_data)

Flags: No Hooks


The “video-dimensions-changed” signal

void
user_function (GstPlayer *gstplayer,
               gint       arg1,
               gint       arg2,
               gpointer   user_data)

Flags: No Hooks


The “volume-changed” signal

void
user_function (GstPlayer *gstplayer,
               gpointer   user_data)

Flags: No Hooks


The “warning” signal

void
user_function (GstPlayer *gstplayer,
               GError    *arg1,
               gpointer   user_data)

Flags: No Hooks

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.