[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:49:34 EEST 2018



On 05/15/2018 08:44 PM, James Almer wrote:
> 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.
>
We use #include "libavcodec/mpegvideo.h"
That file does an include for error_resilience.h, and this breaks our 
compile.
Is libavcodec/mpegvideo.h also a file we should not include?
>> ---
>>   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"
>>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



More information about the ffmpeg-devel mailing list