FFmpeg
Data Structures | Macros | Functions | Variables
unix.c File Reference
#include "libavutil/avstring.h"
#include "libavutil/opt.h"
#include "os_support.h"
#include "network.h"
#include <sys/un.h>
#include "url.h"

Go to the source code of this file.

Data Structures

struct  UnixContext
 

Macros

#define OFFSET(x)   offsetof(UnixContext, x)
 
#define ED   AV_OPT_FLAG_DECODING_PARAM|AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static int unix_open (URLContext *h, const char *filename, int flags)
 
static int unix_read (URLContext *h, uint8_t *buf, int size)
 
static int unix_write (URLContext *h, const uint8_t *buf, int size)
 
static int unix_close (URLContext *h)
 
static int unix_get_file_handle (URLContext *h)
 

Variables

static const AVOption unix_options []
 
static const AVClass unix_class
 
const URLProtocol ff_unix_protocol
 

Detailed Description

Unix socket url_protocol

Definition in file unix.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 44 of file unix.c.

◆ ED

Definition at line 45 of file unix.c.

Function Documentation

◆ unix_open()

static int unix_open ( URLContext h,
const char *  filename,
int  flags 
)
static

Definition at line 63 of file unix.c.

◆ unix_read()

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

Definition at line 103 of file unix.c.

◆ unix_write()

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

Definition at line 119 of file unix.c.

◆ unix_close()

static int unix_close ( URLContext h)
static

Definition at line 133 of file unix.c.

◆ unix_get_file_handle()

static int unix_get_file_handle ( URLContext h)
static

Definition at line 142 of file unix.c.

Variable Documentation

◆ unix_options

const AVOption unix_options[]
static
Initial value:
= {
{ "listen", "Open socket for listening", OFFSET(listen), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ED },
{ "timeout", "Timeout in ms", OFFSET(timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, ED },
{ "type", "Socket type", OFFSET(type), AV_OPT_TYPE_INT, { .i64 = SOCK_STREAM }, INT_MIN, INT_MAX, ED, "type" },
{ "stream", "Stream (reliable stream-oriented)", 0, AV_OPT_TYPE_CONST, { .i64 = SOCK_STREAM }, INT_MIN, INT_MAX, ED, "type" },
{ "datagram", "Datagram (unreliable packet-oriented)", 0, AV_OPT_TYPE_CONST, { .i64 = SOCK_DGRAM }, INT_MIN, INT_MAX, ED, "type" },
{ "seqpacket", "Seqpacket (reliable packet-oriented", 0, AV_OPT_TYPE_CONST, { .i64 = SOCK_SEQPACKET }, INT_MIN, INT_MAX, ED, "type" },
{ NULL }
}

Definition at line 46 of file unix.c.

◆ unix_class

const AVClass unix_class
static
Initial value:
= {
.class_name = "unix",
.item_name = av_default_item_name,
.option = unix_options,
}

Definition at line 56 of file unix.c.

◆ ff_unix_protocol

const URLProtocol ff_unix_protocol
Initial value:
= {
.name = "unix",
.url_open = unix_open,
.url_read = unix_read,
.url_write = unix_write,
.url_close = unix_close,
.url_get_file_handle = unix_get_file_handle,
.priv_data_size = sizeof(UnixContext),
.priv_data_class = &unix_class,
}

Definition at line 148 of file unix.c.

URL_PROTOCOL_FLAG_NETWORK
#define URL_PROTOCOL_FLAG_NETWORK
Definition: url.h:34
ED
#define ED
Definition: unix.c:45
unix_close
static int unix_close(URLContext *h)
Definition: unix.c:133
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
unix_class
static const AVClass unix_class
Definition: unix.c:56
unix_options
static const AVOption unix_options[]
Definition: unix.c:46
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
OFFSET
#define OFFSET(x)
Definition: unix.c:44
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191
unix_get_file_handle
static int unix_get_file_handle(URLContext *h)
Definition: unix.c:142
unix_open
static int unix_open(URLContext *h, const char *filename, int flags)
Definition: unix.c:63
UnixContext
Definition: unix.c:35
unix_write
static int unix_write(URLContext *h, const uint8_t *buf, int size)
Definition: unix.c:119
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:240
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:565
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:232
unix_read
static int unix_read(URLContext *h, uint8_t *buf, int size)
Definition: unix.c:103