diff mbox

[FFmpeg-devel] fftools/ffmpeg: replace call to av_strerror with av_err2str

Message ID 1519630802-8012-1-git-send-email-t.rapp@noa-archive.com
State Accepted
Commit fa0c9d69d3d70ab81400c54a7a7d1446c678ef7a
Headers show

Commit Message

Tobias Rapp Feb. 26, 2018, 7:40 a.m. UTC
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
---
 fftools/ffmpeg.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Comments

Jan Ekström Feb. 26, 2018, 6:39 p.m. UTC | #1
On Mon, Feb 26, 2018 at 9:40 AM, Tobias Rapp <t.rapp@noa-archive.com> wrote:
> Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
> ---
>  fftools/ffmpeg.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index 32caa4b..3a45f43 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -2175,10 +2175,7 @@ static int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame)
>
>          ret = reap_filters(1);
>          if (ret < 0 && ret != AVERROR_EOF) {
> -            char errbuf[128];
> -            av_strerror(ret, errbuf, sizeof(errbuf));
> -
> -            av_log(NULL, AV_LOG_ERROR, "Error while filtering: %s\n", errbuf);
> +            av_log(NULL, AV_LOG_ERROR, "Error while filtering: %s\n", av_err2str(ret));
>              return ret;
>          }
>
> @@ -4638,10 +4635,7 @@ static int transcode(void)
>
>          ret = transcode_step();
>          if (ret < 0 && ret != AVERROR_EOF) {
> -            char errbuf[128];
> -            av_strerror(ret, errbuf, sizeof(errbuf));
> -
> -            av_log(NULL, AV_LOG_ERROR, "Error while filtering: %s\n", errbuf);
> +            av_log(NULL, AV_LOG_ERROR, "Error while filtering: %s\n", av_err2str(ret));
>              break;
>          }
>
> --
> 2.7.4

If I recall correctly logging seems to be the use case where this
macro should be used, so this looks good to me after a quick look in
the e-mail client (and simplifies this piece of code).

Jan
Michael Niedermayer Feb. 26, 2018, 11:59 p.m. UTC | #2
On Mon, Feb 26, 2018 at 08:40:02AM +0100, Tobias Rapp wrote:
> Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
> ---
>  fftools/ffmpeg.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)

LGTM

thx

[...]
Tobias Rapp Feb. 27, 2018, 7:38 a.m. UTC | #3
On 26.02.2018 08:40, Tobias Rapp wrote:
> Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
> ---
>   fftools/ffmpeg.c | 10 ++--------
>   1 file changed, 2 insertions(+), 8 deletions(-)
> 
> [...]

Pushed. Thanks Jan and Michael for review.

Regards,
Tobias
diff mbox

Patch

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 32caa4b..3a45f43 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2175,10 +2175,7 @@  static int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame)
 
         ret = reap_filters(1);
         if (ret < 0 && ret != AVERROR_EOF) {
-            char errbuf[128];
-            av_strerror(ret, errbuf, sizeof(errbuf));
-
-            av_log(NULL, AV_LOG_ERROR, "Error while filtering: %s\n", errbuf);
+            av_log(NULL, AV_LOG_ERROR, "Error while filtering: %s\n", av_err2str(ret));
             return ret;
         }
 
@@ -4638,10 +4635,7 @@  static int transcode(void)
 
         ret = transcode_step();
         if (ret < 0 && ret != AVERROR_EOF) {
-            char errbuf[128];
-            av_strerror(ret, errbuf, sizeof(errbuf));
-
-            av_log(NULL, AV_LOG_ERROR, "Error while filtering: %s\n", errbuf);
+            av_log(NULL, AV_LOG_ERROR, "Error while filtering: %s\n", av_err2str(ret));
             break;
         }