[FFmpeg-devel] [PATCH] ffprobe: Eliminate pointless union in unit_value struct

Derek Buitenhuis derek.buitenhuis at gmail.com
Wed Sep 12 20:48:30 CEST 2012

On 12/09/2012 1:45 PM, Stefano Sabatini wrote:
>> There is no point to this union, as even if it is passed an integer,
>> it is immediately put into a double anyway, inside the only function
>> that uses it.
> The idea was to avoid potentially lossy casts (double->int).

It got cast anyway, though.

> Do you have a specific reason to apply this patch (e.g. get rid of the
> union)?
> Otherwise I could rework the code in order to avoid the silly
> int->int->double path.

The c99-to-c89 converter (for MSVC support) doesn't currently handle designated
initializers or compound literals with nested unions or structs, e.g:

someType var = { .first.seconed = 0 };

This is the only place it occurs in FFmpeg, and is one of the last things that needs
to be done for MSVC support. Since this union didn't actually -do- anything, I thought
it'd be easier to remove it properly. If it does have some actual use after a future
patch, we can hold MSVC support until the converter gets support for it, or just disable
ffprobe when building for MSVC.

- Derek

More information about the ffmpeg-devel mailing list