Versao com problema no socket rx
Dependencies: EthernetInterface NTPClient mbed-rtos mbed
rtpbuf.h@0:4d17cd9c8f9d, 2014-09-09 (annotated)
- Committer:
- klauss
- Date:
- Tue Sep 09 20:01:24 2014 +0000
- Revision:
- 0:4d17cd9c8f9d
20140726 copy
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
klauss | 0:4d17cd9c8f9d | 1 | #ifndef _RTPBUF_H |
klauss | 0:4d17cd9c8f9d | 2 | #define _RTPBUF_H |
klauss | 0:4d17cd9c8f9d | 3 | |
klauss | 0:4d17cd9c8f9d | 4 | #include <stdint.h> |
klauss | 0:4d17cd9c8f9d | 5 | |
klauss | 0:4d17cd9c8f9d | 6 | /* IMPORTANT: sizes must be multiple of 4 */ |
klauss | 0:4d17cd9c8f9d | 7 | #define RTPBUF_PKGSIZE 240 /* 30ms @ 8Ksamples/sec */ |
klauss | 0:4d17cd9c8f9d | 8 | #define RTPBUF_BUFSIZE 320 /* 40ms @ 8Ksamples/sec */ |
klauss | 0:4d17cd9c8f9d | 9 | |
klauss | 0:4d17cd9c8f9d | 10 | #if (RTPBUF_PKGSIZE & 0x03) |
klauss | 0:4d17cd9c8f9d | 11 | # error OPS... value forbidden |
klauss | 0:4d17cd9c8f9d | 12 | #endif |
klauss | 0:4d17cd9c8f9d | 13 | #if (RTPBUF_BUFSIZE & 0x03) |
klauss | 0:4d17cd9c8f9d | 14 | # error OPS... value forbidden |
klauss | 0:4d17cd9c8f9d | 15 | #endif |
klauss | 0:4d17cd9c8f9d | 16 | |
klauss | 0:4d17cd9c8f9d | 17 | struct rtpbuf { |
klauss | 0:4d17cd9c8f9d | 18 | uint32_t b[ RTPBUF_BUFSIZE>>2 ]; |
klauss | 0:4d17cd9c8f9d | 19 | int size; |
klauss | 0:4d17cd9c8f9d | 20 | }; |
klauss | 0:4d17cd9c8f9d | 21 | typedef struct rtpbuf rtpbuf_t; |
klauss | 0:4d17cd9c8f9d | 22 | |
klauss | 0:4d17cd9c8f9d | 23 | /* clear the buffer, useful at the start of a new phone call */ |
klauss | 0:4d17cd9c8f9d | 24 | void rtpbuf_clear (rtpbuf_t * self); |
klauss | 0:4d17cd9c8f9d | 25 | |
klauss | 0:4d17cd9c8f9d | 26 | /* use this function to put audio into the fifo */ |
klauss | 0:4d17cd9c8f9d | 27 | void rtpbuf_put (rtpbuf_t * self, int size, uint8_t * data); |
klauss | 0:4d17cd9c8f9d | 28 | |
klauss | 0:4d17cd9c8f9d | 29 | /* use this function to check if there is audio available |
klauss | 0:4d17cd9c8f9d | 30 | * returns NULL if there is no audio available |
klauss | 0:4d17cd9c8f9d | 31 | * or returns a pointer to the audio package */ |
klauss | 0:4d17cd9c8f9d | 32 | uint8_t * rtpbuf_get (rtpbuf_t * self); |
klauss | 0:4d17cd9c8f9d | 33 | |
klauss | 0:4d17cd9c8f9d | 34 | /* use this function to tell rtpbuf that you already consumed |
klauss | 0:4d17cd9c8f9d | 35 | * the data supplied by rtpbuf_get() */ |
klauss | 0:4d17cd9c8f9d | 36 | void rtpbuf_next (rtpbuf_t * self); |
klauss | 0:4d17cd9c8f9d | 37 | |
klauss | 0:4d17cd9c8f9d | 38 | #endif |