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 | int ret; | 149 | int ret; |
| 150 | 150 | ||
| 151 | if ((ret = avio_open2(&out, filename, AVIO_FLAG_WRITE, NULL, NULL)) < 0) { | 151 | if ((ret = avio_open2(&out, filename, AVIO_FLAG_WRITE, NULL, NULL)) < 0) { |
| 152 | char errbuf[100]; | 152 | fprintf(stderr, "Unable to open %s: %s\n", filename, av_err2str(ret)); |
| 153 | av_strerror(ret, errbuf, sizeof(errbuf)); | ||
| 154 | fprintf(stderr, "Unable to open %s: %s\n", filename, errbuf); | ||
| 155 | return ret; | 153 | return ret; |
| 156 | } | 154 | } |
| 157 | ret = copy_tag(in, out, MKBETAG('m', 'o', 'o', 'f')); | 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 | AVFormatContext *ctx = NULL; | 499 | AVFormatContext *ctx = NULL; |
| 502 | int err = 0, i, orig_tracks = tracks->nb_tracks; | 500 | int err = 0, i, orig_tracks = tracks->nb_tracks; |
| 503 | char errbuf[50], *ptr; | 501 | char *ptr; |
| 504 | struct Track *track; | 502 | struct Track *track; |
| 505 | 503 | ||
| 506 | err = avformat_open_input(&ctx, file, NULL, NULL); | 504 | err = avformat_open_input(&ctx, file, NULL, NULL); |
| 507 | if (err < 0) { | 505 | if (err < 0) { |
| 508 | av_strerror(err, errbuf, sizeof(errbuf)); | 506 | fprintf(stderr, "Unable to open %s: %s\n", file, av_err2str(err)); |
| 509 | fprintf(stderr, "Unable to open %s: %s\n", file, errbuf); | ||
| 510 | return 1; | 507 | return 1; |
| 511 | } | 508 | } |
| 512 | 509 | ||
| 513 | err = avformat_find_stream_info(ctx, NULL); | 510 | err = avformat_find_stream_info(ctx, NULL); |
| 514 | if (err < 0) { | 511 | if (err < 0) { |
| 515 | av_strerror(err, errbuf, sizeof(errbuf)); | 512 | fprintf(stderr, "Unable to identify %s: %s\n", file, av_err2str(err)); |
| 516 | fprintf(stderr, "Unable to identify %s: %s\n", file, errbuf); | ||
| 517 | goto fail; | 513 | goto fail; |
| 518 | } | 514 | } |
| 519 | 515 | ||