FFmpeg
Data Structures | Macros | Functions | Variables
sctp.c File Reference
#include <netinet/in.h>
#include <netinet/sctp.h>
#include "config.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/parseutils.h"
#include "libavutil/opt.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  SCTPContext
 

Macros

#define OFFSET(x)   offsetof(SCTPContext, x)
 
#define D   AV_OPT_FLAG_DECODING_PARAM
 
#define E   AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static int ff_sctp_recvmsg (int s, void *msg, size_t len, struct sockaddr *from, socklen_t *fromlen, struct sctp_sndrcvinfo *sinfo, int *msg_flags)
 
static int ff_sctp_send (int s, const void *msg, size_t len, const struct sctp_sndrcvinfo *sinfo, int flags)
 
static int sctp_open (URLContext *h, const char *uri, int flags)
 
static int sctp_wait_fd (int fd, int write)
 
static int sctp_read (URLContext *h, uint8_t *buf, int size)
 
static int sctp_write (URLContext *h, const uint8_t *buf, int size)
 
static int sctp_close (URLContext *h)
 
static int sctp_get_file_handle (URLContext *h)
 

Variables

static const AVOption options []
 
static const AVClass sctp_class
 
const URLProtocol ff_sctp_protocol
 

Detailed Description

sctp url_protocol

url syntax: sctp://host:port[?option=val...] option: 'listen' : listen for an incoming connection 'max_streams=n' : set the maximum number of streams 'reuse=1' : enable reusing the socket [TBD]

by setting the maximum number of streams the protocol will use the first two bytes of the incoming/outgoing buffer to store the stream number of the packet being read/written.

See also
sctp_read
sctp_write

Definition in file sctp.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 160 of file sctp.c.

◆ D

Definition at line 161 of file sctp.c.

◆ E

Definition at line 162 of file sctp.c.

Function Documentation

◆ ff_sctp_recvmsg()

static int ff_sctp_recvmsg ( int  s,
void *  msg,
size_t  len,
struct sockaddr *  from,
socklen_t *  fromlen,
struct sctp_sndrcvinfo *  sinfo,
int msg_flags 
)
static

Definition at line 74 of file sctp.c.

Referenced by sctp_read().

◆ ff_sctp_send()

static int ff_sctp_send ( int  s,
const void *  msg,
size_t  len,
const struct sctp_sndrcvinfo *  sinfo,
int  flags 
)
static

Definition at line 116 of file sctp.c.

Referenced by sctp_write().

◆ sctp_open()

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

Definition at line 178 of file sctp.c.

◆ sctp_wait_fd()

static int sctp_wait_fd ( int  fd,
int  write 
)
static

Definition at line 290 of file sctp.c.

Referenced by sctp_read(), and sctp_write().

◆ sctp_read()

static int sctp_read ( URLContext h,
uint8_t buf,
int  size 
)
static

Definition at line 300 of file sctp.c.

◆ sctp_write()

static int sctp_write ( URLContext h,
const uint8_t buf,
int  size 
)
static

Definition at line 323 of file sctp.c.

◆ sctp_close()

static int sctp_close ( URLContext h)
static

Definition at line 349 of file sctp.c.

◆ sctp_get_file_handle()

static int sctp_get_file_handle ( URLContext h)
static

Definition at line 356 of file sctp.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "listen", "Listen for incoming connections", OFFSET(listen), AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, .flags = D|E },
{ "timeout", "Connection timeout (in milliseconds)", OFFSET(timeout), AV_OPT_TYPE_INT, { .i64 = 10000 }, INT_MIN, INT_MAX, .flags = D|E },
{ "listen_timeout", "Bind timeout (in milliseconds)", OFFSET(listen_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX, .flags = D|E },
{ "max_streams", "Max stream to allocate", OFFSET(max_streams), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT16_MAX, .flags = D|E },
{ NULL }
}

Definition at line 163 of file sctp.c.

◆ sctp_class

const AVClass sctp_class
static
Initial value:
= {
.class_name = "sctp",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 171 of file sctp.c.

◆ ff_sctp_protocol

const URLProtocol ff_sctp_protocol
Initial value:
= {
.name = "sctp",
.url_open = sctp_open,
.url_read = sctp_read,
.url_write = sctp_write,
.url_close = sctp_close,
.url_get_file_handle = sctp_get_file_handle,
.priv_data_size = sizeof(SCTPContext),
.priv_data_class = &sctp_class,
}

Definition at line 362 of file sctp.c.

D
#define D
Definition: sctp.c:161
options
static const AVOption options[]
Definition: sctp.c:163
URL_PROTOCOL_FLAG_NETWORK
#define URL_PROTOCOL_FLAG_NETWORK
Definition: url.h:34
E
#define E
Definition: sctp.c:162
sctp_get_file_handle
static int sctp_get_file_handle(URLContext *h)
Definition: sctp.c:356
OFFSET
#define OFFSET(x)
Definition: sctp.c:160
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191
sctp_read
static int sctp_read(URLContext *h, uint8_t *buf, int size)
Definition: sctp.c:300
SCTPContext
Definition: sctp.c:150
sctp_close
static int sctp_close(URLContext *h)
Definition: sctp.c:349
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
sctp_class
static const AVClass sctp_class
Definition: sctp.c:171
sctp_write
static int sctp_write(URLContext *h, const uint8_t *buf, int size)
Definition: sctp.c:323
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:240
sctp_open
static int sctp_open(URLContext *h, const char *uri, int flags)
Definition: sctp.c:178
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:565