44 #define OFFSET(x) offsetof(ZMQContext, x)
45 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_VIDEO_PARAM
56 zmq->
zmq = zmq_ctx_new();
59 "Could not create ZMQ context: %s\n", zmq_strerror(errno));
66 "Could not create ZMQ socket: %s\n", zmq_strerror(errno));
72 "Could not bind ZMQ socket to address '%s': %s\n",
86 zmq_ctx_destroy(zmq->
zmq);
93 #define SPACES " \f\t\n\r"
97 const char **
buf = &command_str;
102 "No target specified in command '%s'\n", command_str);
109 "No command specified in command '%s'\n", command_str);
123 if (zmq_msg_init(&msg) == -1) {
125 "Could not initialize receive message: %s\n", zmq_strerror(errno));
129 if (zmq_msg_recv(&msg, zmq->
responder, ZMQ_DONTWAIT) == -1) {
132 "Could not receive message: %s\n", zmq_strerror(errno));
137 *buf_size = zmq_msg_size(&msg) + 1;
143 memcpy(*buf, zmq_msg_data(&msg), *buf_size);
144 (*buf)[*buf_size-1] = 0;
158 char *recv_buf, *send_buf;
164 if (
recv_msg(ctx, &recv_buf, &recv_buf_size) < 0)
176 "Processing command #%d target:%s command:%s arg:%s\n",
180 cmd_buf,
sizeof(cmd_buf),
183 -ret,
av_err2str(ret), cmd_buf[0] ?
"\n" :
"", cmd_buf);
189 "Sending command reply for command #%d:\n%s\n",
191 if (zmq_send(zmq->
responder, send_buf, strlen(send_buf), 0) == -1)
207 #if CONFIG_ZMQ_FILTER
209 #define zmq_options options
231 .description =
NULL_IF_CONFIG_SMALL(
"Receive commands through ZMQ and broker them to filters."),
237 .priv_class = &zmq_class,
242 #if CONFIG_AZMQ_FILTER
244 #define azmq_options options
266 .description =
NULL_IF_CONFIG_SMALL(
"Receive commands through ZMQ and broker them to filters."),
272 .priv_class = &azmq_class,