FFmpeg
Loading...
Searching...
No Matches
libsrt.c File Reference

Haivision Open SRT (Secure Reliable Transport) protocol. More...

#include <srt/srt.h>
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "libavutil/time.h"
#include "avformat.h"
#include "internal.h"
#include "network.h"
#include "os_support.h"
#include "url.h"
#include "urldecode.h"

Go to the source code of this file.

Data Structures

struct  SRTContext
 

Macros

#define SRT_LIVE_DEFAULT_PAYLOAD_SIZE   1316
 
#define SRT_LIVE_MAX_PAYLOAD_SIZE   1456
 
#define D   AV_OPT_FLAG_DECODING_PARAM
 
#define E   AV_OPT_FLAG_ENCODING_PARAM
 
#define OFFSET(x)
 

Enumerations

enum  SRTMode { SRT_MODE_CALLER = 0 , SRT_MODE_LISTENER = 1 , SRT_MODE_RENDEZVOUS = 2 }
 

Functions

static int libsrt_neterrno (URLContext *h)
 
static int libsrt_getsockopt (URLContext *h, int fd, SRT_SOCKOPT optname, const char *optnamestr, void *optval, int *optlen)
 
static int libsrt_socket_nonblock (int socket, int enable)
 
static int libsrt_epoll_create (URLContext *h, int fd, int write)
 
static int libsrt_network_wait_fd (URLContext *h, int eid, int write)
 
static int libsrt_network_wait_fd_timeout (URLContext *h, int eid, int write, int64_t timeout, AVIOInterruptCB *int_cb)
 
static int libsrt_listen (int eid, int fd, const struct sockaddr *addr, socklen_t addrlen, URLContext *h, int64_t timeout)
 
static int libsrt_listen_connect (int eid, int fd, const struct sockaddr *addr, socklen_t addrlen, int64_t timeout, URLContext *h, int will_try_next)
 
static int libsrt_setsockopt (URLContext *h, int fd, SRT_SOCKOPT optname, const char *optnamestr, const void *optval, int optlen)
 
static int libsrt_set_options_post (URLContext *h, int fd)
 
static int libsrt_set_options_pre (URLContext *h, int fd)
 
static int libsrt_setup (URLContext *h, const char *uri, int flags)
 
static int libsrt_open (URLContext *h, const char *uri, int flags)
 
static int libsrt_read (URLContext *h, uint8_t *buf, int size)
 
static int libsrt_write (URLContext *h, const uint8_t *buf, int size)
 
static int libsrt_close (URLContext *h)
 

Variables

static const AVOption libsrt_options []
 
static const AVClass libsrt_class
 
const URLProtocol ff_libsrt_protocol
 

Detailed Description

Haivision Open SRT (Secure Reliable Transport) protocol.

Definition in file libsrt.c.

Macro Definition Documentation

◆ SRT_LIVE_DEFAULT_PAYLOAD_SIZE

#define SRT_LIVE_DEFAULT_PAYLOAD_SIZE   1316

Definition at line 40 of file libsrt.c.

◆ SRT_LIVE_MAX_PAYLOAD_SIZE

#define SRT_LIVE_MAX_PAYLOAD_SIZE   1456

Definition at line 45 of file libsrt.c.

◆ D

Definition at line 102 of file libsrt.c.

◆ E

Definition at line 103 of file libsrt.c.

◆ OFFSET

#define OFFSET ( x)
Value:
offsetof(SRTContext, x)

Definition at line 104 of file libsrt.c.

Enumeration Type Documentation

◆ SRTMode

enum SRTMode
Enumerator
SRT_MODE_CALLER 
SRT_MODE_LISTENER 
SRT_MODE_RENDEZVOUS 

Definition at line 48 of file libsrt.c.

Function Documentation

◆ libsrt_neterrno()

static int libsrt_neterrno ( URLContext * h)
static

◆ libsrt_getsockopt()

static int libsrt_getsockopt ( URLContext * h,
int fd,
SRT_SOCKOPT optname,
const char * optnamestr,
void * optval,
int * optlen )
static

Definition at line 169 of file libsrt.c.

Referenced by libsrt_listen(), and libsrt_setup().

◆ libsrt_socket_nonblock()

static int libsrt_socket_nonblock ( int socket,
int enable )
static

Definition at line 178 of file libsrt.c.

Referenced by libsrt_listen(), and libsrt_setup().

