Interface

RBPlayer

Description [src]

interface RB.Player : GObject.Object

This is the interface implemented by the rhythmbox playback backends. It allows the caller to control playback (open, play, pause, close), seek (set_time), control volume (get_volume, set_volume) and receive playback state information (get_time, various signals).

The playback interface allows for multiple streams to be playing (or at least open) concurrently. The caller associates some data with each stream it opens (#rb_player_open), which is included in the paramters with each signal emitted. The caller should not assume that the new stream is playing immediately upon returning from #rb_player_play. Instead, it should use the ‘playing-stream’ signal to determine that.

The player implementation should emit signals for metadata extracted from the stream using the ‘info’ signal

While playing, the player implementation should emit ‘tick’ signals frequently enough to update an elapsed/remaining time display consistently. The duration value included in tick signal emissions is used to prepare the next stream before the current stream reaches EOS, so it should be updated for each emission to account for variable bitrate streams that produce inaccurate duration estimates early on.

When playing a stream from the network, the player can report buffering status using the ‘buffering’ signal. The value included in the signal indicates the percentage of the buffer that has been filled.

The ‘event’ signal can be used to communicate events from the player to the application. For GStreamer-based player implementations, events are triggered by elements in the pipeline posting application messages. The name of the message becomes the name of the event.

Prerequisite

In order to implement Player, your type must inherit fromGObject.

Functions

rb_player_gst_find_element_with_property

Finds an element inside element that has a property with the specified name.

rb_player_gst_try_audio_sink

Creates and tests an instance of the specified audio sink.

rb_player_new

Creates a new player object.

Instance methods

rb_player_close

If a URI is specified, this will close the stream corresponding to that URI and free any resources related resources. If uri is NULL, this will close all streams.

rb_player_get_time

Returns the current playback for the current stream in nanoseconds.

rb_player_get_volume

Returns the current volume level, between 0.0 and 1.0.

rb_player_multiple_open

Determines whether the player supports multiple open streams.

rb_player_open

Prepares a stream for playback. Depending on the player implementation, this may stop any existing stream being played. The stream preparation process may continue asynchronously, in which case errors may be reported from

rb_player_play or using the 'error' signal.

rb_player_opened

Determines whether a stream has been prepared for playback.

rb_player_pause

Pauses playback of the most recently started stream. Any streams being faded out may continue until the fade is complete.

rb_player_play

Starts playback of the most recently opened stream. if play_type is #RB_PLAYER_PLAY_CROSSFADE, the player may attempt to crossfade the new stream with any existing streams. If it does this, the it will use crossfade as the duration of the fade.

rb_player_playing

Determines whether the player is currently playing a stream. A stream is playing if it’s not paused or being faded out.

rb_player_seekable

Determines whether seeking is supported for the current stream.

rb_player_set_time

Attempts to seek in the current stream. The player may ignore this if the stream is not seekable. The seek may take place asynchronously.

rb_player_set_volume

Adjusts the output volume level. This affects all streams. The player may use a hardware volume control to implement this volume adjustment.

Signals

RB.Player::buffering

The ‘buffering’ signal is emitted while a stream is paused so that a buffer can be filled. The progress value typically varies from 0 to 100, and once it reaches 100, playback resumes.

RB.Player::eos

The ‘eos’ signal is emitted when a stream finishes, or in some cases, when it is about to finish (with early set to TRUE) to allow for a new track to be played immediately afterwards.

RB.Player::error

The ‘error’ signal is emitted when an error is encountered while opening or playing a stream.

RB.Player::event

The ‘event’ signal provides a means for custom GStreamer elements to communicate events back to the rest of the application. The GStreamer element posts an application message on the GStreamer bus, which is translated into an event signal with the detail of the signal set to the name of the structure found in the message.

RB.Player::image

The ‘image’ signal is emitted to provide access to images extracted from the stream.

RB.Player::info

The ‘info’ signal is emitted when a metadata value is found in the stream.

RB.Player::playing-stream

The ‘playing-stream’ signal is emitted when the main playing stream changes. It should be used to update the UI to show the new stream. It can either be emitted before or after #rb_player_play returns, depending on the player backend.

RB.Player::redirect

The ‘redirect’ signal is emitted to indicate when a stream has change URI.

RB.Player::tick

The ‘tick’ signal is emitted repeatedly while the stream is playing. Signal handlers can use this to update UI and to prepare new streams for crossfade or gapless playback.

RB.Player::volume-changed

The ‘volume-changed’ signal is emitted when the output stream volume is changed externally.

Interface structure

struct RBPlayerIface {
  GTypeInterface g_iface;
  gboolean (* open) (
    RBPlayer* player,
    const char* uri,
    gpointer stream_data,
    GDestroyNotify stream_data_destroy,
    GError** error
  );
  gboolean (* opened) (
    RBPlayer* player
  );
  gboolean (* close) (
    RBPlayer* player,
    const char* uri,
    GError** error
  );
  gboolean (* play) (
    RBPlayer* player,
    RBPlayerPlayType play_type,
    gint64 crossfade,
    GError** error
  );
  void (* pause) (
    RBPlayer* player
  );
  gboolean (* playing) (
    RBPlayer* player
  );
  void (* set_volume) (
    RBPlayer* player,
    float volume
  );
  float (* get_volume) (
    RBPlayer* player
  );
  gboolean (* seekable) (
    RBPlayer* player
  );
  void (* set_time) (
    RBPlayer* player,
    gint64 newtime
  );
  gint64 (* get_time) (
    RBPlayer* player
  );
  gboolean (* multiple_open) (
    RBPlayer* player
  );
  void (* playing_stream) (
    RBPlayer* player,
    gpointer stream_data
  );
  void (* eos) (
    RBPlayer* player,
    gpointer stream_data,
    gboolean early
  );
  void (* info) (
    RBPlayer* player,
    gpointer stream_data,
    RBMetaDataField field,
    GValue* value
  );
  void (* buffering) (
    RBPlayer* player,
    gpointer stream_data,
    guint progress
  );
  void (* error) (
    RBPlayer* player,
    gpointer stream_data,
    GError* error
  );
  void (* tick) (
    RBPlayer* player,
    gpointer stream_data,
    gint64 elapsed,
    gint64 duration
  );
  void (* event) (
    RBPlayer* player,
    gpointer stream_data,
    gpointer data
  );
  void (* volume_changed) (
    RBPlayer* player,
    float volume
  );
  void (* image) (
    RBPlayer* player,
    gpointer stream_data,
    GdkPixbuf* image
  );
  void (* redirect) (
    RBPlayer* player,
    gpointer stream_data,
    const gchar* uri
  );
  
}

No description available.

Interface members
g_iface
GTypeInterface
 

No description available.

open
gboolean (* open) (
    RBPlayer* player,
    const char* uri,
    gpointer stream_data,
    GDestroyNotify stream_data_destroy,
    GError** error
  )
 

No description available.

opened
gboolean (* opened) (
    RBPlayer* player
  )
 

No description available.

close
gboolean (* close) (
    RBPlayer* player,
    const char* uri,
    GError** error
  )
 

No description available.

play
gboolean (* play) (
    RBPlayer* player,
    RBPlayerPlayType play_type,
    gint64 crossfade,
    GError** error
  )
 

No description available.

pause
void (* pause) (
    RBPlayer* player
  )
 

No description available.

playing
gboolean (* playing) (
    RBPlayer* player
  )
 

No description available.

set_volume
void (* set_volume) (
    RBPlayer* player,
    float volume
  )
 

No description available.

get_volume
float (* get_volume) (
    RBPlayer* player
  )
 

No description available.

seekable
gboolean (* seekable) (
    RBPlayer* player
  )
 

No description available.

set_time
void (* set_time) (
    RBPlayer* player,
    gint64 newtime
  )
 

No description available.

get_time
gint64 (* get_time) (
    RBPlayer* player
  )
 

No description available.

multiple_open
gboolean (* multiple_open) (
    RBPlayer* player
  )
 

No description available.

playing_stream
void (* playing_stream) (
    RBPlayer* player,
    gpointer stream_data
  )
 

No description available.

eos
void (* eos) (
    RBPlayer* player,
    gpointer stream_data,
    gboolean early
  )
 

No description available.

info
void (* info) (
    RBPlayer* player,
    gpointer stream_data,
    RBMetaDataField field,
    GValue* value
  )
 

No description available.

buffering
void (* buffering) (
    RBPlayer* player,
    gpointer stream_data,
    guint progress
  )
 

No description available.

error
void (* error) (
    RBPlayer* player,
    gpointer stream_data,
    GError* error
  )
 

No description available.

tick
void (* tick) (
    RBPlayer* player,
    gpointer stream_data,
    gint64 elapsed,
    gint64 duration
  )
 

No description available.

event
void (* event) (
    RBPlayer* player,
    gpointer stream_data,
    gpointer data
  )
 

No description available.

volume_changed
void (* volume_changed) (
    RBPlayer* player,
    float volume
  )
 

No description available.

image
void (* image) (
    RBPlayer* player,
    gpointer stream_data,
    GdkPixbuf* image
  )
 

No description available.

redirect
void (* redirect) (
    RBPlayer* player,
    gpointer stream_data,
    const gchar* uri
  )
 

No description available.

Virtual methods

RB.Player.buffering
No description available.

RB.Player.close

If a URI is specified, this will close the stream corresponding to that URI and free any resources related resources. If uri is NULL, this will close all streams.

RB.Player.eos
No description available.

RB.Player.error
No description available.

RB.Player.event
No description available.

RB.Player.get_time

Returns the current playback for the current stream in nanoseconds.

RB.Player.get_volume

Returns the current volume level, between 0.0 and 1.0.

RB.Player.image
No description available.

RB.Player.info
No description available.

RB.Player.multiple_open

Determines whether the player supports multiple open streams.

RB.Player.open

Prepares a stream for playback. Depending on the player implementation, this may stop any existing stream being played. The stream preparation process may continue asynchronously, in which case errors may be reported from

rb_player_play or using the 'error' signal.

RB.Player.opened

Determines whether a stream has been prepared for playback.

RB.Player.pause

Pauses playback of the most recently started stream. Any streams being faded out may continue until the fade is complete.

RB.Player.play

Starts playback of the most recently opened stream. if play_type is #RB_PLAYER_PLAY_CROSSFADE, the player may attempt to crossfade the new stream with any existing streams. If it does this, the it will use crossfade as the duration of the fade.

RB.Player.playing

Determines whether the player is currently playing a stream. A stream is playing if it’s not paused or being faded out.

RB.Player.playing_stream
No description available.

RB.Player.redirect
No description available.

RB.Player.seekable

Determines whether seeking is supported for the current stream.

RB.Player.set_time

Attempts to seek in the current stream. The player may ignore this if the stream is not seekable. The seek may take place asynchronously.

RB.Player.set_volume

Adjusts the output volume level. This affects all streams. The player may use a hardware volume control to implement this volume adjustment.

RB.Player.tick
No description available.

RB.Player.volume_changed
No description available.