Fixed compiler error for av_err2string by redefining in c++ friendly way

This commit is contained in:
zmckevitt 2024-09-05 17:45:15 -06:00
parent 9101bd7ad4
commit 577bb66c1f

View file

@ -20,6 +20,18 @@ extern "C" {
#include <libswscale/swscale.h>
}
// The av_err2str macro in libavutil/error.h does not play nice with C++
// More info: https://github.com/joncampbell123/composite-video-simulator/issues/5
#ifdef av_err2str
#undef av_err2str
#include <string>
av_always_inline std::string av_err2string(int errnum) {
char errbuf[AV_ERROR_MAX_STRING_SIZE];
return av_make_error_string(errbuf, AV_ERROR_MAX_STRING_SIZE, errnum);
}
#define av_err2str(err) av_err2string(err).c_str()
#endif // av_err2str
namespace Libraries::AvPlayer {
using namespace Kernel;