The snippet is:
if ((ret = av->codec_open2(c, codec, NULL)) < 0) {
char buf[1024];
av->strerror(ret, buf, 1024);
fprintf(stderr, "Could not open codec: %s\n", buf);
return false;
}
The av->strerror is a pointer that dynamically gets linked to
av_strerror (the app is C++ and this loosely couples the library so that
it is easy to change versions). I've looked at av_strerror() in the
libav source and since -22 doesn't fall into the predefined macro error
messages numbers, it punts and puts out a meaningless "Error number %d
occurred". Here is the av_strerror source:
int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
{
int ret = 0;
const char *errstr = NULL;
switch (errnum) {
case AVERROR_BSF_NOT_FOUND: errstr = "Bitstream filter not
found" ; break;
case AVERROR_DECODER_NOT_FOUND: errstr = "Decoder not
found" ; break;
case AVERROR_DEMUXER_NOT_FOUND: errstr = "Demuxer not
found" ; break;
case AVERROR_ENCODER_NOT_FOUND: errstr = "Encoder not
found" ; break;
case AVERROR_EOF: errstr = "End of
file" ; break;
case AVERROR_EXIT: errstr = "Immediate exit
requested" ; break;
case AVERROR_FILTER_NOT_FOUND: errstr = "Filter not
found" ; break;
case AVERROR_INVALIDDATA: errstr = "Invalid data found when
processing input" ; break;
case AVERROR_MUXER_NOT_FOUND: errstr = "Muxer not
found" ; break;
case AVERROR_OPTION_NOT_FOUND: errstr = "Option not
found" ; break;
case AVERROR_PATCHWELCOME: errstr = "Not yet implemented in
Libav, patches welcome"; break;
case AVERROR_PROTOCOL_NOT_FOUND:errstr = "Protocol not
found" ; break;
case AVERROR_STREAM_NOT_FOUND: errstr = "Stream not
found" ; break;
case AVERROR_BUG: errstr = "Bug detected, please
report the issue" ; break;
case AVERROR_UNKNOWN: errstr = "Unknown error
occurred" ; break;
case AVERROR_EXPERIMENTAL: errstr = "Experimental
feature" ; break;
}
if (errstr) {
av_strlcpy(errbuf, errstr, errbuf_size);
} else {
#if HAVE_STRERROR_R
ret = strerror_r(AVUNERROR(errnum), errbuf, errbuf_size);
#else
ret = -1;
#endif
if (ret < 0)
snprintf(errbuf, errbuf_size, "Error number %d occurred",
errnum);
}
return ret;
}
So now I'm backtracking the code through codec_open2 to see where it fails.
thanks,
Snippet
On 7/25/2014 2:57 AM, Luca Barbato wrote:
On 23/07/14 18:31, Mike Lockhart wrote:
Hi,
I am using libav to encode audio/video and have started seeing the call
to codec_open2 fail when it has worked for several months. I'm not sure
what the -22 means and calling strerror() returns the useless message
"Error number -22 occurred".
So I'm not sure what to do to fix this.
Does anyone know what -22 means?
av_strerror should print it. if you are on an OS with non-negative error
numbers strerror would have problems.
The snippet seems missing btw.
lu
_______________________________________________
libav-api mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-api
--
Mike Lockhart
c: (435) 757-9905
Mountain Time USA
/Surge <http://www.surgeforward.com>
surgeforward.com <http://www.surgeforward.com>
/
_______________________________________________
libav-api mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-api