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

James Almer jamrial at gmail.com
Wed May 16 03:44:22 EEST 2018


On 5/15/2018 9:25 PM, Peter Bennett wrote:
> 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.

This is not a public header, so you're not supposed to have it available
or be able to include it at all from any external program.

> ---
>  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"
> 



More information about the ffmpeg-devel mailing list