Clutter Gst 2.0.10 Reference Manual: ClutterGstPlayer

## ClutterGstPlayer ClutterGstPlayer — An interface for controlling playback of media data |

## Synopsis

                        ClutterGstPlayer;
    struct              ClutterGstPlayerIface;
    void                clutter_gst_player_class_init       (GObjectClass *object_class);
    gboolean            clutter_gst_player_init             (ClutterGstPlayer *player);
    void                clutter_gst_player_deinit           (ClutterGstPlayer *player);
    GstElement *        clutter_gst_player_get_pipeline     (ClutterGstPlayer *player);
    gboolean            clutter_gst_player_get_idle         (ClutterGstPlayer *player);
    gchar *             clutter_gst_player_get_user_agent   (ClutterGstPlayer *player);
    void                clutter_gst_player_set_user_agent   (ClutterGstPlayer *player,
                                                             const gchar *user_agent);
    void                clutter_gst_player_set_seek_flags   (ClutterGstPlayer *player,
                                                             ClutterGstSeekFlags flags);
    ClutterGstSeekFlags clutter_gst_player_get_seek_flags   (ClutterGstPlayer *player);
    ClutterGstBufferingMode clutter_gst_player_get_buffering_mode
                                                            (ClutterGstPlayer *player);
    void                clutter_gst_player_set_buffering_mode
                                                            (ClutterGstPlayer *player,
                                                             ClutterGstBufferingMode mode);
    GList *             clutter_gst_player_get_audio_streams
                                                            (ClutterGstPlayer *player);
    gint                clutter_gst_player_get_audio_stream (ClutterGstPlayer *player);
    void                clutter_gst_player_set_audio_stream (ClutterGstPlayer *player,
                                                             gint index_);
    GList *             clutter_gst_player_get_subtitle_tracks
                                                            (ClutterGstPlayer *player);
    gint                clutter_gst_player_get_subtitle_track
                                                            (ClutterGstPlayer *player);
    void                clutter_gst_player_set_subtitle_track
                                                            (ClutterGstPlayer *player,
                                                             gint index_);

## Object Hierarchy

      GInterface
       +----ClutterGstPlayer

## Prerequisites

ClutterGstPlayer requires ClutterMedia and GObject.

## Known Implementations

ClutterGstPlayer is implemented by ClutterGstVideoTexture.

## Properties

      "audio-stream"             gint                  : Read / Write
      "audio-streams"            gpointer              : Read
      "idle"                     gboolean              : Read
      "in-seek"                  gboolean              : Read
      "seek-flags"               ClutterGstSeekFlags   : Read / Write
      "subtitle-track"           gint                  : Read / Write
      "subtitle-tracks"          gpointer              : Read
      "user-agent"               gchar*                : Read / Write

## Signals

      "download-buffering"                             : Run Last

## Description

ClutterGstPlayer is an interface for controlling playback of media sources. Contrary to most interfaces, you don't need to implement ClutterGstPlayer. It already provides an implementation/logic leaving you only tweak a few properties to get the desired behavior.

ClutterGstPlayer extends and implements ClutterMedia to create enhanced player.

ClutterMedia is available since Clutter 0.2

## Details

### ClutterGstPlayer

    typedef struct _ClutterGstPlayer ClutterGstPlayer;

ClutterGstPlayer is an opaque structure whose members cannot be directly accessed

Since 1.4

