-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutput.h
144 lines (114 loc) · 2.63 KB
/
output.h
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
#ifndef STREAM_H
#define STREAM_H
#include "getstream.h"
#include "libhttp.h"
#include <glib/glist.h>
#include <event.h>
#define RTCP_BUFFER_SIZE 4096
#define RTCP_VERSION_OFF 0
#define RTCP_VERSION_SHIFT 6
#define RTCP_PT_OFF 1
#define RTCP_VERSION(x) (x[RTCP_VERSION_OFF]>>RTCP_VERSION_SHIFT)
#define RTCP_PT(x) (x[RTCP_PT_OFF])
#define RTP_PT_H261 31 /* RFC2032 */
#define RTP_PT_MP2T 33 /* RFC2250 */
#define RTP_PT_RR 201
#define RTP_PT_BYE 203
#define RTP_PT_OFF 1
#define RTP_VERSION_OFF 0
#define RTP_SEQ_OFF 2
#define RTP_TSTAMP_OFF 4
#define RTP_SSRC_OFF 8
#define RTP_MAX_PAYLOAD 1000
#define RTP_MAX_TS (RTP_MAX_PAYLOAD/TS_PACKET_SIZE)
#define RTP_HEADROOM 12
enum {
OTYPE_UDP,
OTYPE_RTP,
OTYPE_RTCP,
OTYPE_HTTP,
OTYPE_PIPE
};
#if 0
struct stream_out_rtp_s {
/* RTCP informations */
int rtcpfd;
struct event rtcpevent;
char *rtcpbuf;
struct sockaddr *rtcpsockaddr;
int rtcpsockaddrlen;
/* RTP Informations */
int rtpfd;
struct addrspec local,
remote;
struct rtp_receiver_s *rcvr;
int ttl;
uint8_t *buffer;
int buffervalid;
};
#endif
struct http_receiver_s {
struct http_receiver_s *next;
struct http_connection *hc;
struct output_s *output;
int overflow;
};
struct rtp_receiver_s {
struct rtp_receiver_s *next;
char *addr;
int port;
struct sockaddr_in sin;
int sinlen;
time_t lastrr;
uint32_t ssrc;
};
struct output_s {
/* Config elements */
struct output_s *next;
int type;
/* Simple Buffer */
void *buffer;
/* UDP & RTP - MCast or UCast */
char *remoteaddr;
int remoteport;
int ttl;
/* RTCP or HTTP local port or local address */
char *localaddr;
struct sap_s *sap;
/* */
//struct channel_s *channel;
struct stream_s *stream;
int receiver; /* No of receivers */
int sockfd;
/* RTP/RTCP */
uint8_t *rtcpbuffer;
struct rtp_receiver_s *rtpreceiver;
int rtcpfd;
uint16_t rtpseq;
uint32_t rtpssrc;
int rtpport,
rtcpport;
struct event rtcpevent;
/* HTTP */
char *url;
GList *http_receiver;
struct http_url *hurl;
/* PIPE */
struct {
char *filename;
int fd;
time_t last;
struct event event;
} pipe;
};
int output_init(struct output_s *channel);
int output_init_udp(struct output_s *o);
int output_init_rtp(struct output_s *o);
int output_init_http(struct output_s *o);
int output_init_pipe(struct output_s *o);
void output_send(struct output_s *c, uint8_t *tsp);
void output_send_udp(struct output_s *o, uint8_t *tsp);
void output_send_rtp(struct output_s *o, uint8_t *tsp);
void output_send_http(struct output_s *o, uint8_t *tsp);
void output_send_pipe(struct output_s *o, uint8_t *tsp);
#endif