mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
make some more macros as inline functions
Make some macros as inline functions for added type checking. USe new gst_caps_take() in typefind
This commit is contained in:
parent
2f836b5996
commit
be0e58a637
3 changed files with 56 additions and 14 deletions
|
@ -286,9 +286,9 @@ gst_caps_copy (const GstCaps * caps)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_caps_replace:
|
* gst_caps_replace:
|
||||||
* @ocaps: (inout) (transfer full): pointer to a pointer to a #GstCaps to be
|
* @old_caps: (inout) (transfer full): pointer to a pointer to a #GstCaps to be
|
||||||
* replaced.
|
* replaced.
|
||||||
* @ncaps: (transfer none) (allow-none): pointer to a #GstCaps that will
|
* @new_caps: (transfer none) (allow-none): pointer to a #GstCaps that will
|
||||||
* replace the caps pointed to by @ocaps.
|
* replace the caps pointed to by @ocaps.
|
||||||
*
|
*
|
||||||
* Modifies a pointer to a #GstCaps to point to a different #GstCaps. The
|
* Modifies a pointer to a #GstCaps to point to a different #GstCaps. The
|
||||||
|
@ -297,13 +297,41 @@ gst_caps_copy (const GstCaps * caps)
|
||||||
* caps is unreffed, the new is reffed).
|
* caps is unreffed, the new is reffed).
|
||||||
*
|
*
|
||||||
* Either @ncaps or the #GstCaps pointed to by @ocaps may be NULL.
|
* Either @ncaps or the #GstCaps pointed to by @ocaps may be NULL.
|
||||||
|
*
|
||||||
|
* Returns: TRUE if @new_caps was different from @old_caps
|
||||||
*/
|
*/
|
||||||
#define gst_caps_replace(ocaps,ncaps) \
|
#ifdef _FOOL_GTK_DOC_
|
||||||
G_STMT_START { \
|
G_INLINE_FUNC gboolean gst_caps_replace (GstCaps **old_caps, GstCaps *new_caps);
|
||||||
GstCaps **___ocapsaddr = (GstCaps **)(ocaps); \
|
#endif
|
||||||
gst_mini_object_replace ((GstMiniObject **)___ocapsaddr, \
|
|
||||||
GST_MINI_OBJECT_CAST (ncaps)); \
|
static inline gboolean
|
||||||
} G_STMT_END
|
gst_caps_replace (GstCaps **old_caps, GstCaps *new_caps)
|
||||||
|
{
|
||||||
|
return gst_mini_object_replace ((GstMiniObject **) old_caps, (GstMiniObject *) new_caps);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_caps_take:
|
||||||
|
* @old_caps: (inout) (transfer full): pointer to a pointer to a #GstCaps to be
|
||||||
|
* replaced.
|
||||||
|
* @new_caps: (transfer full) (allow-none): pointer to a #GstCaps that will
|
||||||
|
* replace the caps pointed to by @ocaps.
|
||||||
|
*
|
||||||
|
* Modifies a pointer to a #GstCaps to point to a different #GstCaps. This
|
||||||
|
* function is similar to gst_caps_replace() except that it takes ownership
|
||||||
|
* of @new_caps.
|
||||||
|
*
|
||||||
|
* Returns: TRUE if @new_caps was different from @old_caps
|
||||||
|
*/
|
||||||
|
#ifdef _FOOL_GTK_DOC_
|
||||||
|
G_INLINE_FUNC gboolean gst_caps_take (GstCaps **old_caps, GstCaps *new_caps);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
gst_caps_take (GstCaps **old_caps, GstCaps *new_caps)
|
||||||
|
{
|
||||||
|
return gst_mini_object_take ((GstMiniObject **) old_caps, (GstMiniObject *) new_caps);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstCaps:
|
* GstCaps:
|
||||||
|
|
|
@ -306,8 +306,16 @@ gst_event_replace (GstEvent **old_event, GstEvent *new_event)
|
||||||
*
|
*
|
||||||
* Returns: the #GstEvent that was in @old_event
|
* Returns: the #GstEvent that was in @old_event
|
||||||
*/
|
*/
|
||||||
#define gst_event_steal(old_event) \
|
#ifdef _FOOL_GTK_DOC_
|
||||||
GST_EVENT_CAST (gst_mini_object_steal ((GstMiniObject **)(old_event)))
|
G_INLINE_FUNC GstEvent * gst_event_steal (GstEvent **old_event);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline GstEvent *
|
||||||
|
gst_event_steal (GstEvent **old_event)
|
||||||
|
{
|
||||||
|
return GST_EVENT_CAST (gst_mini_object_steal ((GstMiniObject **) old_event));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_event_take:
|
* gst_event_take:
|
||||||
* @old_event: (inout) (transfer full): pointer to a pointer to a #GstEvent
|
* @old_event: (inout) (transfer full): pointer to a pointer to a #GstEvent
|
||||||
|
@ -323,8 +331,15 @@ gst_event_replace (GstEvent **old_event, GstEvent *new_event)
|
||||||
*
|
*
|
||||||
* Returns: TRUE if @new_event was different from @old_event
|
* Returns: TRUE if @new_event was different from @old_event
|
||||||
*/
|
*/
|
||||||
#define gst_event_take(old_event,new_event) \
|
#ifdef _FOOL_GTK_DOC_
|
||||||
gst_mini_object_take ((GstMiniObject **)(old_event), GST_MINI_OBJECT_CAST (new_event))
|
G_INLINE_FUNC gboolean gst_event_take (GstEvent **old_event, GstEvent *new_event);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
gst_event_take (GstEvent **old_event, GstEvent *new_event)
|
||||||
|
{
|
||||||
|
return gst_mini_object_take ((GstMiniObject **) old_event, (GstMiniObject *) new_event);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstQOSType:
|
* GstQOSType:
|
||||||
|
|
|
@ -211,8 +211,7 @@ helper_find_suggest (gpointer data, GstTypeFindProbability probability,
|
||||||
if (probability > helper->best_probability) {
|
if (probability > helper->best_probability) {
|
||||||
GstCaps *copy = gst_caps_copy (caps);
|
GstCaps *copy = gst_caps_copy (caps);
|
||||||
|
|
||||||
gst_caps_replace (&helper->caps, copy);
|
gst_caps_take (&helper->caps, copy);
|
||||||
gst_caps_unref (copy);
|
|
||||||
helper->best_probability = probability;
|
helper->best_probability = probability;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue