Go to the documentation of this file.
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;
70 av_strlcpy(
s->addr.sun_path, filename,
sizeof(
s->addr.sun_path));
75 if (
s->timeout < 0 &&
h->rw_timeout)
76 s->timeout =
h->rw_timeout / 1000;
80 sizeof(
s->addr),
s->timeout,
h);
86 sizeof(
s->addr),
s->timeout,
h, 0);
97 unlink(
s->addr.sun_path);
114 if (!
ret &&
s->type == SOCK_STREAM)
137 unlink(
s->addr.sun_path);
#define URL_PROTOCOL_FLAG_NETWORK
#define AVERROR_EOF
End of file.
static int unix_close(URLContext *h)
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
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.
static const AVClass unix_class
static const AVOption unix_options[]
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
const char * av_default_item_name(void *ptr)
Return the context name.
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.
static int unix_get_file_handle(URLContext *h)
static int unix_open(URLContext *h, const char *filename, int flags)
const URLProtocol ff_unix_protocol
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
static int unix_write(URLContext *h, const uint8_t *buf, int size)
#define AVIO_FLAG_NONBLOCK
Use non-blocking mode.
#define flags(name, subs,...)
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.
int ff_socket(int af, int type, int proto, void *logctx)
static int unix_read(URLContext *h, uint8_t *buf, int size)
int ff_network_wait_fd(int fd, int write)