((parent_class_cast(parent_class)->name != NULL) ? \
parent_class_cast(parent_class)->name args : def_return)
-/* Define possibly unaligned memory access method whether the type of
- * architecture. */
-#if GST_HAVE_UNALIGNED_ACCESS
+/* Define PUT and GET functions for unaligned memory */
+#define _GST_GET(__data, __idx, __size, __shift) \
+ (((guint##__size) (((guint8 *) (__data))[__idx])) << __shift)
-#define _GST_GET(__data, __size, __end) \
- (GUINT##__size##_FROM_##__end (* ((guint##__size *) (__data))))
+#define _GST_PUT(__data, __idx, __size, __shift, __num) \
+ (((guint8 *) (__data))[__idx] = (((guint##__size) __num) >> __shift) & 0xff)
/**
* GST_READ_UINT64_BE:
*
* Read a 64 bit unsigned integer value in big endian format from the memory buffer.
*/
-#define GST_READ_UINT64_BE(data) _GST_GET (data, 64, BE)
+#define GST_READ_UINT64_BE(data) (_GST_GET (data, 0, 64, 56) | \
+ _GST_GET (data, 1, 64, 48) | \
+ _GST_GET (data, 2, 64, 40) | \
+ _GST_GET (data, 3, 64, 32) | \
+ _GST_GET (data, 4, 64, 24) | \
+ _GST_GET (data, 5, 64, 16) | \
+ _GST_GET (data, 6, 64, 8) | \
+ _GST_GET (data, 7, 64, 0))
+
/**
* GST_READ_UINT64_LE:
* @data: memory location
*
* Read a 64 bit unsigned integer value in little endian format from the memory buffer.
*/
-#define GST_READ_UINT64_LE(data) _GST_GET (data, 64, LE)
+#define GST_READ_UINT64_LE(data) (_GST_GET (data, 7, 64, 56) | \
+ _GST_GET (data, 6, 64, 48) | \
+ _GST_GET (data, 5, 64, 40) | \
+ _GST_GET (data, 4, 64, 32) | \
+ _GST_GET (data, 3, 64, 24) | \
+ _GST_GET (data, 2, 64, 16) | \
+ _GST_GET (data, 1, 64, 8) | \
+ _GST_GET (data, 0, 64, 0))
+
/**
* GST_READ_UINT32_BE:
* @data: memory location
*
* Read a 32 bit unsigned integer value in big endian format from the memory buffer.
*/
-#define GST_READ_UINT32_BE(data) _GST_GET (data, 32, BE)
+#define GST_READ_UINT32_BE(data) (_GST_GET (data, 0, 32, 24) | \
+ _GST_GET (data, 1, 32, 16) | \
+ _GST_GET (data, 2, 32, 8) | \
+ _GST_GET (data, 3, 32, 0))
+
/**
* GST_READ_UINT32_LE:
* @data: memory location
*
* Read a 32 bit unsigned integer value in little endian format from the memory buffer.
*/
-#define GST_READ_UINT32_LE(data) _GST_GET (data, 32, LE)
+#define GST_READ_UINT32_LE(data) (_GST_GET (data, 3, 32, 24) | \
+ _GST_GET (data, 2, 32, 16) | \
+ _GST_GET (data, 1, 32, 8) | \
+ _GST_GET (data, 0, 32, 0))
+
/**
- * GST_READ_UINT16_BE:
+ * GST_READ_UINT24_BE:
* @data: memory location
*
- * Read a 16 bit unsigned integer value in big endian format from the memory buffer.
- */
-#define GST_READ_UINT16_BE(data) _GST_GET (data, 16, BE)
-/**
- * GST_READ_UINT16_LE:
- * @data: memory location
+ * Read a 24 bit unsigned integer value in big endian format from the memory buffer.
*
- * Read a 16 bit unsigned integer value in little endian format from the memory buffer.
- */
-#define GST_READ_UINT16_LE(data) _GST_GET (data, 16, LE)
-/**
- * GST_READ_UINT8:
- * @data: memory location
- *
- * Read an 8 bit unsigned integer value from the memory buffer.
+ * Since: 0.10.22
*/
-#define GST_READ_UINT8(data) (* ((guint8 *) (data)))
-
-#define _GST_PUT(__data, __size, __end, __num) \
- ((* (guint##__size *) (__data)) = GUINT##__size##_TO_##__end (__num))
+#define GST_READ_UINT24_BE(data) (_GST_GET (data, 0, 32, 16) | \
+ _GST_GET (data, 1, 32, 8) | \
+ _GST_GET (data, 2, 32, 0))
/**
- * GST_WRITE_UINT64_BE:
- * @data: memory location
- * @num: value to store
- *
- * Store a 64 bit unsigned integer value in big endian format into the memory buffer.
- */
-#define GST_WRITE_UINT64_BE(data, num) _GST_PUT(data, 64, BE, num)
-/**
- * GST_WRITE_UINT64_LE:
+ * GST_READ_UINT24_LE:
* @data: memory location
- * @num: value to store
*
- * Store a 64 bit unsigned integer value in little endian format into the memory buffer.
- */
-#define GST_WRITE_UINT64_LE(data, num) _GST_PUT(data, 64, LE, num)
-/**
- * GST_WRITE_UINT32_BE:
- * @data: memory location
- * @num: value to store
+ * Read a 24 bit unsigned integer value in little endian format from the memory buffer.
*
- * Store a 32 bit unsigned integer value in big endian format into the memory buffer.
+ * Since: 0.10.22
*/
-#define GST_WRITE_UINT32_BE(data, num) _GST_PUT(data, 32, BE, num)
+#define GST_READ_UINT24_LE(data) (_GST_GET (data, 2, 32, 16) | \
+ _GST_GET (data, 1, 32, 8) | \
+ _GST_GET (data, 0, 32, 0))
+
/**
- * GST_WRITE_UINT32_LE:
+ * GST_READ_UINT16_BE:
* @data: memory location
- * @num: value to store
*
- * Store a 32 bit unsigned integer value in little endian format into the memory buffer.
+ * Read a 16 bit unsigned integer value in big endian format from the memory buffer.
*/
-#define GST_WRITE_UINT32_LE(data, num) _GST_PUT(data, 32, LE, num)
+#define GST_READ_UINT16_BE(data) (_GST_GET (data, 0, 16, 8) | \
+ _GST_GET (data, 1, 16, 0))
+
/**
- * GST_WRITE_UINT16_BE:
+ * GST_READ_UINT16_LE:
* @data: memory location
- * @num: value to store
*
- * Store a 16 bit unsigned integer value in big endian format into the memory buffer.
+ * Read a 16 bit unsigned integer value in little endian format from the memory buffer.
*/
-#define GST_WRITE_UINT16_BE(data, num) _GST_PUT(data, 16, BE, num)
+#define GST_READ_UINT16_LE(data) (_GST_GET (data, 1, 16, 8) | \
+ _GST_GET (data, 0, 16, 0))
+
/**
- * GST_WRITE_UINT16_LE:
+ * GST_READ_UINT8:
* @data: memory location
- * @num: value to store
*
- * Store a 16 bit unsigned integer value in little endian format into the memory buffer.
+ * Read an 8 bit unsigned integer value from the memory buffer.
*/
-#define GST_WRITE_UINT16_LE(data, num) _GST_PUT(data, 16, LE, num)
+#define GST_READ_UINT8(data) (_GST_GET (data, 0, 8, 0))
+
/**
- * GST_WRITE_UINT8:
+ * GST_WRITE_UINT64_BE:
* @data: memory location
* @num: value to store
*
- * Store an 8 bit unsigned integer value into the memory buffer.
+ * Store a 64 bit unsigned integer value in big endian format into the memory buffer.
*/
-#define GST_WRITE_UINT8(data, num) ((* (guint8 *) (data)) = (num))
-
-#else /* GST_HAVE_UNALIGNED_ACCESS */
-
-#define _GST_GET(__data, __idx, __size, __shift) \
- (((guint##__size) (((guint8 *) (__data))[__idx])) << __shift)
-
-#define GST_READ_UINT64_BE(data) (_GST_GET (data, 0, 64, 56) | \
- _GST_GET (data, 1, 64, 48) | \
- _GST_GET (data, 2, 64, 40) | \
- _GST_GET (data, 3, 64, 32) | \
- _GST_GET (data, 4, 64, 24) | \
- _GST_GET (data, 5, 64, 16) | \
- _GST_GET (data, 6, 64, 8) | \
- _GST_GET (data, 7, 64, 0))
-
-#define GST_READ_UINT64_LE(data) (_GST_GET (data, 7, 64, 56) | \
- _GST_GET (data, 6, 64, 48) | \
- _GST_GET (data, 5, 64, 40) | \
- _GST_GET (data, 4, 64, 32) | \
- _GST_GET (data, 3, 64, 24) | \
- _GST_GET (data, 2, 64, 16) | \
- _GST_GET (data, 1, 64, 8) | \
- _GST_GET (data, 0, 64, 0))
-
-#define GST_READ_UINT32_BE(data) (_GST_GET (data, 0, 32, 24) | \
- _GST_GET (data, 1, 32, 16) | \
- _GST_GET (data, 2, 32, 8) | \
- _GST_GET (data, 3, 32, 0))
-
-#define GST_READ_UINT32_LE(data) (_GST_GET (data, 3, 32, 24) | \
- _GST_GET (data, 2, 32, 16) | \
- _GST_GET (data, 1, 32, 8) | \
- _GST_GET (data, 0, 32, 0))
-
-#define GST_READ_UINT16_BE(data) (_GST_GET (data, 0, 16, 8) | \
- _GST_GET (data, 1, 16, 0))
-
-#define GST_READ_UINT16_LE(data) (_GST_GET (data, 1, 16, 8) | \
- _GST_GET (data, 0, 16, 0))
-
-#define GST_READ_UINT8(data) (_GST_GET (data, 0, 8, 0))
-
-#define _GST_PUT(__data, __idx, __size, __shift, __num) \
- (((guint8 *) (__data))[__idx] = (((guint##__size) __num) >> __shift) & 0xff)
-
#define GST_WRITE_UINT64_BE(data, num) do { \
_GST_PUT (data, 0, 64, 56, num); \
_GST_PUT (data, 1, 64, 48, num); \
_GST_PUT (data, 7, 64, 0, num); \
} while (0)
+/**
+ * GST_WRITE_UINT64_LE:
+ * @data: memory location
+ * @num: value to store
+ *
+ * Store a 64 bit unsigned integer value in little endian format into the memory buffer.
+ */
#define GST_WRITE_UINT64_LE(data, num) do { \
_GST_PUT (data, 0, 64, 0, num); \
_GST_PUT (data, 1, 64, 8, num); \
_GST_PUT (data, 7, 64, 56, num); \
} while (0)
+/**
+ * GST_WRITE_UINT32_BE:
+ * @data: memory location
+ * @num: value to store
+ *
+ * Store a 32 bit unsigned integer value in big endian format into the memory buffer.
+ */
#define GST_WRITE_UINT32_BE(data, num) do { \
_GST_PUT (data, 0, 32, 24, num); \
_GST_PUT (data, 1, 32, 16, num); \
_GST_PUT (data, 3, 32, 0, num); \
} while (0)
+/**
+ * GST_WRITE_UINT32_LE:
+ * @data: memory location
+ * @num: value to store
+ *
+ * Store a 32 bit unsigned integer value in little endian format into the memory buffer.
+ */
#define GST_WRITE_UINT32_LE(data, num) do { \
_GST_PUT (data, 0, 32, 0, num); \
_GST_PUT (data, 1, 32, 8, num); \
_GST_PUT (data, 3, 32, 24, num); \
} while (0)
+/**
+ * GST_WRITE_UINT24_BE:
+ * @data: memory location
+ * @num: value to store
+ *
+ * Store a 24 bit unsigned integer value in big endian format into the memory buffer.
+ *
+ * Since: 0.10.22
+ */
+#define GST_WRITE_UINT24_BE(data, num) do { \
+ _GST_PUT (data, 0, 32, 16, num); \
+ _GST_PUT (data, 1, 32, 8, num); \
+ _GST_PUT (data, 2, 32, 0, num); \
+ } while (0)
+
+/**
+ * GST_WRITE_UINT24_LE:
+ * @data: memory location
+ * @num: value to store
+ *
+ * Store a 24 bit unsigned integer value in little endian format into the memory buffer.
+ *
+ * Since: 0.10.22
+ */
+#define GST_WRITE_UINT24_LE(data, num) do { \
+ _GST_PUT (data, 0, 32, 0, num); \
+ _GST_PUT (data, 1, 32, 8, num); \
+ _GST_PUT (data, 2, 32, 16, num); \
+ } while (0)
+
+/**
+ * GST_WRITE_UINT16_BE:
+ * @data: memory location
+ * @num: value to store
+ *
+ * Store a 16 bit unsigned integer value in big endian format into the memory buffer.
+ */
#define GST_WRITE_UINT16_BE(data, num) do { \
_GST_PUT (data, 0, 16, 8, num); \
_GST_PUT (data, 1, 16, 0, num); \
} while (0)
+/**
+ * GST_WRITE_UINT16_LE:
+ * @data: memory location
+ * @num: value to store
+ *
+ * Store a 16 bit unsigned integer value in little endian format into the memory buffer.
+ */
#define GST_WRITE_UINT16_LE(data, num) do { \
_GST_PUT (data, 0, 16, 0, num); \
_GST_PUT (data, 1, 16, 8, num); \
} while (0)
+/**
+ * GST_WRITE_UINT8:
+ * @data: memory location
+ * @num: value to store
+ *
+ * Store an 8 bit unsigned integer value into the memory buffer.
+ */
#define GST_WRITE_UINT8(data, num) do { \
_GST_PUT (data, 0, 8, 0, num); \
} while (0)
-#endif /* GST_HAVE_UNALIGNED_ACCESS */
-
-
/* Miscellaneous utility macros */
/**