43 #define OFFSET(x) offsetof(ZMQContext, x)
44 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_VIDEO_PARAM
55 zmq->
zmq = zmq_ctx_new();
58 "Could not create ZMQ context: %s\n", zmq_strerror(errno));
65 "Could not create ZMQ socket: %s\n", zmq_strerror(errno));
71 "Could not bind ZMQ socket to address '%s': %s\n",
85 zmq_ctx_destroy(zmq->
zmq);
92 #define SPACES " \f\t\n\r"
96 const char **buf = &command_str;
101 "No target specified in command '%s'\n", command_str);
108 "No command specified in command '%s'\n", command_str);
122 if (zmq_msg_init(&msg) == -1) {
124 "Could not initialize receive message: %s\n", zmq_strerror(errno));
128 if (zmq_msg_recv(&msg, zmq->
responder, ZMQ_DONTWAIT) == -1) {
131 "Could not receive message: %s\n", zmq_strerror(errno));
136 *buf =
av_strndup(zmq_msg_data(&msg), zmq_msg_size(&msg));
152 char *recv_buf =
NULL, *send_buf =
NULL;
169 "Processing command #%d target:%s command:%s arg:%s\n",
173 cmd_buf,
sizeof(cmd_buf),
177 -ret,
av_err2str(ret), cmd_buf[0] ?
"\n" :
"", cmd_buf);
183 "Sending command reply for command #%d:\n%s\n",
185 if (zmq_send(zmq->
responder, send_buf, strlen(send_buf), 0) == -1)
200 #if CONFIG_ZMQ_FILTER
202 #define zmq_options options
224 .description =
NULL_IF_CONFIG_SMALL(
"Receive commands through ZMQ and broker them to filters."),
230 .priv_class = &zmq_class,
235 #if CONFIG_AZMQ_FILTER
237 #define azmq_options options
259 .description =
NULL_IF_CONFIG_SMALL(
"Receive commands through ZMQ and broker them to filters."),
265 .priv_class = &azmq_class,
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Main libavfilter public API header.
char * av_asprintf(const char *fmt,...)
static void av_cold uninit(AVFilterContext *ctx)
static const AVOption options[]
static int filter_frame(AVFilterLink *inlink, AVFrame *ref)
static av_cold int init(AVFilterContext *ctx)
static int recv_msg(AVFilterContext *ctx, char **buf)
static int parse_command(Command *cmd, const char *command_str, void *log_ctx)
int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, char *res, int res_len, int flags)
Send a command to one or more filter instances.
#define AVFILTER_CMD_FLAG_ONE
Stop once a filter understood the command (for target=all for example), fast filters are favored auto...
#define AVERROR_EXTERNAL
Generic error in an external library.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
char * av_strndup(const char *s, size_t len)
Duplicate a substring of a string.
char * av_get_token(const char **buf, const char *term)
Unescape the given string until a non escaped terminating char, and return the token corresponding to...
#define AVFILTER_DEFINE_CLASS(fname)
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Describe the class of an AVClass context structure.
A link between two filters.
struct AVFilterGraph * graph
Graph the filter belongs to.
AVFilterContext * dst
dest filter
A filter pad used for either input or output.
const char * name
Pad name.
const char * name
Filter name.
This structure describes decoded (raw) audio or video data.
static int ref[MAX_W *MAX_W]