Skip to content

Commit 2918335

Browse files
libraries/videodec: Fix build errors with av_err2str
1 parent 0b015da commit 2918335

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/core/libraries/videodec/videodec2_impl.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@
88
#include "common/logging/log.h"
99
#include "core/libraries/error_codes.h"
1010

11+
// The av_err2str macro in libavutil/error.h does not play nice with C++
12+
#ifdef av_err2str
13+
#undef av_err2str
14+
#include <string>
15+
av_always_inline std::string av_err2string(int errnum) {
16+
char errbuf[AV_ERROR_MAX_STRING_SIZE];
17+
return av_make_error_string(errbuf, AV_ERROR_MAX_STRING_SIZE, errnum);
18+
}
19+
#define av_err2str(err) av_err2string(err).c_str()
20+
#endif // av_err2str
21+
1122
namespace Libraries::Vdec2 {
1223

1324
std::vector<OrbisVideodec2AvcPictureInfo> gPictureInfos;
@@ -225,4 +236,4 @@ AVFrame* VdecDecoder::ConvertNV12Frame(AVFrame& frame) {
225236
return nv12_frame;
226237
}
227238

228-
} // namespace Libraries::Vdec2
239+
} // namespace Libraries::Vdec2

0 commit comments

Comments
 (0)