GNOME Bugzilla – Bug 555196
Move floating point endian conversion macros into core
Last modified: 2008-10-23 09:45:06 UTC
It would probably be a good idea to move the endian conversion macros from floatcast.h into some place in core. They should of course be guarded by #ifndef GFLOAT_SWAP_LE_BE #endif kind of stuff as it might happen that they end up in GLib at some point. gst/gstutils.h might be the appropiate place for them. Afterwards we should also add GST_(READ|WRITE)_(FLOAT|DOUBLE)_(LE|BE) macros. The rationale for this is that it might be also useful at several places in core, for example in the GstByteReader I'm going to commit before next release ;)
2008-10-23 Sebastian Dröge <sebastian.droege@collabora.co.uk> * docs/gst/gstreamer-sections.txt: * gst/gstutils.h: API: Move float endianness conversion macros from libgstfloatcast to core as it's useful in general, even in core. Fixes bug #555196. This adds GDOUBLE_FROM_BE, GDOUBLE_FROM_LE, GDOUBLE_TO_BE, GDOUBLE_TO_LE, GDOUBLE_SWAP_LE_BE, GFLOAT_FROM_BE, GFLOAT_FROM_LE, GFLOAT_TO_BE, GFLOAT_TO_LE, GFLOAT_SWAP_LE_BE. Also add GST_READ_ and GST_WRITE_ macros for floats and doubles: GST_READ_FLOAT_LE, GST_READ_FLOAT_BE, GST_READ_DOUBLE_LE, GST_READ_DOUBLE_BE, GST_WRITE_FLOAT_LE, GST_WRITE_FLOAT_BE, GST_WRITE_DOUBLE_LE, GST_WRITE_DOUBLE_BE.
Mmh, I know I'm a bit late, but since we're effectively adding new API to core, wouldn't it be better to go for stuff with GST_ prefixes instead of clobbering GLib's namespace, and then deprecate the defines in -base?
Not sure... the move as done now is API compatible as floatcast.h includes gstutils.h. If I renamed them this wouldn't be given. Also the data types on which these macros operate are "gdouble" and "gfloat", not "gstdouble" and "gstfloat" ;) Apart from that there should be not conflicts with GLib if they add this macros later... that's why I added the #ifndef GFLOAT_FROM_LE around everything.