[FFmpeg-devel] Eliminating long

Jay L. T. Cornwall jay
Mon Mar 31 00:40:36 CEST 2008

Luca Barbato wrote:

>> There is no reliable way to marshall this type into a managed structure 
>> on all platforms. Could I request that the type be made explicit in 
>> ByteIOContext, as 'unsigned int' or 'uint32_t'.

> I'm not sure that's a good workaround... Cannot fix it on your wrapper side?

Not reliably. The size of the ByteIOContext structure depends on the 
compiler that FFmpeg was built with. It's worse than a 32-bit/64-bit 
issue; unfortunately the C specification is lax enough to permit that 
for the long type. There's no way to detect how the structure was built 
from C#.

If there is a need for the checksum field's size to vary with bitness, 
size_t is a portable alternative. What's in avio.h right now isn't 
portable at all if the field is being used to store more than 32-bit 
data; it will overflow under VC 64-bit.

Jay L. T. Cornwall

More information about the ffmpeg-devel mailing list