1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Use av_strerror() in print_error().

Originally committed as revision 22696 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Stefano Sabatini 2010-03-26 22:46:47 +00:00
parent 94052341be
commit 7a5bdd79eb

View File

@ -291,39 +291,17 @@ void set_context_opts(void *ctx, void *opts_ctx, int flags)
void print_error(const char *filename, int err) void print_error(const char *filename, int err)
{ {
char errbuf[128];
switch(err) { switch(err) {
case AVERROR_NUMEXPECTED:
fprintf(stderr, "%s: Incorrect image filename syntax.\n"
"Use '%%d' to specify the image number:\n"
" for img1.jpg, img2.jpg, ..., use 'img%%d.jpg';\n"
" for img001.jpg, img002.jpg, ..., use 'img%%03d.jpg'.\n",
filename);
break;
case AVERROR_INVALIDDATA:
fprintf(stderr, "%s: Error while parsing header\n", filename);
break;
case AVERROR_NOFMT:
fprintf(stderr, "%s: Unknown format\n", filename);
break;
case AVERROR(EIO):
fprintf(stderr, "%s: I/O error occurred\n"
"Usually that means that input file is truncated and/or corrupted.\n",
filename);
break;
case AVERROR(ENOMEM):
fprintf(stderr, "%s: memory allocation error occurred\n", filename);
break;
case AVERROR(ENOENT):
fprintf(stderr, "%s: no such file or directory\n", filename);
break;
#if CONFIG_NETWORK #if CONFIG_NETWORK
case AVERROR(FF_NETERROR(EPROTONOSUPPORT)): case AVERROR(FF_NETERROR(EPROTONOSUPPORT)):
fprintf(stderr, "%s: Unsupported network protocol\n", filename); fprintf(stderr, "%s: Unsupported network protocol\n", filename);
break; break;
#endif #endif
default: default:
fprintf(stderr, "%s: Error while opening file\n", filename); av_strerror(err, errbuf, sizeof(errbuf));
break; fprintf(stderr, "%s: %s\n", filename, errbuf);
} }
} }