Harald Welte | 41d0d84 | 2011-09-03 15:33:24 +0200 | [diff] [blame] | 1 | #ifndef _OSMO_ORTP_H |
| 2 | #define _OSMO_ORTP_H |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | #include <osmocom/core/linuxlist.h> |
| 7 | #include <osmocom/core/select.h> |
| 8 | |
| 9 | //#include <ortp/ortp.h> |
| 10 | struct _RtpSession; |
| 11 | |
| 12 | |
| 13 | #define RTP_PT_GSM_FULL 3 |
| 14 | #define RTP_PT_GSM_HALF 96 |
| 15 | #define RTP_PT_GSM_EFR 97 |
| 16 | #define RTP_PT_AMR 98 |
| 17 | |
Harald Welte | 9b737df | 2011-09-07 00:59:11 +0200 | [diff] [blame^] | 18 | #define OSMO_RTP_F_POLL 0x0001 |
| 19 | |
Harald Welte | 41d0d84 | 2011-09-03 15:33:24 +0200 | [diff] [blame] | 20 | struct osmo_rtp_socket { |
| 21 | /*! \biref list header for global list of sockets */ |
| 22 | struct llist_head list; |
| 23 | |
| 24 | /*! \brief libortp RTP session pointer */ |
| 25 | struct _RtpSession *sess; |
| 26 | /*! \brief Osmo file descriptor for RTP socket FD */ |
| 27 | struct osmo_fd rtp_bfd; |
| 28 | /*! \brief Osmo file descriptor for RTCP socket FD */ |
| 29 | struct osmo_fd rtcp_bfd; |
| 30 | |
| 31 | /*! \brief callback for incoming data */ |
| 32 | void (*rx_cb)(struct osmo_rtp_socket *rs, const uint8_t *payload, |
| 33 | unsigned int payload_len); |
| 34 | |
| 35 | /* Rx related */ |
| 36 | uint32_t rx_user_ts; |
| 37 | |
| 38 | /* Tx related */ |
| 39 | uint32_t tx_timestamp; |
| 40 | |
Harald Welte | 9b737df | 2011-09-07 00:59:11 +0200 | [diff] [blame^] | 41 | unsigned int flags; |
| 42 | |
Harald Welte | 41d0d84 | 2011-09-03 15:33:24 +0200 | [diff] [blame] | 43 | void *priv; |
| 44 | }; |
| 45 | |
| 46 | void osmo_rtp_init(void *ctx); |
Harald Welte | 9b737df | 2011-09-07 00:59:11 +0200 | [diff] [blame^] | 47 | struct osmo_rtp_socket *osmo_rtp_socket_create(void *talloc_ctx, unsigned int flags); |
Harald Welte | 41d0d84 | 2011-09-03 15:33:24 +0200 | [diff] [blame] | 48 | int osmo_rtp_socket_bind(struct osmo_rtp_socket *rs, const char *ip, int port); |
| 49 | int osmo_rtp_socket_connect(struct osmo_rtp_socket *rs, const char *ip, uint16_t port); |
| 50 | int osmo_rtp_socket_set_pt(struct osmo_rtp_socket *rs, int payload_type); |
| 51 | int osmo_rtp_socket_free(struct osmo_rtp_socket *rs); |
| 52 | int osmo_rtp_send_frame(struct osmo_rtp_socket *rs, const uint8_t *payload, |
| 53 | unsigned int payload_len, unsigned int duration); |
Harald Welte | 9b737df | 2011-09-07 00:59:11 +0200 | [diff] [blame^] | 54 | int osmo_rtp_socket_poll(struct osmo_rtp_socket *rs); |
Harald Welte | 41d0d84 | 2011-09-03 15:33:24 +0200 | [diff] [blame] | 55 | |
| 56 | int osmo_rtp_get_bound_ip_port(struct osmo_rtp_socket *rs, |
| 57 | uint32_t *ip, int *port); |
| 58 | int osmo_rtp_get_bound_addr(struct osmo_rtp_socket *rs, |
| 59 | const char **addr, int *port); |
| 60 | |
| 61 | #endif /* _OSMO_ORTP_H */ |