2018-06-06 10:38:17 +00:00
|
|
|
From a0d32a9b1e1446cb51bf355aad19f2b9a46e7213 Mon Sep 17 00:00:00 2001
|
2018-06-06 09:48:09 +00:00
|
|
|
From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= <tim@centricular.com>
|
|
|
|
Date: Mon, 25 Jul 2016 23:48:50 +0100
|
|
|
|
Subject: [PATCH] WIP: buffer, caps, event, message: attempt to silence
|
|
|
|
compiler warnings
|
|
|
|
|
|
|
|
.. with -Wcast-align on aarch64.
|
|
|
|
|
|
|
|
https://bugzilla.gnome.org/show_bug.cgi?id=767255
|
|
|
|
---
|
|
|
|
gst/gstbuffer.h | 13 ++++++++++---
|
2018-06-06 10:38:17 +00:00
|
|
|
gst/gstcaps.h | 26 ++++++++++++++------------
|
2018-06-06 09:48:09 +00:00
|
|
|
gst/gstevent.h | 13 ++++++++++---
|
|
|
|
gst/gstmessage.h | 13 ++++++++++---
|
|
|
|
gst/gstminiobject.h | 16 ++++++++++++++++
|
2018-06-06 10:38:17 +00:00
|
|
|
5 files changed, 60 insertions(+), 21 deletions(-)
|
2018-06-06 09:48:09 +00:00
|
|
|
|
|
|
|
diff --git a/gst/gstbuffer.h b/gst/gstbuffer.h
|
2018-06-06 10:38:17 +00:00
|
|
|
index 2804b520f..527a64c86 100644
|
2018-06-06 09:48:09 +00:00
|
|
|
--- a/gst/gstbuffer.h
|
|
|
|
+++ b/gst/gstbuffer.h
|
2018-06-06 10:38:17 +00:00
|
|
|
@@ -426,7 +426,8 @@ gboolean gst_buffer_unset_flags (GstBuffer * buffer, GstBufferFlags f
|
2018-06-06 09:48:09 +00:00
|
|
|
static inline GstBuffer *
|
|
|
|
gst_buffer_ref (GstBuffer * buf)
|
|
|
|
{
|
|
|
|
- return (GstBuffer *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (buf));
|
|
|
|
+ gst_mini_object_ref (&buf->mini_object);
|
|
|
|
+ return buf;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-06-06 10:38:17 +00:00
|
|
|
@@ -439,7 +440,7 @@ gst_buffer_ref (GstBuffer * buf)
|
2018-06-06 09:48:09 +00:00
|
|
|
static inline void
|
|
|
|
gst_buffer_unref (GstBuffer * buf)
|
|
|
|
{
|
|
|
|
- gst_mini_object_unref (GST_MINI_OBJECT_CAST (buf));
|
|
|
|
+ gst_mini_object_unref (&buf->mini_object);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* copy buffer */
|
2018-06-06 10:38:17 +00:00
|
|
|
@@ -458,7 +459,13 @@ gst_buffer_unref (GstBuffer * buf)
|
2018-06-06 09:48:09 +00:00
|
|
|
static inline GstBuffer *
|
|
|
|
gst_buffer_copy (const GstBuffer * buf)
|
|
|
|
{
|
|
|
|
- return GST_BUFFER (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (buf)));
|
|
|
|
+ union {
|
|
|
|
+ GstMiniObject *mo;
|
|
|
|
+ GstBuffer *buffer;
|
|
|
|
+ } u;
|
|
|
|
+
|
|
|
|
+ u.mo = gst_mini_object_copy (&buf->mini_object);
|
|
|
|
+ return u.buffer;
|
|
|
|
}
|
|
|
|
|
2018-06-06 10:38:17 +00:00
|
|
|
GST_API
|
2018-06-06 09:48:09 +00:00
|
|
|
diff --git a/gst/gstcaps.h b/gst/gstcaps.h
|
2018-06-06 10:38:17 +00:00
|
|
|
index 0d9530099..6914a74dc 100644
|
2018-06-06 09:48:09 +00:00
|
|
|
--- a/gst/gstcaps.h
|
|
|
|
+++ b/gst/gstcaps.h
|
2018-06-06 10:38:17 +00:00
|
|
|
@@ -35,6 +35,16 @@ GST_API GType _gst_caps_type;
|
2018-06-06 09:48:09 +00:00
|
|
|
#define GST_CAPS_CAST(obj) ((GstCaps*)(obj))
|
|
|
|
#define GST_CAPS(obj) (GST_CAPS_CAST(obj))
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * GstCaps:
|
|
|
|
+ * @mini_object: the parent type
|
|
|
|
+ *
|
|
|
|
+ * Object describing media types.
|
|
|
|
+ */
|
|
|
|
+struct _GstCaps {
|
|
|
|
+ GstMiniObject mini_object;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
#define GST_TYPE_STATIC_CAPS (gst_static_caps_get_type())
|
|
|
|
|
|
|
|
/**
|
2018-06-06 10:38:17 +00:00
|
|
|
@@ -188,6 +198,7 @@ GST_API GstCaps * _gst_caps_none;
|
2018-06-06 09:48:09 +00:00
|
|
|
*/
|
|
|
|
#define GST_CAPS_FLAG_UNSET(caps,flag) GST_MINI_OBJECT_FLAG_UNSET (caps, flag)
|
|
|
|
|
|
|
|
+
|
|
|
|
/* refcounting */
|
|
|
|
/**
|
|
|
|
* gst_caps_ref:
|
2018-06-06 10:38:17 +00:00
|
|
|
@@ -207,7 +218,8 @@ GST_API GstCaps * _gst_caps_none;
|
2018-06-06 09:48:09 +00:00
|
|
|
static inline GstCaps *
|
|
|
|
gst_caps_ref (GstCaps * caps)
|
|
|
|
{
|
|
|
|
- return (GstCaps *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (caps));
|
|
|
|
+ gst_mini_object_ref (&caps->mini_object);
|
|
|
|
+ return caps;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-06-06 10:38:17 +00:00
|
|
|
@@ -220,7 +232,7 @@ gst_caps_ref (GstCaps * caps)
|
2018-06-06 09:48:09 +00:00
|
|
|
static inline void
|
|
|
|
gst_caps_unref (GstCaps * caps)
|
|
|
|
{
|
|
|
|
- gst_mini_object_unref (GST_MINI_OBJECT_CAST (caps));
|
|
|
|
+ gst_mini_object_unref (&caps->mini_object);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* copy caps */
|
2018-06-06 10:38:17 +00:00
|
|
|
@@ -300,16 +312,6 @@ gst_caps_take (GstCaps **old_caps, GstCaps *new_caps)
|
|
|
|
return gst_mini_object_take ((GstMiniObject **) old_caps, (GstMiniObject *) new_caps);
|
2018-06-06 09:48:09 +00:00
|
|
|
}
|
|
|
|
|
2018-06-06 10:38:17 +00:00
|
|
|
-/**
|
2018-06-06 09:48:09 +00:00
|
|
|
- * GstCaps:
|
|
|
|
- * @mini_object: the parent type
|
|
|
|
- *
|
|
|
|
- * Object describing media types.
|
|
|
|
- */
|
|
|
|
-struct _GstCaps {
|
|
|
|
- GstMiniObject mini_object;
|
|
|
|
-};
|
|
|
|
-
|
2018-06-06 10:38:17 +00:00
|
|
|
/**
|
2018-06-06 09:48:09 +00:00
|
|
|
* GstStaticCaps:
|
|
|
|
* @caps: the cached #GstCaps
|
|
|
|
diff --git a/gst/gstevent.h b/gst/gstevent.h
|
2018-06-06 10:38:17 +00:00
|
|
|
index b43f5aef7..d2d2fa5ec 100644
|
2018-06-06 09:48:09 +00:00
|
|
|
--- a/gst/gstevent.h
|
|
|
|
+++ b/gst/gstevent.h
|
2018-06-06 10:38:17 +00:00
|
|
|
@@ -435,7 +435,8 @@ GstEventTypeFlags
|
2018-06-06 09:48:09 +00:00
|
|
|
static inline GstEvent *
|
|
|
|
gst_event_ref (GstEvent * event)
|
|
|
|
{
|
|
|
|
- return (GstEvent *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (event));
|
|
|
|
+ gst_mini_object_ref (&event->mini_object);
|
|
|
|
+ return event;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-06-06 10:38:17 +00:00
|
|
|
@@ -447,7 +448,7 @@ gst_event_ref (GstEvent * event)
|
2018-06-06 09:48:09 +00:00
|
|
|
static inline void
|
|
|
|
gst_event_unref (GstEvent * event)
|
|
|
|
{
|
|
|
|
- gst_mini_object_unref (GST_MINI_OBJECT_CAST (event));
|
|
|
|
+ gst_mini_object_unref (&event->mini_object);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* copy event */
|
2018-06-06 10:38:17 +00:00
|
|
|
@@ -462,7 +463,13 @@ gst_event_unref (GstEvent * event)
|
2018-06-06 09:48:09 +00:00
|
|
|
static inline GstEvent *
|
|
|
|
gst_event_copy (const GstEvent * event)
|
|
|
|
{
|
|
|
|
- return GST_EVENT_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (event)));
|
|
|
|
+ union {
|
|
|
|
+ GstMiniObject *mo;
|
|
|
|
+ GstEvent *event;
|
|
|
|
+ } u;
|
|
|
|
+
|
|
|
|
+ u.mo = gst_mini_object_copy (&event->mini_object);
|
|
|
|
+ return u.event;
|
|
|
|
}
|
|
|
|
|
2018-06-06 10:38:17 +00:00
|
|
|
GST_API
|
2018-06-06 09:48:09 +00:00
|
|
|
diff --git a/gst/gstmessage.h b/gst/gstmessage.h
|
2018-06-06 10:38:17 +00:00
|
|
|
index 84c16ba77..e398b944d 100644
|
2018-06-06 09:48:09 +00:00
|
|
|
--- a/gst/gstmessage.h
|
|
|
|
+++ b/gst/gstmessage.h
|
2018-06-06 10:38:17 +00:00
|
|
|
@@ -363,7 +363,8 @@ GQuark gst_message_type_to_quark (GstMessageType type);
|
2018-06-06 09:48:09 +00:00
|
|
|
static inline GstMessage *
|
|
|
|
gst_message_ref (GstMessage * msg)
|
|
|
|
{
|
|
|
|
- return (GstMessage *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (msg));
|
|
|
|
+ gst_mini_object_ref (&msg->mini_object);
|
|
|
|
+ return msg;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-06-06 10:38:17 +00:00
|
|
|
@@ -376,7 +377,7 @@ gst_message_ref (GstMessage * msg)
|
2018-06-06 09:48:09 +00:00
|
|
|
static inline void
|
|
|
|
gst_message_unref (GstMessage * msg)
|
|
|
|
{
|
|
|
|
- gst_mini_object_unref (GST_MINI_OBJECT_CAST (msg));
|
|
|
|
+ gst_mini_object_unref (&msg->mini_object);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* copy message */
|
2018-06-06 10:38:17 +00:00
|
|
|
@@ -393,7 +394,13 @@ gst_message_unref (GstMessage * msg)
|
2018-06-06 09:48:09 +00:00
|
|
|
static inline GstMessage *
|
|
|
|
gst_message_copy (const GstMessage * msg)
|
|
|
|
{
|
|
|
|
- return GST_MESSAGE_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (msg)));
|
|
|
|
+ union {
|
|
|
|
+ GstMiniObject *mo;
|
|
|
|
+ GstMessage *msg;
|
|
|
|
+ } u;
|
|
|
|
+
|
|
|
|
+ u.mo = gst_mini_object_copy (&msg->mini_object);
|
|
|
|
+ return u.msg;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
diff --git a/gst/gstminiobject.h b/gst/gstminiobject.h
|
2018-06-06 10:38:17 +00:00
|
|
|
index f7aa87a00..e010d63fd 100644
|
2018-06-06 09:48:09 +00:00
|
|
|
--- a/gst/gstminiobject.h
|
|
|
|
+++ b/gst/gstminiobject.h
|
2018-06-06 10:38:17 +00:00
|
|
|
@@ -293,6 +293,22 @@ GstMiniObject * gst_mini_object_steal (GstMiniObject **olddata) G_GNUC
|
2018-06-06 09:48:09 +00:00
|
|
|
(GBoxedCopyFunc) gst_mini_object_ref, \
|
|
|
|
(GBoxedFreeFunc) gst_mini_object_unref)
|
|
|
|
|
|
|
|
+/* FIXME */
|
|
|
|
+#if 0
|
|
|
|
+/**
|
|
|
|
+ * GST_DEFINE_MINI_OBJECT_INLINE_FUNCS:
|
|
|
|
+ * @TypeName: name of the new type in CamelCase
|
|
|
|
+ * @type_name: name of the new type
|
|
|
|
+ *
|
|
|
|
+ * Use in header file to declare standard inline ref, unref and copy functions
|
|
|
|
+ * for a mini object type. Assumes first member of the @TypeName structure is
|
|
|
|
+ * called mini_object.
|
|
|
|
+ *
|
|
|
|
+ * Since: 1.10
|
|
|
|
+ */
|
|
|
|
+#define GST_DEFINE_MINI_OBJECT_INLINE_FUNCS(TypeName,type_name) /* FIXME */
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif
|
|
|
|
--
|
2018-06-06 10:38:17 +00:00
|
|
|
2.17.0
|
2018-06-06 09:48:09 +00:00
|
|
|
|