Message ID | 20200317213147.1140-2-andreas.rheinhardt@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [FFmpeg-devel,1/2] avcodec/bsf: Don't set defaults for AVClass without options | expand |
Context | Check | Description |
---|---|---|
andriy/ffmpeg-patchwork | success | Make fate finished |
Quoting Andreas Rheinhardt (2020-03-17 22:31:47) > Up until now, the name of every AVBSFContext for logging purposes was > "AVBSFContext", so that the default logging callback produced output > like "[AVBSFContext @ 0x55813bae92c0] Extradata". This has been changed > to "[trace_headers @ 0x60a000000700] Extradata" by adding an item_name- > function to the AVClass for bitstream filters. > > Furthermore, the correct category has been set so that the introductory > part before the actual message (everything before "Extradata" in the > above examples) are displayed in a different colour than the rest. > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> > --- Looks ok.
On 3/18/2020 10:44 AM, Anton Khirnov wrote: > Quoting Andreas Rheinhardt (2020-03-17 22:31:47) >> Up until now, the name of every AVBSFContext for logging purposes was >> "AVBSFContext", so that the default logging callback produced output >> like "[AVBSFContext @ 0x55813bae92c0] Extradata". This has been changed >> to "[trace_headers @ 0x60a000000700] Extradata" by adding an item_name- >> function to the AVClass for bitstream filters. >> >> Furthermore, the correct category has been set so that the introductory >> part before the actual message (everything before "Extradata" in the >> above examples) are displayed in a different colour than the rest. >> >> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> >> --- > > Looks ok. Applied.
diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c index d0e0d46068..7b96183e64 100644 --- a/libavcodec/bsf.c +++ b/libavcodec/bsf.c @@ -64,12 +64,18 @@ static void *bsf_child_next(void *obj, void *prev) return NULL; } +static const char *bsf_to_name(void *bsf) +{ + return ((AVBSFContext *)bsf)->filter->name; +} + static const AVClass bsf_class = { .class_name = "AVBSFContext", - .item_name = av_default_item_name, + .item_name = bsf_to_name, .version = LIBAVUTIL_VERSION_INT, .child_next = bsf_child_next, .child_class_next = ff_bsf_child_class_next, + .category = AV_CLASS_CATEGORY_BITSTREAM_FILTER, }; const AVClass *av_bsf_get_class(void)
Up until now, the name of every AVBSFContext for logging purposes was "AVBSFContext", so that the default logging callback produced output like "[AVBSFContext @ 0x55813bae92c0] Extradata". This has been changed to "[trace_headers @ 0x60a000000700] Extradata" by adding an item_name- function to the AVClass for bitstream filters. Furthermore, the correct category has been set so that the introductory part before the actual message (everything before "Extradata" in the above examples) are displayed in a different colour than the rest. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> --- libavcodec/bsf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)