[FFmpeg-devel] [PATCH] Revert "lavc/v4l2_m2m_enc: Add missing braces around initializers."

Mark Thompson sw at jkqxz.net
Mon Nov 5 02:53:33 EET 2018

On 04/11/18 03:46, Ronak wrote:
>> On Oct 31, 2018, at 5:58 PM, Mark Thompson <sw at jkqxz.net> wrote:
>> On 31/10/18 00:07, Ronak Patel wrote:
>>>> On Oct 27, 2018, at 5:25 PM, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
>>>> 2018-10-27 20:50 GMT+02:00, Mark Thompson <sw at jkqxz.net>:
>>>>> This reverts commit 6dbb64fdccafe846aaec75d3784f7ad49d8af5df.
>>>>> The additional braces cause build errors with Linux headers earlier
>>>>> than 4.5 because the first element of the structure was not originally
>>>>> a union.
>>>>> Not sure what compiler was warning about these, but it's definitely
>>>>> incorrect for it to do so.
>>>> Must have been NDK clang.
>>> This fix isn’t enough for this. The references to the variables in the union fail to compile. This doesn’t fix that.
>> I tried both before and after the change at 4.5: <https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/videodev2.h#L1593>, <https://elixir.bootlin.com/linux/v4.4.162/source/include/uapi/linux/videodev2.h#L1481>.
>> What headers do you have and what are the errors in that version?
> I've attach the header file that I have.
> struct v4l2_ext_controls {
>  union {
>   __u32 ctrl_class;
>   __u32 which;
>  };
>  __u32 count;
>  __u32 error_idx;
>  __u32 reserved[2];
>  struct v4l2_ext_control *controls;
> };

That looks like a normal 4.5+ definition.

Does your compiler perhaps not support anonymous unions?  (Generally warnings in system header files are suppressed, so you would only see the results of that - it would deny the existence of the ctrl_class element in struct v4l2_ext_controls.)  They are a hard requirement for using a lot of Linux header files nowadays, so I suppose we might need to add a check for them if people are combining new headers with old compilers lacking that support.

- Mark

More information about the ffmpeg-devel mailing list