From 1160c79015273ee850eb0a350d77480baef2fa52 Mon Sep 17 00:00:00 2001
From: Christian Vogel <vogelchr@vogel.cx>
Date: Mon, 9 Apr 2012 21:03:01 +0200
Subject: [PATCH] filter ctrl chars on dump
---
libavformat/utils.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index ebf34de..48d52b6 100644
|
a
|
b
|
static void print_fps(double d, const char *postfix){ |
| 3623 | 3623 | else av_log(NULL, AV_LOG_INFO, ", %1.0fk %s", d/1000, postfix); |
| 3624 | 3624 | } |
| 3625 | 3625 | |
| | 3626 | /* sometimes control-characters are hidden in files' metadata, make sure |
| | 3627 | * they are not dumped to stdout, messing up the console */ |
| | 3628 | |
| | 3629 | static void dump_md_clean(char *s,int len){ |
| | 3630 | while(len){ |
| | 3631 | if(*s > 0 && *s < 32) |
| | 3632 | *s='?'; |
| | 3633 | len--; |
| | 3634 | s++; |
| | 3635 | } |
| | 3636 | } |
| | 3637 | |
| 3626 | 3638 | static void dump_metadata(void *ctx, AVDictionary *m, const char *indent) |
| 3627 | 3639 | { |
| 3628 | 3640 | if(m && !(m->count == 1 && av_dict_get(m, "language", NULL, 0))){ |
| … |
… |
static void dump_metadata(void *ctx, AVDictionary *m, const char *indent) |
| 3637 | 3649 | char tmp[256]; |
| 3638 | 3650 | size_t len = strcspn(p, "\xd\xa"); |
| 3639 | 3651 | av_strlcpy(tmp, p, FFMIN(sizeof(tmp), len+1)); |
| | 3652 | dump_md_clean(tmp,len); |
| 3640 | 3653 | av_log(ctx, AV_LOG_INFO, "%s", tmp); |
| 3641 | 3654 | p += len; |
| 3642 | 3655 | if (*p == 0xd) av_log(ctx, AV_LOG_INFO, " "); |