### struct ClutterGstPlayerIface

    struct ClutterGstPlayerIface {
      GstElement * (* get_pipeline)   (ClutterGstPlayer *player);

      gchar * (* get_user_agent) (ClutterGstPlayer *player);
      void    (* set_user_agent) (ClutterGstPlayer *player,
                                  const gchar      *user_agent);

      ClutterGstSeekFlags (* get_seek_flags) (ClutterGstPlayer *player);
      void                (* set_seek_flags) (ClutterGstPlayer    *player,
                                              ClutterGstSeekFlags  flags);

      ClutterGstBufferingMode (* get_buffering_mode) (ClutterGstPlayer *player);
      void                    (* set_buffering_mode) (ClutterGstPlayer        *player,
                                                      ClutterGstBufferingMode  mode);

      GList * (* get_audio_streams) (ClutterGstPlayer *player);
      gint    (* get_audio_stream)  (ClutterGstPlayer *player);
      void    (* set_audio_stream)  (ClutterGstPlayer *player,
                                     gint              index_);

      GList * (* get_subtitle_tracks) (ClutterGstPlayer *player);
      gint    (* get_subtitle_track)  (ClutterGstPlayer *player);
      void    (* set_subtitle_track)  (ClutterGstPlayer *player,
                                       gint              index_);

      gboolean (*get_idle) (ClutterGstPlayer *player);

      gboolean (*get_in_seek) (ClutterGstPlayer *player);

      void (* _iface_reserved16) (void);
      void (* _iface_reserved17) (void);
      void (* _iface_reserved18) (void);
      void (* _iface_reserved19) (void);
      void (* _iface_reserved20) (void);
      void (* _iface_reserved21) (void);
      void (* _iface_reserved22) (void);
      void (* _iface_reserved23) (void);
      void (* _iface_reserved24) (void);
      void (* _iface_reserved25) (void);
      void (* _iface_reserved26) (void);
      void (* _iface_reserved27) (void);
      void (* _iface_reserved28) (void);
      void (* _iface_reserved29) (void);
      void (* _iface_reserved30) (void);
      void (* _iface_reserved31) (void);
      void (* _iface_reserved32) (void);
      void (* _iface_reserved33) (void);
      void (* _iface_reserved34) (void);
      void (* _iface_reserved35) (void);

      /* signals */
      void (* download_buffering)  (ClutterGstPlayer *player,
                                    gdouble           start,
                                    gdouble           stop);
      void (* _clutter_reserved2)  (void);
      void (* _clutter_reserved3)  (void);
      void (* _clutter_reserved4)  (void);
      void (* _clutter_reserved5)  (void);
      void (* _clutter_reserved6)  (void);
      void (* _clutter_reserved7)  (void);
      void (* _clutter_reserved8)  (void);
      void (* _clutter_reserved9)  (void);
      void (* _clutter_reserved10) (void);
    };

Interface vtable for ClutterGstPlayer implementations

`get_pipeline` () |
`get_user_agent` () |
`set_user_agent` () |
`get_seek_flags` () |
`set_seek_flags` () |
`get_buffering_mode` () |
`set_buffering_mode` () |
`get_audio_streams` () |
`get_audio_stream` () |
`set_audio_stream` () |
`get_subtitle_tracks` () |
`get_subtitle_track` () |
`set_subtitle_track` () |
`get_idle` () |
`get_in_seek` () |
`_iface_reserved16` () |
`_iface_reserved17` () |
`_iface_reserved18` () |
`_iface_reserved19` () |
`_iface_reserved20` () |
`_iface_reserved21` () |
`_iface_reserved22` () |
`_iface_reserved23` () |
`_iface_reserved24` () |
`_iface_reserved25` () |
`_iface_reserved26` () |
`_iface_reserved27` () |
`_iface_reserved28` () |
`_iface_reserved29` () |
`_iface_reserved30` () |
`_iface_reserved31` () |
`_iface_reserved32` () |
`_iface_reserved33` () |
`_iface_reserved34` () |
`_iface_reserved35` () |
`download_buffering` () | handler for the "download-buffering" signal
`_clutter_reserved2` () |
`_clutter_reserved3` () |
`_clutter_reserved4` () |
`_clutter_reserved5` () |
`_clutter_reserved6` () |
`_clutter_reserved7` () |
`_clutter_reserved8` () |
`_clutter_reserved9` () |
`_clutter_reserved10` () |

Since 1.4

### clutter_gst_player_class_init ()

    void                clutter_gst_player_class_init       (GObjectClass *object_class);

