2013-12-29 04:53:12 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 Glyptodon LLC
|
2012-11-02 10:14:25 +00:00
|
|
|
*
|
2013-12-29 04:53:12 +00:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
2012-11-02 10:14:25 +00:00
|
|
|
*
|
2013-12-29 04:53:12 +00:00
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
2012-11-02 10:14:25 +00:00
|
|
|
*
|
2013-12-29 04:53:12 +00:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2012-10-28 01:36:21 +00:00
|
|
|
|
2012-10-28 03:03:18 +00:00
|
|
|
#ifndef __GUAC_RDPSND_MESSAGES_H
|
|
|
|
#define __GUAC_RDPSND_MESSAGES_H
|
2012-10-28 01:36:21 +00:00
|
|
|
|
2014-01-01 22:44:28 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "rdpsnd_service.h"
|
|
|
|
|
2013-09-24 19:01:02 +00:00
|
|
|
#include <guacamole/audio.h>
|
|
|
|
|
2014-06-11 01:45:14 +00:00
|
|
|
#ifdef ENABLE_WINPR
|
|
|
|
#include <winpr/stream.h>
|
|
|
|
#else
|
|
|
|
#include "compat/winpr-stream.h"
|
|
|
|
#endif
|
|
|
|
|
2012-11-02 10:14:25 +00:00
|
|
|
/*
|
|
|
|
* PDU Message Types
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Close PDU
|
|
|
|
*/
|
2012-10-28 01:36:21 +00:00
|
|
|
#define SNDC_CLOSE 1
|
2012-11-02 10:14:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* WaveInfo PDU. This PDU is sent just before wave data is sent.
|
|
|
|
*/
|
2012-10-28 01:36:21 +00:00
|
|
|
#define SNDC_WAVE 2
|
2012-11-02 10:14:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Wave Confirm PDU. This PDU is sent in response to the WaveInfo PDU,
|
|
|
|
* confirming it has been received and played.
|
|
|
|
*/
|
2012-10-28 01:36:21 +00:00
|
|
|
#define SNDC_WAVECONFIRM 5
|
2012-11-02 10:14:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Training PDU. This PDU is sent by the server occasionally and must be
|
|
|
|
* responded to with another training PDU, similar to Guac's sync message.
|
|
|
|
*/
|
2012-10-28 01:36:21 +00:00
|
|
|
#define SNDC_TRAINING 6
|
2012-11-02 10:14:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Server Audio Formats and Version PDU. This PDU is sent by the server to
|
|
|
|
* advertise to the client which audio formats are supported.
|
|
|
|
*/
|
2012-10-28 01:36:21 +00:00
|
|
|
#define SNDC_FORMATS 7
|
2012-11-02 10:14:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Quality Mode PDU. This PDU must be sent by the client to select an audio
|
|
|
|
* quality mode if the server is at least version 6.
|
|
|
|
*/
|
2012-10-28 01:36:21 +00:00
|
|
|
#define SNDC_QUALITYMODE 12
|
|
|
|
|
2012-11-02 10:14:25 +00:00
|
|
|
/*
|
|
|
|
* Quality Modes
|
|
|
|
*/
|
2012-10-28 01:36:21 +00:00
|
|
|
|
2012-11-02 10:14:25 +00:00
|
|
|
/**
|
|
|
|
* Dynamic Quality. The server will choose the audio quality based on its
|
|
|
|
* perception of latency.
|
|
|
|
*/
|
|
|
|
#define DYNAMIC_QUALITY 0x0000
|
2012-10-28 01:36:21 +00:00
|
|
|
|
2012-11-02 10:14:25 +00:00
|
|
|
/**
|
|
|
|
* Medium Quality. The server prioritizes bandwidth over quality.
|
|
|
|
*/
|
|
|
|
#define MEDIUM_QUALITY 0x0001
|
|
|
|
|
|
|
|
/**
|
|
|
|
* High Quality. The server prioritizes quality over bandwidth.
|
|
|
|
*/
|
|
|
|
#define HIGH_QUALITY 0x0002
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Capabilities
|
|
|
|
*/
|
|
|
|
#define TSSNDCAPS_ALIVE 1
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Sound Formats
|
|
|
|
*/
|
2012-10-28 01:36:21 +00:00
|
|
|
#define WAVE_FORMAT_PCM 1
|
|
|
|
|
2012-11-02 10:14:25 +00:00
|
|
|
/**
|
|
|
|
* The header common to all RDPSND PDUs.
|
|
|
|
*/
|
|
|
|
typedef struct guac_rdpsnd_pdu_header {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of message represented by this PDU (SNDC_WAVE, etc.)
|
|
|
|
*/
|
|
|
|
int message_type;
|
2012-10-28 01:36:21 +00:00
|
|
|
|
2012-11-02 10:14:25 +00:00
|
|
|
/**
|
|
|
|
* The size of the remainder of the message.
|
|
|
|
*/
|
|
|
|
int body_size;
|
2012-10-28 01:36:21 +00:00
|
|
|
|
2012-11-02 10:14:25 +00:00
|
|
|
} guac_rdpsnd_pdu_header;
|
2012-10-28 01:36:21 +00:00
|
|
|
|
2012-11-02 10:14:25 +00:00
|
|
|
/**
|
|
|
|
* Handler for the SNDC_FORMATS (Server Audio Formats and Version) PDU.
|
|
|
|
*/
|
|
|
|
void guac_rdpsnd_formats_handler(guac_rdpsndPlugin* rdpsnd,
|
2013-09-24 19:01:02 +00:00
|
|
|
guac_audio_stream* audio, wStream* input_stream,
|
2012-11-02 10:14:25 +00:00
|
|
|
guac_rdpsnd_pdu_header* header);
|
2012-10-28 01:36:21 +00:00
|
|
|
|
2012-11-02 10:14:25 +00:00
|
|
|
/**
|
|
|
|
* Handler for the SNDC_TRAINING (Training) PDU.
|
|
|
|
*/
|
|
|
|
void guac_rdpsnd_training_handler(guac_rdpsndPlugin* rdpsnd,
|
2013-09-24 19:01:02 +00:00
|
|
|
guac_audio_stream* audio, wStream* input_stream,
|
2012-11-02 10:14:25 +00:00
|
|
|
guac_rdpsnd_pdu_header* header);
|
2012-10-28 01:36:21 +00:00
|
|
|
|
2012-11-02 10:14:25 +00:00
|
|
|
/**
|
|
|
|
* Handler for the SNDC_WAVE (WaveInfo) PDU.
|
|
|
|
*/
|
|
|
|
void guac_rdpsnd_wave_info_handler(guac_rdpsndPlugin* rdpsnd,
|
2013-09-24 19:01:02 +00:00
|
|
|
guac_audio_stream* audio, wStream* input_stream,
|
2012-11-02 10:14:25 +00:00
|
|
|
guac_rdpsnd_pdu_header* header);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handler for the SNDWAV (Wave) PDU which follows any WaveInfo PDU.
|
|
|
|
*/
|
|
|
|
void guac_rdpsnd_wave_handler(guac_rdpsndPlugin* rdpsnd,
|
2013-09-24 19:01:02 +00:00
|
|
|
guac_audio_stream* audio, wStream* input_stream,
|
2012-11-02 10:14:25 +00:00
|
|
|
guac_rdpsnd_pdu_header* header);
|
2012-10-28 01:36:21 +00:00
|
|
|
|
2012-11-02 10:14:25 +00:00
|
|
|
/**
|
|
|
|
* Handler for the SNDC_CLOSE (Close) PDU.
|
|
|
|
*/
|
|
|
|
void guac_rdpsnd_close_handler(guac_rdpsndPlugin* rdpsnd,
|
2013-09-24 19:01:02 +00:00
|
|
|
guac_audio_stream* audio, wStream* input_stream,
|
2012-11-02 10:14:25 +00:00
|
|
|
guac_rdpsnd_pdu_header* header);
|
2012-10-28 01:36:21 +00:00
|
|
|
|
2012-10-28 03:03:18 +00:00
|
|
|
#endif
|
2012-10-28 01:36:21 +00:00
|
|
|
|