[FFmpeg-devel] [PATCH] Add memory dumper function av_log_dump().
Michael Niedermayer
michaelni at gmx.at
Sat Sep 24 23:40:53 CEST 2011
On Sat, Sep 24, 2011 at 11:28:48PM +0200, Clément Bœsch wrote:
> From: joolzg <joolzg at btinternet.com>
>
> ---
> Here is a patch from Julian Gardner, with a small cleanup (style mainly). I
> didn't test it nor I did a proper review. Another more interesting patch is
> incoming.
> ---
> libavutil/avutil.h | 2 +-
> libavutil/log.c | 27 +++++++++++++++++++++++++++
> libavutil/log.h | 3 +++
> 3 files changed, 31 insertions(+), 1 deletions(-)
>
> diff --git a/libavutil/avutil.h b/libavutil/avutil.h
> index 3d46365..dde9d43 100644
> --- a/libavutil/avutil.h
> +++ b/libavutil/avutil.h
> @@ -40,7 +40,7 @@
> #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
>
> #define LIBAVUTIL_VERSION_MAJOR 51
> -#define LIBAVUTIL_VERSION_MINOR 17
> +#define LIBAVUTIL_VERSION_MINOR 18
> #define LIBAVUTIL_VERSION_MICRO 0
>
> #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
> diff --git a/libavutil/log.c b/libavutil/log.c
> index fd5e2cb..7c59c12 100644
> --- a/libavutil/log.c
> +++ b/libavutil/log.c
> @@ -169,3 +169,30 @@ void av_log_set_callback(void (*callback)(void*, int, const char*, va_list))
> {
> av_log_callback = callback;
> }
> +
> +void av_log_dump(void *avcl, int level, const unsigned char *data, int size)
> +{
> + long address = 0;
maybe address should be passed as argument to the function
> +
> + av_log(avcl, level, "HexDump (%p %d)\n", data, size);
> + if (data) {
> + while (size) {
> + int size2 = FFMIN(size, 16);
> + int l;
> +
> + av_log(avcl, level, "%08lx:", address);
> + for (l = 0; l < size2; l++)
> + av_log(avcl, level, "%02x ", data[l]);
> + while (l < 16) {
> + av_log(avcl, level, " ");
> + l++;
> + }
id write it as
for (; l < 16; l++)
av_log(avcl, level, " ");
for consistency with the previous but its bikeshed so ignore me if you
dont agree
except these, LGTM
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110924/5ac22c82/attachment.asc>
More information about the ffmpeg-devel
mailing list