[FFmpeg-devel] [PATCH] avformat/error_resilience: Allow file to be included in c++ programs

Peter Bennett pb.mythtv at gmail.com
Wed May 16 03:25:57 EEST 2018


From: Peter Bennett <pbennett at mythtv.org>

The header stdatomic.h causes compile errors in a c++ compiler, even
when extern "C" is used around it. The appropriate c++ include is <atomic>.
We cannot use #include <atomic> inside error_resilience.h because that causes
compile errors inside extern "C". With this change, using error_resilience.h in a
c++ program works but requires also including <atomic> in the c++ code.
---
 libavcodec/error_resilience.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/error_resilience.h b/libavcodec/error_resilience.h
index 664a765..7d81c4d 100644
--- a/libavcodec/error_resilience.h
+++ b/libavcodec/error_resilience.h
@@ -20,7 +20,9 @@
 #define AVCODEC_ERROR_RESILIENCE_H
 
 #include <stdint.h>
+#ifndef __cplusplus
 #include <stdatomic.h>
+#endif
 
 #include "avcodec.h"
 #include "me_cmp.h"
-- 
2.7.4



More information about the ffmpeg-devel mailing list