91 lines
3.1 KiB
C
91 lines
3.1 KiB
C
/*
|
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
* or more contributor license agreements. See the NOTICE file
|
|
* distributed with this work for additional information
|
|
* regarding copyright ownership. The ASF licenses this file
|
|
* to you under the Apache License, Version 2.0 (the
|
|
* "License"); you may not use this file except in compliance
|
|
* with the License. You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing,
|
|
* software distributed under the License is distributed on an
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
* KIND, either express or implied. See the License for the
|
|
* specific language governing permissions and limitations
|
|
* under the License.
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
#include "audio.h"
|
|
#include "spice.h"
|
|
|
|
#include <guacamole/audio.h>
|
|
#include <guacamole/client.h>
|
|
|
|
void guac_spice_client_audio_playback_data_handler(
|
|
SpicePlaybackChannel* channel, gpointer data, gint size,
|
|
guac_client* client) {
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
void guac_spice_client_audio_playback_delay_handler(
|
|
SpicePlaybackChannel* channel, guac_client* client) {
|
|
|
|
guac_client_log(client, GUAC_LOG_DEBUG, "Calling audio playback delay handler.");
|
|
|
|
}
|
|
|
|
void guac_spice_client_audio_playback_start_handler(
|
|
SpicePlaybackChannel* channel, gint format, gint channels, gint rate,
|
|
guac_client* client) {
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
void guac_spice_client_audio_playback_stop_handler(
|
|
SpicePlaybackChannel* channel, guac_client* client) {
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
void guac_spice_client_audio_record_start_handler(SpiceRecordChannel* channel,
|
|
gint format, gint channels, gint rate, guac_client* client) {
|
|
|
|
guac_client_log(client, GUAC_LOG_DEBUG, "Calling audio record start handler.");
|
|
|
|
}
|
|
|
|
void guac_spice_client_audio_record_stop_handler(SpiceRecordChannel* channel,
|
|
guac_client* client) {
|
|
|
|
guac_client_log(client, GUAC_LOG_DEBUG, "Calling audio record stop handler.");
|
|
|
|
} |