VZTECH / Mbed 2 deprecated main_src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers rtpbuf.h Source File

rtpbuf.h

Go to the documentation of this file.
00001 /**
00002  * @file rtpbuf.h
00003  * @Synopsis Implementa funcionalidades de conversão entre u-law e a-law
00004  * @author Jhonatan Casale / PedroZN 
00005  * @version 1
00006  * @date 2014-11-05
00007  * \note IMPORTANT: sizes must be multiple of 4 
00008  */
00009 #ifndef __RTPBUF_H__
00010 #define __RTPBUF_H__
00011 
00012 #include <stdint.h>
00013 #include <stdlib.h>
00014 #include "utils.h"
00015 
00016 const uint16_t RTPBUF_PKGSIZE = 240;
00017 ///< 30ms @ 8Ksamples/sec
00018 const uint16_t RTPBUF_BUFSIZE = 320;
00019 ///< 40ms @ 8Ksamples/sec
00020 
00021 #if (RTPBUF_PKGSIZE & 0x03)
00022 # error OPS... value forbidden
00023 #endif
00024 #if (RTPBUF_BUFSIZE & 0x03)
00025 # error OPS... value forbidden
00026 #endif
00027 
00028 struct rtpbuf {
00029   uint32_t b[ RTPBUF_BUFSIZE>>2 ];
00030     ///< A fila de audio.
00031   int size; 
00032     ///< Representa o tamanho da fila.
00033 };
00034 typedef struct rtpbuf rtpbuf_t;
00035 
00036 /** clear the buffer, useful at the start of a new phone call 
00037  */
00038 void rtpbuf_clear (rtpbuf_t * self);
00039 
00040 /** use this function to put audio into the fifo
00041  */
00042 void rtpbuf_put (rtpbuf_t * self, int size, uint8_t * data);
00043 
00044 /** use this function to check if there is audio available
00045  * returns NULL if there is no audio available
00046  * or returns a pointer to the audio package 
00047  */
00048 uint8_t * rtpbuf_get (rtpbuf_t * self);
00049 
00050 /** 
00051  * use this function to tell rtpbuf that you already consumed
00052  * the data supplied by rtpbuf_get() 
00053  */
00054 void rtpbuf_next (rtpbuf_t * self);
00055 
00056 #endif