History

lavfi: add avfilter_default_filter_name()

The function is modelled after av_default_item_name(), and will print the name of the instance filter if defined, otherwise the name of the filter. This allows to show the instance name in the log, which is useful when debugging complex filter graphs.

Stefano Sabatini committed 14 years ago

Commit 4d6a8a21 parent 7d8202026 files · +38 −119Browse files

Unified · Split

26 files
  1. doc/APIchanges +3 −0
  2. libavfilter/af_aformat.c +1 −1
  3. libavfilter/af_amix.c +1 −1
  4. libavfilter/af_asyncts.c +1 −1
  5. libavfilter/af_silencedetect.c +1 −6
  6. libavfilter/asrc_aevalsrc.c +1 −6
  7. libavfilter/asrc_anullsrc.c +1 −6
  8. libavfilter/avfilter.c +4 −4
  9. libavfilter/avfilter.h +6 −0
  10. libavfilter/avfiltergraph.c +1 −1
  11. libavfilter/buffersrc.c +1 −1
  12. libavfilter/src_movie.c +1 −6
  13. libavfilter/version.h +1 −1
  14. libavfilter/vf_ass.c +1 −6
  15. libavfilter/vf_blackdetect.c +1 −6
  16. libavfilter/vf_delogo.c +1 −6
  17. libavfilter/vf_drawtext.c +1 −6
  18. libavfilter/vf_fade.c +1 −6
  19. libavfilter/vf_fps.c +1 −1
  20. libavfilter/vf_lut.c +1 −6
  21. libavfilter/vf_overlay.c +1 −6
  22. libavfilter/vsrc_cellauto.c +1 −6
  23. libavfilter/vsrc_life.c +1 −6
  24. libavfilter/vsrc_mandelbrot.c +1 −6
  25. libavfilter/vsrc_mptestsrc.c +1 −6
  26. libavfilter/vsrc_testsrc.c +3 −18
