1 /*
2 * SRTP network protocol
3 * Copyright (c) 2012 Martin Storsjo
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
26
30
39
40 #define D AV_OPT_FLAG_DECODING_PARAM
41 #define E AV_OPT_FLAG_ENCODING_PARAM
48 };
49
55 };
56
58 {
64 return 0;
65 }
66
68 {
70 char hostname[256],
buf[1024], path[1024];
71 int rtp_port, ret;
72
79
81 path, sizeof(path), uri);
82 ff_url_join(buf,
sizeof(buf),
"rtp",
NULL, hostname, rtp_port,
"%s", path);
86
90 return 0;
91
94 return ret;
95 }
96
98 {
100 int ret;
106 }
107 return ret;
108 }
109
111 {
113 if (!s->srtp_out.aes)
117 if (size < 0)
120 }
121
123 {
126 }
127
129 int *numhandles)
130 {
133 }
134
144 .priv_data_class = &srtp_context_class,
146 };
void av_url_split(char *proto, int proto_size, char *authorization, int authorization_size, char *hostname, int hostname_size, int *port_ptr, char *path, int path_size, const char *url)
Split a URL string into components.
int ffurl_open_whitelist(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options, const char *whitelist, const char *blacklist, URLContext *parent)
Create an URLContext for accessing to the resource indicated by url, and open it. ...
#define URL_PROTOCOL_FLAG_NETWORK
int ff_srtp_encrypt(struct SRTPContext *s, const uint8_t *in, int len, uint8_t *out, int outlen)
#define RTP_MAX_PACKET_LENGTH
#define LIBAVUTIL_VERSION_INT
int ffurl_write(URLContext *h, const unsigned char *buf, int size)
Write size bytes from buf to the resource accessed by h.
int is_streamed
true if streamed (no seek possible), default = false
uint8_t encryptbuf[RTP_MAX_PACKET_LENGTH]
AVIOInterruptCB interrupt_callback
static int srtp_get_file_handle(URLContext *h)
const char * av_default_item_name(void *ptr)
Return the context name.
static int srtp_read(URLContext *h, uint8_t *buf, int size)
static const AVClass srtp_context_class
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
void ff_srtp_free(struct SRTPContext *s)
static int srtp_write(URLContext *h, const uint8_t *buf, int size)
int ffurl_get_multi_file_handle(URLContext *h, int **handles, int *numhandles)
Return the file descriptors associated with this URL.
static int srtp_open(URLContext *h, const char *uri, int flags)
const char * protocol_whitelist
struct SRTPContext srtp_out srtp_in
int ff_srtp_decrypt(struct SRTPContext *s, uint8_t *buf, int *lenptr)
static int srtp_get_multi_file_handle(URLContext *h, int **handles, int *numhandles)
int ffurl_get_file_handle(URLContext *h)
Return the file descriptor associated with this URL.
static const AVOption options[]
int ff_url_join(char *str, int size, const char *proto, const char *authorization, const char *hostname, int port, const char *fmt,...)
const char * protocol_blacklist
Describe the class of an AVClass context structure.
int ffurl_close(URLContext *h)
const URLProtocol ff_srtp_protocol
static int srtp_close(URLContext *h)
int ff_srtp_set_crypto(struct SRTPContext *s, const char *suite, const char *params)
int max_packet_size
if non zero, the stream is packetized with this max packet size
unbuffered private I/O API
int ffurl_read(URLContext *h, unsigned char *buf, int size)
Read up to size bytes from the resource accessed by h, and store the read bytes in buf...