Top | ![]() |
![]() |
![]() |
![]() |
GstSyncServerGstSyncServer — Provides a server object to publish information that clients on a network can use to play a stream in a synchronised manner. |
gchar * | control-address | Read / Write |
gint | control-port | Read / Write |
GObject * | control-server | Read / Write |
guint64 | latency | Read / Write |
GVariant * | playlist | Read / Write |
guint64 | stream-start-delay | Read / Write |
The GstSyncServer object provides API to start a server on one device on a network that other devices (using GstSyncClient) can communicate with to play a stream such that all devices are playing the same stream at the same time.
It also provides API to control these clients and perform tasks such as switching the currently playing stream, pausing/unpausing, etc.
GstSyncServer itself does not implement the network transport for controlling the client, but defers that to an object that implements the GstSyncControlServer interface. A default TCP-based implementation is provided with this library, however.
The stream(s) to play are configured using the “playlist”
property, which takes a GVariant that can be constructed using
gst_sync_server_playlist_new()
and manipulated by related functions.
GstSyncServer * gst_sync_server_new (const gchar *control_addr
,gint control_port
);
Creates a new GstSyncServer object that will listen on the given network address/port pair once started.
gboolean gst_sync_server_start (GstSyncServer *server
,GError **error
);
Starts the GstSyncServer so that clients can connect and start synchronised playback.
server |
The GstSyncServer object |
|
error |
If non-NULL, will be set to the appropriate GError if starting the server fails. |
void
gst_sync_server_stop (GstSyncServer *server
);
Disconnects all existing clients and stops listening for new clients.
void gst_sync_server_set_stopped (GstSyncServer *server
,gboolean stopped
);
Stops or restarts playback of the current stream on all connected clients.
server |
The GstSyncServer object |
|
stopped |
Whether the stream should be stopped (or restarted) |
void gst_sync_server_set_paused (GstSyncServer *server
,gboolean paused
);
Pauses or unpauses playback of the current stream on all connected clients.
GVariant * gst_sync_server_playlist_new (gchar **uris
,guint64 *durations
,guint64 n_tracks
,guint64 current_track
);
Creates a playlist object from the given uris, durations and current track.
uris |
A list of string URIs representing the playlist. |
[array length=n_tracks] |
durations |
A list of durations corresponding to each URI (set to GST_CLOCK_TIME_NONE if unknown). |
[array length=n_tracks] |
n_tracks |
The number of tracks in |
|
current_track |
The current track to play |
GVariant * gst_sync_server_playlist_set_tracks (GVariant *playlist
,gchar **uris
,guint64 *durations
,guint64 n_tracks
);
Changes the track list in the given playlist and returns a new playlist.
playlist |
The playlist. |
[transfer full] |
uris |
A list of string URIs representing the playlist. |
[array length=n_tracks] |
durations |
A list of durations corresponding to each URI (set to GST_CLOCK_TIME_NONE if unknown). |
[array length=n_tracks] |
n_tracks |
The number of tracks in |
GVariant * gst_sync_server_playlist_set_current_track (GVariant *playlist
,guint64 current_track
);
Changes the currently playing track in the given playlist and returns a new playlist.
void gst_sync_server_playlist_get_tracks (GVariant *playlist
,gchar ***uris
,guint64 **durations
,guint64 *n_tracks
);
Returns the set of tracks and their corresponding durations, if available.
Use gst_sync_server_playlist_free_tracks()
to free uris
and durations
.
playlist |
The playlist |
|
uris |
A list of string URIs representing the playlist. |
[out callee-allocates][array length=n_tracks] |
durations |
A list of
durations corresponding to each URI in |
[out callee-allocates][array length=n_tracks] |
n_tracks |
The number of tracks returned in |
[out caller-allocates] |
void gst_sync_server_playlist_free_tracks (gchar **uris
,guint64 *durations
,guint64 n_tracks
);
Frees the URIs and durations (allocated by
gst_sync_server_playlist_get_tracks()
.
“control-address”
property“control-address” gchar *
The network address for the control server to listen on.
Flags: Read / Write
Default value: NULL
“control-port”
property“control-port” gint
The network port for the control server to listen on.
Flags: Read / Write
Allowed values: [0,65535]
Default value: 0
“control-server”
property“control-server” GObject *
The implementation of the control protocol that should be used to communicate with clients. This object must implement the GstSyncControlServer interface. If set to NULL, a built-in TCP implementation is used.
Flags: Read / Write
“latency”
property“latency” guint64
The pipeline latency that clients should use. This should be large enough to account for any buffering that is expected (network related for HTTP/RTP/... streams, and worst-case audio device latency).
Flags: Read / Write
Default value: 300000000
“playlist”
property“playlist” GVariant *
A GVariant tuple of the current track index and an array of playlist entries. Each playlist entry, in turn, is a tuple of a URI and its duration. Unknown durations can be set to 0, which might cause a small (network-dependent) delay in swiching tracks.
See gst_sync_server_playlist_new()
and related functions for easy
manipulation of these playlists.
Flags: Read / Write
Allowed values: GVariant<(ta(st))>
Default value: NULL
“stream-start-delay”
property“stream-start-delay” guint64
The amount of time to wait between streams before starting. This allows for devices which take different amounts of time to load the data (either due to network delays or differing storage speeds) to start smoothly at the same time when switching streams.
Flags: Read / Write
Default value: 500000000
“end-of-playlist”
signalvoid user_function (GstSyncServer *arg0, gpointer user_data)
Emitted when the currently all the songs in the playlist have finished playing.
Flags: Run First
“end-of-stream”
signalvoid user_function (GstSyncServer *arg0, gpointer user_data)
Emitted when the currently playing URI reaches the end of the stream. This is called for each stream in the current playlist.
Flags: Run First