mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-30 12:10:37 +00:00
gst: Add non-inline methods for bindings to able to use core APIs
Provide non-inline version of refcounting APIs so that it can be consumed by bindings Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer-sharp/-/issues/46 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/728>
This commit is contained in:
parent
e02902a783
commit
84a3f0448b
25 changed files with 1230 additions and 622 deletions
|
@ -116,6 +116,7 @@
|
|||
* for re-use. (Since: 1.6)
|
||||
*
|
||||
*/
|
||||
#define GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
#include "gst_private.h"
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
|
@ -2933,3 +2934,96 @@ gst_buffer_get_custom_meta (GstBuffer * buffer, const gchar * name)
|
|||
|
||||
return (GstCustomMeta *) gst_buffer_get_meta (buffer, info->api);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_buffer_ref: (skip)
|
||||
* @buf: a #GstBuffer.
|
||||
*
|
||||
* Increases the refcount of the given buffer by one.
|
||||
*
|
||||
* Note that the refcount affects the writability
|
||||
* of @buf and its metadata, see gst_buffer_is_writable().
|
||||
* It is important to note that keeping additional references to
|
||||
* GstBuffer instances can potentially increase the number
|
||||
* of memcpy operations in a pipeline.
|
||||
*
|
||||
* Returns: (transfer full): @buf
|
||||
*/
|
||||
GstBuffer *
|
||||
gst_buffer_ref (GstBuffer * buf)
|
||||
{
|
||||
return (GstBuffer *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (buf));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_buffer_unref: (skip)
|
||||
* @buf: (transfer full): a #GstBuffer.
|
||||
*
|
||||
* Decreases the refcount of the buffer. If the refcount reaches 0, the buffer
|
||||
* with the associated metadata and memory will be freed.
|
||||
*/
|
||||
void
|
||||
gst_buffer_unref (GstBuffer * buf)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (buf));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clear_buffer: (skip)
|
||||
* @buf_ptr: a pointer to a #GstBuffer reference
|
||||
*
|
||||
* Clears a reference to a #GstBuffer.
|
||||
*
|
||||
* @buf_ptr must not be %NULL.
|
||||
*
|
||||
* If the reference is %NULL then this function does nothing. Otherwise, the
|
||||
* reference count of the buffer is decreased and the pointer is set to %NULL.
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
void
|
||||
gst_clear_buffer (GstBuffer ** buf_ptr)
|
||||
{
|
||||
gst_clear_mini_object ((GstMiniObject **) buf_ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_buffer_copy: (skip)
|
||||
* @buf: a #GstBuffer.
|
||||
*
|
||||
* Create a copy of the given buffer. This will only copy the buffer's
|
||||
* data to a newly allocated memory if needed (if the type of memory
|
||||
* requires it), otherwise the underlying data is just referenced.
|
||||
* Check gst_buffer_copy_deep() if you want to force the data
|
||||
* to be copied to newly allocated memory.
|
||||
*
|
||||
* Returns: (transfer full): a new copy of @buf.
|
||||
*/
|
||||
GstBuffer *
|
||||
gst_buffer_copy (const GstBuffer * buf)
|
||||
{
|
||||
return GST_BUFFER (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (buf)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_buffer_replace: (skip)
|
||||
* @obuf: (inout) (transfer full) (nullable): pointer to a pointer to
|
||||
* a #GstBuffer to be replaced.
|
||||
* @nbuf: (transfer none) (allow-none): pointer to a #GstBuffer that will
|
||||
* replace the buffer pointed to by @obuf.
|
||||
*
|
||||
* Modifies a pointer to a #GstBuffer to point to a different #GstBuffer. The
|
||||
* modification is done atomically (so this is useful for ensuring thread safety
|
||||
* in some cases), and the reference counts are updated appropriately (the old
|
||||
* buffer is unreffed, the new is reffed).
|
||||
*
|
||||
* Either @nbuf or the #GstBuffer pointed to by @obuf may be %NULL.
|
||||
*
|
||||
* Returns: %TRUE when @obuf was different from @nbuf.
|
||||
*/
|
||||
gboolean
|
||||
gst_buffer_replace (GstBuffer ** obuf, GstBuffer * nbuf)
|
||||
{
|
||||
return gst_mini_object_replace ((GstMiniObject **) obuf,
|
||||
(GstMiniObject *) nbuf);
|
||||
}
|
||||
|
|
|
@ -409,56 +409,20 @@ GST_API
|
|||
gboolean gst_buffer_unset_flags (GstBuffer * buffer, GstBufferFlags flags);
|
||||
|
||||
|
||||
|
||||
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
/* refcounting */
|
||||
/**
|
||||
* gst_buffer_ref: (skip)
|
||||
* @buf: a #GstBuffer.
|
||||
*
|
||||
* Increases the refcount of the given buffer by one.
|
||||
*
|
||||
* Note that the refcount affects the writability
|
||||
* of @buf and its metadata, see gst_buffer_is_writable().
|
||||
* It is important to note that keeping additional references to
|
||||
* GstBuffer instances can potentially increase the number
|
||||
* of memcpy operations in a pipeline.
|
||||
*
|
||||
* Returns: (transfer full): @buf
|
||||
*/
|
||||
static inline GstBuffer* gst_buffer_ref(GstBuffer* buf);
|
||||
static inline GstBuffer *
|
||||
gst_buffer_ref (GstBuffer * buf)
|
||||
{
|
||||
return (GstBuffer *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (buf));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_buffer_unref: (skip)
|
||||
* @buf: (transfer full): a #GstBuffer.
|
||||
*
|
||||
* Decreases the refcount of the buffer. If the refcount reaches 0, the buffer
|
||||
* with the associated metadata and memory will be freed.
|
||||
*/
|
||||
static inline void gst_buffer_unref(GstBuffer* buf);
|
||||
static inline void
|
||||
gst_buffer_unref (GstBuffer * buf)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (buf));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clear_buffer: (skip)
|
||||
* @buf_ptr: a pointer to a #GstBuffer reference
|
||||
*
|
||||
* Clears a reference to a #GstBuffer.
|
||||
*
|
||||
* @buf_ptr must not be %NULL.
|
||||
*
|
||||
* If the reference is %NULL then this function does nothing. Otherwise, the
|
||||
* reference count of the buffer is decreased and the pointer is set to %NULL.
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
static inline void
|
||||
gst_clear_buffer (GstBuffer ** buf_ptr)
|
||||
{
|
||||
|
@ -466,24 +430,24 @@ gst_clear_buffer (GstBuffer ** buf_ptr)
|
|||
}
|
||||
|
||||
/* copy buffer */
|
||||
/**
|
||||
* gst_buffer_copy: (skip)
|
||||
* @buf: a #GstBuffer.
|
||||
*
|
||||
* Create a copy of the given buffer. This will only copy the buffer's
|
||||
* data to a newly allocated memory if needed (if the type of memory
|
||||
* requires it), otherwise the underlying data is just referenced.
|
||||
* Check gst_buffer_copy_deep() if you want to force the data
|
||||
* to be copied to newly allocated memory.
|
||||
*
|
||||
* Returns: (transfer full): a new copy of @buf.
|
||||
*/
|
||||
static inline GstBuffer* gst_buffer_copy(const GstBuffer* buf);
|
||||
static inline GstBuffer *
|
||||
gst_buffer_copy (const GstBuffer * buf)
|
||||
{
|
||||
return GST_BUFFER (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (buf)));
|
||||
}
|
||||
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
GST_API
|
||||
GstBuffer * gst_buffer_ref (GstBuffer * buf);
|
||||
|
||||
GST_API
|
||||
void gst_buffer_unref (GstBuffer * buf);
|
||||
|
||||
GST_API
|
||||
void gst_clear_buffer (GstBuffer ** buf_ptr);
|
||||
|
||||
GST_API
|
||||
GstBuffer * gst_buffer_copy (const GstBuffer * buf);
|
||||
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
|
||||
GST_API
|
||||
GstBuffer * gst_buffer_copy_deep (const GstBuffer * buf);
|
||||
|
@ -579,28 +543,17 @@ gboolean gst_buffer_copy_into (GstBuffer *dest, GstBuffer *src
|
|||
*/
|
||||
#define gst_buffer_make_writable(buf) GST_BUFFER_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (buf)))
|
||||
|
||||
/**
|
||||
* gst_buffer_replace: (skip)
|
||||
* @obuf: (inout) (transfer full) (nullable): pointer to a pointer to
|
||||
* a #GstBuffer to be replaced.
|
||||
* @nbuf: (transfer none) (allow-none): pointer to a #GstBuffer that will
|
||||
* replace the buffer pointed to by @obuf.
|
||||
*
|
||||
* Modifies a pointer to a #GstBuffer to point to a different #GstBuffer. The
|
||||
* modification is done atomically (so this is useful for ensuring thread safety
|
||||
* in some cases), and the reference counts are updated appropriately (the old
|
||||
* buffer is unreffed, the new is reffed).
|
||||
*
|
||||
* Either @nbuf or the #GstBuffer pointed to by @obuf may be %NULL.
|
||||
*
|
||||
* Returns: %TRUE when @obuf was different from @nbuf.
|
||||
*/
|
||||
static inline gboolean gst_buffer_replace(GstBuffer** obuf, GstBuffer* nbuf);
|
||||
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
static inline gboolean
|
||||
gst_buffer_replace (GstBuffer **obuf, GstBuffer *nbuf)
|
||||
{
|
||||
return gst_mini_object_replace ((GstMiniObject **) obuf, (GstMiniObject *) nbuf);
|
||||
}
|
||||
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
GST_API
|
||||
gboolean gst_buffer_replace (GstBuffer ** obuf,
|
||||
GstBuffer * nbuf);
|
||||
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
|
||||
/* creating a region */
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
* interesting when multiple buffers need to be pushed in one go because it
|
||||
* can reduce the amount of overhead for pushing each buffer individually.
|
||||
*/
|
||||
#define GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
#include "gst_private.h"
|
||||
|
||||
#include "gstbuffer.h"
|
||||
|
@ -553,3 +554,120 @@ gst_buffer_list_calculate_size (GstBufferList * list)
|
|||
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_buffer_list_ref: (skip)
|
||||
* @list: a #GstBufferList
|
||||
*
|
||||
* Increases the refcount of the given buffer list by one.
|
||||
*
|
||||
* Note that the refcount affects the writability of @list and its data, see
|
||||
* gst_buffer_list_make_writable(). It is important to note that keeping
|
||||
* additional references to GstBufferList instances can potentially increase
|
||||
* the number of memcpy operations in a pipeline.
|
||||
*
|
||||
* Returns: (transfer full): @list
|
||||
*/
|
||||
GstBufferList *
|
||||
gst_buffer_list_ref (GstBufferList * list)
|
||||
{
|
||||
return
|
||||
GST_BUFFER_LIST_CAST (gst_mini_object_ref (GST_MINI_OBJECT_CAST (list)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_buffer_list_unref: (skip)
|
||||
* @list: (transfer full): a #GstBufferList
|
||||
*
|
||||
* Decreases the refcount of the buffer list. If the refcount reaches 0, the
|
||||
* buffer list will be freed.
|
||||
*/
|
||||
void
|
||||
gst_buffer_list_unref (GstBufferList * list)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (list));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clear_buffer_list: (skip)
|
||||
* @list_ptr: a pointer to a #GstBufferList reference
|
||||
*
|
||||
* Clears a reference to a #GstBufferList.
|
||||
*
|
||||
* @list_ptr must not be %NULL.
|
||||
*
|
||||
* If the reference is %NULL then this function does nothing. Otherwise, the
|
||||
* reference count of the list is decreased and the pointer is set to %NULL.
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
void
|
||||
gst_clear_buffer_list (GstBufferList ** list_ptr)
|
||||
{
|
||||
gst_clear_mini_object ((GstMiniObject **) list_ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_buffer_list_copy: (skip)
|
||||
* @list: a #GstBufferList
|
||||
*
|
||||
* Create a shallow copy of the given buffer list. This will make a newly
|
||||
* allocated copy of the source list with copies of buffer pointers. The
|
||||
* refcount of buffers pointed to will be increased by one.
|
||||
*
|
||||
* Returns: (transfer full): a new copy of @list.
|
||||
*/
|
||||
GstBufferList *
|
||||
gst_buffer_list_copy (const GstBufferList * list)
|
||||
{
|
||||
return
|
||||
GST_BUFFER_LIST_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST
|
||||
(list)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_buffer_list_replace:
|
||||
* @old_list: (inout) (transfer full) (nullable): pointer to a pointer to a
|
||||
* #GstBufferList to be replaced.
|
||||
* @new_list: (transfer none) (allow-none): pointer to a #GstBufferList that
|
||||
* will replace the buffer list pointed to by @old_list.
|
||||
*
|
||||
* Modifies a pointer to a #GstBufferList to point to a different
|
||||
* #GstBufferList. The modification is done atomically (so this is useful for
|
||||
* ensuring thread safety in some cases), and the reference counts are updated
|
||||
* appropriately (the old buffer list is unreffed, the new is reffed).
|
||||
*
|
||||
* Either @new_list or the #GstBufferList pointed to by @old_list may be %NULL.
|
||||
*
|
||||
* Returns: %TRUE if @new_list was different from @old_list
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
gboolean
|
||||
gst_buffer_list_replace (GstBufferList ** old_list, GstBufferList * new_list)
|
||||
{
|
||||
return gst_mini_object_replace ((GstMiniObject **) old_list,
|
||||
(GstMiniObject *) new_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_buffer_list_take:
|
||||
* @old_list: (inout) (transfer full): pointer to a pointer to a #GstBufferList
|
||||
* to be replaced.
|
||||
* @new_list: (transfer full) (allow-none): pointer to a #GstBufferList
|
||||
* that will replace the bufferlist pointed to by @old_list.
|
||||
*
|
||||
* Modifies a pointer to a #GstBufferList to point to a different
|
||||
* #GstBufferList. This function is similar to gst_buffer_list_replace() except
|
||||
* that it takes ownership of @new_list.
|
||||
*
|
||||
* Returns: %TRUE if @new_list was different from @old_list
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
gboolean
|
||||
gst_buffer_list_take (GstBufferList ** old_list, GstBufferList * new_list)
|
||||
{
|
||||
return gst_mini_object_take ((GstMiniObject **) old_list,
|
||||
(GstMiniObject *) new_list);
|
||||
}
|
||||
|
|
|
@ -58,22 +58,8 @@ typedef struct _GstBufferList GstBufferList;
|
|||
typedef gboolean (*GstBufferListFunc) (GstBuffer **buffer, guint idx,
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
/* refcounting */
|
||||
/**
|
||||
* gst_buffer_list_ref: (skip)
|
||||
* @list: a #GstBufferList
|
||||
*
|
||||
* Increases the refcount of the given buffer list by one.
|
||||
*
|
||||
* Note that the refcount affects the writability of @list and its data, see
|
||||
* gst_buffer_list_make_writable(). It is important to note that keeping
|
||||
* additional references to GstBufferList instances can potentially increase
|
||||
* the number of memcpy operations in a pipeline.
|
||||
*
|
||||
* Returns: (transfer full): @list
|
||||
*/
|
||||
static inline GstBufferList* gst_buffer_list_ref(GstBufferList* list);
|
||||
static inline GstBufferList *
|
||||
gst_buffer_list_ref (GstBufferList * list)
|
||||
{
|
||||
|
@ -81,33 +67,12 @@ gst_buffer_list_ref (GstBufferList * list)
|
|||
list)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_buffer_list_unref: (skip)
|
||||
* @list: (transfer full): a #GstBufferList
|
||||
*
|
||||
* Decreases the refcount of the buffer list. If the refcount reaches 0, the
|
||||
* buffer list will be freed.
|
||||
*/
|
||||
static inline void gst_buffer_list_unref(GstBufferList* list);
|
||||
static inline void
|
||||
gst_buffer_list_unref(GstBufferList* list)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (list));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clear_buffer_list: (skip)
|
||||
* @list_ptr: a pointer to a #GstBufferList reference
|
||||
*
|
||||
* Clears a reference to a #GstBufferList.
|
||||
*
|
||||
* @list_ptr must not be %NULL.
|
||||
*
|
||||
* If the reference is %NULL then this function does nothing. Otherwise, the
|
||||
* reference count of the list is decreased and the pointer is set to %NULL.
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
static inline void
|
||||
gst_clear_buffer_list (GstBufferList ** list_ptr)
|
||||
{
|
||||
|
@ -115,41 +80,12 @@ gst_clear_buffer_list (GstBufferList ** list_ptr)
|
|||
}
|
||||
|
||||
/* copy */
|
||||
/**
|
||||
* gst_buffer_list_copy: (skip)
|
||||
* @list: a #GstBufferList
|
||||
*
|
||||
* Create a shallow copy of the given buffer list. This will make a newly
|
||||
* allocated copy of the source list with copies of buffer pointers. The
|
||||
* refcount of buffers pointed to will be increased by one.
|
||||
*
|
||||
* Returns: (transfer full): a new copy of @list.
|
||||
*/
|
||||
static inline GstBufferList* gst_buffer_list_copy(const GstBufferList* list);
|
||||
static inline GstBufferList *
|
||||
gst_buffer_list_copy (const GstBufferList * list)
|
||||
{
|
||||
return GST_BUFFER_LIST_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (list)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_buffer_list_replace:
|
||||
* @old_list: (inout) (transfer full) (nullable): pointer to a pointer to a
|
||||
* #GstBufferList to be replaced.
|
||||
* @new_list: (transfer none) (allow-none): pointer to a #GstBufferList that
|
||||
* will replace the buffer list pointed to by @old_list.
|
||||
*
|
||||
* Modifies a pointer to a #GstBufferList to point to a different
|
||||
* #GstBufferList. The modification is done atomically (so this is useful for
|
||||
* ensuring thread safety in some cases), and the reference counts are updated
|
||||
* appropriately (the old buffer list is unreffed, the new is reffed).
|
||||
*
|
||||
* Either @new_list or the #GstBufferList pointed to by @old_list may be %NULL.
|
||||
*
|
||||
* Returns: %TRUE if @new_list was different from @old_list
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
static inline gboolean
|
||||
gst_buffer_list_replace (GstBufferList **old_list, GstBufferList *new_list)
|
||||
{
|
||||
|
@ -157,27 +93,33 @@ gst_buffer_list_replace (GstBufferList **old_list, GstBufferList *new_list)
|
|||
(GstMiniObject *) new_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_buffer_list_take:
|
||||
* @old_list: (inout) (transfer full): pointer to a pointer to a #GstBufferList
|
||||
* to be replaced.
|
||||
* @new_list: (transfer full) (allow-none): pointer to a #GstBufferList
|
||||
* that will replace the bufferlist pointed to by @old_list.
|
||||
*
|
||||
* Modifies a pointer to a #GstBufferList to point to a different
|
||||
* #GstBufferList. This function is similar to gst_buffer_list_replace() except
|
||||
* that it takes ownership of @new_list.
|
||||
*
|
||||
* Returns: %TRUE if @new_list was different from @old_list
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
static inline gboolean
|
||||
gst_buffer_list_take (GstBufferList **old_list, GstBufferList *new_list)
|
||||
{
|
||||
return gst_mini_object_take ((GstMiniObject **) old_list,
|
||||
(GstMiniObject *) new_list);
|
||||
}
|
||||
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
GST_API
|
||||
GstBufferList * gst_buffer_list_ref (GstBufferList * list);
|
||||
|
||||
GST_API
|
||||
void gst_buffer_list_unref (GstBufferList * list);
|
||||
|
||||
GST_API
|
||||
void gst_clear_buffer_list (GstBufferList ** list_ptr);
|
||||
|
||||
GST_API
|
||||
GstBufferList * gst_buffer_list_copy (const GstBufferList * list);
|
||||
|
||||
GST_API
|
||||
gboolean gst_buffer_list_replace (GstBufferList ** old_list,
|
||||
GstBufferList * new_list);
|
||||
|
||||
GST_API
|
||||
gboolean gst_buffer_list_take (GstBufferList ** old_list,
|
||||
GstBufferList * new_list);
|
||||
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
|
||||
/**
|
||||
* gst_buffer_list_is_writable:
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#include <string.h>
|
||||
#include <signal.h>
|
||||
|
||||
#define GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
#include "gst_private.h"
|
||||
#include <gst/gst.h>
|
||||
#include <gobject/gvaluecollector.h>
|
||||
|
@ -2714,3 +2715,99 @@ GstCaps *(gst_caps_copy) (const GstCaps * caps)
|
|||
{
|
||||
return GST_CAPS (gst_mini_object_copy (GST_MINI_OBJECT_CAST (caps)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_caps_ref: (skip)
|
||||
* @caps: the #GstCaps to reference
|
||||
*
|
||||
* Add a reference to a #GstCaps object.
|
||||
*
|
||||
* From this point on, until the caller calls gst_caps_unref() or
|
||||
* gst_caps_make_writable(), it is guaranteed that the caps object will not
|
||||
* change. This means its structures won't change, etc. To use a #GstCaps
|
||||
* object, you must always have a refcount on it -- either the one made
|
||||
* implicitly by e.g. gst_caps_new_simple(), or via taking one explicitly with
|
||||
* this function.
|
||||
*
|
||||
* Returns: the same #GstCaps object.
|
||||
*/
|
||||
GstCaps *
|
||||
gst_caps_ref (GstCaps * caps)
|
||||
{
|
||||
return (GstCaps *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (caps));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_caps_unref: (skip)
|
||||
* @caps: a #GstCaps.
|
||||
*
|
||||
* Unref a #GstCaps and and free all its structures and the
|
||||
* structures' values when the refcount reaches 0.
|
||||
*/
|
||||
void
|
||||
gst_caps_unref (GstCaps * caps)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (caps));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clear_caps: (skip)
|
||||
* @caps_ptr: a pointer to a #GstCaps reference
|
||||
*
|
||||
* Clears a reference to a #GstCaps.
|
||||
*
|
||||
* @caps_ptr must not be %NULL.
|
||||
*
|
||||
* If the reference is %NULL then this function does nothing. Otherwise, the
|
||||
* reference count of the caps is decreased and the pointer is set to %NULL.
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
void
|
||||
gst_clear_caps (GstCaps ** caps_ptr)
|
||||
{
|
||||
gst_clear_mini_object ((GstMiniObject **) caps_ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_caps_replace: (skip)
|
||||
* @old_caps: (inout) (transfer full) (nullable): pointer to a pointer
|
||||
* to a #GstCaps to be replaced.
|
||||
* @new_caps: (transfer none) (allow-none): pointer to a #GstCaps that will
|
||||
* replace the caps pointed to by @old_caps.
|
||||
*
|
||||
* Modifies a pointer to a #GstCaps to point to a different #GstCaps. The
|
||||
* modification is done atomically (so this is useful for ensuring thread safety
|
||||
* in some cases), and the reference counts are updated appropriately (the old
|
||||
* caps is unreffed, the new is reffed).
|
||||
*
|
||||
* Either @new_caps or the #GstCaps pointed to by @old_caps may be %NULL.
|
||||
*
|
||||
* Returns: %TRUE if @new_caps was different from @old_caps
|
||||
*/
|
||||
gboolean
|
||||
gst_caps_replace (GstCaps ** old_caps, GstCaps * new_caps)
|
||||
{
|
||||
return gst_mini_object_replace ((GstMiniObject **) old_caps,
|
||||
(GstMiniObject *) new_caps);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_caps_take: (skip)
|
||||
* @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 @old_caps.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
gboolean
|
||||
gst_caps_take (GstCaps ** old_caps, GstCaps * new_caps)
|
||||
{
|
||||
return gst_mini_object_take ((GstMiniObject **) old_caps,
|
||||
(GstMiniObject *) new_caps);
|
||||
}
|
||||
|
|
|
@ -188,61 +188,35 @@ GST_API GstCaps * _gst_caps_none;
|
|||
*/
|
||||
#define GST_CAPS_FLAG_UNSET(caps,flag) GST_MINI_OBJECT_FLAG_UNSET (caps, flag)
|
||||
|
||||
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
/* refcounting */
|
||||
/**
|
||||
* gst_caps_ref: (skip)
|
||||
* @caps: the #GstCaps to reference
|
||||
*
|
||||
* Add a reference to a #GstCaps object.
|
||||
*
|
||||
* From this point on, until the caller calls gst_caps_unref() or
|
||||
* gst_caps_make_writable(), it is guaranteed that the caps object will not
|
||||
* change. This means its structures won't change, etc. To use a #GstCaps
|
||||
* object, you must always have a refcount on it -- either the one made
|
||||
* implicitly by e.g. gst_caps_new_simple(), or via taking one explicitly with
|
||||
* this function.
|
||||
*
|
||||
* Returns: the same #GstCaps object.
|
||||
*/
|
||||
static inline GstCaps * gst_caps_ref (GstCaps * caps);
|
||||
static inline GstCaps *
|
||||
gst_caps_ref (GstCaps * caps)
|
||||
{
|
||||
return (GstCaps *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (caps));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_caps_unref: (skip)
|
||||
* @caps: a #GstCaps.
|
||||
*
|
||||
* Unref a #GstCaps and and free all its structures and the
|
||||
* structures' values when the refcount reaches 0.
|
||||
*/
|
||||
static inline void gst_caps_unref (GstCaps * caps);
|
||||
static inline void
|
||||
gst_caps_unref (GstCaps * caps)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (caps));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clear_caps: (skip)
|
||||
* @caps_ptr: a pointer to a #GstCaps reference
|
||||
*
|
||||
* Clears a reference to a #GstCaps.
|
||||
*
|
||||
* @caps_ptr must not be %NULL.
|
||||
*
|
||||
* If the reference is %NULL then this function does nothing. Otherwise, the
|
||||
* reference count of the caps is decreased and the pointer is set to %NULL.
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
static inline void
|
||||
gst_clear_caps (GstCaps ** caps_ptr)
|
||||
{
|
||||
gst_clear_mini_object ((GstMiniObject **) caps_ptr);
|
||||
}
|
||||
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
GST_API
|
||||
GstCaps * gst_caps_ref (GstCaps * caps);
|
||||
|
||||
GST_API
|
||||
void gst_caps_unref (GstCaps * caps);
|
||||
|
||||
GST_API
|
||||
void gst_clear_caps (GstCaps ** caps_ptr);
|
||||
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
|
||||
/* copy caps */
|
||||
GST_API
|
||||
|
@ -280,48 +254,27 @@ GstCaps * gst_caps_copy (const GstCaps * caps);
|
|||
*/
|
||||
#define gst_caps_make_writable(caps) GST_CAPS_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (caps)))
|
||||
|
||||
/**
|
||||
* gst_caps_replace: (skip)
|
||||
* @old_caps: (inout) (transfer full) (nullable): pointer to a pointer
|
||||
* to a #GstCaps to be replaced.
|
||||
* @new_caps: (transfer none) (allow-none): pointer to a #GstCaps that will
|
||||
* replace the caps pointed to by @old_caps.
|
||||
*
|
||||
* Modifies a pointer to a #GstCaps to point to a different #GstCaps. The
|
||||
* modification is done atomically (so this is useful for ensuring thread safety
|
||||
* in some cases), and the reference counts are updated appropriately (the old
|
||||
* caps is unreffed, the new is reffed).
|
||||
*
|
||||
* Either @new_caps or the #GstCaps pointed to by @old_caps may be %NULL.
|
||||
*
|
||||
* Returns: %TRUE if @new_caps was different from @old_caps
|
||||
*/
|
||||
static inline gboolean gst_caps_replace (GstCaps **old_caps, GstCaps *new_caps);
|
||||
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
static inline gboolean
|
||||
gst_caps_replace (GstCaps **old_caps, GstCaps *new_caps)
|
||||
{
|
||||
return gst_mini_object_replace ((GstMiniObject **) old_caps, (GstMiniObject *) new_caps);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_caps_take: (skip)
|
||||
* @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 @old_caps.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
static inline gboolean gst_caps_take (GstCaps **old_caps, GstCaps *new_caps);
|
||||
static inline gboolean
|
||||
gst_caps_take (GstCaps **old_caps, GstCaps *new_caps)
|
||||
{
|
||||
return gst_mini_object_take ((GstMiniObject **) old_caps, (GstMiniObject *) new_caps);
|
||||
}
|
||||
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
GST_API
|
||||
gboolean gst_caps_replace (GstCaps ** old_caps,
|
||||
GstCaps * new_caps);
|
||||
|
||||
GST_API
|
||||
gboolean gst_caps_take (GstCaps ** old_caps,
|
||||
GstCaps * new_caps);
|
||||
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
|
||||
/**
|
||||
* GstCaps:
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
* Since: 1.2
|
||||
*/
|
||||
|
||||
#define GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
#include "gst_private.h"
|
||||
#include <string.h>
|
||||
#include "gstcontext.h"
|
||||
|
@ -282,3 +283,79 @@ gst_context_is_persistent (const GstContext * context)
|
|||
|
||||
return context->persistent;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_context_ref:
|
||||
* @context: the context to ref
|
||||
*
|
||||
* Convenience macro to increase the reference count of the context.
|
||||
*
|
||||
* Returns: @context (for convenience when doing assignments)
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
GstContext *
|
||||
gst_context_ref (GstContext * context)
|
||||
{
|
||||
return (GstContext *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (context));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_context_unref:
|
||||
* @context: the context to unref
|
||||
*
|
||||
* Convenience macro to decrease the reference count of the context, possibly
|
||||
* freeing it.
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
void
|
||||
gst_context_unref (GstContext * context)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (context));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_context_copy:
|
||||
* @context: the context to copy
|
||||
*
|
||||
* Creates a copy of the context. Returns a copy of the context.
|
||||
*
|
||||
* Returns: (transfer full): a new copy of @context.
|
||||
*
|
||||
* MT safe
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
GstContext *
|
||||
gst_context_copy (const GstContext * context)
|
||||
{
|
||||
return
|
||||
GST_CONTEXT_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST
|
||||
(context)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_context_replace:
|
||||
* @old_context: (inout) (transfer full): pointer to a pointer to a #GstContext
|
||||
* to be replaced.
|
||||
* @new_context: (allow-none) (transfer none): pointer to a #GstContext that will
|
||||
* replace the context pointed to by @old_context.
|
||||
*
|
||||
* Modifies a pointer to a #GstContext to point to a different #GstContext. The
|
||||
* modification is done atomically (so this is useful for ensuring thread safety
|
||||
* in some cases), and the reference counts are updated appropriately (the old
|
||||
* context is unreffed, the new one is reffed).
|
||||
*
|
||||
* Either @new_context or the #GstContext pointed to by @old_context may be %NULL.
|
||||
*
|
||||
* Returns: %TRUE if @new_context was different from @old_context
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
gboolean
|
||||
gst_context_replace (GstContext ** old_context, GstContext * new_context)
|
||||
{
|
||||
return gst_mini_object_replace ((GstMiniObject **) old_context,
|
||||
(GstMiniObject *) new_context);
|
||||
}
|
||||
|
|
|
@ -45,29 +45,14 @@ GST_API GType _gst_context_type;
|
|||
GST_API
|
||||
GType gst_context_get_type (void);
|
||||
|
||||
|
||||
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
/* refcounting */
|
||||
/**
|
||||
* gst_context_ref:
|
||||
* @context: the context to ref
|
||||
*
|
||||
* Convenience macro to increase the reference count of the context.
|
||||
*
|
||||
* Returns: @context (for convenience when doing assignments)
|
||||
*/
|
||||
static inline GstContext *
|
||||
gst_context_ref (GstContext * context)
|
||||
{
|
||||
return (GstContext *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (context));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_context_unref:
|
||||
* @context: the context to unref
|
||||
*
|
||||
* Convenience macro to decrease the reference count of the context, possibly
|
||||
* freeing it.
|
||||
*/
|
||||
static inline void
|
||||
gst_context_unref (GstContext * context)
|
||||
{
|
||||
|
@ -75,21 +60,21 @@ gst_context_unref (GstContext * context)
|
|||
}
|
||||
|
||||
/* copy context */
|
||||
/**
|
||||
* gst_context_copy:
|
||||
* @context: the context to copy
|
||||
*
|
||||
* Creates a copy of the context. Returns a copy of the context.
|
||||
*
|
||||
* Returns: (transfer full): a new copy of @context.
|
||||
*
|
||||
* MT safe
|
||||
*/
|
||||
static inline GstContext *
|
||||
gst_context_copy (const GstContext * context)
|
||||
{
|
||||
return GST_CONTEXT_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (context)));
|
||||
}
|
||||
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
GST_API
|
||||
GstContext * gst_context_ref (GstContext * context);
|
||||
|
||||
GST_API
|
||||
void gst_context_unref (GstContext * context);
|
||||
|
||||
GST_API
|
||||
GstContext * gst_context_copy (const GstContext * context);
|
||||
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
|
||||
/**
|
||||
* gst_context_is_writable:
|
||||
|
@ -111,27 +96,18 @@ gst_context_copy (const GstContext * context)
|
|||
* MT safe
|
||||
*/
|
||||
#define gst_context_make_writable(context) GST_CONTEXT_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (context)))
|
||||
/**
|
||||
* gst_context_replace:
|
||||
* @old_context: (inout) (transfer full): pointer to a pointer to a #GstContext
|
||||
* to be replaced.
|
||||
* @new_context: (allow-none) (transfer none): pointer to a #GstContext that will
|
||||
* replace the context pointed to by @old_context.
|
||||
*
|
||||
* Modifies a pointer to a #GstContext to point to a different #GstContext. The
|
||||
* modification is done atomically (so this is useful for ensuring thread safety
|
||||
* in some cases), and the reference counts are updated appropriately (the old
|
||||
* context is unreffed, the new one is reffed).
|
||||
*
|
||||
* Either @new_context or the #GstContext pointed to by @old_context may be %NULL.
|
||||
*
|
||||
* Returns: %TRUE if @new_context was different from @old_context
|
||||
*/
|
||||
|
||||
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
static inline gboolean
|
||||
gst_context_replace (GstContext **old_context, GstContext *new_context)
|
||||
{
|
||||
return gst_mini_object_replace ((GstMiniObject **) old_context, (GstMiniObject *) new_context);
|
||||
}
|
||||
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
GST_API
|
||||
gboolean gst_context_replace (GstContext ** old_context,
|
||||
GstContext * new_context);
|
||||
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
|
||||
GST_API
|
||||
GstContext * gst_context_new (const gchar * context_type,
|
||||
|
|
124
gst/gstevent.c
124
gst/gstevent.c
|
@ -71,7 +71,7 @@
|
|||
* ]|
|
||||
*/
|
||||
|
||||
|
||||
#define GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
#include "gst_private.h"
|
||||
#include <string.h> /* memcpy */
|
||||
|
||||
|
@ -2387,3 +2387,125 @@ gst_event_parse_instant_rate_sync_time (GstEvent * event,
|
|||
running_time, GST_QUARK (UPSTREAM_RUNNING_TIME), GST_TYPE_CLOCK_TIME,
|
||||
upstream_running_time, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_event_replace: (skip)
|
||||
* @old_event: (inout) (transfer full) (nullable): pointer to a
|
||||
* pointer to a #GstEvent to be replaced.
|
||||
* @new_event: (allow-none) (transfer none): pointer to a #GstEvent that will
|
||||
* replace the event pointed to by @old_event.
|
||||
*
|
||||
* Modifies a pointer to a #GstEvent to point to a different #GstEvent. The
|
||||
* modification is done atomically (so this is useful for ensuring thread safety
|
||||
* in some cases), and the reference counts are updated appropriately (the old
|
||||
* event is unreffed, the new one is reffed).
|
||||
*
|
||||
* Either @new_event or the #GstEvent pointed to by @old_event may be %NULL.
|
||||
*
|
||||
* Returns: %TRUE if @new_event was different from @old_event
|
||||
*/
|
||||
gboolean
|
||||
gst_event_replace (GstEvent ** old_event, GstEvent * new_event)
|
||||
{
|
||||
return gst_mini_object_replace ((GstMiniObject **) old_event,
|
||||
(GstMiniObject *) new_event);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_event_steal: (skip)
|
||||
* @old_event: (inout) (transfer full) (nullable): pointer to a
|
||||
* pointer to a #GstEvent to be stolen.
|
||||
*
|
||||
* Atomically replace the #GstEvent pointed to by @old_event with %NULL and
|
||||
* return the original event.
|
||||
*
|
||||
* Returns: the #GstEvent that was in @old_event
|
||||
*/
|
||||
GstEvent *
|
||||
gst_event_steal (GstEvent ** old_event)
|
||||
{
|
||||
return GST_EVENT_CAST (gst_mini_object_steal ((GstMiniObject **) old_event));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_event_take: (skip)
|
||||
* @old_event: (inout) (transfer full) (nullable): pointer to a
|
||||
* pointer to a #GstEvent to be stolen.
|
||||
* @new_event: (allow-none) (transfer full): pointer to a #GstEvent that will
|
||||
* replace the event pointed to by @old_event.
|
||||
*
|
||||
* Modifies a pointer to a #GstEvent to point to a different #GstEvent. This
|
||||
* function is similar to gst_event_replace() except that it takes ownership of
|
||||
* @new_event.
|
||||
*
|
||||
* Either @new_event or the #GstEvent pointed to by @old_event may be %NULL.
|
||||
*
|
||||
* Returns: %TRUE if @new_event was different from @old_event
|
||||
*/
|
||||
gboolean
|
||||
gst_event_take (GstEvent ** old_event, GstEvent * new_event)
|
||||
{
|
||||
return gst_mini_object_take ((GstMiniObject **) old_event,
|
||||
(GstMiniObject *) new_event);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_event_ref: (skip)
|
||||
* @event: The event to refcount
|
||||
*
|
||||
* Increase the refcount of this event.
|
||||
*
|
||||
* Returns: (transfer full): @event (for convenience when doing assignments)
|
||||
*/
|
||||
GstEvent *
|
||||
gst_event_ref (GstEvent * event)
|
||||
{
|
||||
return (GstEvent *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (event));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_event_unref: (skip)
|
||||
* @event: (transfer full): the event to refcount
|
||||
*
|
||||
* Decrease the refcount of an event, freeing it if the refcount reaches 0.
|
||||
*/
|
||||
void
|
||||
gst_event_unref (GstEvent * event)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (event));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clear_event: (skip)
|
||||
* @event_ptr: a pointer to a #GstEvent reference
|
||||
*
|
||||
* Clears a reference to a #GstEvent.
|
||||
*
|
||||
* @event_ptr must not be %NULL.
|
||||
*
|
||||
* If the reference is %NULL then this function does nothing. Otherwise, the
|
||||
* reference count of the event is decreased and the pointer is set to %NULL.
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
void
|
||||
gst_clear_event (GstEvent ** event_ptr)
|
||||
{
|
||||
gst_clear_mini_object ((GstMiniObject **) event_ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_event_copy: (skip)
|
||||
* @event: The event to copy
|
||||
*
|
||||
* Copy the event using the event specific copy function.
|
||||
*
|
||||
* Returns: (transfer full): the new event
|
||||
*/
|
||||
GstEvent *
|
||||
gst_event_copy (const GstEvent * event)
|
||||
{
|
||||
return
|
||||
GST_EVENT_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST
|
||||
(event)));
|
||||
}
|
||||
|
|
111
gst/gstevent.h
111
gst/gstevent.h
|
@ -321,67 +321,37 @@ GST_API GType _gst_event_type;
|
|||
* same as @ev
|
||||
*/
|
||||
#define gst_event_make_writable(ev) GST_EVENT_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (ev)))
|
||||
/**
|
||||
* gst_event_replace: (skip)
|
||||
* @old_event: (inout) (transfer full) (nullable): pointer to a
|
||||
* pointer to a #GstEvent to be replaced.
|
||||
* @new_event: (allow-none) (transfer none): pointer to a #GstEvent that will
|
||||
* replace the event pointed to by @old_event.
|
||||
*
|
||||
* Modifies a pointer to a #GstEvent to point to a different #GstEvent. The
|
||||
* modification is done atomically (so this is useful for ensuring thread safety
|
||||
* in some cases), and the reference counts are updated appropriately (the old
|
||||
* event is unreffed, the new one is reffed).
|
||||
*
|
||||
* Either @new_event or the #GstEvent pointed to by @old_event may be %NULL.
|
||||
*
|
||||
* Returns: %TRUE if @new_event was different from @old_event
|
||||
*/
|
||||
static inline gboolean gst_event_replace(GstEvent** old_event, GstEvent* new_event);
|
||||
|
||||
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
static inline gboolean
|
||||
gst_event_replace(GstEvent** old_event, GstEvent* new_event)
|
||||
{
|
||||
return gst_mini_object_replace ((GstMiniObject **) old_event, (GstMiniObject *) new_event);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_event_steal: (skip)
|
||||
* @old_event: (inout) (transfer full) (nullable): pointer to a
|
||||
* pointer to a #GstEvent to be stolen.
|
||||
*
|
||||
* Atomically replace the #GstEvent pointed to by @old_event with %NULL and
|
||||
* return the original event.
|
||||
*
|
||||
* Returns: the #GstEvent that was in @old_event
|
||||
*/
|
||||
static inline GstEvent* gst_event_steal(GstEvent** old_event);
|
||||
static inline GstEvent *
|
||||
gst_event_steal (GstEvent **old_event)
|
||||
{
|
||||
return GST_EVENT_CAST (gst_mini_object_steal ((GstMiniObject **) old_event));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_event_take: (skip)
|
||||
* @old_event: (inout) (transfer full) (nullable): pointer to a
|
||||
* pointer to a #GstEvent to be stolen.
|
||||
* @new_event: (allow-none) (transfer full): pointer to a #GstEvent that will
|
||||
* replace the event pointed to by @old_event.
|
||||
*
|
||||
* Modifies a pointer to a #GstEvent to point to a different #GstEvent. This
|
||||
* function is similar to gst_event_replace() except that it takes ownership of
|
||||
* @new_event.
|
||||
*
|
||||
* Either @new_event or the #GstEvent pointed to by @old_event may be %NULL.
|
||||
*
|
||||
* Returns: %TRUE if @new_event was different from @old_event
|
||||
*/
|
||||
static inline gboolean gst_event_take(GstEvent** old_event, GstEvent* new_event);
|
||||
static inline gboolean
|
||||
gst_event_take (GstEvent **old_event, GstEvent *new_event)
|
||||
{
|
||||
return gst_mini_object_take ((GstMiniObject **) old_event, (GstMiniObject *) new_event);
|
||||
}
|
||||
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
GST_API
|
||||
gboolean gst_event_replace (GstEvent ** old_event,
|
||||
GstEvent * new_event);
|
||||
|
||||
GST_API
|
||||
GstEvent * gst_event_steal (GstEvent ** old_event);
|
||||
|
||||
GST_API
|
||||
gboolean gst_event_take (GstEvent ** old_event,
|
||||
GstEvent *new_event);
|
||||
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
|
||||
/**
|
||||
* GstQOSType:
|
||||
|
@ -447,49 +417,20 @@ GST_API
|
|||
GstEventTypeFlags
|
||||
gst_event_type_get_flags (GstEventType type);
|
||||
|
||||
|
||||
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
/* refcounting */
|
||||
/**
|
||||
* gst_event_ref: (skip)
|
||||
* @event: The event to refcount
|
||||
*
|
||||
* Increase the refcount of this event.
|
||||
*
|
||||
* Returns: (transfer full): @event (for convenience when doing assignments)
|
||||
*/
|
||||
static inline GstEvent* gst_event_ref(GstEvent* event);
|
||||
static inline GstEvent *
|
||||
gst_event_ref (GstEvent * event)
|
||||
{
|
||||
return (GstEvent *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (event));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_event_unref: (skip)
|
||||
* @event: (transfer full): the event to refcount
|
||||
*
|
||||
* Decrease the refcount of an event, freeing it if the refcount reaches 0.
|
||||
*/
|
||||
static inline void gst_event_unref(GstEvent* event);
|
||||
static inline void
|
||||
gst_event_unref (GstEvent * event)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (event));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clear_event: (skip)
|
||||
* @event_ptr: a pointer to a #GstEvent reference
|
||||
*
|
||||
* Clears a reference to a #GstEvent.
|
||||
*
|
||||
* @event_ptr must not be %NULL.
|
||||
*
|
||||
* If the reference is %NULL then this function does nothing. Otherwise, the
|
||||
* reference count of the event is decreased and the pointer is set to %NULL.
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
static inline void
|
||||
gst_clear_event (GstEvent ** event_ptr)
|
||||
{
|
||||
|
@ -497,20 +438,24 @@ gst_clear_event (GstEvent ** event_ptr)
|
|||
}
|
||||
|
||||
/* copy event */
|
||||
/**
|
||||
* gst_event_copy: (skip)
|
||||
* @event: The event to copy
|
||||
*
|
||||
* Copy the event using the event specific copy function.
|
||||
*
|
||||
* Returns: (transfer full): the new event
|
||||
*/
|
||||
static inline GstEvent* gst_event_copy(const GstEvent* event);
|
||||
static inline GstEvent *
|
||||
gst_event_copy (const GstEvent * event)
|
||||
{
|
||||
return GST_EVENT_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (event)));
|
||||
}
|
||||
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
GST_API
|
||||
GstEvent * gst_event_ref (GstEvent * event);
|
||||
|
||||
GST_API
|
||||
void gst_event_unref (GstEvent * event);
|
||||
|
||||
GST_API
|
||||
void gst_clear_event (GstEvent ** event_ptr);
|
||||
|
||||
GST_API
|
||||
GstEvent * gst_event_copy (const GstEvent * event);
|
||||
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
|
||||
GST_API
|
||||
GType gst_event_get_type (void);
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#define GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
#include "gst_private.h"
|
||||
#include "gstmemory.h"
|
||||
|
||||
|
@ -464,3 +465,29 @@ _priv_gst_memory_initialize (void)
|
|||
{
|
||||
_gst_memory_type = gst_memory_get_type ();
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_memory_ref: (skip)
|
||||
* @memory: The memory to refcount
|
||||
*
|
||||
* Increase the refcount of this memory.
|
||||
*
|
||||
* Returns: (transfer full): @memory (for convenience when doing assignments)
|
||||
*/
|
||||
GstMemory *
|
||||
gst_memory_ref (GstMemory * memory)
|
||||
{
|
||||
return (GstMemory *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (memory));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_memory_unref: (skip)
|
||||
* @memory: (transfer full): the memory to refcount
|
||||
*
|
||||
* Decrease the refcount of a memory, freeing it if the refcount reaches 0.
|
||||
*/
|
||||
void
|
||||
gst_memory_unref (GstMemory * memory)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (memory));
|
||||
}
|
||||
|
|
|
@ -323,34 +323,26 @@ void gst_memory_init (GstMemory *mem, GstMemoryFlags flags,
|
|||
GST_API
|
||||
gboolean gst_memory_is_type (GstMemory *mem, const gchar *mem_type);
|
||||
|
||||
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
/* refcounting */
|
||||
/**
|
||||
* gst_memory_ref: (skip)
|
||||
* @memory: The memory to refcount
|
||||
*
|
||||
* Increase the refcount of this memory.
|
||||
*
|
||||
* Returns: (transfer full): @memory (for convenience when doing assignments)
|
||||
*/
|
||||
static inline GstMemory* gst_memory_ref(GstMemory* memory);
|
||||
static inline GstMemory *
|
||||
gst_memory_ref (GstMemory * memory)
|
||||
{
|
||||
return (GstMemory *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (memory));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_memory_unref: (skip)
|
||||
* @memory: (transfer full): the memory to refcount
|
||||
*
|
||||
* Decrease the refcount of a memory, freeing it if the refcount reaches 0.
|
||||
*/
|
||||
static inline void gst_memory_unref(GstMemory* memory);
|
||||
static inline void
|
||||
gst_memory_unref (GstMemory * memory)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (memory));
|
||||
}
|
||||
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
GST_API
|
||||
GstMemory * gst_memory_ref (GstMemory * memory);
|
||||
|
||||
GST_API
|
||||
void gst_memory_unref (GstMemory * memory);
|
||||
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
|
||||
/* getting/setting memory properties */
|
||||
|
||||
|
|
111
gst/gstmessage.c
111
gst/gstmessage.c
|
@ -43,7 +43,7 @@
|
|||
* container using gst_element_post_message().
|
||||
*/
|
||||
|
||||
|
||||
#define GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
#include "gst_private.h"
|
||||
#include <string.h> /* memcpy */
|
||||
#include "gsterror.h"
|
||||
|
@ -3324,3 +3324,112 @@ gst_message_parse_instant_rate_request (GstMessage * message,
|
|||
gst_structure_id_get (structure, GST_QUARK (RATE), G_TYPE_DOUBLE,
|
||||
rate_multiplier, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_message_ref: (skip)
|
||||
* @msg: the message to ref
|
||||
*
|
||||
* Convenience macro to increase the reference count of the message.
|
||||
*
|
||||
* Returns: @msg (for convenience when doing assignments)
|
||||
*/
|
||||
GstMessage *
|
||||
gst_message_ref (GstMessage * msg)
|
||||
{
|
||||
return (GstMessage *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_message_unref: (skip)
|
||||
* @msg: the message to unref
|
||||
*
|
||||
* Convenience macro to decrease the reference count of the message, possibly
|
||||
* freeing it.
|
||||
*/
|
||||
void
|
||||
gst_message_unref (GstMessage * msg)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clear_message: (skip)
|
||||
* @msg_ptr: a pointer to a #GstMessage reference
|
||||
*
|
||||
* Clears a reference to a #GstMessage.
|
||||
*
|
||||
* @msg_ptr must not be %NULL.
|
||||
*
|
||||
* If the reference is %NULL then this function does nothing. Otherwise, the
|
||||
* reference count of the message is decreased and the pointer is set to %NULL.
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
void
|
||||
gst_clear_message (GstMessage ** msg_ptr)
|
||||
{
|
||||
gst_clear_mini_object ((GstMiniObject **) msg_ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_message_copy: (skip)
|
||||
* @msg: the message to copy
|
||||
*
|
||||
* Creates a copy of the message. Returns a copy of the message.
|
||||
*
|
||||
* Returns: (transfer full): a new copy of @msg.
|
||||
*
|
||||
* MT safe
|
||||
*/
|
||||
GstMessage *
|
||||
gst_message_copy (const GstMessage * msg)
|
||||
{
|
||||
return
|
||||
GST_MESSAGE_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST
|
||||
(msg)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_message_replace: (skip)
|
||||
* @old_message: (inout) (transfer full) (nullable): pointer to a
|
||||
* pointer to a #GstMessage to be replaced.
|
||||
* @new_message: (allow-none) (transfer none): pointer to a #GstMessage that will
|
||||
* replace the message pointed to by @old_message.
|
||||
*
|
||||
* Modifies a pointer to a #GstMessage to point to a different #GstMessage. The
|
||||
* modification is done atomically (so this is useful for ensuring thread safety
|
||||
* in some cases), and the reference counts are updated appropriately (the old
|
||||
* message is unreffed, the new one is reffed).
|
||||
*
|
||||
* Either @new_message or the #GstMessage pointed to by @old_message may be %NULL.
|
||||
*
|
||||
* Returns: %TRUE if @new_message was different from @old_message
|
||||
*/
|
||||
gboolean
|
||||
gst_message_replace (GstMessage ** old_message, GstMessage * new_message)
|
||||
{
|
||||
return gst_mini_object_replace ((GstMiniObject **) old_message,
|
||||
(GstMiniObject *) new_message);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_message_take:
|
||||
* @old_message: (inout) (transfer full): pointer to a pointer to a #GstMessage
|
||||
* to be replaced.
|
||||
* @new_message: (transfer full) (allow-none): pointer to a #GstMessage that
|
||||
* will replace the message pointed to by @old_message.
|
||||
*
|
||||
* Modifies a pointer to a #GstMessage to point to a different #GstMessage. This
|
||||
* function is similar to gst_message_replace() except that it takes ownership
|
||||
* of @new_message.
|
||||
*
|
||||
* Returns: %TRUE if @new_message was different from @old_message
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
gboolean
|
||||
gst_message_take (GstMessage ** old_message, GstMessage * new_message)
|
||||
{
|
||||
return gst_mini_object_take ((GstMiniObject **) old_message,
|
||||
(GstMiniObject *) new_message);
|
||||
}
|
||||
|
|
|
@ -360,49 +360,20 @@ const gchar* gst_message_type_get_name (GstMessageType type);
|
|||
GST_API
|
||||
GQuark gst_message_type_to_quark (GstMessageType type);
|
||||
|
||||
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
/* refcounting */
|
||||
/**
|
||||
* gst_message_ref: (skip)
|
||||
* @msg: the message to ref
|
||||
*
|
||||
* Convenience macro to increase the reference count of the message.
|
||||
*
|
||||
* Returns: @msg (for convenience when doing assignments)
|
||||
*/
|
||||
static inline GstMessage * gst_message_ref (GstMessage * msg);
|
||||
static inline GstMessage *
|
||||
gst_message_ref (GstMessage * msg)
|
||||
{
|
||||
return (GstMessage *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_message_unref: (skip)
|
||||
* @msg: the message to unref
|
||||
*
|
||||
* Convenience macro to decrease the reference count of the message, possibly
|
||||
* freeing it.
|
||||
*/
|
||||
static inline void gst_message_unref (GstMessage * msg);
|
||||
static inline void
|
||||
gst_message_unref (GstMessage * msg)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (msg));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clear_message: (skip)
|
||||
* @msg_ptr: a pointer to a #GstMessage reference
|
||||
*
|
||||
* Clears a reference to a #GstMessage.
|
||||
*
|
||||
* @msg_ptr must not be %NULL.
|
||||
*
|
||||
* If the reference is %NULL then this function does nothing. Otherwise, the
|
||||
* reference count of the message is decreased and the pointer is set to %NULL.
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
static inline void
|
||||
gst_clear_message (GstMessage ** msg_ptr)
|
||||
{
|
||||
|
@ -410,22 +381,25 @@ gst_clear_message (GstMessage ** msg_ptr)
|
|||
}
|
||||
|
||||
/* copy message */
|
||||
/**
|
||||
* gst_message_copy: (skip)
|
||||
* @msg: the message to copy
|
||||
*
|
||||
* Creates a copy of the message. Returns a copy of the message.
|
||||
*
|
||||
* Returns: (transfer full): a new copy of @msg.
|
||||
*
|
||||
* MT safe
|
||||
*/
|
||||
static inline GstMessage * gst_message_copy (const GstMessage * msg);
|
||||
static inline GstMessage *
|
||||
gst_message_copy (const GstMessage * msg)
|
||||
{
|
||||
return GST_MESSAGE_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (msg)));
|
||||
}
|
||||
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
GST_API
|
||||
GstMessage * gst_message_ref (GstMessage * msg);
|
||||
|
||||
GST_API
|
||||
void gst_message_unref (GstMessage * msg);
|
||||
|
||||
GST_API
|
||||
void gst_clear_message (GstMessage ** msg_ptr);
|
||||
|
||||
GST_API
|
||||
GstMessage * gst_message_copy (const GstMessage * msg);
|
||||
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
|
||||
/**
|
||||
* gst_message_is_writable:
|
||||
|
@ -447,22 +421,8 @@ gst_message_copy (const GstMessage * msg)
|
|||
* MT safe
|
||||
*/
|
||||
#define gst_message_make_writable(msg) GST_MESSAGE_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (msg)))
|
||||
/**
|
||||
* gst_message_replace: (skip)
|
||||
* @old_message: (inout) (transfer full) (nullable): pointer to a
|
||||
* pointer to a #GstMessage to be replaced.
|
||||
* @new_message: (allow-none) (transfer none): pointer to a #GstMessage that will
|
||||
* replace the message pointed to by @old_message.
|
||||
*
|
||||
* Modifies a pointer to a #GstMessage to point to a different #GstMessage. The
|
||||
* modification is done atomically (so this is useful for ensuring thread safety
|
||||
* in some cases), and the reference counts are updated appropriately (the old
|
||||
* message is unreffed, the new one is reffed).
|
||||
*
|
||||
* Either @new_message or the #GstMessage pointed to by @old_message may be %NULL.
|
||||
*
|
||||
* Returns: %TRUE if @new_message was different from @old_message
|
||||
*/
|
||||
|
||||
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
static inline gboolean gst_message_replace (GstMessage **old_message, GstMessage *new_message);
|
||||
static inline gboolean
|
||||
gst_message_replace (GstMessage **old_message, GstMessage *new_message)
|
||||
|
@ -470,28 +430,21 @@ gst_message_replace (GstMessage **old_message, GstMessage *new_message)
|
|||
return gst_mini_object_replace ((GstMiniObject **) old_message, (GstMiniObject *) new_message);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_message_take:
|
||||
* @old_message: (inout) (transfer full): pointer to a pointer to a #GstMessage
|
||||
* to be replaced.
|
||||
* @new_message: (transfer full) (allow-none): pointer to a #GstMessage that
|
||||
* will replace the message pointed to by @old_message.
|
||||
*
|
||||
* Modifies a pointer to a #GstMessage to point to a different #GstMessage. This
|
||||
* function is similar to gst_message_replace() except that it takes ownership
|
||||
* of @new_message.
|
||||
*
|
||||
* Returns: %TRUE if @new_message was different from @old_message
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
static inline gboolean
|
||||
gst_message_take (GstMessage **old_message, GstMessage *new_message)
|
||||
{
|
||||
return gst_mini_object_take ((GstMiniObject **) old_message,
|
||||
(GstMiniObject *) new_message);
|
||||
}
|
||||
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
GST_API
|
||||
gboolean gst_message_replace (GstMessage ** old_message,
|
||||
GstMessage * new_message);
|
||||
|
||||
GST_API
|
||||
gboolean gst_message_take (GstMessage ** old_message,
|
||||
GstMessage * new_message);
|
||||
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
|
||||
/* custom messages */
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#define GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
#include "gst_private.h"
|
||||
|
||||
#include "gstpromise.h"
|
||||
|
@ -408,3 +409,34 @@ gst_promise_new_with_change_func (GstPromiseChangeFunc func, gpointer user_data,
|
|||
}
|
||||
|
||||
GST_DEFINE_MINI_OBJECT_TYPE (GstPromise, gst_promise);
|
||||
|
||||
/**
|
||||
* gst_promise_ref:
|
||||
* @promise: a #GstPromise.
|
||||
*
|
||||
* Increases the refcount of the given @promise by one.
|
||||
*
|
||||
* Returns: (transfer full): @promise
|
||||
*
|
||||
* Since: 1.14
|
||||
*/
|
||||
GstPromise *
|
||||
gst_promise_ref (GstPromise * promise)
|
||||
{
|
||||
return (GstPromise *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (promise));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_promise_unref:
|
||||
* @promise: (transfer full): a #GstPromise.
|
||||
*
|
||||
* Decreases the refcount of the promise. If the refcount reaches 0, the
|
||||
* promise will be freed.
|
||||
*
|
||||
* Since: 1.14
|
||||
*/
|
||||
void
|
||||
gst_promise_unref (GstPromise * promise)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (promise));
|
||||
}
|
||||
|
|
|
@ -93,36 +93,25 @@ void gst_promise_expire (GstPromise * promis
|
|||
GST_API
|
||||
const GstStructure * gst_promise_get_reply (GstPromise * promise);
|
||||
|
||||
/**
|
||||
* gst_promise_ref:
|
||||
* @promise: a #GstPromise.
|
||||
*
|
||||
* Increases the refcount of the given @promise by one.
|
||||
*
|
||||
* Returns: (transfer full): @promise
|
||||
*
|
||||
* Since: 1.14
|
||||
*/
|
||||
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
static inline GstPromise *
|
||||
gst_promise_ref (GstPromise * promise)
|
||||
{
|
||||
return (GstPromise *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (promise));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_promise_unref:
|
||||
* @promise: (transfer full): a #GstPromise.
|
||||
*
|
||||
* Decreases the refcount of the promise. If the refcount reaches 0, the
|
||||
* promise will be freed.
|
||||
*
|
||||
* Since: 1.14
|
||||
*/
|
||||
static inline void
|
||||
gst_promise_unref (GstPromise * promise)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (promise));
|
||||
}
|
||||
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
GST_API
|
||||
GstPromise * gst_promise_ref (GstPromise * promise);
|
||||
|
||||
GST_API
|
||||
void gst_promise_unref (GstPromise * promise);
|
||||
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPromise, gst_promise_unref)
|
||||
|
||||
|
|
111
gst/gstquery.c
111
gst/gstquery.c
|
@ -53,7 +53,7 @@
|
|||
* ]|
|
||||
*/
|
||||
|
||||
|
||||
#define GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
#include "gst_private.h"
|
||||
#include "gstinfo.h"
|
||||
#include "gstquery.h"
|
||||
|
@ -2727,3 +2727,112 @@ gst_query_parse_bitrate (GstQuery * query, guint * nominal_bitrate)
|
|||
*nominal_bitrate = g_value_get_uint (value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_query_ref:
|
||||
* @q: a #GstQuery to increase the refcount of.
|
||||
*
|
||||
* Increases the refcount of the given query by one.
|
||||
*
|
||||
* Returns: @q
|
||||
*/
|
||||
GstQuery *
|
||||
gst_query_ref (GstQuery * q)
|
||||
{
|
||||
return GST_QUERY_CAST (gst_mini_object_ref (GST_MINI_OBJECT_CAST (q)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_query_unref: (skip)
|
||||
* @q: a #GstQuery to decrease the refcount of.
|
||||
*
|
||||
* Decreases the refcount of the query. If the refcount reaches 0, the query
|
||||
* will be freed.
|
||||
*/
|
||||
void
|
||||
gst_query_unref (GstQuery * q)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (q));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clear_query: (skip)
|
||||
* @query_ptr: a pointer to a #GstQuery reference
|
||||
*
|
||||
* Clears a reference to a #GstQuery.
|
||||
*
|
||||
* @query_ptr must not be %NULL.
|
||||
*
|
||||
* If the reference is %NULL then this function does nothing. Otherwise, the
|
||||
* reference count of the query is decreased and the pointer is set to %NULL.
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
void
|
||||
gst_clear_query (GstQuery ** query_ptr)
|
||||
{
|
||||
gst_clear_mini_object ((GstMiniObject **) query_ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_query_copy: (skip)
|
||||
* @q: a #GstQuery to copy.
|
||||
*
|
||||
* Copies the given query using the copy function of the parent #GstStructure.
|
||||
*
|
||||
* Free-function: gst_query_unref
|
||||
*
|
||||
* Returns: (transfer full): a new copy of @q.
|
||||
*/
|
||||
GstQuery *
|
||||
gst_query_copy (const GstQuery * q)
|
||||
{
|
||||
return GST_QUERY_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (q)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_query_replace: (skip)
|
||||
* @old_query: (inout) (transfer full) (nullable): pointer to a pointer to a
|
||||
* #GstQuery to be replaced.
|
||||
* @new_query: (allow-none) (transfer none): pointer to a #GstQuery that will
|
||||
* replace the query pointed to by @old_query.
|
||||
*
|
||||
* Modifies a pointer to a #GstQuery to point to a different #GstQuery. The
|
||||
* modification is done atomically (so this is useful for ensuring thread safety
|
||||
* in some cases), and the reference counts are updated appropriately (the old
|
||||
* query is unreffed, the new one is reffed).
|
||||
*
|
||||
* Either @new_query or the #GstQuery pointed to by @old_query may be %NULL.
|
||||
*
|
||||
* Returns: %TRUE if @new_query was different from @old_query
|
||||
*/
|
||||
gboolean
|
||||
gst_query_replace (GstQuery ** old_query, GstQuery * new_query)
|
||||
{
|
||||
return gst_mini_object_replace ((GstMiniObject **) old_query,
|
||||
(GstMiniObject *) new_query);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_query_take:
|
||||
* @old_query: (inout) (transfer full) (nullable): pointer to a
|
||||
* pointer to a #GstQuery to be stolen.
|
||||
* @new_query: (allow-none) (transfer full): pointer to a #GstQuery that will
|
||||
* replace the query pointed to by @old_query.
|
||||
*
|
||||
* Modifies a pointer to a #GstQuery to point to a different #GstQuery. This
|
||||
* function is similar to gst_query_replace() except that it takes ownership of
|
||||
* @new_query.
|
||||
*
|
||||
* Either @new_query or the #GstQuery pointed to by @old_query may be %NULL.
|
||||
*
|
||||
* Returns: %TRUE if @new_query was different from @old_query
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
gboolean
|
||||
gst_query_take (GstQuery ** old_query, GstQuery * new_query)
|
||||
{
|
||||
return gst_mini_object_take ((GstMiniObject **) old_query,
|
||||
(GstMiniObject *) new_query);
|
||||
}
|
||||
|
|
|
@ -228,48 +228,20 @@ GstQueryTypeFlags
|
|||
GST_API
|
||||
GType gst_query_get_type (void);
|
||||
|
||||
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
/* refcounting */
|
||||
/**
|
||||
* gst_query_ref:
|
||||
* @q: a #GstQuery to increase the refcount of.
|
||||
*
|
||||
* Increases the refcount of the given query by one.
|
||||
*
|
||||
* Returns: @q
|
||||
*/
|
||||
static inline GstQuery *
|
||||
gst_query_ref (GstQuery * q)
|
||||
{
|
||||
return GST_QUERY_CAST (gst_mini_object_ref (GST_MINI_OBJECT_CAST (q)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_query_unref: (skip)
|
||||
* @q: a #GstQuery to decrease the refcount of.
|
||||
*
|
||||
* Decreases the refcount of the query. If the refcount reaches 0, the query
|
||||
* will be freed.
|
||||
*/
|
||||
static inline void gst_query_unref(GstQuery* q);
|
||||
static inline void
|
||||
gst_query_unref (GstQuery * q)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (q));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clear_query: (skip)
|
||||
* @query_ptr: a pointer to a #GstQuery reference
|
||||
*
|
||||
* Clears a reference to a #GstQuery.
|
||||
*
|
||||
* @query_ptr must not be %NULL.
|
||||
*
|
||||
* If the reference is %NULL then this function does nothing. Otherwise, the
|
||||
* reference count of the query is decreased and the pointer is set to %NULL.
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
static inline void
|
||||
gst_clear_query (GstQuery ** query_ptr)
|
||||
{
|
||||
|
@ -277,22 +249,24 @@ gst_clear_query (GstQuery ** query_ptr)
|
|||
}
|
||||
|
||||
/* copy query */
|
||||
/**
|
||||
* gst_query_copy: (skip)
|
||||
* @q: a #GstQuery to copy.
|
||||
*
|
||||
* Copies the given query using the copy function of the parent #GstStructure.
|
||||
*
|
||||
* Free-function: gst_query_unref
|
||||
*
|
||||
* Returns: (transfer full): a new copy of @q.
|
||||
*/
|
||||
static inline GstQuery* gst_query_copy(const GstQuery* q);
|
||||
static inline GstQuery *
|
||||
gst_query_copy (const GstQuery * q)
|
||||
{
|
||||
return GST_QUERY_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (q)));
|
||||
}
|
||||
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
GST_API
|
||||
GstQuery * gst_query_ref (GstQuery * q);
|
||||
|
||||
GST_API
|
||||
void gst_query_unref (GstQuery * q);
|
||||
|
||||
GST_API
|
||||
void gst_clear_query (GstQuery ** query_ptr);
|
||||
|
||||
GST_API
|
||||
GstQuery * gst_query_copy (const GstQuery * q);
|
||||
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
|
||||
/**
|
||||
* gst_query_is_writable:
|
||||
|
@ -310,52 +284,29 @@ gst_query_copy (const GstQuery * q)
|
|||
* Returns: (transfer full): a new writable query (possibly same as @q)
|
||||
*/
|
||||
#define gst_query_make_writable(q) GST_QUERY_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (q)))
|
||||
/**
|
||||
* gst_query_replace: (skip)
|
||||
* @old_query: (inout) (transfer full) (nullable): pointer to a pointer to a
|
||||
* #GstQuery to be replaced.
|
||||
* @new_query: (allow-none) (transfer none): pointer to a #GstQuery that will
|
||||
* replace the query pointed to by @old_query.
|
||||
*
|
||||
* Modifies a pointer to a #GstQuery to point to a different #GstQuery. The
|
||||
* modification is done atomically (so this is useful for ensuring thread safety
|
||||
* in some cases), and the reference counts are updated appropriately (the old
|
||||
* query is unreffed, the new one is reffed).
|
||||
*
|
||||
* Either @new_query or the #GstQuery pointed to by @old_query may be %NULL.
|
||||
*
|
||||
* Returns: %TRUE if @new_query was different from @old_query
|
||||
*/
|
||||
static inline gboolean gst_query_replace(GstQuery** old_query, GstQuery* new_query);
|
||||
|
||||
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
static inline gboolean
|
||||
gst_query_replace (GstQuery **old_query, GstQuery *new_query)
|
||||
{
|
||||
return gst_mini_object_replace ((GstMiniObject **) old_query, (GstMiniObject *) new_query);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_query_take:
|
||||
* @old_query: (inout) (transfer full) (nullable): pointer to a
|
||||
* pointer to a #GstQuery to be stolen.
|
||||
* @new_query: (allow-none) (transfer full): pointer to a #GstQuery that will
|
||||
* replace the query pointed to by @old_query.
|
||||
*
|
||||
* Modifies a pointer to a #GstQuery to point to a different #GstQuery. This
|
||||
* function is similar to gst_query_replace() except that it takes ownership of
|
||||
* @new_query.
|
||||
*
|
||||
* Either @new_query or the #GstQuery pointed to by @old_query may be %NULL.
|
||||
*
|
||||
* Returns: %TRUE if @new_query was different from @old_query
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
static inline gboolean
|
||||
gst_query_take (GstQuery **old_query, GstQuery *new_query)
|
||||
{
|
||||
return gst_mini_object_take ((GstMiniObject **) old_query,
|
||||
(GstMiniObject *) new_query);
|
||||
}
|
||||
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
GST_API
|
||||
gboolean gst_query_replace (GstQuery ** old_query,
|
||||
GstQuery * new_query);
|
||||
|
||||
GST_API
|
||||
gboolean gst_query_take (GstQuery ** old_query,
|
||||
GstQuery * new_query);
|
||||
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
|
||||
/* application specific query */
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
* A #GstSample is a small object containing data, a type, timing and
|
||||
* extra arbitrary information.
|
||||
*/
|
||||
#define GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
#include "gst_private.h"
|
||||
|
||||
#include "gstsample.h"
|
||||
|
@ -432,3 +433,48 @@ had_parent:
|
|||
g_warning ("structure is already owned by another object");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_sample_ref: (skip)
|
||||
* @sample: a #GstSample
|
||||
*
|
||||
* Increases the refcount of the given sample by one.
|
||||
*
|
||||
* Returns: (transfer full): @sample
|
||||
*/
|
||||
GstSample *
|
||||
gst_sample_ref (GstSample * sample)
|
||||
{
|
||||
return GST_SAMPLE_CAST (gst_mini_object_ref (GST_MINI_OBJECT_CAST (sample)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_sample_unref: (skip)
|
||||
* @sample: (transfer full): a #GstSample
|
||||
*
|
||||
* Decreases the refcount of the sample. If the refcount reaches 0, the
|
||||
* sample will be freed.
|
||||
*/
|
||||
void
|
||||
gst_sample_unref (GstSample * sample)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (sample));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_sample_copy: (skip)
|
||||
* @buf: a #GstSample.
|
||||
*
|
||||
* Create a copy of the given sample. This will also make a newly allocated
|
||||
* copy of the data the source sample contains.
|
||||
*
|
||||
* Returns: (transfer full): a new copy of @buf.
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
GstSample *
|
||||
gst_sample_copy (const GstSample * buf)
|
||||
{
|
||||
return
|
||||
GST_SAMPLE_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (buf)));
|
||||
}
|
||||
|
|
|
@ -87,16 +87,8 @@ void gst_sample_set_segment (GstSample * sample, const GstSegm
|
|||
GST_API
|
||||
gboolean gst_sample_set_info (GstSample *sample, GstStructure *info);
|
||||
|
||||
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
/* refcounting */
|
||||
/**
|
||||
* gst_sample_ref: (skip)
|
||||
* @sample: a #GstSample
|
||||
*
|
||||
* Increases the refcount of the given sample by one.
|
||||
*
|
||||
* Returns: (transfer full): @sample
|
||||
*/
|
||||
static inline GstSample* gst_sample_ref(GstSample* sample);
|
||||
static inline GstSample *
|
||||
gst_sample_ref (GstSample * sample)
|
||||
{
|
||||
|
@ -104,19 +96,18 @@ gst_sample_ref (GstSample * sample)
|
|||
sample)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_sample_unref: (skip)
|
||||
* @sample: (transfer full): a #GstSample
|
||||
*
|
||||
* Decreases the refcount of the sample. If the refcount reaches 0, the
|
||||
* sample will be freed.
|
||||
*/
|
||||
static inline void gst_sample_unref(GstSample* sample);
|
||||
static inline void
|
||||
gst_sample_unref (GstSample * sample)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (sample));
|
||||
}
|
||||
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
GST_API
|
||||
GstSample * gst_sample_ref (GstSample * sample);
|
||||
|
||||
GST_API
|
||||
void gst_sample_unref (GstSample * sample);
|
||||
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
|
||||
/**
|
||||
* gst_sample_is_writable:
|
||||
|
@ -156,25 +147,17 @@ gst_sample_unref (GstSample * sample)
|
|||
*/
|
||||
#define gst_sample_make_writable(sample) GST_SAMPLE_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (sample)))
|
||||
|
||||
|
||||
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
/* copy sample */
|
||||
/**
|
||||
* gst_sample_copy: (skip)
|
||||
* @buf: a #GstSample.
|
||||
*
|
||||
* Create a copy of the given sample. This will also make a newly allocated
|
||||
* copy of the data the source sample contains.
|
||||
*
|
||||
* Returns: (transfer full): a new copy of @buf.
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
static inline GstSample* gst_sample_copy(const GstSample* buf);
|
||||
static inline GstSample *
|
||||
gst_sample_copy (const GstSample * buf)
|
||||
{
|
||||
return GST_SAMPLE_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (buf)));
|
||||
}
|
||||
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
GST_API
|
||||
GstSample * gst_sample_copy(const GstSample * buf);
|
||||
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
|
||||
/**
|
||||
* gst_value_set_sample:
|
||||
|
|
100
gst/gsttaglist.c
100
gst/gsttaglist.c
|
@ -34,6 +34,7 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#define GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
#include "gst_private.h"
|
||||
#include "math-compat.h"
|
||||
#include "gst-i18n-lib.h"
|
||||
|
@ -2083,3 +2084,102 @@ GstTagList *(gst_tag_list_copy) (const GstTagList * taglist)
|
|||
{
|
||||
return GST_TAG_LIST (gst_mini_object_copy (GST_MINI_OBJECT_CAST (taglist)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_tag_list_ref: (skip)
|
||||
* @taglist: the #GstTagList to reference
|
||||
*
|
||||
* Add a reference to a #GstTagList mini object.
|
||||
*
|
||||
* From this point on, until the caller calls gst_tag_list_unref() or
|
||||
* gst_tag_list_make_writable(), it is guaranteed that the taglist object will
|
||||
* not change. To use a #GstTagList object, you must always have a refcount on
|
||||
* it -- either the one made implicitly by e.g. gst_tag_list_new(), or via
|
||||
* taking one explicitly with this function.
|
||||
*
|
||||
* Returns: the same #GstTagList mini object.
|
||||
*/
|
||||
GstTagList *
|
||||
gst_tag_list_ref (GstTagList * taglist)
|
||||
{
|
||||
return (GstTagList *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (taglist));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_tag_list_unref: (skip)
|
||||
* @taglist: a #GstTagList.
|
||||
*
|
||||
* Unref a #GstTagList, and and free all its memory when the refcount reaches 0.
|
||||
*/
|
||||
void
|
||||
gst_tag_list_unref (GstTagList * taglist)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (taglist));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clear_tag_list: (skip)
|
||||
* @taglist_ptr: a pointer to a #GstTagList reference
|
||||
*
|
||||
* Clears a reference to a #GstTagList.
|
||||
*
|
||||
* @taglist_ptr must not be %NULL.
|
||||
*
|
||||
* If the reference is %NULL then this function does nothing. Otherwise, the
|
||||
* reference count of the taglist is decreased and the pointer is set to %NULL.
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
void
|
||||
gst_clear_tag_list (GstTagList ** taglist_ptr)
|
||||
{
|
||||
gst_clear_mini_object ((GstMiniObject **) taglist_ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_tag_list_replace:
|
||||
* @old_taglist: (inout) (transfer full) (nullable): pointer to a pointer to a
|
||||
* #GstTagList to be replaced.
|
||||
* @new_taglist: (transfer none) (allow-none): pointer to a #GstTagList that
|
||||
* will replace the tag list pointed to by @old_taglist.
|
||||
*
|
||||
* Modifies a pointer to a #GstTagList to point to a different #GstTagList. The
|
||||
* modification is done atomically (so this is useful for ensuring thread
|
||||
* safety in some cases), and the reference counts are updated appropriately
|
||||
* (the old tag list is unreffed, the new is reffed).
|
||||
*
|
||||
* Either @new_taglist or the #GstTagList pointed to by @old_taglist may be
|
||||
* %NULL.
|
||||
*
|
||||
* Returns: %TRUE if @new_taglist was different from @old_taglist
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
gboolean
|
||||
gst_tag_list_replace (GstTagList ** old_taglist, GstTagList * new_taglist)
|
||||
{
|
||||
return gst_mini_object_replace ((GstMiniObject **) old_taglist,
|
||||
(GstMiniObject *) new_taglist);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_tag_list_take:
|
||||
* @old_taglist: (inout) (transfer full): pointer to a pointer to a #GstTagList
|
||||
* to be replaced.
|
||||
* @new_taglist: (transfer full) (allow-none): pointer to a #GstTagList that
|
||||
* will replace the taglist pointed to by @old_taglist.
|
||||
*
|
||||
* Modifies a pointer to a #GstTagList to point to a different #GstTagList.
|
||||
* This function is similar to gst_tag_list_replace() except that it takes
|
||||
* ownership of @new_taglist.
|
||||
*
|
||||
* Returns: %TRUE if @new_taglist was different from @old_taglist
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
gboolean
|
||||
gst_tag_list_take (GstTagList ** old_taglist, GstTagList * new_taglist)
|
||||
{
|
||||
return gst_mini_object_take ((GstMiniObject **) old_taglist,
|
||||
(GstMiniObject *) new_taglist);
|
||||
}
|
||||
|
|
|
@ -399,84 +399,42 @@ gboolean gst_tag_list_get_sample_index (const GstTagList * list,
|
|||
guint index,
|
||||
GstSample ** sample);
|
||||
|
||||
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
/* refcounting */
|
||||
/**
|
||||
* gst_tag_list_ref: (skip)
|
||||
* @taglist: the #GstTagList to reference
|
||||
*
|
||||
* Add a reference to a #GstTagList mini object.
|
||||
*
|
||||
* From this point on, until the caller calls gst_tag_list_unref() or
|
||||
* gst_tag_list_make_writable(), it is guaranteed that the taglist object will
|
||||
* not change. To use a #GstTagList object, you must always have a refcount on
|
||||
* it -- either the one made implicitly by e.g. gst_tag_list_new(), or via
|
||||
* taking one explicitly with this function.
|
||||
*
|
||||
* Returns: the same #GstTagList mini object.
|
||||
*/
|
||||
static inline GstTagList* gst_tag_list_ref(GstTagList* taglist);
|
||||
static inline GstTagList *
|
||||
gst_tag_list_ref (GstTagList * taglist)
|
||||
{
|
||||
return (GstTagList *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (taglist));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_tag_list_unref: (skip)
|
||||
* @taglist: a #GstTagList.
|
||||
*
|
||||
* Unref a #GstTagList, and and free all its memory when the refcount reaches 0.
|
||||
*/
|
||||
static inline void gst_tag_list_unref(GstTagList* taglist);
|
||||
static inline void
|
||||
gst_tag_list_unref (GstTagList * taglist)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (taglist));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clear_tag_list: (skip)
|
||||
* @taglist_ptr: a pointer to a #GstTagList reference
|
||||
*
|
||||
* Clears a reference to a #GstTagList.
|
||||
*
|
||||
* @taglist_ptr must not be %NULL.
|
||||
*
|
||||
* If the reference is %NULL then this function does nothing. Otherwise, the
|
||||
* reference count of the taglist is decreased and the pointer is set to %NULL.
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
static inline void
|
||||
gst_clear_tag_list (GstTagList ** taglist_ptr)
|
||||
{
|
||||
gst_clear_mini_object ((GstMiniObject **) taglist_ptr);
|
||||
}
|
||||
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
GST_API
|
||||
GstTagList * gst_tag_list_ref (GstTagList * taglist);
|
||||
|
||||
GST_API
|
||||
void gst_tag_list_unref (GstTagList * taglist);
|
||||
|
||||
GST_API
|
||||
void gst_clear_tag_list (GstTagList ** taglist_ptr);
|
||||
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
|
||||
GST_API
|
||||
GstTagList* gst_tag_list_copy(const GstTagList* taglist);
|
||||
|
||||
#define gst_tag_list_copy(taglist) GST_TAG_LIST (gst_mini_object_copy (GST_MINI_OBJECT_CAST (taglist)))
|
||||
|
||||
/**
|
||||
* gst_tag_list_replace:
|
||||
* @old_taglist: (inout) (transfer full) (nullable): pointer to a pointer to a
|
||||
* #GstTagList to be replaced.
|
||||
* @new_taglist: (transfer none) (allow-none): pointer to a #GstTagList that
|
||||
* will replace the tag list pointed to by @old_taglist.
|
||||
*
|
||||
* Modifies a pointer to a #GstTagList to point to a different #GstTagList. The
|
||||
* modification is done atomically (so this is useful for ensuring thread
|
||||
* safety in some cases), and the reference counts are updated appropriately
|
||||
* (the old tag list is unreffed, the new is reffed).
|
||||
*
|
||||
* Either @new_taglist or the #GstTagList pointed to by @old_taglist may be
|
||||
* %NULL.
|
||||
*
|
||||
* Returns: %TRUE if @new_taglist was different from @old_taglist
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
static inline gboolean
|
||||
gst_tag_list_replace (GstTagList **old_taglist, GstTagList *new_taglist)
|
||||
{
|
||||
|
@ -484,27 +442,21 @@ gst_tag_list_replace (GstTagList **old_taglist, GstTagList *new_taglist)
|
|||
(GstMiniObject *) new_taglist);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_tag_list_take:
|
||||
* @old_taglist: (inout) (transfer full): pointer to a pointer to a #GstTagList
|
||||
* to be replaced.
|
||||
* @new_taglist: (transfer full) (allow-none): pointer to a #GstTagList that
|
||||
* will replace the taglist pointed to by @old_taglist.
|
||||
*
|
||||
* Modifies a pointer to a #GstTagList to point to a different #GstTagList.
|
||||
* This function is similar to gst_tag_list_replace() except that it takes
|
||||
* ownership of @new_taglist.
|
||||
*
|
||||
* Returns: %TRUE if @new_taglist was different from @old_taglist
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
static inline gboolean
|
||||
gst_tag_list_take (GstTagList **old_taglist, GstTagList *new_taglist)
|
||||
{
|
||||
return gst_mini_object_take ((GstMiniObject **) old_taglist,
|
||||
(GstMiniObject *) new_taglist);
|
||||
}
|
||||
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
GST_API
|
||||
gboolean gst_tag_list_replace (GstTagList ** old_taglist,
|
||||
GstTagList * new_taglist);
|
||||
|
||||
GST_API
|
||||
gboolean gst_tag_list_take (GstTagList ** old_taglist,
|
||||
GstTagList * new_taglist);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* gst_tag_list_is_writable:
|
||||
|
|
73
gst/gsturi.c
73
gst/gsturi.c
|
@ -42,6 +42,7 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#define GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
#include "gst_private.h"
|
||||
#include "gst.h"
|
||||
#include "gsturi.h"
|
||||
|
@ -2874,3 +2875,75 @@ gst_uri_get_media_fragment_table (const GstUri * uri)
|
|||
return NULL;
|
||||
return _gst_uri_string_to_table (uri->fragment, "&", "=", TRUE, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_uri_copy:
|
||||
* @uri: This #GstUri object.
|
||||
*
|
||||
* Create a new #GstUri object with the same data as this #GstUri object.
|
||||
* If @uri is %NULL then returns %NULL.
|
||||
*
|
||||
* Returns: (transfer full): A new #GstUri object which is a copy of this
|
||||
* #GstUri or %NULL.
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
GstUri *
|
||||
gst_uri_copy (const GstUri * uri)
|
||||
{
|
||||
return GST_URI_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (uri)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_uri_ref:
|
||||
* @uri: (transfer none): This #GstUri object.
|
||||
*
|
||||
* Add a reference to this #GstUri object. See gst_mini_object_ref() for further
|
||||
* info.
|
||||
*
|
||||
* Returns: This object with the reference count incremented.
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
GstUri *
|
||||
gst_uri_ref (GstUri * uri)
|
||||
{
|
||||
return GST_URI_CAST (gst_mini_object_ref (GST_MINI_OBJECT_CAST (uri)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_uri_unref:
|
||||
* @uri: (transfer full): This #GstUri object.
|
||||
*
|
||||
* Decrement the reference count to this #GstUri object.
|
||||
*
|
||||
* If the reference count drops to 0 then finalize this object.
|
||||
*
|
||||
* See gst_mini_object_unref() for further info.
|
||||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
void
|
||||
gst_uri_unref (GstUri * uri)
|
||||
{
|
||||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (uri));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clear_uri: (skip)
|
||||
* @uri_ptr: a pointer to a #GstUri reference
|
||||
*
|
||||
* Clears a reference to a #GstUri.
|
||||
*
|
||||
* @uri_ptr must not be %NULL.
|
||||
*
|
||||
* If the reference is %NULL then this function does nothing. Otherwise, the
|
||||
* reference count of the uri is decreased and the pointer is set to %NULL.
|
||||
*
|
||||
* Since: 1.18
|
||||
*/
|
||||
void
|
||||
gst_clear_uri (GstUri ** uri_ptr)
|
||||
{
|
||||
gst_clear_mini_object ((GstMiniObject **) uri_ptr);
|
||||
}
|
||||
|
|
14
gst/gsturi.h
14
gst/gsturi.h
|
@ -351,6 +351,7 @@ gboolean gst_uri_set_fragment (GstUri * uri, const gchar * fragment);
|
|||
GST_API
|
||||
GHashTable * gst_uri_get_media_fragment_table (const GstUri * uri);
|
||||
|
||||
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
|
||||
/**
|
||||
* gst_uri_copy:
|
||||
* @uri: This #GstUri object.
|
||||
|
@ -416,6 +417,19 @@ gst_clear_uri (GstUri ** uri_ptr)
|
|||
{
|
||||
gst_clear_mini_object ((GstMiniObject **) uri_ptr);
|
||||
}
|
||||
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
GST_API
|
||||
GstUri * gst_uri_copy (const GstUri * uri);
|
||||
|
||||
GST_API
|
||||
GstUri * gst_uri_ref (GstUri * uri);
|
||||
|
||||
GST_API
|
||||
void gst_uri_unref (GstUri * uri);
|
||||
|
||||
GST_API
|
||||
void gst_clear_uri (GstUri ** uri_ptr);
|
||||
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstUri, gst_uri_unref)
|
||||
|
||||
|
|
|
@ -266,6 +266,7 @@ if build_gir
|
|||
gst_gir_extra_args += ['--cflags-begin',
|
||||
'-I' + meson.current_source_dir() + '/..',
|
||||
'-I' + meson.current_build_dir() + '/..',
|
||||
'-DGST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS',
|
||||
'--cflags-end']
|
||||
endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue