[FFmpeg-devel] [PATCH] cmdutils: limit length of file name in errors.
Nicolas George
nicolas.george at normalesup.org
Sun Jul 21 10:58:51 CEST 2013
Useful with the concat protocol where pseudo file names can
be very long.
Fix part of trac ticket #2801.
Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
cmdutils.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/cmdutils.c b/cmdutils.c
index 6eb093d..1344480 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -996,11 +996,15 @@ int opt_opencl(void *optctx, const char *opt, const char *arg)
void print_error(const char *filename, int err)
{
char errbuf[128];
- const char *errbuf_ptr = errbuf;
+ const char *errbuf_ptr = errbuf, *ellipsis = "";
+ const int max_file_length = 512;
if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)
errbuf_ptr = strerror(AVUNERROR(err));
- av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, errbuf_ptr);
+ if (strlen(filename) > max_file_length)
+ ellipsis = "...";
+ av_log(NULL, AV_LOG_ERROR, "%-.*s%s: %s\n",
+ max_file_length, filename, ellipsis, errbuf_ptr);
}
static int warned_cfg = 0;
--
1.7.10.4
More information about the ffmpeg-devel
mailing list