FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
libsrt.c File Reference
#include <srt/srt.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"

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)   offsetof(SRTContext, 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 38 of file libsrt.c.

◆ SRT_LIVE_MAX_PAYLOAD_SIZE

#define SRT_LIVE_MAX_PAYLOAD_SIZE   1456

Definition at line 43 of file libsrt.c.

◆ D

Definition at line 96 of file libsrt.c.

◆ E

Definition at line 97 of file libsrt.c.

◆ OFFSET

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

Definition at line 98 of file libsrt.c.

Enumeration Type Documentation

◆ SRTMode

enum SRTMode
Enumerator
SRT_MODE_CALLER 
SRT_MODE_LISTENER 
SRT_MODE_RENDEZVOUS 

Definition at line 46 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 160 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 169 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 179 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 192 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 216 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 236 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 268 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 289 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 302 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 316 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 382 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 524 of file libsrt.c.

◆ libsrt_read()

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

Definition at line 674 of file libsrt.c.

◆ libsrt_write()

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

Definition at line 693 of file libsrt.c.

◆ libsrt_close()

static int libsrt_close ( URLContext h)
static

Definition at line 712 of file libsrt.c.

Variable Documentation

◆ libsrt_options

const AVOption libsrt_options[]
static

Definition at line 99 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,
}

Definition at line 724 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,
}

Definition at line 731 of file libsrt.c.

URL_PROTOCOL_FLAG_NETWORK
#define URL_PROTOCOL_FLAG_NETWORK
Definition: url.h:34
SRTContext
Definition: srtenc.c:33
libsrt_open
static int libsrt_open(URLContext *h, const char *uri, int flags)
Definition: libsrt.c:524
libsrt_options
static const AVOption libsrt_options[]
Definition: libsrt.c:99
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:235
libsrt_write
static int libsrt_write(URLContext *h, const uint8_t *buf, int size)
Definition: libsrt.c:693
libsrt_class
static const AVClass libsrt_class
Definition: libsrt.c:724
libsrt_read
static int libsrt_read(URLContext *h, uint8_t *buf, int size)
Definition: libsrt.c:674
libsrt_close
static int libsrt_close(URLContext *h)
Definition: libsrt.c:712
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561