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
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
182012-06-04 - xxxxxxx - lafi 2.78.100
19 Add avfilter_default_filter_name() function in avfilter.h.
20
182012-05-24 - xxxxxxx - lavu 51.54.100212012-05-24 - xxxxxxx - lavu 51.54.100
19 Move AVPALETTE_SIZE and AVPALETTE_COUNT macros from22 Move AVPALETTE_SIZE and AVPALETTE_COUNT macros from
20 libavcodec/avcodec.h to libavutil/pixfmt.h.23 libavcodec/avcodec.h to libavutil/pixfmt.h.
libavfilter/af_aformat.c+1−1
@@ -55,7 +55,7 @@ static const AVOption options[] = { · 54 unmodified lines
55 55
56static const AVClass aformat_class = {56static const AVClass aformat_class = {
57 .class_name = "aformat filter",57 .class_name = "aformat filter",
58 .item_name = av_default_item_name,58 .item_name = avfilter_default_filter_name,
59 .option = options,59 .option = options,
60 .version = LIBAVUTIL_VERSION_INT,60 .version = LIBAVUTIL_VERSION_INT,
61 .category = AV_CLASS_CATEGORY_FILTER,61 .category = AV_CLASS_CATEGORY_FILTER,
libavfilter/af_amix.c+1−1
@@ -186,7 +186,7 @@ static const AVOption options[] = { · 185 unmodified lines
186 186
187static const AVClass amix_class = {187static const AVClass amix_class = {
188 .class_name = "amix filter",188 .class_name = "amix filter",
189 .item_name = av_default_item_name,189 .item_name = avfilter_default_filter_name,
190 .option = options,190 .option = options,
191 .version = LIBAVUTIL_VERSION_INT,191 .version = LIBAVUTIL_VERSION_INT,
192};192};
libavfilter/af_asyncts.c+1−1
@@ -50,7 +50,7 @@ static const AVOption options[] = { · 49 unmodified lines
50 50
51static const AVClass async_class = {51static const AVClass async_class = {
52 .class_name = "asyncts filter",52 .class_name = "asyncts filter",
53 .item_name = av_default_item_name,53 .item_name = avfilter_default_filter_name,
54 .option = options,54 .option = options,
55 .version = LIBAVUTIL_VERSION_INT,55 .version = LIBAVUTIL_VERSION_INT,
56};56};
libavfilter/af_silencedetect.c+1−6
@@ -48,14 +48,9 @@ static const AVOption silencedetect_options[] = { · 47 unmodified lines
48 { NULL },48 { NULL },
49};49};
50 50
51static const char *silencedetect_get_name(void *ctx)
52{
53 return "silencedetect";
54}
55
56static const AVClass silencedetect_class = {51static const AVClass silencedetect_class = {
57 .class_name = "SilenceDetectContext",52 .class_name = "SilenceDetectContext",
58 .item_name = silencedetect_get_name,53 .item_name = avfilter_default_filter_name,
59 .option = silencedetect_options,54 .option = silencedetect_options,
60};55};
61 56
libavfilter/asrc_aevalsrc.c+1−6
@@ -78,14 +78,9 @@ static const AVOption eval_options[]= { · 77 unmodified lines
78{NULL},78{NULL},
79};79};
80 80
81static const char *eval_get_name(void *ctx)
82{
83 return "aevalsrc";
84}
85
86static const AVClass eval_class = {81static const AVClass eval_class = {
87 "AEvalSrcContext",82 "AEvalSrcContext",
88 eval_get_name,83 avfilter_default_filter_name,
89 eval_options84 eval_options
90};85};
91 86
libavfilter/asrc_anullsrc.c+1−6
@@ -53,14 +53,9 @@ static const AVOption anullsrc_options[]= { · 52 unmodified lines
53 { NULL },53 { NULL },
54};54};
55 55
56static const char *anullsrc_get_name(void *ctx)
57{
58 return "anullsrc";
59}
60
61static const AVClass anullsrc_class = {56static const AVClass anullsrc_class = {
62 "ANullSrcContext",57 "ANullSrcContext",
63 anullsrc_get_name,58 avfilter_default_filter_name,
64 anullsrc_options59 anullsrc_options
65};60};
66 61
libavfilter/avfilter.c+4−4
@@ -366,15 +366,15 @@ static int pad_count(const AVFilterPad *pads) · 365 unmodified lines
366 return count;366 return count;
367}367}
368 368
369static const char *filter_name(void *p)369const char *avfilter_default_filter_name(void *filter_ctx)
370{370{
371 AVFilterContext *filter = p;371 AVFilterContext *ctx = filter_ctx;
372 return filter->filter->name;372 return ctx->name ? ctx->name : ctx->filter->name;
373}373}
374 374
375static const AVClass avfilter_class = {375static const AVClass avfilter_class = {
376 .class_name = "AVFilter",376 .class_name = "AVFilter",
377 .item_name = filter_name,377 .item_name = avfilter_default_filter_name,
378 .version = LIBAVUTIL_VERSION_INT,378 .version = LIBAVUTIL_VERSION_INT,
379 .category = AV_CLASS_CATEGORY_FILTER,379 .category = AV_CLASS_CATEGORY_FILTER,
380};380};
libavfilter/avfilter.h+6−0
@@ -634,6 +634,12 @@ struct AVFilterContext { · 633 unmodified lines
634 struct AVFilterCommand *command_queue;634 struct AVFilterCommand *command_queue;
635};635};
636 636
637/**
638 * Print the name of the filter given a filter context.
639 */
640const char *avfilter_default_filter_name(void *filter_ctx);
641
642
637#if FF_API_PACKING643#if FF_API_PACKING
638enum AVFilterPacking {644enum AVFilterPacking {
639 AVFILTER_PACKED = 0,645 AVFILTER_PACKED = 0,
libavfilter/avfiltergraph.c+1−1
@@ -36,7 +36,7 @@ · 35 unmodified lines
36 36
37static const AVClass filtergraph_class = {37static const AVClass filtergraph_class = {
38 .class_name = "AVFilterGraph",38 .class_name = "AVFilterGraph",
39 .item_name = av_default_item_name,39 .item_name = avfilter_default_filter_name,
40 .version = LIBAVUTIL_VERSION_INT,40 .version = LIBAVUTIL_VERSION_INT,
41};41};
42 42
libavfilter/buffersrc.c+1−1
@@ -255,7 +255,7 @@ static const AVOption audio_options[] = { · 254 unmodified lines
255 255
256static const AVClass abuffer_class = {256static const AVClass abuffer_class = {
257 .class_name = "abuffer source",257 .class_name = "abuffer source",
258 .item_name = av_default_item_name,258 .item_name = avfilter_default_filter_name,
259 .option = audio_options,259 .option = audio_options,
260 .version = LIBAVUTIL_VERSION_INT,260 .version = LIBAVUTIL_VERSION_INT,
261 .category = AV_CLASS_CATEGORY_FILTER,261 .category = AV_CLASS_CATEGORY_FILTER,
libavfilter/src_movie.c+1−6
@@ -78,14 +78,9 @@ static const AVOption movie_options[]= { · 77 unmodified lines
78{NULL},78{NULL},
79};79};
80 80
81static const char *movie_get_name(void *ctx)
82{
83 return "movie";
84}
85
86static const AVClass movie_class = {81static const AVClass movie_class = {
87 "MovieContext",82 "MovieContext",
88 movie_get_name,83 avfilter_default_filter_name,
89 movie_options84 movie_options
90};85};
91 86
libavfilter/version.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
29#include "libavutil/avutil.h"29#include "libavutil/avutil.h"
30 30
31#define LIBAVFILTER_VERSION_MAJOR 231#define LIBAVFILTER_VERSION_MAJOR 2
32#define LIBAVFILTER_VERSION_MINOR 7732#define LIBAVFILTER_VERSION_MINOR 78
33#define LIBAVFILTER_VERSION_MICRO 10033#define LIBAVFILTER_VERSION_MICRO 100
34 34
35#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \35#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
54 {NULL},54 {NULL},
55};55};
56 56
57static const char *ass_get_name(void *ctx)
58{
59 return "ass";
60}
61
62static const AVClass ass_class = {57static const AVClass ass_class = {
63 "AssContext",58 "AssContext",
64 ass_get_name,59 avfilter_default_filter_name,
65 ass_options60 ass_options
66};61};
67 62
libavfilter/vf_blackdetect.c+1−6
@@ -57,14 +57,9 @@ static const AVOption blackdetect_options[] = { · 56 unmodified lines
57 { NULL },57 { NULL },
58};58};
59 59
60static const char *blackdetect_get_name(void *ctx)
61{
62 return "blackdetect";
63}
64
65static const AVClass blackdetect_class = {60static const AVClass blackdetect_class = {
66 .class_name = "BlackDetectContext",61 .class_name = "BlackDetectContext",
67 .item_name = blackdetect_get_name,62 .item_name = avfilter_default_filter_name,
68 .option = blackdetect_options,63 .option = blackdetect_options,
69};64};
70 65
libavfilter/vf_delogo.c+1−6
@@ -149,14 +149,9 @@ static const AVOption delogo_options[]= { · 148 unmodified lines
149 {NULL},149 {NULL},
150};150};
151 151
152static const char *delogo_get_name(void *ctx)
153{
154 return "delogo";
155}
156
157static const AVClass delogo_class = {152static const AVClass delogo_class = {
158 .class_name = "DelogoContext",153 .class_name = "DelogoContext",
159 .item_name = delogo_get_name,154 .item_name = avfilter_default_filter_name,
160 .option = delogo_options,155 .option = delogo_options,
161};156};
162 157
libavfilter/vf_drawtext.c+1−6
@@ -205,14 +205,9 @@ static const AVOption drawtext_options[]= { · 204 unmodified lines
205{NULL},205{NULL},
206};206};
207 207
208static const char *drawtext_get_name(void *ctx)
209{
210 return "drawtext";
211}
212
213static const AVClass drawtext_class = {208static const AVClass drawtext_class = {
214 "DrawTextContext",209 "DrawTextContext",
215 drawtext_get_name,210 avfilter_default_filter_name,
216 drawtext_options211 drawtext_options
217};212};
218 213
libavfilter/vf_fade.c+1−6
@@ -69,14 +69,9 @@ static const AVOption fade_options[] = { · 68 unmodified lines
69 {NULL},69 {NULL},
70};70};
71 71
72static const char *fade_get_name(void *ctx)
73{
74 return "fade";
75}
76
77static const AVClass fade_class = {72static const AVClass fade_class = {
78 "FadeContext",73 "FadeContext",
79 fade_get_name,74 avfilter_default_filter_name,
80 fade_options75 fade_options
81};76};
82 77
libavfilter/vf_fps.c+1−1
@@ -60,7 +60,7 @@ static const AVOption options[] = { · 59 unmodified lines
60 60
61static const AVClass class = {61static const AVClass class = {
62 .class_name = "FPS filter",62 .class_name = "FPS filter",
63 .item_name = av_default_item_name,63 .item_name = avfilter_default_filter_name,
64 .option = options,64 .option = options,
65 .version = LIBAVUTIL_VERSION_INT,65 .version = LIBAVUTIL_VERSION_INT,
66};66};
libavfilter/vf_lut.c+1−6
@@ -89,14 +89,9 @@ static const AVOption lut_options[] = { · 88 unmodified lines
89 {NULL},89 {NULL},
90};90};
91 91
92static const char *lut_get_name(void *ctx)
93{
94 return "lut";
95}
96
97static const AVClass lut_class = {92static const AVClass lut_class = {
98 "LutContext",93 "LutContext",
99 lut_get_name,94 avfilter_default_filter_name,
100 lut_options95 lut_options
101};96};
102 97
libavfilter/vf_overlay.c+1−6
@@ -101,14 +101,9 @@ static const AVOption overlay_options[] = { · 100 unmodified lines
101 {NULL},101 {NULL},
102};102};
103 103
104static const char *overlay_get_name(void *ctx)
105{
106 return "overlay";
107}
108
109static const AVClass overlay_class = {104static const AVClass overlay_class = {
110 "OverlayContext",105 "OverlayContext",
111 overlay_get_name,106 avfilter_default_filter_name,
112 overlay_options107 overlay_options
113};108};
114 109
libavfilter/vsrc_cellauto.c+1−6
@@ -76,14 +76,9 @@ static const AVOption cellauto_options[] = { · 75 unmodified lines
76 { NULL },76 { NULL },
77};77};
78 78
79static const char *cellauto_get_name(void *ctx)
80{
81 return "cellauto";
82}
83
84static const AVClass cellauto_class = {79static const AVClass cellauto_class = {
85 "CellAutoContext",80 "CellAutoContext",
86 cellauto_get_name,81 avfilter_default_filter_name,
87 cellauto_options82 cellauto_options
88};83};
89 84
libavfilter/vsrc_life.c+1−6
@@ -95,14 +95,9 @@ static const AVOption life_options[] = { · 94 unmodified lines
95 { NULL },95 { NULL },
96};96};
97 97
98static const char *life_get_name(void *ctx)
99{
100 return "life";
101}
102
103static const AVClass life_class = {98static const AVClass life_class = {
104 "LifeContext",99 "LifeContext",
105 life_get_name,100 avfilter_default_filter_name,
106 life_options101 life_options
107};102};
108 103
libavfilter/vsrc_mandelbrot.c+1−6
@@ -103,14 +103,9 @@ static const AVOption mandelbrot_options[] = { · 102 unmodified lines
103 {NULL},103 {NULL},
104};104};
105 105
106static const char *mandelbrot_get_name(void *ctx)
107{
108 return "mandelbrot";
109}
110
111static const AVClass mandelbrot_class = {106static const AVClass mandelbrot_class = {
112 "MBContext",107 "MBContext",
113 mandelbrot_get_name,108 avfilter_default_filter_name,
114 mandelbrot_options109 mandelbrot_options
115};110};
116 111
libavfilter/vsrc_mptestsrc.c+1−6
@@ -82,14 +82,9 @@ static const AVOption mptestsrc_options[]= { · 81 unmodified lines
82 { NULL },82 { NULL },
83};83};
84 84
85static const char *mptestsrc_get_name(void *ctx)
86{
87 return "mptestsrc";
88}
89
90static const AVClass mptestsrc_class = {85static const AVClass mptestsrc_class = {
91 "MPTestContext",86 "MPTestContext",
92 mptestsrc_get_name,87 avfilter_default_filter_name,
93 mptestsrc_options88 mptestsrc_options
94};89};
95 90
libavfilter/vsrc_testsrc.c+3−18
@@ -156,14 +156,9 @@ static int request_frame(AVFilterLink *outlink) · 155 unmodified lines
156 156
157#if CONFIG_NULLSRC_FILTER157#if CONFIG_NULLSRC_FILTER
158 158
159static const char *nullsrc_get_name(void *ctx)
160{
161 return "nullsrc";
162}
163
164static const AVClass nullsrc_class = {159static const AVClass nullsrc_class = {
165 .class_name = "NullSourceContext",160 .class_name = "NullSourceContext",
166 .item_name = nullsrc_get_name,161 .item_name = avfilter_default_filter_name,
167 .option = testsrc_options,162 .option = testsrc_options,
168};163};
169 164
@@ -196,14 +191,9 @@ AVFilter avfilter_vsrc_nullsrc = { · 26 unmodified lines
196 191
197#if CONFIG_TESTSRC_FILTER192#if CONFIG_TESTSRC_FILTER
198 193
199static const char *testsrc_get_name(void *ctx)
200{
201 return "testsrc";
202}
203
204static const AVClass testsrc_class = {194static const AVClass testsrc_class = {
205 .class_name = "TestSourceContext",195 .class_name = "TestSourceContext",
206 .item_name = testsrc_get_name,196 .item_name = avfilter_default_filter_name,
207 .option = testsrc_options,197 .option = testsrc_options,
208};198};
209 199
@@ -423,14 +413,9 @@ AVFilter avfilter_vsrc_testsrc = { · 213 unmodified lines
423 413
424#if CONFIG_RGBTESTSRC_FILTER414#if CONFIG_RGBTESTSRC_FILTER
425 415
426static const char *rgbtestsrc_get_name(void *ctx)
427{
428 return "rgbtestsrc";
429}
430
431static const AVClass rgbtestsrc_class = {416static const AVClass rgbtestsrc_class = {
432 .class_name = "RGBTestSourceContext",417 .class_name = "RGBTestSourceContext",
433 .item_name = rgbtestsrc_get_name,418 .item_name = avfilter_default_filter_name,
434 .option = testsrc_options,419 .option = testsrc_options,
435};420};
436 421

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