[FFmpeg-devel] [PATCH 1/7] avformat/dashdec: use av_err2str

Marvin Scholz epirat07 at gmail.com
Wed Apr 2 02:43:30 EEST 2025


There is no need to explicitly specify the buffer, as it
is only ever passed to av_log, so av_err2str can be used.
---
 libavformat/dashenc.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index d4a6fe0304..af92e38bbd 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -277,10 +277,8 @@ static const char *get_extension_str(SegmentType type, int single_file)
 
 static int handle_io_open_error(AVFormatContext *s, int err, char *url) {
     DASHContext *c = s->priv_data;
-    char errbuf[AV_ERROR_MAX_STRING_SIZE];
-    av_strerror(err, errbuf, sizeof(errbuf));
     av_log(s, c->ignore_io_errors ? AV_LOG_WARNING : AV_LOG_ERROR,
-           "Unable to open %s for writing: %s\n", url, errbuf);
+           "Unable to open %s for writing: %s\n", url, av_err2str(err));
     return c->ignore_io_errors ? 0 : err;
 }
 
@@ -1865,9 +1863,8 @@ static void dashenc_delete_file(AVFormatContext *s, char *filename) {
     } else {
         int res = ffurl_delete(filename);
         if (res < 0) {
-            char errbuf[AV_ERROR_MAX_STRING_SIZE];
-            av_strerror(res, errbuf, sizeof(errbuf));
-            av_log(s, (res == AVERROR(ENOENT) ? AV_LOG_WARNING : AV_LOG_ERROR), "failed to delete %s: %s\n", filename, errbuf);
+            av_log(s, (res == AVERROR(ENOENT) ? AV_LOG_WARNING : AV_LOG_ERROR),
+                "failed to delete %s: %s\n", filename, av_err2str(res));
         }
     }
 }
-- 
2.39.5 (Apple Git-154)



More information about the ffmpeg-devel mailing list