libguac  0.9.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
audio.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Glyptodon LLC
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  * THE SOFTWARE.
21  */
22 
23 
24 #ifndef __GUAC_AUDIO_H
25 #define __GUAC_AUDIO_H
26 
33 #include "audio-fntypes.h"
34 #include "audio-types.h"
35 #include "client-types.h"
36 #include "stream-types.h"
37 
39 
44  const char* mimetype;
45 
50 
55 
60 
61 };
62 
64 
68  unsigned char* pcm_data;
69 
73  int used;
74 
78  int length;
79 
83  unsigned char* encoded_data;
84 
89 
94 
100 
105 
110 
114  int rate;
115 
120  int channels;
121 
126  int bps;
127 
132 
136  void* data;
137 
138 };
139 
155  guac_audio_encoder* encoder);
156 
163 
174 void guac_audio_stream_begin(guac_audio_stream* stream, int rate, int channels, int bps);
175 
184 
196  const unsigned char* data, int length);
197 
204 
216  const unsigned char* data, int length);
217 
218 #endif
219 
void guac_audio_stream_write_encoded(guac_audio_stream *audio, const unsigned char *data, int length)
Appends arbitrarily-encoded data to the encoded_data buffer within the given audio stream...
void guac_audio_encoder_end_handler(guac_audio_stream *audio)
Handler which is called when the audio stream is closed.
Definition: audio-fntypes.h:42
int bps
The number of bits per sample per channel for PCM data.
Definition: audio.h:126
int encoded_data_used
Number of bytes in the encoded data buffer.
Definition: audio.h:88
guac_audio_encoder * encoder
Arbitrary codec encoder.
Definition: audio.h:99
guac_audio_encoder_begin_handler * begin_handler
Handler which will be called when the audio stream is opened.
Definition: audio.h:49
Type definitions related to Guacamole protocol streams.
void guac_audio_stream_write_pcm(guac_audio_stream *stream, const unsigned char *data, int length)
Writes PCM data to the given audio stream.
int used
Number of bytes in buffer.
Definition: audio.h:73
Type definitions related to the Guacamole client structure, guac_client.
Function type definitions related to simple streaming audio.
guac_client * client
The client associated with this audio stream.
Definition: audio.h:104
void guac_audio_encoder_write_handler(guac_audio_stream *audio, const unsigned char *pcm_data, int length)
Handler which is called when the audio stream is flushed.
Definition: audio-fntypes.h:47
guac_audio_encoder_write_handler * write_handler
Handler which will be called when the audio stream is flushed.
Definition: audio.h:54
void guac_audio_stream_flush(guac_audio_stream *stream)
Flushes the given audio stream.
guac_stream * stream
The actual stream associated with this audio stream.
Definition: audio.h:109
void guac_audio_stream_end(guac_audio_stream *stream)
Ends the current audio packet, writing the finished packet as an audio instruction.
void guac_audio_stream_free(guac_audio_stream *stream)
Frees the given audio stream.
void * data
Encoder-specific state data.
Definition: audio.h:136
Guacamole proxy client.
Definition: client.h:85
Type definitions related to simple streaming audio.
const char * mimetype
The mimetype of the audio data encoded by this audio encoder.
Definition: audio.h:44
Basic audio stream.
Definition: audio.h:63
unsigned char * encoded_data
Encoded audio data buffer, as written by the encoder.
Definition: audio.h:83
int rate
The number of samples per second of PCM data sent to this stream.
Definition: audio.h:114
int encoded_data_length
Maximum number of bytes in the encoded data buffer.
Definition: audio.h:93
Arbitrary audio codec encoder.
Definition: audio.h:38
guac_audio_encoder_end_handler * end_handler
Handler which will be called when the audio stream is closed.
Definition: audio.h:59
Represents a single stream within the Guacamole protocol.
Definition: stream.h:35
int length
Maximum number of bytes in buffer.
Definition: audio.h:78
void guac_audio_stream_begin(guac_audio_stream *stream, int rate, int channels, int bps)
Begins a new audio packet within the given audio stream.
unsigned char * pcm_data
PCM data buffer, 16-bit samples, 2-channel, 44100 Hz.
Definition: audio.h:68
guac_audio_stream * guac_audio_stream_alloc(guac_client *client, guac_audio_encoder *encoder)
Allocates a new audio stream which encodes audio data using the given encoder.
int channels
The number of audio channels per sample of PCM data.
Definition: audio.h:120
void guac_audio_encoder_begin_handler(guac_audio_stream *audio)
Handler which is called when the audio stream is opened.
Definition: audio-fntypes.h:37
int pcm_bytes_written
The number of PCM bytes written since the audio chunk began.
Definition: audio.h:131