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 | |
| 18 | struct osmo_rtp_socket { |
| 19 | /*! \biref list header for global list of sockets */ |
| 20 | struct llist_head list; |
| 21 | |
| 22 | /*! \brief libortp RTP session pointer */ |
| 23 | struct _RtpSession *sess; |
| 24 | /*! \brief Osmo file descriptor for RTP socket FD */ |
| 25 | struct osmo_fd rtp_bfd; |
| 26 | /*! \brief Osmo file descriptor for RTCP socket FD */ |
| 27 | struct osmo_fd rtcp_bfd; |
| 28 | |
| 29 | /*! \brief callback for incoming data */ |
| 30 | void (*rx_cb)(struct osmo_rtp_socket *rs, const uint8_t *payload, |
| 31 | unsigned int payload_len); |
| 32 | |
| 33 | /* Rx related */ |
| 34 | uint32_t rx_user_ts; |
| 35 | |
| 36 | /* Tx related */ |
| 37 | uint32_t tx_timestamp; |
| 38 | |
| 39 | void *priv; |
| 40 | }; |
| 41 | |
| 42 | void osmo_rtp_init(void *ctx); |
| 43 | struct osmo_rtp_socket *osmo_rtp_socket_create(void *talloc_ctx); |
| 44 | int osmo_rtp_socket_bind(struct osmo_rtp_socket *rs, const char *ip, int port); |
| 45 | int osmo_rtp_socket_connect(struct osmo_rtp_socket *rs, const char *ip, uint16_t port); |
| 46 | int osmo_rtp_socket_set_pt(struct osmo_rtp_socket *rs, int payload_type); |
| 47 | int osmo_rtp_socket_free(struct osmo_rtp_socket *rs); |
| 48 | int osmo_rtp_send_frame(struct osmo_rtp_socket *rs, const uint8_t *payload, |
| 49 | unsigned int payload_len, unsigned int duration); |
| 50 | |
| 51 | int osmo_rtp_get_bound_ip_port(struct osmo_rtp_socket *rs, |
| 52 | uint32_t *ip, int *port); |
| 53 | int osmo_rtp_get_bound_addr(struct osmo_rtp_socket *rs, |
| 54 | const char **addr, int *port); |
| 55 | |
| 56 | #endif /* _OSMO_ORTP_H */ |