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.
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_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_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_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::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::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 |
|
No description available. |
|
open |
|
No description available. |
|
opened |
|
No description available. |
|
close |
|
No description available. |
|
play |
|
No description available. |
|
pause |
|
No description available. |
|
playing |
|
No description available. |
|
set_volume |
|
No description available. |
|
get_volume |
|
No description available. |
|
seekable |
|
No description available. |
|
set_time |
|
No description available. |
|
get_time |
|
No description available. |
|
multiple_open |
|
No description available. |
|
playing_stream |
|
No description available. |
|
eos |
|
No description available. |
|
info |
|
No description available. |
|
buffering |
|
No description available. |
|
error |
|
No description available. |
|
tick |
|
No description available. |
|
event |
|
No description available. |
|
volume_changed |
|
No description available. |
|
image |
|
No description available. |
|
redirect |
|
No description available. |
Virtual 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.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.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.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.