blob: adb389aa3c1d6289a5c1f77e584d608858b27e81 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
/*
* xine_input_vdr_net.h:
*
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
* $Id: xine_input_vdr_net.h,v 1.11 2009-03-24 19:35:22 phintuka Exp $
*
*/
#ifndef __XINE_INPUT_VDR_NET_H_
#define __XINE_INPUT_VDR_NET_H_
#include <arpa/inet.h>
#ifdef __APPLE__
# include <machine/endian.h>
#else
# include <endian.h>
#endif
#ifndef PACKED
# define PACKED __attribute__((packed))
#endif
#include "tools/rtp.h" /* generic RTP headers */
/*
* Default port(s)
*/
#ifndef DEFAULT_VDR_PORT
# define DEFAULT_VDR_PORT 37890
#endif
/*
* Byte-order conversions
*/
#if __BYTE_ORDER == __BIG_ENDIAN
#elif __BYTE_ORDER == __LITTLE_ENDIAN
#else
# error __BYTE_ORDER not defined !
#endif
#if __BYTE_ORDER == __BIG_ENDIAN
# define ntohll(val) (val)
# define htonll(val) (val)
# define ntohull(val) (val)
# define htonull(val) (val)
#else
# define ntohll(val) ((int64_t)ntohull((uint64_t)val))
# define htonll(val) ((int64_t)htonull((uint64_t)val))
# define ntohull(val) \
((uint64_t) ntohl((uint32_t)((val) >> 32)) | \
(uint64_t) ntohl((uint32_t)(val)) << 32)
# define htonull(val) \
((uint64_t) htonl((uint32_t)((val) >> 32)) | \
(uint64_t) htonl((uint32_t)(val)) << 32)
#endif
/*
* Network packet headers
*/
#if defined __cplusplus
extern "C" {
#endif
/*
* TCP / PIPE
*/
typedef struct stream_tcp_header {
uint64_t pos; /* stream position of first byte */
uint32_t len; /* length of following PES packet */
uint8_t payload[0];
} PACKED stream_tcp_header_t;
/*
* UDP
*/
typedef struct stream_udp_header {
uint64_t pos; /* stream position of first byte */
/* -1ULL and first bytes of frame != 00 00 01 */
/* --> embedded control stream data */
uint16_t seq; /* packet sequence number
(for re-ordering and detecting missing packets) */
uint8_t payload[0];
} PACKED stream_udp_header_t;
#define UDP_SEQ_MASK 0xff
/*
* RTP
*/
/* xineliboutput RTP header extension */
typedef struct stream_rtp_header_ext_x {
stream_rtp_header_ext_t hdr;
union {
uint8_t raw[12]; /* 3 DWORDs */
uint32_t rawd[3];
union {
struct {
uint16_t padding0; /* must be padded to full DWORDs */
stream_udp_header_t udphdr;
} PACKED;
struct {
uint16_t padding1; /* must be padded to full DWORDs */
uint64_t pos;
uint16_t seq;
} PACKED;
} PACKED;
} PACKED;
uint8_t payload[0];
} PACKED stream_rtp_header_ext_x_t;
/* xineliboutput RTP header */
typedef struct stream_rtp_header_impl {
stream_rtp_header_t rtp_hdr;
stream_rtp_header_ext_x_t hdr_ext;
uint8_t payload[0];
} PACKED stream_rtp_header_impl_t;
#define RTP_VERSION 2
#define RTP_MARKER_BIT 0x80
#define RTP_HDREXT_BIT 0x10
#define RTP_PAYLOAD_TYPE_PES 96 /* application */
#define RTP_PAYLOAD_TYPE_TS 33 /* MPEG-TS */
#define RTP_VERSION_BYTE (RTP_VERSION<<6)
#define RTP_PAYLOAD_TYPE_PES_M (RTP_PAYLOAD_TYPE_PES|RTP_MARKER_BIT)
#define RTP_PAYLOAD_TYPE_TS_M (RTP_PAYLOAD_TYPE_TS |RTP_MARKER_BIT)
#define RTP_HEADER_EXT_X_SIZE 3 /* dwords, not counting stream_rtp_header_ext_t */
#define RTP_HEADER_EXT_X_TYPE 0x54d3
#if defined __cplusplus
}
#endif
#endif /*__XINE_INPUT_VDR_NET_H_*/
|