[FFmpeg-devel] [PATCH] lavfi: rename AVFilterCommand.command to "verb"
Stefano Sabatini
stefasab at gmail.com
Sat Sep 24 15:04:55 CEST 2011
This avoids the confusing recursive terminology
(AVFilterCommand.command).
---
libavfilter/avfilter.c | 11 ++++++-----
libavfilter/avfilter.h | 6 +++---
libavfilter/avfiltergraph.c | 5 +++--
libavfilter/internal.h | 2 +-
libavfilter/vf_drawtext.c | 4 ++--
5 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 783fda5..78ae434 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -49,7 +49,7 @@ static void command_queue_pop(AVFilterContext *filter)
{
AVFilterCommand *c= filter->command_queue;
av_freep(&c->arg);
- av_freep(&c->command);
+ av_freep(&c->verb);
filter->command_queue= c->next;
av_free(c);
}
@@ -572,7 +572,7 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
link->cur_buf = picref;
while(cmd && cmd->time <= picref->pts * av_q2d(link->time_base)){
- avfilter_process_command(link->dst, cmd->command, cmd->arg, 0, 0, cmd->flags);
+ avfilter_process_command(link->dst, cmd->verb, cmd->arg, 0, 0, cmd->flags);
command_queue_pop(link->dst);
cmd= link->dst->command_queue;
}
@@ -638,13 +638,14 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
draw_slice(link, y, h, slice_dir);
}
-int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags)
+int avfilter_process_command(AVFilterContext *filter,
+ const char *verb, const char *arg, char *res, int res_len, int flags)
{
- if(!strcmp(cmd, "ping")){
+ if (!strcmp(verb, "ping")) {
av_strlcatf(res, res_len, "pong from:%s %s\n", filter->filter->name, filter->name);
return 0;
}else if(filter->filter->process_command) {
- return filter->filter->process_command(filter, cmd, arg, res, res_len, flags);
+ return filter->filter->process_command(filter, verb, arg, res, res_len, flags);
}
return AVERROR(ENOSYS);
}
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 96c8e3b..986d66a 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -572,7 +572,7 @@ typedef struct AVFilter {
/**
* Make the filter instance process a command.
*
- * @param cmd the command to process, for handling simplicity all commands must be alphanumeric only
+ * @param verb the verb of the command to process, for handling simplicity all verbs must be alphanumeric only
* @param arg the argument for the command
* @param res a buffer with size res_size where the filter(s) can return a response. This must not change when the command is not supported.
* @param flags if AVFILTER_CMD_FLAG_FAST is set and the command would be
@@ -581,7 +581,7 @@ typedef struct AVFilter {
* @returns >=0 on success otherwise an error code.
* AVERROR(ENOSYS) on unsupported commands
*/
- int (*process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, int flags);
+ int (*process_command)(AVFilterContext *, const char *verb, const char *arg, char *res, int res_len, int flags);
} AVFilter;
/** An instance of a filter */
@@ -830,7 +830,7 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
* Make the filter instance process a command.
* It is recommanded to use avfilter_graph_send_command().
*/
-int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags);
+int avfilter_process_command(AVFilterContext *filter, const char *verb, const char *arg, char *res, int res_len, int flags);
/**
* Send a buffer of audio samples to the next filter.
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index c97e495..c262b0e 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -329,7 +329,8 @@ int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const
return r;
}
-int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const char *command, const char *arg, int flags, double ts)
+int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target,
+ const char *verb, const char *arg, int flags, double ts)
{
int i;
@@ -344,7 +345,7 @@ int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const
que = &(*que)->next;
next= *que;
*que= av_mallocz(sizeof(AVFilterCommand));
- (*que)->command = av_strdup(command);
+ (*que)->verb = av_strdup(verb);
(*que)->arg = av_strdup(arg);
(*que)->time = ts;
(*que)->flags = flags;
diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index 9f28a83..deceb45 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -35,7 +35,7 @@ typedef struct AVFilterPool {
typedef struct AVFilterCommand {
double time; ///< time expressed in seconds
- char *command; ///< command
+ char *verb; ///< verb of the command
char *arg; ///< optional argument for the command
int flags;
struct AVFilterCommand *next;
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index bebe0d1..8b6c3b1 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -481,9 +481,9 @@ static int config_input(AVFilterLink *inlink)
return 0;
}
-static int command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
+static int command(AVFilterContext *ctx, const char *verb, const char *arg, char *res, int res_len, int flags)
{
- if(!strcmp(cmd, "reinit")){
+ if (!strcmp(verb, "reinit")) {
int ret;
uninit(ctx);
if((ret=init(ctx, arg, NULL)) < 0)
--
1.7.2.5
More information about the ffmpeg-devel
mailing list