有谁知道AVERROR含义列表在哪里?像
这样的东西-1: reason A
-2: reason B
等等?
答案 0 :(得分:7)
您可以使用av_strerror()
来获取错误代码的字符串表示。
如果您只想查找,可以参考libavutil/error.c和libavutil/error.h的文档。
答案 1 :(得分:5)
你走了(取自libavutil/error.c):
{ ERROR_TAG(BSF_NOT_FOUND), "Bitstream filter not found" },
{ ERROR_TAG(BUG), "Internal bug, should not have happened" },
{ ERROR_TAG(BUG2), "Internal bug, should not have happened" },
{ ERROR_TAG(BUFFER_TOO_SMALL), "Buffer too small" },
{ ERROR_TAG(DECODER_NOT_FOUND), "Decoder not found" },
{ ERROR_TAG(DEMUXER_NOT_FOUND), "Demuxer not found" },
{ ERROR_TAG(ENCODER_NOT_FOUND), "Encoder not found" },
{ ERROR_TAG(EOF), "End of file" },
{ ERROR_TAG(EXIT), "Immediate exit requested" },
{ ERROR_TAG(EXTERNAL), "Generic error in an external library" },
{ ERROR_TAG(FILTER_NOT_FOUND), "Filter not found" },
{ ERROR_TAG(INVALIDDATA), "Invalid data found when processing input" },
{ ERROR_TAG(MUXER_NOT_FOUND), "Muxer not found" },
{ ERROR_TAG(OPTION_NOT_FOUND), "Option not found" },
{ ERROR_TAG(PATCHWELCOME), "Not yet implemented in FFmpeg, patches welcome" },
{ ERROR_TAG(PROTOCOL_NOT_FOUND), "Protocol not found" },
{ ERROR_TAG(STREAM_NOT_FOUND), "Stream not found" },
{ ERROR_TAG(UNKNOWN), "Unknown error occurred" },
但这是依赖于版本的方式,最好使用av_strerror()
让库为您提供错误代码的字符串表示。
答案 2 :(得分:4)
使用
printf("%s", av_err2str(ret));
其中ret是函数返回的整数(例如avformat_open_input(...))。
答案 3 :(得分:1)
请注意,大多数函数都会返回NEGATIVE错误。所以你必须调用av_strerror(-returnvalue)