VZTECH / Mbed 2 deprecated header_main

Dependencies:   EthernetInterface NTPClient mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers rtpbuf.h Source File

rtpbuf.h

00001 #ifndef _RTPBUF_H
00002 #define _RTPBUF_H
00003 
00004 #include <stdint.h>
00005 
00006 /* IMPORTANT: sizes must be multiple of 4 */
00007 #define RTPBUF_PKGSIZE 240 /* 30ms @ 8Ksamples/sec */
00008 #define RTPBUF_BUFSIZE 320 /* 40ms @ 8Ksamples/sec */
00009 
00010 #if (RTPBUF_PKGSIZE & 0x03)
00011 # error OPS... value forbidden
00012 #endif
00013 #if (RTPBUF_BUFSIZE & 0x03)
00014 # error OPS... value forbidden
00015 #endif
00016 
00017 struct rtpbuf {
00018   uint32_t b[ RTPBUF_BUFSIZE>>2 ];
00019   int size;
00020 };
00021 typedef struct rtpbuf rtpbuf_t;
00022 
00023 /* clear the buffer, useful at the start of a new phone call */
00024 void rtpbuf_clear (rtpbuf_t * self);
00025 
00026 /* use this function to put audio into the fifo */
00027 void rtpbuf_put (rtpbuf_t * self, int size, uint8_t * data);
00028 
00029 /* use this function to check if there is audio available
00030  * returns NULL if there is no audio available
00031  * or returns a pointer to the audio package */
00032 uint8_t * rtpbuf_get (rtpbuf_t * self);
00033 
00034 /* use this function to tell rtpbuf that you already consumed
00035  * the data supplied by rtpbuf_get() */
00036 void rtpbuf_next (rtpbuf_t * self);
00037 
00038 #endif