doc/APIchanges+3−0
@@ -15,6 +15,9 @@ libavutil: 2011-04-18 · 14 unmodified lines
1515
1616 API changes, most recent first:
1717
18+2012-06-04 - xxxxxxx - lafi 2.78.100
19+ Add avfilter_default_filter_name() function in avfilter.h.
20+
1821 2012-05-24 - xxxxxxx - lavu 51.54.100
1922 Move AVPALETTE_SIZE and AVPALETTE_COUNT macros from
2023 libavcodec/avcodec.h to libavutil/pixfmt.h.
libavfilter/af_aformat.c+1−1
@@ -55,7 +55,7 @@ static const AVOption options[] = { · 54 unmodified lines
5555
5656 static const AVClass aformat_class = {
5757 .class_name = "aformat filter",
58− .item_name = av_default_item_name,
58+ .item_name = avfilter_default_filter_name,
5959 .option = options,
6060 .version = LIBAVUTIL_VERSION_INT,
6161 .category = AV_CLASS_CATEGORY_FILTER,
libavfilter/af_amix.c+1−1
@@ -186,7 +186,7 @@ static const AVOption options[] = { · 185 unmodified lines
186186
187187 static const AVClass amix_class = {
188188 .class_name = "amix filter",
189− .item_name = av_default_item_name,
189+ .item_name = avfilter_default_filter_name,
190190 .option = options,
191191 .version = LIBAVUTIL_VERSION_INT,
192192 };
libavfilter/af_asyncts.c+1−1
@@ -50,7 +50,7 @@ static const AVOption options[] = { · 49 unmodified lines
5050
5151 static const AVClass async_class = {
5252 .class_name = "asyncts filter",
53− .item_name = av_default_item_name,
53+ .item_name = avfilter_default_filter_name,
5454 .option = options,
5555 .version = LIBAVUTIL_VERSION_INT,
5656 };
libavfilter/af_silencedetect.c+1−6
@@ -48,14 +48,9 @@ static const AVOption silencedetect_options[] = { · 47 unmodified lines
4848 { NULL },
4949 };
5050
51−static const char *silencedetect_get_name(void *ctx)
52−{
53− return "silencedetect";
54−}
55−
5651 static const AVClass silencedetect_class = {
5752 .class_name = "SilenceDetectContext",
58− .item_name = silencedetect_get_name,
53+ .item_name = avfilter_default_filter_name,
5954 .option = silencedetect_options,
6055 };
6156
libavfilter/asrc_aevalsrc.c+1−6
@@ -78,14 +78,9 @@ static const AVOption eval_options[]= { · 77 unmodified lines
7878 {NULL},
7979 };
8080
81−static const char *eval_get_name(void *ctx)
82−{
83− return "aevalsrc";
84−}
85−
8681 static const AVClass eval_class = {
8782 "AEvalSrcContext",
88− eval_get_name,
83+ avfilter_default_filter_name,
8984 eval_options
9085 };
9186
libavfilter/asrc_anullsrc.c+1−6
@@ -53,14 +53,9 @@ static const AVOption anullsrc_options[]= { · 52 unmodified lines
5353 { NULL },
5454 };
5555
56−static const char *anullsrc_get_name(void *ctx)
57−{
58− return "anullsrc";
59−}
60−
6156 static const AVClass anullsrc_class = {
6257 "ANullSrcContext",
63− anullsrc_get_name,
58+ avfilter_default_filter_name,
6459 anullsrc_options
6560 };
6661
libavfilter/avfilter.c+4−4
@@ -366,15 +366,15 @@ static int pad_count(const AVFilterPad *pads) · 365 unmodified lines
366366 return count;
367367 }
368368
369−static const char *filter_name(void *p)
369+const char *avfilter_default_filter_name(void *filter_ctx)
370370 {
371− AVFilterContext *filter = p;
372− return filter->filter->name;
371+ AVFilterContext *ctx = filter_ctx;
372+ return ctx->name ? ctx->name : ctx->filter->name;
373373 }
374374
375375 static const AVClass avfilter_class = {
376376 .class_name = "AVFilter",
377− .item_name = filter_name,
377+ .item_name = avfilter_default_filter_name,
378378 .version = LIBAVUTIL_VERSION_INT,
379379 .category = AV_CLASS_CATEGORY_FILTER,
380380 };
libavfilter/avfilter.h+6−0
@@ -634,6 +634,12 @@ struct AVFilterContext { · 633 unmodified lines
634634 struct AVFilterCommand *command_queue;
635635 };
636636
637+/**
638+ * Print the name of the filter given a filter context.
639+ */
640+const char *avfilter_default_filter_name(void *filter_ctx);
641+
642+
637643 #if FF_API_PACKING
638644 enum AVFilterPacking {
639645 AVFILTER_PACKED = 0,
libavfilter/avfiltergraph.c+1−1
@@ -36,7 +36,7 @@ · 35 unmodified lines
3636
3737 static const AVClass filtergraph_class = {
3838 .class_name = "AVFilterGraph",
39− .item_name = av_default_item_name,
39+ .item_name = avfilter_default_filter_name,
4040 .version = LIBAVUTIL_VERSION_INT,
4141 };
4242
libavfilter/buffersrc.c+1−1
@@ -255,7 +255,7 @@ static const AVOption audio_options[] = { · 254 unmodified lines
255255
256256 static const AVClass abuffer_class = {
257257 .class_name = "abuffer source",
258− .item_name = av_default_item_name,
258+ .item_name = avfilter_default_filter_name,
259259 .option = audio_options,
260260 .version = LIBAVUTIL_VERSION_INT,
261261 .category = AV_CLASS_CATEGORY_FILTER,
libavfilter/src_movie.c+1−6
@@ -78,14 +78,9 @@ static const AVOption movie_options[]= { · 77 unmodified lines
7878 {NULL},
7979 };
8080
81−static const char *movie_get_name(void *ctx)
82−{
83− return "movie";
84−}
85−
8681 static const AVClass movie_class = {
8782 "MovieContext",
88− movie_get_name,
83+ avfilter_default_filter_name,
8984 movie_options
9085 };
9186
libavfilter/version.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
2929 #include "libavutil/avutil.h"
3030
3131 #define LIBAVFILTER_VERSION_MAJOR 2
32−#define LIBAVFILTER_VERSION_MINOR 77
32+#define LIBAVFILTER_VERSION_MINOR 78
3333 #define LIBAVFILTER_VERSION_MICRO 100
3434
3535 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
libavfilter/vf_ass.c+1−6
@@ -54,14 +54,9 @@ static const AVOption ass_options[] = { · 53 unmodified lines
5454 {NULL},
5555 };
5656
57−static const char *ass_get_name(void *ctx)
58−{
59− return "ass";
60−}
61−
6257 static const AVClass ass_class = {
6358 "AssContext",
64− ass_get_name,
59+ avfilter_default_filter_name,
6560 ass_options
6661 };
6762
libavfilter/vf_blackdetect.c+1−6
@@ -57,14 +57,9 @@ static const AVOption blackdetect_options[] = { · 56 unmodified lines
5757 { NULL },
5858 };
5959
60−static const char *blackdetect_get_name(void *ctx)
61−{
62− return "blackdetect";
63−}
64−
6560 static const AVClass blackdetect_class = {
6661 .class_name = "BlackDetectContext",
67− .item_name = blackdetect_get_name,
62+ .item_name = avfilter_default_filter_name,
6863 .option = blackdetect_options,
6964 };
7065
libavfilter/vf_delogo.c+1−6
@@ -149,14 +149,9 @@ static const AVOption delogo_options[]= { · 148 unmodified lines
149149 {NULL},
150150 };
151151
152−static const char *delogo_get_name(void *ctx)
153−{
154− return "delogo";
155−}
156−
157152 static const AVClass delogo_class = {
158153 .class_name = "DelogoContext",
159− .item_name = delogo_get_name,
154+ .item_name = avfilter_default_filter_name,
160155 .option = delogo_options,
161156 };
162157
libavfilter/vf_drawtext.c+1−6
@@ -205,14 +205,9 @@ static const AVOption drawtext_options[]= { · 204 unmodified lines
205205 {NULL},
206206 };
207207
208−static const char *drawtext_get_name(void *ctx)
209−{
210− return "drawtext";
211−}
212−
213208 static const AVClass drawtext_class = {
214209 "DrawTextContext",
215− drawtext_get_name,
210+ avfilter_default_filter_name,
216211 drawtext_options
217212 };
218213
libavfilter/vf_fade.c+1−6
@@ -69,14 +69,9 @@ static const AVOption fade_options[] = { · 68 unmodified lines
6969 {NULL},
7070 };
7171
72−static const char *fade_get_name(void *ctx)
73−{
74− return "fade";
75−}
76−
7772 static const AVClass fade_class = {
7873 "FadeContext",
79− fade_get_name,
74+ avfilter_default_filter_name,
8075 fade_options
8176 };
8277
libavfilter/vf_fps.c+1−1
@@ -60,7 +60,7 @@ static const AVOption options[] = { · 59 unmodified lines
6060
6161 static const AVClass class = {
6262 .class_name = "FPS filter",
63− .item_name = av_default_item_name,
63+ .item_name = avfilter_default_filter_name,
6464 .option = options,
6565 .version = LIBAVUTIL_VERSION_INT,
6666 };
libavfilter/vf_lut.c+1−6
@@ -89,14 +89,9 @@ static const AVOption lut_options[] = { · 88 unmodified lines
8989 {NULL},
9090 };
9191
92−static const char *lut_get_name(void *ctx)
93−{
94− return "lut";
95−}
96−
9792 static const AVClass lut_class = {
9893 "LutContext",
99− lut_get_name,
94+ avfilter_default_filter_name,
10095 lut_options
10196 };
10297
libavfilter/vf_overlay.c+1−6
@@ -101,14 +101,9 @@ static const AVOption overlay_options[] = { · 100 unmodified lines
101101 {NULL},
102102 };
103103
104−static const char *overlay_get_name(void *ctx)
105−{
106− return "overlay";
107−}
108−
109104 static const AVClass overlay_class = {
110105 "OverlayContext",
111− overlay_get_name,
106+ avfilter_default_filter_name,
112107 overlay_options
113108 };
114109
libavfilter/vsrc_cellauto.c+1−6
@@ -76,14 +76,9 @@ static const AVOption cellauto_options[] = { · 75 unmodified lines
7676 { NULL },
7777 };
7878
79−static const char *cellauto_get_name(void *ctx)
80−{
81− return "cellauto";
82−}
83−
8479 static const AVClass cellauto_class = {
8580 "CellAutoContext",
86− cellauto_get_name,
81+ avfilter_default_filter_name,
8782 cellauto_options
8883 };
8984
libavfilter/vsrc_life.c+1−6
@@ -95,14 +95,9 @@ static const AVOption life_options[] = { · 94 unmodified lines
9595 { NULL },
9696 };
9797
98−static const char *life_get_name(void *ctx)
99−{
100− return "life";
101−}
102−
10398 static const AVClass life_class = {
10499 "LifeContext",
105− life_get_name,
100+ avfilter_default_filter_name,
106101 life_options
107102 };
108103
libavfilter/vsrc_mandelbrot.c+1−6
@@ -103,14 +103,9 @@ static const AVOption mandelbrot_options[] = { · 102 unmodified lines
103103 {NULL},
104104 };
105105
106−static const char *mandelbrot_get_name(void *ctx)
107−{
108− return "mandelbrot";
109−}
110−
111106 static const AVClass mandelbrot_class = {
112107 "MBContext",
113− mandelbrot_get_name,
108+ avfilter_default_filter_name,
114109 mandelbrot_options
115110 };
116111
libavfilter/vsrc_mptestsrc.c+1−6
@@ -82,14 +82,9 @@ static const AVOption mptestsrc_options[]= { · 81 unmodified lines
8282 { NULL },
8383 };
8484
85−static const char *mptestsrc_get_name(void *ctx)
86−{
87− return "mptestsrc";
88−}
89−
9085 static const AVClass mptestsrc_class = {
9186 "MPTestContext",
92− mptestsrc_get_name,
87+ avfilter_default_filter_name,
9388 mptestsrc_options
9489 };
9590
libavfilter/vsrc_testsrc.c+3−18
@@ -156,14 +156,9 @@ static int request_frame(AVFilterLink *outlink) · 155 unmodified lines
156156
157157 #if CONFIG_NULLSRC_FILTER
158158
159−static const char *nullsrc_get_name(void *ctx)
160−{
161− return "nullsrc";
162−}
163−
164159 static const AVClass nullsrc_class = {
165160 .class_name = "NullSourceContext",
166− .item_name = nullsrc_get_name,
161+ .item_name = avfilter_default_filter_name,
167162 .option = testsrc_options,
168163 };
169164
@@ -196,14 +191,9 @@ AVFilter avfilter_vsrc_nullsrc = { · 26 unmodified lines
196191
197192 #if CONFIG_TESTSRC_FILTER
198193
199−static const char *testsrc_get_name(void *ctx)
200−{
201− return "testsrc";
202−}
203−
204194 static const AVClass testsrc_class = {
205195 .class_name = "TestSourceContext",
206− .item_name = testsrc_get_name,
196+ .item_name = avfilter_default_filter_name,
207197 .option = testsrc_options,
208198 };
209199
@@ -423,14 +413,9 @@ AVFilter avfilter_vsrc_testsrc = { · 213 unmodified lines
423413
424414 #if CONFIG_RGBTESTSRC_FILTER
425415
426−static const char *rgbtestsrc_get_name(void *ctx)
427−{
428− return "rgbtestsrc";
429−}
430−
431416 static const AVClass rgbtestsrc_class = {
432417 .class_name = "RGBTestSourceContext",
433− .item_name = rgbtestsrc_get_name,
418+ .item_name = avfilter_default_filter_name,
434419 .option = testsrc_options,
435420 };
436421

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