Adds the ClutterGstPlayer properties to a class and surchages the set/get_property of GObjectClass. You should call this function at the end of the class_init method of the class implementing ClutterGstPlayer.

`object_class` : | a GObjectClass

Since 1.4

### clutter_gst_player_init ()

    gboolean            clutter_gst_player_init             (ClutterGstPlayer *player);

Initialize a ClutterGstPlayer instance. You should call this function at the beginning of the init method of the class implementing ClutterGstPlayer.

When you're finished with the ClutterGstPlayer mixin features (usually in the dispose or finalize vfuncs), call `clutter_gst_player_deinit()` to desallocate the resources created by `clutter_gst_player_init()`.

`player` : | a ClutterGstPlayer
Returns : | TRUE if the initialization was successfull, FALSE otherwise.

Since 1.4

### clutter_gst_player_deinit ()

    void                clutter_gst_player_deinit           (ClutterGstPlayer *player);

Frees the resources created by `clutter_gst_player_init()`. After `clutter_gst_player_deinit()` has been called, no other player method can be called on the instance.

`player` : | a ClutterGstPlayer

Since 1.4

### clutter_gst_player_get_pipeline ()

    GstElement *        clutter_gst_player_get_pipeline     (ClutterGstPlayer *player);

Retrieves the GstPipeline used by the `player`, for direct use with GStreamer API.

`player` : | a ClutterGstPlayer
Returns : | the GstPipeline element used by the player. [transfer none]

Since 1.4

### clutter_gst_player_get_idle ()

    gboolean            clutter_gst_player_get_idle         (ClutterGstPlayer *player);

Get the idle state of the pipeline.

`player` : | a ClutterGstPlayer
Returns : | TRUE if the pipline is in idle mode, FALSE otherwise.

Since 1.4

### clutter_gst_player_get_user_agent ()

    gchar *             clutter_gst_player_get_user_agent   (ClutterGstPlayer *player);

Retrieves the user agent used when streaming.

`player` : | a ClutterGstPlayer
Returns : | the user agent used. The returned string has to be freed with `g_free()`

Since 1.4

### clutter_gst_player_set_user_agent ()

    void                clutter_gst_player_set_user_agent   (ClutterGstPlayer *player,
                                                             const gchar *user_agent);

Sets the user agent to use when streaming.

When streaming content, you might want to set a custom user agent, eg. to promote your software, make it appear in statistics or because the server requires a special user agent you want to impersonate.

`player` : | a ClutterGstPlayer
`user_agent` : | the user agent

Since 1.4

### clutter_gst_player_set_seek_flags ()

    void                clutter_gst_player_set_seek_flags   (ClutterGstPlayer *player,
                                                             ClutterGstSeekFlags flags);

Seeking can be done with several trade-offs. Clutter-gst defaults to `CLUTTER_GST_SEEK_FLAG_NONE`.

`player` : | a ClutterGstPlayer
`flags` : | a combination of ClutterGstSeekFlags

Since 1.4

### clutter_gst_player_get_seek_flags ()

    ClutterGstSeekFlags clutter_gst_player_get_seek_flags   (ClutterGstPlayer *player);

Get the current value of the seek-flags property.

`player` : | a ClutterGstPlayer
Returns : | a combination of ClutterGstSeekFlags

Since 1.4

### clutter_gst_player_get_buffering_mode ()

    ClutterGstBufferingMode clutter_gst_player_get_buffering_mode
                                                            (ClutterGstPlayer *player);

`player` : | a ClutterGstPlayer
Returns : | a ClutterGstBufferingMode

Since 1.4

### clutter_gst_player_set_buffering_mode ()

    void                clutter_gst_player_set_buffering_mode
                                                            (ClutterGstPlayer *player,
                                                             ClutterGstBufferingMode mode);

`player` : | a ClutterGstPlayer
`mode` : | a ClutterGstBufferingMode

Since 1.4

### clutter_gst_player_get_audio_streams ()

    GList *             clutter_gst_player_get_audio_streams
                                                            (ClutterGstPlayer *player);

