[FFmpeg-devel] [PATCH v5 1/2] libavutil/log: Add capability to prefix loglines with current time or current date+time
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Tue Aug 10 18:32:31 EEST 2021
Soft Works:
> Signed-off-by: softworkz <softworkz at hotmail.com>
> ---
> doc/APIchanges | 3 +++
> libavutil/log.c | 35 ++++++++++++++++++++++++++++++-----
> libavutil/log.h | 10 ++++++++++
> libavutil/version.h | 2 +-
> 4 files changed, 44 insertions(+), 6 deletions(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 6eefc7fc33..be707314f3 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -14,6 +14,9 @@ libavutil: 2021-04-27
>
> API changes, most recent first:
>
> +2021-08-09 - xxxxxxxxxx - lavu 57.4.100 - log.h
> + Add new defines: AV_LOG_PRINT_TIME and AV_LOG_PRINT_DATETIME
Add new logging flags
> +
> 2021-08-02 - xxxxxxxxxx - lavc 59.4.100 - packet.h
> Add AVPacket.opaque, AVPacket.opaque_ref, AVPacket.time_base.
>
> diff --git a/libavutil/log.c b/libavutil/log.c
> index 66defa9c42..34af1da60c 100644
> --- a/libavutil/log.c
> +++ b/libavutil/log.c
> static void format_line(void *avcl, int level, const char *fmt, va_list vl,
> - AVBPrint part[4], int *print_prefix, int type[2])
> + AVBPrint part[5], int *print_prefix, int type[2])
> {
> - AVClass* avc = avcl ? *(AVClass **) avcl : NULL;
> + AVClass *avc = avcl ? *(AVClass **) avcl : NULL;
> av_bprint_init(part+0, 0, AV_BPRINT_SIZE_AUTOMATIC);
> av_bprint_init(part+1, 0, AV_BPRINT_SIZE_AUTOMATIC);
> av_bprint_init(part+2, 0, AV_BPRINT_SIZE_AUTOMATIC);
> av_bprint_init(part+3, 0, 65536);
> + av_bprint_init(part+4, 0, AV_BPRINT_SIZE_AUTOMATIC);
>
> if(type) type[0] = type[1] = AV_CLASS_CATEGORY_NA + 16;
> if (*print_prefix && avc) {
> if (avc->parent_log_context_offset) {
> - AVClass** parent = *(AVClass ***) (((uint8_t *) avcl) +
> + AVClass **parent = *(AVClass ***) (((uint8_t *) avcl) +
Nicolas wanted you to not add new code with the * not attached to the
variable; he did not ask you to change existing code in the same patch.
Spurious changes are frowned upon, as they impair reviewability.
> avc->parent_log_context_offset);
> if (parent && *parent) {
> av_bprintf(part+0, "[%s @ %p] ",
- Andreas
More information about the ffmpeg-devel
mailing list