speex_jitter.h

Go to the documentation of this file.
00001 /* Copyright (C) 2002 Jean-Marc Valin */
00006 /*
00007    Redistribution and use in source and binary forms, with or without
00008    modification, are permitted provided that the following conditions
00009    are met:
00010    
00011    - Redistributions of source code must retain the above copyright
00012    notice, this list of conditions and the following disclaimer.
00013    
00014    - Redistributions in binary form must reproduce the above copyright
00015    notice, this list of conditions and the following disclaimer in the
00016    documentation and/or other materials provided with the distribution.
00017    
00018    - Neither the name of the Xiph.org Foundation nor the names of its
00019    contributors may be used to endorse or promote products derived from
00020    this software without specific prior written permission.
00021    
00022    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023    ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00025    A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
00026    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00027    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00028    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00029    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00030    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00031    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00032    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033 
00034 */
00035 
00036 #ifndef SPEEX_JITTER_H
00037 #define SPEEX_JITTER_H
00038 
00044 #include "speex/speex_types.h"
00045 
00046 #ifdef __cplusplus
00047 extern "C" {
00048 #endif
00049 
00051 struct JitterBuffer_;
00052 
00054 typedef struct JitterBuffer_ JitterBuffer;
00055 
00057 typedef struct _JitterBufferPacket JitterBufferPacket;
00058 
00060 struct _JitterBufferPacket {
00061    char        *data;       
00062    spx_uint32_t len;        
00063    spx_uint32_t timestamp;  
00064    spx_uint32_t span;       
00065    spx_uint16_t sequence;   
00066    spx_uint32_t user_data;  
00067 };
00068 
00070 #define JITTER_BUFFER_OK 0
00071 
00072 #define JITTER_BUFFER_MISSING 1
00073 
00074 #define JITTER_BUFFER_INSERTION 2
00075 
00076 #define JITTER_BUFFER_INTERNAL_ERROR -1
00077 
00078 #define JITTER_BUFFER_BAD_ARGUMENT -2
00079 
00080 
00082 #define JITTER_BUFFER_SET_MARGIN 0
00083 
00084 #define JITTER_BUFFER_GET_MARGIN 1
00085 /* JITTER_BUFFER_SET_AVAILABLE_COUNT wouldn't make sense */
00086 
00088 #define JITTER_BUFFER_GET_AVAILABLE_COUNT 3
00089 
00090 #define JITTER_BUFFER_GET_AVALIABLE_COUNT 3
00091 
00094 #define JITTER_BUFFER_SET_DESTROY_CALLBACK 4
00095 
00096 #define JITTER_BUFFER_GET_DESTROY_CALLBACK 5
00097 
00099 #define JITTER_BUFFER_SET_DELAY_STEP 6
00100 
00101 #define JITTER_BUFFER_GET_DELAY_STEP 7
00102 
00104 #define JITTER_BUFFER_SET_CONCEALMENT_SIZE 8
00105 #define JITTER_BUFFER_GET_CONCEALMENT_SIZE 9
00106 
00109 #define JITTER_BUFFER_SET_MAX_LATE_RATE 10
00110 #define JITTER_BUFFER_GET_MAX_LATE_RATE 11
00111 
00113 #define JITTER_BUFFER_SET_LATE_COST 12
00114 #define JITTER_BUFFER_GET_LATE_COST 13
00115 
00116 
00124 JitterBuffer *jitter_buffer_init(int step_size);
00125 
00130 void jitter_buffer_reset(JitterBuffer *jitter);
00131 
00136 void jitter_buffer_destroy(JitterBuffer *jitter);
00137 
00143 void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet);
00144 
00152 int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t desired_span, spx_int32_t *start_offset);
00153 
00160 int jitter_buffer_get_another(JitterBuffer *jitter, JitterBufferPacket *packet);
00161 
00166 int jitter_buffer_get_pointer_timestamp(JitterBuffer *jitter);
00167 
00172 void jitter_buffer_tick(JitterBuffer *jitter);
00173 
00178 void jitter_buffer_remaining_span(JitterBuffer *jitter, spx_uint32_t rem);
00179 
00187 int jitter_buffer_ctl(JitterBuffer *jitter, int request, void *ptr);
00188 
00189 int jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset);
00190 
00191 /* @} */
00192 
00193 #ifdef __cplusplus
00194 }
00195 #endif
00196 
00197 #endif

Generated on Sat Dec 6 22:03:22 2008 for Speex by  doxygen 1.5.1