voltando a versao de n aberturas e fechamentos de sockets data 19/09
Dependencies: EthernetInterface NTPClient mbed-rtos mbed EALib
Fork of header_main_publish by
Diff: rtpbuf.h
- Revision:
- 0:4d17cd9c8f9d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rtpbuf.h Tue Sep 09 20:01:24 2014 +0000 @@ -0,0 +1,38 @@ +#ifndef _RTPBUF_H +#define _RTPBUF_H + +#include <stdint.h> + +/* IMPORTANT: sizes must be multiple of 4 */ +#define RTPBUF_PKGSIZE 240 /* 30ms @ 8Ksamples/sec */ +#define RTPBUF_BUFSIZE 320 /* 40ms @ 8Ksamples/sec */ + +#if (RTPBUF_PKGSIZE & 0x03) +# error OPS... value forbidden +#endif +#if (RTPBUF_BUFSIZE & 0x03) +# error OPS... value forbidden +#endif + +struct rtpbuf { + uint32_t b[ RTPBUF_BUFSIZE>>2 ]; + int size; +}; +typedef struct rtpbuf rtpbuf_t; + +/* clear the buffer, useful at the start of a new phone call */ +void rtpbuf_clear (rtpbuf_t * self); + +/* use this function to put audio into the fifo */ +void rtpbuf_put (rtpbuf_t * self, int size, uint8_t * data); + +/* use this function to check if there is audio available + * returns NULL if there is no audio available + * or returns a pointer to the audio package */ +uint8_t * rtpbuf_get (rtpbuf_t * self); + +/* use this function to tell rtpbuf that you already consumed + * the data supplied by rtpbuf_get() */ +void rtpbuf_next (rtpbuf_t * self); + +#endif \ No newline at end of file