◆ libsrt_epoll_create()

static int libsrt_epoll_create ( URLContext * h,
int fd,
int write )
static

Definition at line 188 of file libsrt.c.

Referenced by libsrt_setup().

◆ libsrt_network_wait_fd()

static int libsrt_network_wait_fd ( URLContext * h,
int eid,
int write )
static

Definition at line 201 of file libsrt.c.

Referenced by libsrt_network_wait_fd_timeout().

◆ libsrt_network_wait_fd_timeout()

static int libsrt_network_wait_fd_timeout ( URLContext * h,
int eid,
int write,
int64_t timeout,
AVIOInterruptCB * int_cb )
static

Definition at line 225 of file libsrt.c.

Referenced by libsrt_listen(), libsrt_listen_connect(), libsrt_read(), and libsrt_write().

◆ libsrt_listen()

static int libsrt_listen ( int eid,
int fd,
const struct sockaddr * addr,
socklen_t addrlen,
URLContext * h,
int64_t timeout )
static

Definition at line 245 of file libsrt.c.

Referenced by libsrt_setup().

◆ libsrt_listen_connect()

static int libsrt_listen_connect ( int eid,
int fd,
const struct sockaddr * addr,
socklen_t addrlen,
int64_t timeout,
URLContext * h,
int will_try_next )
static

Definition at line 277 of file libsrt.c.

Referenced by libsrt_setup().

◆ libsrt_setsockopt()

static int libsrt_setsockopt ( URLContext * h,
int fd,
SRT_SOCKOPT optname,
const char * optnamestr,
const void * optval,
int optlen )
static

Definition at line 298 of file libsrt.c.

Referenced by libsrt_set_options_post(), and libsrt_set_options_pre().

◆ libsrt_set_options_post()

static int libsrt_set_options_post ( URLContext * h,
int fd )
static

Definition at line 311 of file libsrt.c.

Referenced by libsrt_setup().

◆ libsrt_set_options_pre()

static int libsrt_set_options_pre ( URLContext * h,
int fd )
static

Definition at line 325 of file libsrt.c.

Referenced by libsrt_setup().

◆ libsrt_setup()

static int libsrt_setup ( URLContext * h,
const char * uri,
int flags )
static

Definition at line 391 of file libsrt.c.

Referenced by libsrt_open().

◆ libsrt_open()

static int libsrt_open ( URLContext * h,
const char * uri,
int flags )
static

Definition at line 546 of file libsrt.c.

◆ libsrt_read()

static int libsrt_read ( URLContext * h,
uint8_t * buf,
int size )
static

Definition at line 573 of file libsrt.c.

◆ libsrt_write()

static int libsrt_write ( URLContext * h,
const uint8_t * buf,
int size )
static

Definition at line 592 of file libsrt.c.

◆ libsrt_close()

static int libsrt_close ( URLContext * h)
static

Definition at line 611 of file libsrt.c.

Variable Documentation

◆ libsrt_options

const AVOption libsrt_options[]
static

Definition at line 105 of file libsrt.c.

◆ libsrt_class

const AVClass libsrt_class
static
Initial value:
= {
.class_name = "libsrt",
.item_name = av_default_item_name,
.option = libsrt_options,
}
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
#define LIBAVUTIL_VERSION_INT
Definition version.h:85
static const AVOption libsrt_options[]
Definition libsrt.c:105

Definition at line 623 of file libsrt.c.

◆ ff_libsrt_protocol

const URLProtocol ff_libsrt_protocol
Initial value:
= {
.name = "srt",
.url_open = libsrt_open,
.url_read = libsrt_read,
.url_write = libsrt_write,
.url_close = libsrt_close,
.priv_data_size = sizeof(SRTContext),
.priv_data_class = &libsrt_class,
}
#define flags(name, subs,...)
Definition cbs_h264.c:74
static int libsrt_open(URLContext *h, const char *uri, int flags)
Definition libsrt.c:546
static int libsrt_read(URLContext *h, uint8_t *buf, int size)
Definition libsrt.c:573
static int libsrt_write(URLContext *h, const uint8_t *buf, int size)
Definition libsrt.c:592
static int libsrt_close(URLContext *h)
Definition libsrt.c:611
static const AVClass libsrt_class
Definition libsrt.c:623
#define URL_PROTOCOL_FLAG_NETWORK
Definition url.h:33

Definition at line 630 of file libsrt.c.