Re: [libav-devel] [PATCH] avconv: report the error for codec open failure

2013-06-20 Thread Luca Barbato
On 06/20/2013 07:29 AM, Anton Khirnov wrote:
 I think av_strerror already falls back to strerror, so there should be no need
 for this.

It fallsback using strerror_r that might or might not present, we are
using the same pattern in other part of avconv.

Do you prefer dropping it everywhere or factor it in cmdutil ?

lu
 

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] avconv: report the error for codec open failure

2013-06-20 Thread Anton Khirnov

On Thu, 20 Jun 2013 10:09:17 +0200, Luca Barbato lu_z...@gentoo.org wrote:
 On 06/20/2013 07:29 AM, Anton Khirnov wrote:
  I think av_strerror already falls back to strerror, so there should be no 
  need
  for this.
 
 It fallsback using strerror_r that might or might not present, we are
 using the same pattern in other part of avconv.
 
 Do you prefer dropping it everywhere or factor it in cmdutil ?
 

How many relevant platforms have strerror, but not strerror_r?
I'd drop strerror from avconv.

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] avconv: report the error for codec open failure

2013-06-19 Thread Luca Barbato
External codec may have corner case reason to fail at init, better
report them instead having the user wonder.
---

This helped a lot debugging why the QSV failed to init when running
avconv through ssh on windows (yes I do such stuff).

 avconv.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/avconv.c b/avconv.c
index 4808235..8ef1495 100644
--- a/avconv.c
+++ b/avconv.c
@@ -1371,10 +1371,16 @@ static int init_input_stream(int ist_index, char 
*error, int error_len)
 if (!av_dict_get(ist-opts, threads, NULL, 0))
 av_dict_set(ist-opts, threads, auto, 0);
 if ((ret = avcodec_open2(ist-st-codec, codec, ist-opts))  0) {
+char errbuf[128];
+const char *errbuf_ptr = errbuf;
 if (ret == AVERROR_EXPERIMENTAL)
 abort_codec_experimental(codec, 0);
-snprintf(error, error_len, Error while opening decoder for input 
stream #%d:%d,
-ist-file_index, ist-st-index);
+if (av_strerror(ret, errbuf, sizeof(errbuf))  0)
+errbuf_ptr = strerror(AVUNERROR(ret));
+
+snprintf(error, error_len,
+ Error while opening decoder for input stream #%d:%d : 
%s,
+ ist-file_index, ist-st-index, errbuf_ptr);
 return ret;
 }
 assert_avoptions(ist-opts);
--
1.8.2.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] avconv: report the error for codec open failure

2013-06-19 Thread Anton Khirnov

On Thu, 20 Jun 2013 00:08:36 +0200, Luca Barbato lu_z...@gentoo.org wrote:
 External codec may have corner case reason to fail at init, better
 report them instead having the user wonder.
 ---
 
 This helped a lot debugging why the QSV failed to init when running
 avconv through ssh on windows (yes I do such stuff).
 
  avconv.c | 10 --
  1 file changed, 8 insertions(+), 2 deletions(-)
 
 diff --git a/avconv.c b/avconv.c
 index 4808235..8ef1495 100644
 --- a/avconv.c
 +++ b/avconv.c
 @@ -1371,10 +1371,16 @@ static int init_input_stream(int ist_index, char 
 *error, int error_len)
  if (!av_dict_get(ist-opts, threads, NULL, 0))
  av_dict_set(ist-opts, threads, auto, 0);
  if ((ret = avcodec_open2(ist-st-codec, codec, ist-opts))  0) {
 +char errbuf[128];
 +const char *errbuf_ptr = errbuf;
  if (ret == AVERROR_EXPERIMENTAL)
  abort_codec_experimental(codec, 0);
 -snprintf(error, error_len, Error while opening decoder for 
 input stream #%d:%d,
 -ist-file_index, ist-st-index);
 +if (av_strerror(ret, errbuf, sizeof(errbuf))  0)
 +errbuf_ptr = strerror(AVUNERROR(ret));

I think av_strerror already falls back to strerror, so there should be no need
for this.

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel