There is no need to explicitly specify the buffer, as it is only ever passed to fprintf, so av_err2str can be used.
Unified · Split
| @@ -149,9 +149,7 @@ static int write_fragment(const char *filename, AVIOContext *in) · 148 unmodified lines | ||
| 149 | 149 | int ret; |
| 150 | 150 | |
| 151 | 151 | if ((ret = avio_open2(&out, filename, AVIO_FLAG_WRITE, NULL, NULL)) < 0) { |
| 152 | − char errbuf[100]; | |
| 153 | − av_strerror(ret, errbuf, sizeof(errbuf)); | |
| 154 | − fprintf(stderr, "Unable to open %s: %s\n", filename, errbuf); | |
| 152 | + fprintf(stderr, "Unable to open %s: %s\n", filename, av_err2str(ret)); | |
| 155 | 153 | return ret; |
| 156 | 154 | } |
| 157 | 155 | ret = copy_tag(in, out, MKBETAG('m', 'o', 'o', 'f')); |
| @@ -500,20 +498,18 @@ static int handle_file(struct Tracks *tracks, const char *file, int split, · 342 unmodified lines | ||
| 500 | 498 | { |
| 501 | 499 | AVFormatContext *ctx = NULL; |
| 502 | 500 | int err = 0, i, orig_tracks = tracks->nb_tracks; |
| 503 | − char errbuf[50], *ptr; | |
| 501 | + char *ptr; | |
| 504 | 502 | struct Track *track; |
| 505 | 503 | |
| 506 | 504 | err = avformat_open_input(&ctx, file, NULL, NULL); |
| 507 | 505 | if (err < 0) { |
| 508 | − av_strerror(err, errbuf, sizeof(errbuf)); | |
| 509 | − fprintf(stderr, "Unable to open %s: %s\n", file, errbuf); | |
| 506 | + fprintf(stderr, "Unable to open %s: %s\n", file, av_err2str(err)); | |
| 510 | 507 | return 1; |
| 511 | 508 | } |
| 512 | 509 | |
| 513 | 510 | err = avformat_find_stream_info(ctx, NULL); |
| 514 | 511 | if (err < 0) { |
| 515 | − av_strerror(err, errbuf, sizeof(errbuf)); | |
| 516 | − fprintf(stderr, "Unable to identify %s: %s\n", file, errbuf); | |
| 512 | + fprintf(stderr, "Unable to identify %s: %s\n", file, av_err2str(err)); | |
| 517 | 513 | goto fail; |
| 518 | 514 | } |
| 519 | 515 | |