History

avfilter/graphparser: allow specifying filter@id as filter instance

See http://lists.ffmpeg.org/pipermail/ffmpeg-user/2017-April/035975.html Parsed_filter_X could remain and user can override it with custom one. Example: ffplay -f lavfi "nullsrc=s=640x360, sendcmd='1 drawtext@top reinit text=Hello; 2 drawtext@bottom reinit text=World', drawtext@top=x=16:y=16:fontsize=20:fontcolor=Red:text='', drawtext@bottom=x=16:y=340:fontsize=16:fontcolor=Blue:text=''"

Muhammad Faiz committed 9 years ago

Commit 162414c1 parent 3fb104f2 files · +31 −8Browse files

Showing the changes to libavfilter/graphparser.c (1 of 2 files). Show all

Unified · Split

libavfilter/graphparser.c+21−5
@@ -88,20 +88,36 @@ static char *parse_link_name(const char **buf, void *log_ctx) · 87 unmodified lines
88 * @param filt_ctx put here a filter context in case of successful creation and configuration, NULL otherwise.88 * @param filt_ctx put here a filter context in case of successful creation and configuration, NULL otherwise.
89 * @param ctx the filtergraph context89 * @param ctx the filtergraph context
90 * @param index an index which is supposed to be unique for each filter instance added to the filtergraph90 * @param index an index which is supposed to be unique for each filter instance added to the filtergraph
91 * @param filt_name the name of the filter to create91 * @param name the name of the filter to create, can be filter name or filter_name\@id as instance name
92 * @param args the arguments provided to the filter during its initialization92 * @param args the arguments provided to the filter during its initialization
93 * @param log_ctx the log context to use93 * @param log_ctx the log context to use
94 * @return >= 0 in case of success, a negative AVERROR code otherwise94 * @return >= 0 in case of success, a negative AVERROR code otherwise
95 */95 */
96static int create_filter(AVFilterContext **filt_ctx, AVFilterGraph *ctx, int index,96static int create_filter(AVFilterContext **filt_ctx, AVFilterGraph *ctx, int index,
97 const char *filt_name, const char *args, void *log_ctx)97 const char *name, const char *args, void *log_ctx)
98{98{
99 AVFilter *filt;99 AVFilter *filt;
100 char inst_name[30];100 char name2[30];
101 const char *inst_name = NULL, *filt_name = NULL;
101 char *tmp_args = NULL;102 char *tmp_args = NULL;
102 int ret;103 int ret, k;
104
105 av_strlcpy(name2, name, sizeof(name2));
106
107 for (k = 0; name2[k]; k++) {
108 if (name2[k] == '@' && name[k+1]) {
109 name2[k] = 0;
110 inst_name = name;
111 filt_name = name2;
112 break;
113 }
114 }
103 115
104 snprintf(inst_name, sizeof(inst_name), "Parsed_%s_%d", filt_name, index);116 if (!inst_name) {
117 snprintf(name2, sizeof(name2), "Parsed_%s_%d", name, index);
118 inst_name = name2;
119 filt_name = name;
120 }
105 121
106 filt = avfilter_get_by_name(filt_name);122 filt = avfilter_get_by_name(filt_name);
107 123

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t