FFmpeg
Data Structures | Macros | Functions | Variables
tcp.c File Reference
#include "avformat.h"
#include "libavutil/avassert.h"
#include "libavutil/mem.h"
#include "libavutil/parseutils.h"
#include "libavutil/opt.h"
#include "libavutil/time.h"
#include "network.h"
#include "os_support.h"
#include "url.h"

Go to the source code of this file.

Data Structures

struct  TCPContext
 

Macros

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

Functions

static int customize_fd (void *ctx, int fd, int family)
 
static int tcp_open (URLContext *h, const char *uri, int flags)
 
static int tcp_accept (URLContext *s, URLContext **c)
 
static int tcp_read (URLContext *h, uint8_t *buf, int size)
 
static int tcp_write (URLContext *h, const uint8_t *buf, int size)
 
static int tcp_shutdown (URLContext *h, int flags)
 
static int tcp_close (URLContext *h)
 
static int tcp_get_file_handle (URLContext *h)
 
static int tcp_get_window_size (URLContext *h)
 

Variables

static const AVOption options []
 
static const AVClass tcp_class
 
const URLProtocol ff_tcp_protocol
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 52 of file tcp.c.

◆ D

Definition at line 53 of file tcp.c.

◆ E

Definition at line 54 of file tcp.c.

Function Documentation

◆ customize_fd()

static int customize_fd ( void *  ctx,
int  fd,
int  family 
)
static

Definition at line 77 of file tcp.c.

Referenced by ff_connect_parallel(), start_connect_attempt(), and tcp_open().

◆ tcp_open()

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

Definition at line 140 of file tcp.c.

◆ tcp_accept()

static int tcp_accept ( URLContext s,
URLContext **  c 
)
static

Definition at line 268 of file tcp.c.

◆ tcp_read()

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

Definition at line 286 of file tcp.c.

◆ tcp_write()

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

Definition at line 302 of file tcp.c.

◆ tcp_shutdown()

static int tcp_shutdown ( URLContext h,
int  flags 
)
static

Definition at line 316 of file tcp.c.

◆ tcp_close()

static int tcp_close ( URLContext h)
static

Definition at line 332 of file tcp.c.

◆ tcp_get_file_handle()

static int tcp_get_file_handle ( URLContext h)
static

Definition at line 339 of file tcp.c.

◆ tcp_get_window_size()

static int tcp_get_window_size ( URLContext h)
static

Definition at line 345 of file tcp.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "listen", "Listen for incoming connections", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, .flags = D|E },
{ "local_port", "Local port", OFFSET(local_port), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, .flags = D|E },
{ "local_addr", "Local address", OFFSET(local_addr), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, .flags = D|E },
{ "timeout", "set timeout (in microseconds) of socket I/O operations", OFFSET(rw_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E },
{ "listen_timeout", "Connection awaiting timeout (in milliseconds)", OFFSET(listen_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E },
{ "send_buffer_size", "Socket send buffer size (in bytes)", OFFSET(send_buffer_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E },
{ "recv_buffer_size", "Socket receive buffer size (in bytes)", OFFSET(recv_buffer_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E },
{ "tcp_nodelay", "Use TCP_NODELAY to disable nagle's algorithm", OFFSET(tcp_nodelay), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, .flags = D|E },
{ "tcp_mss", "Maximum segment size for outgoing TCP packets", OFFSET(tcp_mss), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E },
{ NULL }
}

Definition at line 55 of file tcp.c.

◆ tcp_class

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

Definition at line 70 of file tcp.c.

◆ ff_tcp_protocol

const URLProtocol ff_tcp_protocol
Initial value:
= {
.name = "tcp",
.url_open = tcp_open,
.url_accept = tcp_accept,
.url_read = tcp_read,
.url_write = tcp_write,
.url_close = tcp_close,
.url_get_file_handle = tcp_get_file_handle,
.url_get_short_seek = tcp_get_window_size,
.url_shutdown = tcp_shutdown,
.priv_data_size = sizeof(TCPContext),
.priv_data_class = &tcp_class,
}

Definition at line 365 of file tcp.c.

E
#define E
Definition: tcp.c:54
tcp_accept
static int tcp_accept(URLContext *s, URLContext **c)
Definition: tcp.c:268
URL_PROTOCOL_FLAG_NETWORK
#define URL_PROTOCOL_FLAG_NETWORK
Definition: url.h:33
OFFSET
#define OFFSET(x)
Definition: tcp.c:52
tcp_write
static int tcp_write(URLContext *h, const uint8_t *buf, int size)
Definition: tcp.c:302
tcp_open
static int tcp_open(URLContext *h, const char *uri, int flags)
Definition: tcp.c:140
tcp_read
static int tcp_read(URLContext *h, uint8_t *buf, int size)
Definition: tcp.c:286
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:237
options
static const AVOption options[]
Definition: tcp.c:55
tcp_close
static int tcp_close(URLContext *h)
Definition: tcp.c:332
TCPContext
Definition: tcp.c:35
tcp_get_file_handle
static int tcp_get_file_handle(URLContext *h)
Definition: tcp.c:339
tcp_get_window_size
static int tcp_get_window_size(URLContext *h)
Definition: tcp.c:345
D
#define D
Definition: tcp.c:53
tcp_shutdown
static int tcp_shutdown(URLContext *h, int flags)
Definition: tcp.c:316
tcp_class
static const AVClass tcp_class
Definition: tcp.c:70
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
AV_OPT_TYPE_STRING
@ 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...
Definition: opt.h:276