Skip to content

Commit d0bcf62

Browse files
committed
tools/aviocat: use av_err2str
There is no need to explicitly specify the buffer, as it is only ever passed to fprintf, so av_err2str can be used.
1 parent da38b2f commit d0bcf62

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

tools/aviocat.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ int main(int argc, char **argv)
3737
const char *input_url = NULL, *output_url = NULL;
3838
int64_t stream_pos = 0;
3939
int64_t start_time;
40-
char errbuf[50];
4140
AVIOContext *input, *output;
4241
AVDictionary *in_opts = NULL;
4342
AVDictionary *out_opts = NULL;
@@ -80,8 +79,7 @@ int main(int argc, char **argv)
8079

8180
ret = avio_open2(&input, input_url, AVIO_FLAG_READ, NULL, &in_opts);
8281
if (ret) {
83-
av_strerror(ret, errbuf, sizeof(errbuf));
84-
fprintf(stderr, "Unable to open %s: %s\n", input_url, errbuf);
82+
fprintf(stderr, "Unable to open %s: %s\n", input_url, av_err2str(ret));
8583
return 1;
8684
}
8785
if (verbose) {
@@ -95,16 +93,14 @@ int main(int argc, char **argv)
9593
if (duration && !bps) {
9694
int64_t size = avio_size(input);
9795
if (size < 0) {
98-
av_strerror(ret, errbuf, sizeof(errbuf));
99-
fprintf(stderr, "Unable to get size of %s: %s\n", input_url, errbuf);
96+
fprintf(stderr, "Unable to get size of %s: %s\n", input_url, av_err2str(ret));
10097
goto fail;
10198
}
10299
bps = size / duration;
103100
}
104101
ret = avio_open2(&output, output_url, AVIO_FLAG_WRITE, NULL, &out_opts);
105102
if (ret) {
106-
av_strerror(ret, errbuf, sizeof(errbuf));
107-
fprintf(stderr, "Unable to open %s: %s\n", output_url, errbuf);
103+
fprintf(stderr, "Unable to open %s: %s\n", output_url, av_err2str(ret));
108104
goto fail;
109105
}
110106

@@ -117,8 +113,7 @@ int main(int argc, char **argv)
117113
break;
118114
avio_write(output, buf, n);
119115
if (output->error) {
120-
av_strerror(output->error, errbuf, sizeof(errbuf));
121-
fprintf(stderr, "Unable to write %s: %s\n", output_url, errbuf);
116+
fprintf(stderr, "Unable to write %s: %s\n", output_url, av_err2str(output->error));
122117
break;
123118
}
124119
stream_pos += n;

0 commit comments

Comments
 (0)