After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 555196 - Move floating point endian conversion macros into core
Move floating point endian conversion macros into core
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal enhancement
: 0.10.22
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-10-06 09:46 UTC by Sebastian Dröge (slomo)
Modified: 2008-10-23 09:45 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sebastian Dröge (slomo) 2008-10-06 09:46:58 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 ;)
Comment 1 Sebastian Dröge (slomo) 2008-10-23 07:09:10 UTC
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.
Comment 2 Tim-Philipp Müller 2008-10-23 09:38:50 UTC
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?
Comment 3 Sebastian Dröge (slomo) 2008-10-23 09:45:06 UTC
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.