[3272] | 1 | //vio_rtp.h: |
---|
| 2 | |
---|
| 3 | /* |
---|
| 4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010 |
---|
| 5 | * |
---|
| 6 | * This file is part of libroar a part of RoarAudio, |
---|
| 7 | * a cross-platform sound system for both, home and professional use. |
---|
| 8 | * See README for details. |
---|
| 9 | * |
---|
| 10 | * This file is free software; you can redistribute it and/or modify |
---|
| 11 | * it under the terms of the GNU General Public License version 3 |
---|
| 12 | * as published by the Free Software Foundation. |
---|
| 13 | * |
---|
| 14 | * libroar is distributed in the hope that it will be useful, |
---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 17 | * GNU General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License |
---|
| 20 | * along with this software; see the file COPYING. If not, write to |
---|
[3517] | 21 | * the Free Software Foundation, 51 Franklin Street, Fifth Floor, |
---|
| 22 | * Boston, MA 02110-1301, USA. |
---|
[3272] | 23 | * |
---|
| 24 | * NOTE for everyone want's to change something and send patches: |
---|
| 25 | * read README and HACKING! There a addition information on |
---|
| 26 | * the license of this document you need to read before you send |
---|
| 27 | * any patches. |
---|
| 28 | * |
---|
| 29 | * NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc |
---|
| 30 | * or libpulse*: |
---|
| 31 | * The libs libroaresd, libroararts and libroarpulse link this lib |
---|
| 32 | * and are therefore GPL. Because of this it may be illigal to use |
---|
| 33 | * them with any software that uses libesd, libartsc or libpulse*. |
---|
| 34 | */ |
---|
| 35 | |
---|
| 36 | #ifndef _LIBROARVIO_RTP_H_ |
---|
| 37 | #define _LIBROARVIO_RTP_H_ |
---|
| 38 | |
---|
| 39 | #include "libroar.h" |
---|
| 40 | |
---|
| 41 | #define ROAR_RTP_FLAG_PADDING 0x02 |
---|
| 42 | #define ROAR_RTP_FLAG_EXTENSION 0x03 |
---|
| 43 | #define ROAR_RTP_FLAG_MARKER 0x08 |
---|
| 44 | |
---|
| 45 | /* |
---|
| 46 | RFC 3551 RTP A/V Profile July 2003 |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | PT encoding media type clock rate channels |
---|
| 50 | name (Hz) |
---|
| 51 | ___________________________________________________ |
---|
| 52 | 0 PCMU A 8,000 1 |
---|
| 53 | 1 reserved A |
---|
| 54 | 2 reserved A |
---|
| 55 | 3 GSM A 8,000 1 |
---|
| 56 | 4 G723 A 8,000 1 |
---|
| 57 | 5 DVI4 A 8,000 1 |
---|
| 58 | 6 DVI4 A 16,000 1 |
---|
| 59 | 7 LPC A 8,000 1 |
---|
| 60 | 8 PCMA A 8,000 1 |
---|
| 61 | 9 G722 A 8,000 1 |
---|
| 62 | 10 L16 A 44,100 2 |
---|
| 63 | 11 L16 A 44,100 1 |
---|
| 64 | 12 QCELP A 8,000 1 |
---|
| 65 | 13 CN A 8,000 1 |
---|
| 66 | 14 MPA A 90,000 (see text) |
---|
| 67 | 15 G728 A 8,000 1 |
---|
| 68 | 16 DVI4 A 11,025 1 |
---|
| 69 | 17 DVI4 A 22,050 1 |
---|
| 70 | 18 G729 A 8,000 1 |
---|
| 71 | 19 reserved A |
---|
| 72 | 20 unassigned A |
---|
| 73 | 21 unassigned A |
---|
| 74 | 22 unassigned A |
---|
| 75 | 23 unassigned A |
---|
| 76 | dyn G726-40 A 8,000 1 |
---|
| 77 | dyn G726-32 A 8,000 1 |
---|
| 78 | dyn G726-24 A 8,000 1 |
---|
| 79 | dyn G726-16 A 8,000 1 |
---|
| 80 | dyn G729D A 8,000 1 |
---|
| 81 | dyn G729E A 8,000 1 |
---|
| 82 | dyn GSM-EFR A 8,000 1 |
---|
| 83 | dyn L8 A var. var. |
---|
| 84 | dyn RED A (see text) |
---|
| 85 | dyn VDVI A var. 1 |
---|
| 86 | |
---|
| 87 | Table 4: Payload types (PT) for audio encodings |
---|
| 88 | */ |
---|
| 89 | |
---|
| 90 | #define ROAR_RTP_PT_A_PCMU 0 /* mu-Law */ |
---|
| 91 | #define ROAR_RTP_PT_A_PCMA 8 /* A-Law */ |
---|
| 92 | #define ROAR_RTP_PT_A_L16_441_2 10 |
---|
| 93 | #define ROAR_RTP_PT_A_L16_441_1 11 |
---|
| 94 | #define ROAR_RTP_PT_UNKNOWN 127 /* non standard asignment */ |
---|
| 95 | |
---|
| 96 | struct roar_rtp_header { |
---|
| 97 | int version; |
---|
| 98 | int flags; |
---|
| 99 | int csrc_count; |
---|
[3273] | 100 | int payload_type; |
---|
[3272] | 101 | uint16_t seq_num; |
---|
| 102 | uint32_t ts; |
---|
| 103 | uint32_t ssrc; |
---|
| 104 | uint32_t csrc[16]; |
---|
| 105 | }; |
---|
| 106 | |
---|
| 107 | struct roar_rtp_inst { |
---|
| 108 | struct roar_vio_calls * vio; |
---|
| 109 | struct roar_rtp_header header; |
---|
[3287] | 110 | struct roar_buffer * io; |
---|
[3285] | 111 | struct roar_audio_info info; |
---|
| 112 | size_t mtu; |
---|
| 113 | int bpf; // byte per frame |
---|
[3290] | 114 | |
---|
| 115 | // read speific things |
---|
| 116 | struct roar_buffer * rx_decoded; // buffer to hold allready decoded data |
---|
[3272] | 117 | }; |
---|
| 118 | |
---|
| 119 | int roar_vio_open_rtp (struct roar_vio_calls * calls, struct roar_vio_calls * dst, |
---|
| 120 | char * dstr, struct roar_vio_defaults * odef); |
---|
| 121 | |
---|
| 122 | ssize_t roar_vio_rtp_read (struct roar_vio_calls * vio, void *buf, size_t count); |
---|
| 123 | ssize_t roar_vio_rtp_write (struct roar_vio_calls * vio, void *buf, size_t count); |
---|
| 124 | off_t roar_vio_rtp_lseek (struct roar_vio_calls * vio, off_t offset, int whence); |
---|
| 125 | int roar_vio_rtp_nonblock(struct roar_vio_calls * vio, int state); |
---|
| 126 | int roar_vio_rtp_sync (struct roar_vio_calls * vio); |
---|
| 127 | int roar_vio_rtp_ctl (struct roar_vio_calls * vio, int cmd, void * data); |
---|
| 128 | int roar_vio_rtp_close (struct roar_vio_calls * vio); |
---|
| 129 | |
---|
| 130 | #endif |
---|
| 131 | |
---|
| 132 | //ll |
---|