rb-player

rb-player

Synopsis




enum                RBPlayerError;
#define             RB_PLAYER_ERROR
GQuark              rb_player_error_quark               (void);
RBPlayer*           rb_player_new                       (gboolean want_crossfade,
                                                         GError **error);
gboolean            rb_player_open                      (RBPlayer *player,
                                                         const char *uri,
                                                         gpointer stream_data,
                                                         GDestroyNotify stream_data_destroy,
                                                         GError **error);
gboolean            rb_player_opened                    (RBPlayer *player);
gboolean            rb_player_close                     (RBPlayer *player,
                                                         const char *uri,
                                                         GError **error);
gboolean            rb_player_play                      (RBPlayer *player,
                                                         gint crossfade,
                                                         GError **error);
void                rb_player_pause                     (RBPlayer *player);
gboolean            rb_player_playing                   (RBPlayer *player);
void                rb_player_set_volume                (RBPlayer *player,
                                                         float volume);
float               rb_player_get_volume                (RBPlayer *player);
void                rb_player_set_replaygain            (RBPlayer *player,
                                                         const char *uri,
                                                         double track_gain,
                                                         double track_peak,
                                                         double album_gain,
                                                         double album_peak);
gboolean            rb_player_seekable                  (RBPlayer *player);
void                rb_player_set_time                  (RBPlayer *player,
                                                         long time );
long                rb_player_get_time                  (RBPlayer *player);

Description

Details

enum RBPlayerError

typedef enum
{
	RB_PLAYER_ERROR_NO_AUDIO,
	RB_PLAYER_ERROR_GENERAL,
	RB_PLAYER_ERROR_INTERNAL
} RBPlayerError;


RB_PLAYER_ERROR

#define RB_PLAYER_ERROR rb_player_error_quark ()


rb_player_error_quark ()

GQuark              rb_player_error_quark               (void);

Returns :


rb_player_new ()

RBPlayer*           rb_player_new                       (gboolean want_crossfade,
                                                         GError **error);

Creates a new player object.

want_crossfade :

if TRUE, try to use a backend that supports crossfading and other track transitions.

error :

returns error information

Returns :


rb_player_open ()

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

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.

returns TRUE if the stream preparation was not unsuccessful

player :

a RBPlayer

uri :

URI to open

stream_data :

arbitrary data to associate with the stream

stream_data_destroy :

function to call to destroy the stream data

error :

returns error information

Returns :


rb_player_opened ()

gboolean            rb_player_opened                    (RBPlayer *player);

player :

a RBPlayer returns TRUE if a stream is prepared for playback

Returns :


rb_player_close ()

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

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.

If no streams remain open after this call, the audio device will be released.

returns TRUE if a stream was found and closed

player :

a RBPlayer

uri :

optionally, the URI of the stream to close

error :

returns error information

Returns :


rb_player_play ()

gboolean            rb_player_play                      (RBPlayer *player,
                                                         gint crossfade,
                                                         GError **error);

Starts playback of the most recently opened stream. If crossfade is greater than zero, the player may attempt to crossfade the new stream with any existing streams.

If crossfade is zero, the player may attempt to start the stream immediately after the current playing stream reaches EOS. This may or may not result in the phenomemon known as 'gapless playback'.

If crossfade is less than zero, the player will stop any existing stream before starting the new stream. It may do this anyway, regardless of the value of crossfade.

The 'playing-stream' signal will be emitted when the new stream is actually playing. This may be before or after control returns to the caller.

returns: TRUE if playback started successfully

player :

a RBPlayer

crossfade :

requested crossfade duration

error :

returns error information

Returns :


rb_player_pause ()

void                rb_player_pause                     (RBPlayer *player);

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

player :

a RBPlayer

rb_player_playing ()

gboolean            rb_player_playing                   (RBPlayer *player);

player :

a RBPlayer

Returns :

TRUE if a stream is currently being played (not paused or being faded out).

rb_player_set_volume ()

void                rb_player_set_volume                (RBPlayer *player,
                                                         float volume);

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

player :

a RBPlayer

volume :

new output volume level

rb_player_get_volume ()

float               rb_player_get_volume                (RBPlayer *player);

player :

a RBPlayer

Returns :

current output volume level

rb_player_set_replaygain ()

void                rb_player_set_replaygain            (RBPlayer *player,
                                                         const char *uri,
                                                         double track_gain,
                                                         double track_peak,
                                                         double album_gain,
                                                         double album_peak);

Sets ReplayGain values for a stream

player :

a RBPlayer

uri :

URI of stream to adjust

track_gain :

ReplayGain track gain level

track_peak :

ReplayGain track peak level

album_gain :

ReplayGain album gain level

album_peak :

ReplayGain album peak level

rb_player_seekable ()

gboolean            rb_player_seekable                  (RBPlayer *player);

player :

a RBPlayer

Returns :

TRUE if the current stream is seekable

rb_player_set_time ()

void                rb_player_set_time                  (RBPlayer *player,
                                                         long 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.

player :

a RBPlayer

Param2 :


rb_player_get_time ()

long                rb_player_get_time                  (RBPlayer *player);

player :

a RBPlayer

Returns :

the current playback position in the current stream