44 #define OFFSET(x) offsetof(UnixContext, x) 45 #define ED AV_OPT_FLAG_DECODING_PARAM|AV_OPT_FLAG_ENCODING_PARAM 50 {
"stream",
"Stream (reliable stream-oriented)", 0,
AV_OPT_TYPE_CONST, { .i64 = SOCK_STREAM }, INT_MIN, INT_MAX,
ED,
"type" },
51 {
"datagram",
"Datagram (unreliable packet-oriented)", 0,
AV_OPT_TYPE_CONST, { .i64 = SOCK_DGRAM }, INT_MIN, INT_MAX,
ED,
"type" },
52 {
"seqpacket",
"Seqpacket (reliable packet-oriented", 0,
AV_OPT_TYPE_CONST, { .i64 = SOCK_SEQPACKET }, INT_MIN, INT_MAX,
ED,
"type" },
69 s->
addr.sun_family = AF_UNIX;
97 unlink(s->
addr.sun_path);
113 ret = recv(s->
fd, buf, size, 0);
114 if (!ret && s->
type == SOCK_STREAM)
137 unlink(s->
addr.sun_path);
156 .priv_data_class = &unix_class,
static const AVClass unix_class
#define URL_PROTOCOL_FLAG_NETWORK
#define LIBAVUTIL_VERSION_INT
static int unix_write(URLContext *h, const uint8_t *buf, int size)
static int unix_get_file_handle(URLContext *h)
const char * av_default_item_name(void *ptr)
Return the context name.
int64_t rw_timeout
maximum time to wait for (network) read/write operation completion, in mcs
int ff_socket(int af, int type, int proto)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
int ff_listen_bind(int fd, const struct sockaddr *addr, socklen_t addrlen, int timeout, URLContext *h)
Bind to a file descriptor and poll for a connection.
miscellaneous OS support macros and functions.
#define AVERROR_EOF
End of file.
int ff_listen_connect(int fd, const struct sockaddr *addr, socklen_t addrlen, int timeout, URLContext *h, int will_try_next)
Connect to a file descriptor and poll for result.
const URLProtocol ff_unix_protocol
static int unix_close(URLContext *h)
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
#define AVIO_FLAG_NONBLOCK
Use non-blocking mode.
Describe the class of an AVClass context structure.
static const AVOption unix_options[]
static int unix_read(URLContext *h, uint8_t *buf, int size)
static int unix_open(URLContext *h, const char *filename, int flags)
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
int ff_network_wait_fd(int fd, int write)
unbuffered private I/O API