FFmpeg: libavformat/srtpproto.c Source File
Go to the documentation of this file. 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
25
28
37
38 #define D AV_OPT_FLAG_DECODING_PARAM
39 #define E AV_OPT_FLAG_ENCODING_PARAM
46 };
47
53 };
54
56 {
61 return 0;
62 }
63
65 {
67 char hostname[256], buf[1024], path[1024];
69
70 if (
s->out_suite &&
s->out_params)
73 if (
s->in_suite &&
s->in_params)
76
78 path, sizeof(path), uri);
79 ff_url_join(buf,
sizeof(buf),
"rtp",
NULL, hostname, rtp_port,
"%s", path);
81 options,
h->protocol_whitelist,
h->protocol_blacklist,
h)) < 0)
83
84 h->max_packet_size =
FFMIN(
s->rtp_hd->max_packet_size,
85 sizeof(
s->encryptbuf)) - 14;
87 return 0;
88
92 }
93
95 {
98 start:
100 if (
ret > 0 &&
s->srtp_in.aes) {
102 goto start;
103 }
105 }
106
108 {
110 if (!
s->srtp_out.aes)
113 sizeof(
s->encryptbuf));
117 }
118
120 {
123 }
124
126 int *numhandles)
127 {
130 }
131
143 };
uint8_t encryptbuf[RTP_MAX_PACKET_LENGTH]
#define URL_PROTOCOL_FLAG_NETWORK
static int srtp_get_file_handle(URLContext *h)
static int ffurl_write(URLContext *h, const uint8_t *buf, int size)
Write size bytes from buf to the resource accessed by h.
static const AVClass srtp_context_class
static int srtp_read(URLContext *h, uint8_t *buf, int size)
int ff_srtp_decrypt(struct SRTPContext *s, uint8_t *buf, int *lenptr)
static int srtp_close(URLContext *h)
int ff_srtp_encrypt(struct SRTPContext *s, const uint8_t *in, int len, uint8_t *out, int outlen)
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.
int ff_url_join(char *str, int size, const char *proto, const char *authorization, const char *hostname, int port, const char *fmt,...)
const URLProtocol ff_srtp_protocol
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
static int srtp_open(URLContext *h, const char *uri, int flags, AVDictionary **options)
const char * av_default_item_name(void *ptr)
Return the context name.
int ffurl_get_multi_file_handle(URLContext *h, int **handles, int *numhandles)
Return the file descriptors associated with this URL.
static int srtp_get_multi_file_handle(URLContext *h, int **handles, int *numhandles)
void ff_srtp_free(struct SRTPContext *s)
static int srtp_write(URLContext *h, const uint8_t *buf, int size)
struct SRTPContext srtp_out srtp_in
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 ff_srtp_set_crypto(struct SRTPContext *s, const char *suite, const char *params)
int ffurl_closep(URLContext **hh)
Close the resource accessed by the URLContext h, and free the memory used by it.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#define RTP_MAX_PACKET_LENGTH
static const AVOption options[]
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
int ffurl_get_file_handle(URLContext *h)
Return the file descriptor associated with this URL.
static int ffurl_read(URLContext *h, uint8_t *buf, int size)
Read up to size bytes from the resource accessed by h, and store the read bytes in buf.
Generated on Sat Oct 18 2025 19:23:30 for FFmpeg by
doxygen
1.8.17