[WIP]: [SOUND] Implement sound playback.
This commit is contained in:
parent
36bb5a0dba
commit
6fbc713358
@ -20,7 +20,9 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
|
#include "spice.h"
|
||||||
|
|
||||||
|
#include <guacamole/audio.h>
|
||||||
#include <guacamole/client.h>
|
#include <guacamole/client.h>
|
||||||
|
|
||||||
void guac_spice_client_audio_playback_data_handler(
|
void guac_spice_client_audio_playback_data_handler(
|
||||||
@ -28,6 +30,9 @@ void guac_spice_client_audio_playback_data_handler(
|
|||||||
guac_client* client) {
|
guac_client* client) {
|
||||||
|
|
||||||
guac_client_log(client, GUAC_LOG_DEBUG, "Calling audio playback data handler.");
|
guac_client_log(client, GUAC_LOG_DEBUG, "Calling audio playback data handler.");
|
||||||
|
guac_spice_client* spice_client = (guac_spice_client*) client->data;
|
||||||
|
|
||||||
|
guac_audio_stream_write_pcm(spice_client->audio_playback, data, size);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,6 +48,20 @@ void guac_spice_client_audio_playback_start_handler(
|
|||||||
guac_client* client) {
|
guac_client* client) {
|
||||||
|
|
||||||
guac_client_log(client, GUAC_LOG_DEBUG, "Calling audio playback start handler.");
|
guac_client_log(client, GUAC_LOG_DEBUG, "Calling audio playback start handler.");
|
||||||
|
guac_client_log(client, GUAC_LOG_DEBUG, "Format: %d", format);
|
||||||
|
guac_client_log(client, GUAC_LOG_DEBUG, "Channels: %d", channels);
|
||||||
|
guac_client_log(client, GUAC_LOG_DEBUG, "Rate: %d", rate);
|
||||||
|
|
||||||
|
guac_spice_client* spice_client = (guac_spice_client*) client->data;
|
||||||
|
|
||||||
|
int bps = 16;
|
||||||
|
|
||||||
|
if (format != SPICE_AUDIO_FMT_S16) {
|
||||||
|
guac_client_log(client, GUAC_LOG_WARNING, "Unknown Spice audio format: %d", format);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
spice_client->audio_playback = guac_audio_stream_alloc(client, NULL, rate, channels, bps);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,6 +69,10 @@ void guac_spice_client_audio_playback_stop_handler(
|
|||||||
SpicePlaybackChannel* channel, guac_client* client) {
|
SpicePlaybackChannel* channel, guac_client* client) {
|
||||||
|
|
||||||
guac_client_log(client, GUAC_LOG_DEBUG, "Calling audio playback stop handler.");
|
guac_client_log(client, GUAC_LOG_DEBUG, "Calling audio playback stop handler.");
|
||||||
|
|
||||||
|
guac_spice_client* spice_client = (guac_spice_client*) client->data;
|
||||||
|
|
||||||
|
guac_audio_stream_free(spice_client->audio_playback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@
|
|||||||
* A signal sent when the server is notifying the client that audio playback
|
* A signal sent when the server is notifying the client that audio playback
|
||||||
* should begin, which also contains characteristics of that audio data.
|
* should begin, which also contains characteristics of that audio data.
|
||||||
*/
|
*/
|
||||||
#define SPICE_SIGNAL_PLAYBACK_START "plaback-start"
|
#define SPICE_SIGNAL_PLAYBACK_START "playback-start"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A signal sent when audio playback should cease.
|
* A signal sent when audio playback should cease.
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
|
#include <guacamole/audio.h>
|
||||||
#include <guacamole/client.h>
|
#include <guacamole/client.h>
|
||||||
#include <guacamole/layer.h>
|
#include <guacamole/layer.h>
|
||||||
#include <guacamole/recording.h>
|
#include <guacamole/recording.h>
|
||||||
@ -155,6 +156,11 @@ typedef struct guac_spice_client {
|
|||||||
*/
|
*/
|
||||||
pthread_mutex_t message_lock;
|
pthread_mutex_t message_lock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Audio output, if any.
|
||||||
|
*/
|
||||||
|
guac_audio_stream* audio_playback;
|
||||||
|
|
||||||
} guac_spice_client;
|
} guac_spice_client;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user