Get the list of audio streams of the current media.

`player` : | a ClutterGstPlayer
Returns : | a list of strings describing the available audio streams. [transfer none][element-type utf8]

Since 1.4

### clutter_gst_player_get_audio_stream ()

    gint                clutter_gst_player_get_audio_stream (ClutterGstPlayer *player);

Get the current audio stream. The number returned in the index of the audio stream playing in the list returned by `clutter_gst_player_get_audio_streams()`.

`player` : | a ClutterGstPlayer
Returns : | the index of the current audio stream, -1 if the media has no audio stream

Since 1.4

### clutter_gst_player_set_audio_stream ()

    void                clutter_gst_player_set_audio_stream (ClutterGstPlayer *player,
                                                             gint index_);

Set the audio stream to play. `index_` is the index of the stream in the list returned by `clutter_gst_player_get_audio_streams()`.

`player` : | a ClutterGstPlayer
`index_` : | the index of the audio stream

Since 1.4

### clutter_gst_player_get_subtitle_tracks ()

    GList *             clutter_gst_player_get_subtitle_tracks
                                                            (ClutterGstPlayer *player);

Get the list of subtitles tracks of the current media.

`player` : | a ClutterGstPlayer
Returns : | a list of strings describing the available subtitles tracks. [transfer none][element-type utf8]

Since 1.4

### clutter_gst_player_get_subtitle_track ()

    gint                clutter_gst_player_get_subtitle_track
                                                            (ClutterGstPlayer *player);

Get the current subtitles track. The number returned is the index of the subtiles track in the list returned by `clutter_gst_player_get_subtitle_tracks()`.

`player` : | a ClutterGstPlayer
Returns : | the index of the current subtitlest track, -1 if the media has no subtitles track or if the subtitles have been turned off

Since 1.4

### clutter_gst_player_set_subtitle_track ()

    void                clutter_gst_player_set_subtitle_track
                                                            (ClutterGstPlayer *player,
                                                             gint index_);

Set the subtitles track to play. `index_` is the index of the stream in the list returned by `clutter_gst_player_get_subtitle_tracks()`.

If `index_` is -1, the subtitles are turned off.

`player` : | a ClutterGstPlayer
`index_` : | the index of the subtitles track

Since 1.4

## Property Details

### The `"audio-stream"` property

      "audio-stream"             gint                  : Read / Write

Index of the current audio stream.

Allowed values: >= -1

Default value: -1

Since 1.4

### The `"audio-streams"` property

      "audio-streams"            gpointer              : Read

List of audio streams available on the current media.

Since 1.4

### The `"idle"` property

      "idle"                     gboolean              : Read

Whether the ClutterGstPlayer is in idle mode.

Default value: TRUE

Since 1.4

### The `"in-seek"` property

      "in-seek"                  gboolean              : Read

Whether or not the stream is being seeked.

Default value: FALSE

Since 1.6

### The `"seek-flags"` property

      "seek-flags"               ClutterGstSeekFlags   : Read / Write

Flags to use when seeking.

Since 1.4

### The `"subtitle-track"` property

      "subtitle-track"           gint                  : Read / Write

Index of the current subtitles track.

Allowed values: >= -1

Default value: -1

### The `"subtitle-tracks"` property

      "subtitle-tracks"          gpointer              : Read

List of the subtitles tracks of the media.

### The `"user-agent"` property

      "user-agent"               gchar*                : Read / Write

The User Agent used by ClutterGstPlayer with network protocols.

Default value: NULL

Since 1.4

## Signal Details

### The `"download-buffering"` signal

    void                user_function                      (ClutterGstPlayer *player,
                                                            gdouble           start,
                                                            gdouble           stop,
                                                            gpointer          user_data)      : Run Last

The ::download-buffering signal is emitted each time their an update about the buffering of the current media.

`player` : | the ClutterGstPlayer instance that received the signal
`start` : | start position of the buffering
`stop` : | start position of the buffering
`user_data` : | user data set when the signal handler was connected.

Since 1.4