Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/APIchanges
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
The last version increases of all libraries were on 2025-03-28

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the FFmpeg mailing list, Andreas Rheinhardt wrote (reply to this):

softworkz:
> From: softworkz <[email protected]>
> 
> which is controls prefix formatting. With this flag set, the prefix is
> printed without the memory address, otherwise it is included.
> 
> Signed-off-by: softworkz <[email protected]>
> ---
>  doc/APIchanges      | 3 +++
>  libavutil/log.c     | 6 ++++--
>  libavutil/log.h     | 5 +++++
>  libavutil/version.h | 2 +-
>  4 files changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 65bf5a9419..db832f8b19 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -1,5 +1,8 @@
>  The last version increases of all libraries were on 2025-03-28
>  
> +2025-03-xx - xxxxxxxxxx - lavu 60.2.100 - log.h
> +  Add flag AV_LOG_NO_PRINT_MEMADDRESS
> +
>  API changes, most recent first:
>  
>  2025-04-07 - 19e9a203b7 - lavu 60.01.100 - dict.h
> diff --git a/libavutil/log.c b/libavutil/log.c
> index c5ee876a88..1949a797e7 100644
> --- a/libavutil/log.c
> +++ b/libavutil/log.c
> @@ -327,16 +327,18 @@ static void format_line(void *avcl, int level, const char *fmt, va_list vl,
>  
>      if(type) type[0] = type[1] = AV_CLASS_CATEGORY_NA + 16;
>      if (*print_prefix && avc) {
> +        const char *p_fmt = flags & AV_LOG_NO_PRINT_MEMADDRESS ? "[%s] " : "[%s @ %p] ";
> +
>          if (avc->parent_log_context_offset) {
>              AVClass** parent = *(AVClass ***) (((uint8_t *) avcl) +
>                                     avc->parent_log_context_offset);
>              if (parent && *parent) {
> -                av_bprintf(part+0, "[%s @ %p] ",
> +                av_bprintf(part+0, p_fmt,
>                             item_name(parent, *parent), parent);
>                  if(type) type[0] = get_category(parent);
>              }
>          }
> -        av_bprintf(part+1, "[%s @ %p] ",
> +        av_bprintf(part+1, p_fmt,
>                     item_name(avcl, avc), avcl);
>          if(type) type[1] = get_category(avcl);
>      }
> diff --git a/libavutil/log.h b/libavutil/log.h
> index dd094307ce..499c5d71ab 100644
> --- a/libavutil/log.h
> +++ b/libavutil/log.h
> @@ -416,6 +416,11 @@ int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl,
>   */
>  #define AV_LOG_PRINT_DATETIME 8
>  
> +/**
> + * Do not print memory addresses of context instances.
> + */
> +#define AV_LOG_NO_PRINT_MEMADDRESS 16
> +
>  void av_log_set_flags(int arg);
>  int av_log_get_flags(void);
>  
> diff --git a/libavutil/version.h b/libavutil/version.h
> index 5139883569..4717cd562b 100644
> --- a/libavutil/version.h
> +++ b/libavutil/version.h
> @@ -79,7 +79,7 @@
>   */
>  
>  #define LIBAVUTIL_VERSION_MAJOR  60
> -#define LIBAVUTIL_VERSION_MINOR   1
> +#define LIBAVUTIL_VERSION_MINOR   2
>  #define LIBAVUTIL_VERSION_MICRO 100
>  
>  #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

The commit message needs an update.

- Andreas

_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the FFmpeg mailing list, "softworkz ." wrote (reply to this):



> -----Original Message-----
> From: ffmpeg-devel <[email protected]> On Behalf Of
> Andreas Rheinhardt
> Sent: Donnerstag, 10. April 2025 09:39
> To: [email protected]
> Subject: Re: [FFmpeg-devel] [PATCH v10 1/3] avutil/log: Add log flag
> AV_LOG_PRINT_MEMADDRESSES
> 
> softworkz:
> > From: softworkz <[email protected]>
> >
> > which is controls prefix formatting. With this flag set, the prefix is
> > printed without the memory address, otherwise it is included.
> >
> > Signed-off-by: softworkz <[email protected]>
> > ---
> >  doc/APIchanges      | 3 +++
> >  libavutil/log.c     | 6 ++++--
> >  libavutil/log.h     | 5 +++++
> >  libavutil/version.h | 2 +-
> >  4 files changed, 13 insertions(+), 3 deletions(-)
> >
> > diff --git a/doc/APIchanges b/doc/APIchanges
> > index 65bf5a9419..db832f8b19 100644
> > --- a/doc/APIchanges
> > +++ b/doc/APIchanges
> > @@ -1,5 +1,8 @@
> >  The last version increases of all libraries were on 2025-03-28
> >
> > +2025-03-xx - xxxxxxxxxx - lavu 60.2.100 - log.h
> > +  Add flag AV_LOG_NO_PRINT_MEMADDRESS
> > +
> >  API changes, most recent first:
> >
> >  2025-04-07 - 19e9a203b7 - lavu 60.01.100 - dict.h
> > diff --git a/libavutil/log.c b/libavutil/log.c
> > index c5ee876a88..1949a797e7 100644
> > --- a/libavutil/log.c
> > +++ b/libavutil/log.c
> > @@ -327,16 +327,18 @@ static void format_line(void *avcl, int level,
> const char *fmt, va_list vl,
> >
> >      if(type) type[0] = type[1] = AV_CLASS_CATEGORY_NA + 16;
> >      if (*print_prefix && avc) {
> > +        const char *p_fmt = flags & AV_LOG_NO_PRINT_MEMADDRESS ?
> "[%s] " : "[%s @ %p] ";
> > +
> >          if (avc->parent_log_context_offset) {
> >              AVClass** parent = *(AVClass ***) (((uint8_t *) avcl) +
> >                                     avc->parent_log_context_offset);
> >              if (parent && *parent) {
> > -                av_bprintf(part+0, "[%s @ %p] ",
> > +                av_bprintf(part+0, p_fmt,
> >                             item_name(parent, *parent), parent);
> >                  if(type) type[0] = get_category(parent);
> >              }
> >          }
> > -        av_bprintf(part+1, "[%s @ %p] ",
> > +        av_bprintf(part+1, p_fmt,
> >                     item_name(avcl, avc), avcl);
> >          if(type) type[1] = get_category(avcl);
> >      }
> > diff --git a/libavutil/log.h b/libavutil/log.h
> > index dd094307ce..499c5d71ab 100644
> > --- a/libavutil/log.h
> > +++ b/libavutil/log.h
> > @@ -416,6 +416,11 @@ int av_log_format_line2(void *ptr, int level,
> const char *fmt, va_list vl,
> >   */
> >  #define AV_LOG_PRINT_DATETIME 8
> >
> > +/**
> > + * Do not print memory addresses of context instances.
> > + */
> > +#define AV_LOG_NO_PRINT_MEMADDRESS 16
> > +
> >  void av_log_set_flags(int arg);
> >  int av_log_get_flags(void);
> >
> > diff --git a/libavutil/version.h b/libavutil/version.h
> > index 5139883569..4717cd562b 100644
> > --- a/libavutil/version.h
> > +++ b/libavutil/version.h
> > @@ -79,7 +79,7 @@
> >   */
> >
> >  #define LIBAVUTIL_VERSION_MAJOR  60
> > -#define LIBAVUTIL_VERSION_MINOR   1
> > +#define LIBAVUTIL_VERSION_MINOR   2
> >  #define LIBAVUTIL_VERSION_MICRO 100
> >
> >  #define LIBAVUTIL_VERSION_INT
> AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
> 
> The commit message needs an update.
> 
> - Andreas
> 
> _______________________________________________

Thanks! Fixed locally.


_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".


2025-03-xx - xxxxxxxxxx - lavu 60.4.100 - log.h
Add flag AV_LOG_PRINT_MEMADDRESS

API changes, most recent first:

2025-05-21 - xxxxxxxxxx - lavu 60.3.100 - avassert.h
Expand Down
2 changes: 2 additions & 0 deletions doc/fftools-common-opts.texi
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ log to file.
Indicates that log lines should be prefixed with time information.
@item datetime
Indicates that log lines should be prefixed with date and time information.
@item mem
Indicates that context prefixes should be printed with memory address.
@end table
Flags can also be used alone by adding a '+'/'-' prefix to set/reset a single
flag without affecting other @var{flags} or changing @var{loglevel}. When
Expand Down
7 changes: 7 additions & 0 deletions fftools/opt_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1301,6 +1301,12 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg)
} else {
flags |= AV_LOG_PRINT_DATETIME;
}
} else if (av_strstart(token, "mem", &arg)) {
if (cmd == '-') {
flags &= ~AV_LOG_PRINT_MEMADDRESS;
} else {
flags |= AV_LOG_PRINT_MEMADDRESS;
}
} else {
break;
}
Expand Down Expand Up @@ -1332,6 +1338,7 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg)
av_log(NULL, AV_LOG_FATAL, "\"level\"\n");
av_log(NULL, AV_LOG_FATAL, "\"time\"\n");
av_log(NULL, AV_LOG_FATAL, "\"datetime\"\n");
av_log(NULL, AV_LOG_FATAL, "\"mem\"\n");
return AVERROR(EINVAL);
}

Expand Down
6 changes: 4 additions & 2 deletions libavutil/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,16 +328,18 @@ static void format_line(void *avcl, int level, const char *fmt, va_list vl,

if(type) type[0] = type[1] = AV_CLASS_CATEGORY_NA + 16;
if (*print_prefix && avc) {
const char *p_fmt = flags & AV_LOG_PRINT_MEMADDRESS ? "[%s @ %p] " : "[%s] ";

if (avc->parent_log_context_offset) {
AVClass** parent = *(AVClass ***) (((uint8_t *) avcl) +
avc->parent_log_context_offset);
if (parent && *parent) {
av_bprintf(part+0, "[%s @ %p] ",
av_bprintf(part+0, p_fmt,
item_name(parent, *parent), parent);
if(type) type[0] = get_category(parent);
}
}
av_bprintf(part+1, "[%s @ %p] ",
av_bprintf(part+1, p_fmt,
item_name(avcl, avc), avcl);
if(type) type[1] = get_category(avcl);
}
Expand Down
5 changes: 5 additions & 0 deletions libavutil/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,11 @@ int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl,
*/
#define AV_LOG_PRINT_DATETIME 8

/**
* Print memory addresses of context instances.
*/
#define AV_LOG_PRINT_MEMADDRESS 16

void av_log_set_flags(int arg);
int av_log_get_flags(void);

Expand Down
2 changes: 1 addition & 1 deletion libavutil/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
*/

#define LIBAVUTIL_VERSION_MAJOR 60
#define LIBAVUTIL_VERSION_MINOR 3
#define LIBAVUTIL_VERSION_MINOR 4
#define LIBAVUTIL_VERSION_MICRO 100

#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
Expand Down