Speex  1.2~beta4
speex_jitter.h
Go to the documentation of this file.
1 /* Copyright (C) 2002 Jean-Marc Valin */
6 /*
7  Redistribution and use in source and binary forms, with or without
8  modification, are permitted provided that the following conditions
9  are met:
10 
11  - Redistributions of source code must retain the above copyright
12  notice, this list of conditions and the following disclaimer.
13 
14  - Redistributions in binary form must reproduce the above copyright
15  notice, this list of conditions and the following disclaimer in the
16  documentation and/or other materials provided with the distribution.
17 
18  - Neither the name of the Xiph.org Foundation nor the names of its
19  contributors may be used to endorse or promote products derived from
20  this software without specific prior written permission.
21 
22  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
26  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 
34 */
35 
36 #ifndef SPEEX_JITTER_H
37 #define SPEEX_JITTER_H
44 #include "speex/speex_types.h"
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
51 struct JitterBuffer_;
52 
54 typedef struct JitterBuffer_ JitterBuffer;
55 
58 
61  char *data;
62  spx_uint32_t len;
63  spx_uint32_t timestamp;
64  spx_uint32_t span;
65  spx_uint16_t sequence;
66  spx_uint32_t user_data;
67 };
68 
70 #define JITTER_BUFFER_OK 0
72 #define JITTER_BUFFER_MISSING 1
74 #define JITTER_BUFFER_INSERTION 2
76 #define JITTER_BUFFER_INTERNAL_ERROR -1
78 #define JITTER_BUFFER_BAD_ARGUMENT -2
79 
80 
82 #define JITTER_BUFFER_SET_MARGIN 0
84 #define JITTER_BUFFER_GET_MARGIN 1
85 /* JITTER_BUFFER_SET_AVAILABLE_COUNT wouldn't make sense */
86 
88 #define JITTER_BUFFER_GET_AVAILABLE_COUNT 3
90 #define JITTER_BUFFER_GET_AVALIABLE_COUNT 3
91 
94 #define JITTER_BUFFER_SET_DESTROY_CALLBACK 4
96 #define JITTER_BUFFER_GET_DESTROY_CALLBACK 5
97 
99 #define JITTER_BUFFER_SET_DELAY_STEP 6
101 #define JITTER_BUFFER_GET_DELAY_STEP 7
102 
104 #define JITTER_BUFFER_SET_CONCEALMENT_SIZE 8
105 #define JITTER_BUFFER_GET_CONCEALMENT_SIZE 9
106 
109 #define JITTER_BUFFER_SET_MAX_LATE_RATE 10
110 #define JITTER_BUFFER_GET_MAX_LATE_RATE 11
111 
113 #define JITTER_BUFFER_SET_LATE_COST 12
114 #define JITTER_BUFFER_GET_LATE_COST 13
115 
116 
125 
131 
137 
143 void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet);
144 
152 int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t desired_span, spx_int32_t *start_offset);
153 
161 
167 
173 
178 void jitter_buffer_remaining_span(JitterBuffer *jitter, spx_uint32_t rem);
179 
187 int jitter_buffer_ctl(JitterBuffer *jitter, int request, void *ptr);
188 
189 int jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset);
190 
191 /* @} */
192 
193 #ifdef __cplusplus
194 }
195 #endif
196 
197 #endif
spx_uint16_t sequence
Definition: speex_jitter.h:65
int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t desired_span, spx_int32_t *start_offset)
char * data
Definition: speex_jitter.h:61
void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet)
void jitter_buffer_reset(JitterBuffer *jitter)
void jitter_buffer_tick(JitterBuffer *jitter)
spx_uint32_t len
Definition: speex_jitter.h:62
JitterBuffer * jitter_buffer_init(int step_size)
int jitter_buffer_get_pointer_timestamp(JitterBuffer *jitter)
void jitter_buffer_destroy(JitterBuffer *jitter)
spx_uint32_t user_data
Definition: speex_jitter.h:66
spx_uint32_t span
Definition: speex_jitter.h:64
spx_uint32_t timestamp
Definition: speex_jitter.h:63
int jitter_buffer_ctl(JitterBuffer *jitter, int request, void *ptr)
int jitter_buffer_get_another(JitterBuffer *jitter, JitterBufferPacket *packet)
struct JitterBuffer_ JitterBuffer
Definition: speex_jitter.h:54
void jitter_buffer_remaining_span(JitterBuffer *jitter, spx_uint32_t rem)
Speex types.
Definition: speex_jitter.h:60