![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
rtpbuf.h@69:65665afbad5d, 2014-11-12 (annotated)
- Committer:
- klauss
- Date:
- Wed Nov 12 13:25:54 2014 +0000
- Revision:
- 69:65665afbad5d
- Parent:
- 60:b4ec6beb3be3
- Child:
- 74:81c47fff88a5
versao em re-valida??o a priori, os dados de audio est?o se perdendo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
klauss | 69:65665afbad5d | 1 | /** |
klauss | 69:65665afbad5d | 2 | * @file rtpbuf.h |
klauss | 69:65665afbad5d | 3 | * @Synopsis Implementa funcionalidades de conversão entre u-law e a-law |
klauss | 69:65665afbad5d | 4 | * @author Jhonatan Casale / PedroZN |
klauss | 69:65665afbad5d | 5 | * @version 1 |
klauss | 69:65665afbad5d | 6 | * @date 2014-11-05 |
klauss | 69:65665afbad5d | 7 | * \note IMPORTANT: sizes must be multiple of 4 |
klauss | 69:65665afbad5d | 8 | */ |
klauss | 0:4d17cd9c8f9d | 9 | #ifndef _RTPBUF_H |
klauss | 0:4d17cd9c8f9d | 10 | #define _RTPBUF_H |
klauss | 0:4d17cd9c8f9d | 11 | |
klauss | 0:4d17cd9c8f9d | 12 | #include <stdint.h> |
klauss | 60:b4ec6beb3be3 | 13 | #include "debug.h" |
klauss | 0:4d17cd9c8f9d | 14 | |
klauss | 69:65665afbad5d | 15 | #define RTPBUF_PKGSIZE 240 |
klauss | 69:65665afbad5d | 16 | ///< 30ms @ 8Ksamples/sec |
klauss | 69:65665afbad5d | 17 | #define RTPBUF_BUFSIZE 320 |
klauss | 69:65665afbad5d | 18 | ///< 40ms @ 8Ksamples/sec |
klauss | 0:4d17cd9c8f9d | 19 | |
klauss | 0:4d17cd9c8f9d | 20 | #if (RTPBUF_PKGSIZE & 0x03) |
klauss | 0:4d17cd9c8f9d | 21 | # error OPS... value forbidden |
klauss | 0:4d17cd9c8f9d | 22 | #endif |
klauss | 0:4d17cd9c8f9d | 23 | #if (RTPBUF_BUFSIZE & 0x03) |
klauss | 0:4d17cd9c8f9d | 24 | # error OPS... value forbidden |
klauss | 0:4d17cd9c8f9d | 25 | #endif |
klauss | 0:4d17cd9c8f9d | 26 | |
klauss | 0:4d17cd9c8f9d | 27 | struct rtpbuf { |
klauss | 0:4d17cd9c8f9d | 28 | uint32_t b[ RTPBUF_BUFSIZE>>2 ]; |
klauss | 69:65665afbad5d | 29 | ///< A fila de audio. |
klauss | 69:65665afbad5d | 30 | int size; |
klauss | 69:65665afbad5d | 31 | ///< Representa o tamanho da fila. |
klauss | 0:4d17cd9c8f9d | 32 | }; |
klauss | 0:4d17cd9c8f9d | 33 | typedef struct rtpbuf rtpbuf_t; |
klauss | 0:4d17cd9c8f9d | 34 | |
klauss | 69:65665afbad5d | 35 | /** clear the buffer, useful at the start of a new phone call |
klauss | 69:65665afbad5d | 36 | */ |
klauss | 0:4d17cd9c8f9d | 37 | void rtpbuf_clear (rtpbuf_t * self); |
klauss | 0:4d17cd9c8f9d | 38 | |
klauss | 69:65665afbad5d | 39 | /** use this function to put audio into the fifo |
klauss | 69:65665afbad5d | 40 | */ |
klauss | 0:4d17cd9c8f9d | 41 | void rtpbuf_put (rtpbuf_t * self, int size, uint8_t * data); |
klauss | 0:4d17cd9c8f9d | 42 | |
klauss | 69:65665afbad5d | 43 | /** use this function to check if there is audio available |
klauss | 0:4d17cd9c8f9d | 44 | * returns NULL if there is no audio available |
klauss | 69:65665afbad5d | 45 | * or returns a pointer to the audio package |
klauss | 69:65665afbad5d | 46 | */ |
klauss | 0:4d17cd9c8f9d | 47 | uint8_t * rtpbuf_get (rtpbuf_t * self); |
klauss | 0:4d17cd9c8f9d | 48 | |
klauss | 69:65665afbad5d | 49 | /** |
klauss | 69:65665afbad5d | 50 | * use this function to tell rtpbuf that you already consumed |
klauss | 69:65665afbad5d | 51 | * the data supplied by rtpbuf_get() |
klauss | 69:65665afbad5d | 52 | */ |
klauss | 0:4d17cd9c8f9d | 53 | void rtpbuf_next (rtpbuf_t * self); |
klauss | 0:4d17cd9c8f9d | 54 | |
klauss | 0:4d17cd9c8f9d | 55 | #endif |