Go to the documentation of this file.
29 #define ZMQ_STRERROR zmq_strerror(zmq_errno())
39 #define OFFSET(x) offsetof(ZMQContext, x)
40 #define D AV_OPT_FLAG_DECODING_PARAM
41 #define E AV_OPT_FLAG_ENCODING_PARAM
43 {
"pkt_size",
"Maximum send/read packet size",
OFFSET(pkt_size),
AV_OPT_TYPE_INT, { .i64 = 131072 }, -1, INT_MAX, .flags =
D |
E },
50 int ev = write ? ZMQ_POLLOUT : ZMQ_POLLIN;
51 zmq_pollitem_t items = { .socket = socket, .fd = 0, .events = ev, .revents = 0 };
57 return items.revents & ev ? 0 :
AVERROR(EAGAIN);
84 s->pkt_size_overflow = 0;
88 h->max_packet_size =
s->pkt_size;
90 s->context = zmq_ctx_new();
104 s->socket = zmq_socket(
s->context, ZMQ_PUB);
110 ret = zmq_bind(
s->socket, uri);
119 s->socket = zmq_socket(
s->context, ZMQ_SUB);
125 ret = zmq_setsockopt(
s->socket, ZMQ_SUBSCRIBE,
"", 0);
131 ret = zmq_connect(
s->socket, uri);
140 zmq_close(
s->socket);
142 zmq_ctx_term(
s->context);
154 ret = zmq_send(
s->socket, buf,
size, 0);
170 ret = zmq_recv(
s->socket, buf,
size, 0);
176 s->pkt_size_overflow =
FFMAX(
s->pkt_size_overflow,
ret);
177 av_log(
h,
AV_LOG_WARNING,
"Message exceeds available space in the buffer. Message will be truncated. Setting -pkt_size %d may resolve the issue.\n",
s->pkt_size_overflow);
186 zmq_close(
s->socket);
187 zmq_ctx_term(
s->context);
int64_t av_gettime_relative(void)
Get the current time in microseconds since some unspecified starting point.
#define AV_LOG_WARNING
Something somehow does not look correct.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
#define URL_PROTOCOL_FLAG_NETWORK
Callback for checking whether to abort blocking functions.
int ff_check_interrupt(AVIOInterruptCB *cb)
Check if the user has requested to interrupt a blocking function associated with cb.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int zmq_proto_close(URLContext *h)
#define AVIO_FLAG_WRITE
write-only
#define LIBAVUTIL_VERSION_INT
const URLProtocol ff_libzmq_protocol
Describe the class of an AVClass context structure.
static int zmq_proto_write(URLContext *h, const unsigned char *buf, int size)
const char * av_default_item_name(void *ptr)
Return the context name.
static int zmq_proto_wait_timeout(URLContext *h, void *socket, int write, int64_t timeout, AVIOInterruptCB *int_cb)
#define AVERROR_EXTERNAL
Generic error in an external library.
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
const AVIOInterruptCB int_cb
static int zmq_proto_open(URLContext *h, const char *uri, int flags)
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 const AVOption options[]
static const AVClass zmq_context_class
#define AVIO_FLAG_READ
read-only
#define flags(name, subs,...)
static int zmq_proto_wait(URLContext *h, void *socket, int write)
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
static int zmq_proto_read(URLContext *h, unsigned char *buf, int size)