Playback Channel

Playback Channel — audio stream for playback

Stability Level

Stable, unless otherwise indicated

Functions

Properties

guint min-latency Read / Write
gboolean mute Read / Write
guint nchannels Read / Write
gpointer volume Read / Write

Signals

Types and Values

Object Hierarchy

    GObject
    ╰── SpiceChannel
        ╰── SpicePlaybackChannel

Includes

#include <spice-client.h>

Description

SpicePlaybackChannel class handles an audio playback stream. The audio data is received via “playback-data” signal, and is controlled by the guest with “playback-stop” and “playback-start” signal events.

Note: You may be interested to let the SpiceAudio class play and record audio channels for your application.

Functions

spice_playback_channel_set_delay ()

void
spice_playback_channel_set_delay (SpicePlaybackChannel *channel,
                                  guint32 delay_ms);

Adjust the multimedia time according to the delay.

Parameters

channel

a SpicePlaybackChannel

 

delay_ms

the delay in ms

 

Types and Values

struct SpicePlaybackChannel

struct SpicePlaybackChannel;

The SpicePlaybackChannel struct is opaque and should not be accessed directly.


struct SpicePlaybackChannelClass

struct SpicePlaybackChannelClass {
    SpiceChannelClass parent_class;

    /* signals */
    void (*playback_start)(SpicePlaybackChannel *channel,
                           gint format, gint channels, gint freq);
    void (*playback_data)(SpicePlaybackChannel *channel, gpointer *data, gint size);
    void (*playback_stop)(SpicePlaybackChannel *channel);
};

Class structure for SpicePlaybackChannel.

Members

playback_start ()

Signal class handler for the “playback-start” signal.

 

playback_data ()

Signal class handler for the “playback-data” signal.

 

playback_stop ()

Signal class handler for the “playback-stop” signal.

 

Property Details

The “min-latency” property

  “min-latency”              guint

Playback min buffer size (ms).

Flags: Read / Write

Default value: 200


The “mute” property

  “mute”                     gboolean

Mute.

Flags: Read / Write

Default value: FALSE


The “nchannels” property

  “nchannels”                guint

Number of Channels.

Flags: Read / Write

Allowed values: <= 255

Default value: 2


The “volume” property

  “volume”                   gpointer

Playback volume.

Flags: Read / Write

Signal Details

The “playback-data” signal

void
user_function (SpicePlaybackChannel *channel,
               gpointer              data,
               gint                  data_size,
               gpointer              user_data)

Provide audio data to be played.

Parameters

channel

the SpicePlaybackChannel that emitted the signal

 

data

pointer to audio data

 

data_size

size in byte of data

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First


The “playback-get-delay” signal

void
user_function (SpicePlaybackChannel *channel,
               gpointer              user_data)

Notify when the current playback delay is requested

Parameters

channel

the SpicePlaybackChannel that emitted the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First


The “playback-start” signal

void
user_function (SpicePlaybackChannel *channel,
               gint                  format,
               gint                  channels,
               gint                  rate,
               gpointer              user_data)

Notify when the playback should start, and provide audio format characteristics.

Parameters

channel

the SpicePlaybackChannel that emitted the signal

 

format

a SPICE_AUDIO_FMT

 

channels

number of channels

 

rate

audio rate

 

latency

minimum playback latency in ms

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First


The “playback-stop” signal

void
user_function (SpicePlaybackChannel *channel,
               gpointer              user_data)

Notify when the playback should stop.

Parameters

channel

the SpicePlaybackChannel that emitted the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First

See Also

SpiceChannel, and SpiceAudio