gst: Convert is_writable() / make_writable() macros to inline functions

Plus actual functions that are exported from the library.

Apart from improving type-safety, this also makes bindings more happy.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9588>
This commit is contained in:
Sebastian Dröge 2025-08-20 15:32:15 +03:00 committed by GStreamer Marge Bot
parent c2d83fabbd
commit 9f19e0e0a2
23 changed files with 1086 additions and 595 deletions

View File

@ -2953,6 +2953,21 @@ gst_buffer_is_writable() to check that if needed.</doc>
</parameter>
</parameters>
</method>
<method name="is_writable" c:identifier="gst_buffer_is_writable" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbuffer.c">Tests if you can safely write to a buffer's metadata or its memory array.
It is only safe to change buffer metadata when the current reference is
writable, i.e. nobody can see the modifications you will make.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstbuffer.h"/>
<return-value transfer-ownership="none">
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<instance-parameter name="buf" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbuffer.c">a #GstBuffer</doc>
<type name="Buffer" c:type="const GstBuffer*"/>
</instance-parameter>
</parameters>
</method>
<method name="iterate_meta" c:identifier="gst_buffer_iterate_meta" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbuffer.c">Retrieves the next #GstMeta after @current. If @state points
to %NULL, the first metadata is returned.
@ -3002,6 +3017,38 @@ type @meta_api_type is returned.
</parameter>
</parameters>
</method>
<method name="make_writable" c:identifier="gst_buffer_make_writable" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbuffer.c">Returns a writable copy of @buf. If the source buffer is
already writable, this will simply return the same buffer.
Use this function to ensure that a buffer can be safely modified before
making changes to it, including changing the metadata such as PTS/DTS.
If the reference count of the source buffer @buf is exactly one, the caller
is the sole owner and this function will return the buffer object unchanged.
If there is more than one reference on the object, a copy will be made using
gst_buffer_copy(). The passed-in @buf will be unreffed in that case, and the
caller will now own a reference to the new returned buffer object. Note
that this just copies the buffer structure itself, the underlying memory is
not copied if it can be shared amongst multiple buffers.
In short, this function unrefs the buf in the argument and refs the buffer
that it returns. Don't access the argument after calling this function unless
you have an additional reference to it.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstbuffer.h"/>
<return-value transfer-ownership="full" nullable="1">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbuffer.c">a writable buffer (which may or may not be the
same as @buf) or %NULL if copying is required but not possible.</doc>
<type name="Buffer" c:type="GstBuffer*"/>
</return-value>
<parameters>
<instance-parameter name="buf" transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbuffer.c">a #GstBuffer</doc>
<type name="Buffer" c:type="GstBuffer*"/>
</instance-parameter>
</parameters>
</method>
<method name="map" c:identifier="gst_buffer_map">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbuffer.c">Fills @info with the #GstMapInfo of all merged memory blocks in @buffer.
@ -3829,6 +3876,20 @@ A -1 value for @idx will append the buffer at the end.</doc>
</parameter>
</parameters>
</method>
<method name="is_writable" c:identifier="gst_buffer_list_is_writable">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbufferlist.c">Tests if you can safely modify @list. It is only safe to modify buffer list when
there is only one owner of the buffer list - ie, the object is writable.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstbufferlist.h"/>
<return-value transfer-ownership="none">
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<instance-parameter name="list" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbufferlist.c">a #GstEvent</doc>
<type name="BufferList" c:type="const GstBufferList*"/>
</instance-parameter>
</parameters>
</method>
<method name="length" c:identifier="gst_buffer_list_length">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbufferlist.c">Returns the number of buffers in @list.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstbufferlist.h"/>
@ -3843,6 +3904,31 @@ A -1 value for @idx will append the buffer at the end.</doc>
</instance-parameter>
</parameters>
</method>
<method name="make_writable" c:identifier="gst_buffer_list_make_writable">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbufferlist.c">Returns a writable copy of @list.
If there is only one reference count on @list, the caller must be the owner,
and so this function will return the buffer list object unchanged. If on the other
hand there is more than one reference on the object, a new buffer list object will
be returned. The caller's reference on @list will be removed, and instead the
caller will own a reference to the returned object.
In short, this function unrefs the buffer_list in the argument and refs the buffer list
that it returns. Don't access the argument after calling this function. See
also: gst_buffer_list_ref().</doc>
<source-position filename="../subprojects/gstreamer/gst/gstbufferlist.h"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbufferlist.c">a writable buffer list which may or may not be the
same as @buffer list</doc>
<type name="BufferList" c:type="GstBufferList*"/>
</return-value>
<parameters>
<instance-parameter name="list" transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbufferlist.c">a #GstBufferList</doc>
<type name="BufferList" c:type="GstBufferList*"/>
</instance-parameter>
</parameters>
</method>
<method name="ref" c:identifier="gst_buffer_list_ref" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbufferlist.c">Increases the refcount of the given buffer list by one.
@ -7709,6 +7795,45 @@ for more information.</doc>
</parameter>
</parameters>
</method>
<method name="is_writable" c:identifier="gst_caps_is_writable">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcaps.c">Tests if you can safely modify @caps. It is only safe to modify caps when
there is only one owner of the caps - ie, the object is writable.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstcaps.h"/>
<return-value transfer-ownership="none">
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<instance-parameter name="caps" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcaps.c">a #GstCaps</doc>
<type name="Caps" c:type="const GstCaps*"/>
</instance-parameter>
</parameters>
</method>
<method name="make_writable" c:identifier="gst_caps_make_writable">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcaps.c">Returns a writable copy of @caps.
If there is only one reference count on @caps, the caller must be the owner,
and so this function will return the caps object unchanged. If on the other
hand there is more than one reference on the object, a new caps object will
be returned. The caller's reference on @caps will be removed, and instead the
caller will own a reference to the returned object.
In short, this function unrefs the caps in the argument and refs the caps
that it returns. Don't access the argument after calling this function. See
also: gst_caps_ref().</doc>
<source-position filename="../subprojects/gstreamer/gst/gstcaps.h"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcaps.c">a writable caps which may or may not be the
same as @caps</doc>
<type name="Caps" c:type="GstCaps*"/>
</return-value>
<parameters>
<instance-parameter name="caps" transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcaps.c">a #GstCaps</doc>
<type name="Caps" c:type="GstCaps*"/>
</instance-parameter>
</parameters>
</method>
<method name="map_in_place" c:identifier="gst_caps_map_in_place" version="1.6">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcaps.c">Calls the provided function once for each structure and caps feature in the
#GstCaps. In contrast to gst_caps_foreach(), the function may modify but not
@ -10917,6 +11042,45 @@ free it and that the pointer becomes invalid when you free the context.</doc>
</instance-parameter>
</parameters>
</method>
<method name="is_writable" c:identifier="gst_context_is_writable">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcontext.c">Tests if you can safely modify @context. It is only safe to modify context when
there is only one owner of the context - ie, the object is writable.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstcontext.h"/>
<return-value transfer-ownership="none">
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<instance-parameter name="context" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcontext.c">a #GstContext</doc>
<type name="Context" c:type="const GstContext*"/>
</instance-parameter>
</parameters>
</method>
<method name="make_writable" c:identifier="gst_context_make_writable">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcontext.c">Returns a writable copy of @context.
If there is only one reference count on @context, the caller must be the owner,
and so this function will return the context object unchanged. If on the other
hand there is more than one reference on the object, a new context object will
be returned. The caller's reference on @context will be removed, and instead the
caller will own a reference to the returned object.
In short, this function unrefs the context in the argument and refs the context
that it returns. Don't access the argument after calling this function. See
also: gst_context_ref().</doc>
<source-position filename="../subprojects/gstreamer/gst/gstcontext.h"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcontext.c">a writable context which may or may not be the
same as @context</doc>
<type name="Context" c:type="GstContext*"/>
</return-value>
<parameters>
<instance-parameter name="context" transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcontext.c">a #GstContext</doc>
<type name="Context" c:type="GstContext*"/>
</instance-parameter>
</parameters>
</method>
<method name="ref" c:identifier="gst_context_ref" version="1.2">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcontext.c">Convenience macro to increase the reference count of the context.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstcontext.h"/>
@ -20306,6 +20470,45 @@ check the name of a custom event.</doc>
</parameter>
</parameters>
</method>
<method name="is_writable" c:identifier="gst_event_is_writable">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstevent.c">Tests if you can safely modify @event. It is only safe to modify event when
there is only one owner of the event - ie, the object is writable.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstevent.h"/>
<return-value transfer-ownership="none">
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<instance-parameter name="event" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstevent.c">a #GstEvent</doc>
<type name="Event" c:type="const GstEvent*"/>
</instance-parameter>
</parameters>
</method>
<method name="make_writable" c:identifier="gst_event_make_writable">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstevent.c">Returns a writable copy of @event.
If there is only one reference count on @event, the caller must be the owner,
and so this function will return the event object unchanged. If on the other
hand there is more than one reference on the object, a new event object will
be returned. The caller's reference on @event will be removed, and instead the
caller will own a reference to the returned object.
In short, this function unrefs the event in the argument and refs the event
that it returns. Don't access the argument after calling this function. See
also: gst_event_ref().</doc>
<source-position filename="../subprojects/gstreamer/gst/gstevent.h"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstevent.c">a writable event which may or may not be the
same as @event</doc>
<type name="Event" c:type="GstEvent*"/>
</return-value>
<parameters>
<instance-parameter name="event" transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstevent.c">a #GstEvent</doc>
<type name="Event" c:type="GstEvent*"/>
</instance-parameter>
</parameters>
</method>
<method name="parse_buffer_size" c:identifier="gst_event_parse_buffer_size">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstevent.c">Get the format, minsize, maxsize and async-flag in the buffersize event.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstevent.h"/>
@ -24815,6 +25018,20 @@ the returned @offset.</doc>
</parameter>
</parameters>
</method>
<method name="is_writable" c:identifier="gst_memory_is_writable">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmemory.c">Tests if you can safely modify @memory. It is only safe to modify memory when
there is only one owner of the memory - ie, the object is writable.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstmemory.h"/>
<return-value transfer-ownership="none">
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<instance-parameter name="memory" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmemory.c">a #GstMemory</doc>
<type name="Memory" c:type="const GstMemory*"/>
</instance-parameter>
</parameters>
</method>
<method name="make_mapped" c:identifier="gst_memory_make_mapped">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmemory.c">Create a #GstMemory object that is mapped with @flags. If @mem is mappable
with @flags, this function returns the mapped @mem directly. Otherwise a
@ -24843,6 +25060,31 @@ with @flags or %NULL when a mapping is not possible.</doc>
</parameter>
</parameters>
</method>
<method name="make_writable" c:identifier="gst_memory_make_writable">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmemory.c">Returns a writable copy of @memory.
If there is only one reference count on @memory, the caller must be the owner,
and so this function will return the memory object unchanged. If on the other
hand there is more than one reference on the object, a new memory object will
be returned. The caller's reference on @memory will be removed, and instead the
caller will own a reference to the returned object.
In short, this function unrefs the memory in the argument and refs the memory
that it returns. Don't access the argument after calling this function. See
also: gst_memory_ref().</doc>
<source-position filename="../subprojects/gstreamer/gst/gstmemory.h"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmemory.c">a writable memory which may or may not be the
same as @memory</doc>
<type name="Memory" c:type="GstMemory*"/>
</return-value>
<parameters>
<instance-parameter name="memory" transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmemory.c">a #GstMemory</doc>
<type name="Memory" c:type="GstMemory*"/>
</instance-parameter>
</parameters>
</method>
<method name="map" c:identifier="gst_memory_map">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmemory.c">Fill @info with the pointer and sizes of the memory in @mem that can be
accessed according to @flags.
@ -26467,6 +26709,45 @@ check the name of a custom message.</doc>
</parameter>
</parameters>
</method>
<method name="is_writable" c:identifier="gst_message_is_writable">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmessage.c">Tests if you can safely modify @message. It is only safe to modify message when
there is only one owner of the message - ie, the object is writable.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstmessage.h"/>
<return-value transfer-ownership="none">
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<instance-parameter name="message" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmessage.c">a #GstMessage</doc>
<type name="Message" c:type="const GstMessage*"/>
</instance-parameter>
</parameters>
</method>
<method name="make_writable" c:identifier="gst_message_make_writable">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmessage.c">Returns a writable copy of @message.
If there is only one reference count on @message, the caller must be the owner,
and so this function will return the message object unchanged. If on the other
hand there is more than one reference on the object, a new message object will
be returned. The caller's reference on @message will be removed, and instead the
caller will own a reference to the returned object.
In short, this function unrefs the message in the argument and refs the message
that it returns. Don't access the argument after calling this function. See
also: gst_message_ref().</doc>
<source-position filename="../subprojects/gstreamer/gst/gstmessage.h"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmessage.c">a writable message which may or may not be the
same as @message</doc>
<type name="Message" c:type="GstMessage*"/>
</return-value>
<parameters>
<instance-parameter name="message" transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmessage.c">a #GstMessage</doc>
<type name="Message" c:type="GstMessage*"/>
</instance-parameter>
</parameters>
</method>
<method name="parse_async_done" c:identifier="gst_message_parse_async_done">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmessage.c">Extract the running_time from the async_done message.
@ -38765,6 +39046,45 @@ query scheduling flags.</doc>
</parameter>
</parameters>
</method>
<method name="is_writable" c:identifier="gst_query_is_writable">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstquery.c">Tests if you can safely modify @query. It is only safe to modify query when
there is only one owner of the query - ie, the object is writable.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstquery.h"/>
<return-value transfer-ownership="none">
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<instance-parameter name="query" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstquery.c">a #GstQuery</doc>
<type name="Query" c:type="const GstQuery*"/>
</instance-parameter>
</parameters>
</method>
<method name="make_writable" c:identifier="gst_query_make_writable">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstquery.c">Returns a writable copy of @query.
If there is only one reference count on @query, the caller must be the owner,
and so this function will return the query object unchanged. If on the other
hand there is more than one reference on the object, a new query object will
be returned. The caller's reference on @query will be removed, and instead the
caller will own a reference to the returned object.
In short, this function unrefs the query in the argument and refs the query
that it returns. Don't access the argument after calling this function. See
also: gst_query_ref().</doc>
<source-position filename="../subprojects/gstreamer/gst/gstquery.h"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstquery.c">a writable query which may or may not be the
same as @query</doc>
<type name="Query" c:type="GstQuery*"/>
</return-value>
<parameters>
<instance-parameter name="query" transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstquery.c">a #GstQuery</doc>
<type name="Query" c:type="GstQuery*"/>
</instance-parameter>
</parameters>
</method>
<method name="parse_accept_caps" c:identifier="gst_query_parse_accept_caps">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstquery.c">Get the caps from @query. The caps remains valid as long as @query remains
valid.</doc>
@ -41693,6 +42013,49 @@ copy of the data the source sample contains.</doc>
</instance-parameter>
</parameters>
</method>
<method name="is_writable" c:identifier="gst_sample_is_writable" version="1.16">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstsample.c">Tests if you can safely set the buffer and / or buffer list of @sample.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstsample.h"/>
<return-value transfer-ownership="none">
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<instance-parameter name="sample" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstsample.c">A #GstSample</doc>
<type name="Sample" c:type="const GstSample*"/>
</instance-parameter>
</parameters>
</method>
<method name="make_writable" c:identifier="gst_sample_make_writable" version="1.16">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstsample.c">Returns a writable copy of @sample. If the source sample is
already writable, this will simply return the same sample.
Use this function to ensure that a sample can be safely modified before
making changes to it, for example before calling gst_sample_set_buffer()
If the reference count of the source sample @sample is exactly one, the caller
is the sole owner and this function will return the sample object unchanged.
If there is more than one reference on the object, a copy will be made using
gst_sample_copy(). The passed-in @sample will be unreffed in that case, and the
caller will now own a reference to the new returned sample object.
In short, this function unrefs the sample in the argument and refs the sample
that it returns. Don't access the argument after calling this function unless
you have an additional reference to it.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstsample.h"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstsample.c">a writable sample which may or may not be the
same as @sample</doc>
<type name="Sample" c:type="GstSample*"/>
</return-value>
<parameters>
<instance-parameter name="sample" transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstsample.c">A #GstSample</doc>
<type name="Sample" c:type="GstSample*"/>
</instance-parameter>
</parameters>
</method>
<method name="ref" c:identifier="gst_sample_ref" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstsample.c">Increases the refcount of the given sample by one.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstsample.h"/>
@ -48554,6 +48917,45 @@ list.</doc>
</parameter>
</parameters>
</method>
<method name="is_writable" c:identifier="gst_tag_list_is_writable">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gsttaglist.c">Tests if you can safely modify @taglist. It is only safe to modify taglist when
there is only one owner of the taglist - ie, the object is writable.</doc>
<source-position filename="../subprojects/gstreamer/gst/gsttaglist.h"/>
<return-value transfer-ownership="none">
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<instance-parameter name="taglist" transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gsttaglist.c">a #GstTagList</doc>
<type name="TagList" c:type="const GstTagList*"/>
</instance-parameter>
</parameters>
</method>
<method name="make_writable" c:identifier="gst_tag_list_make_writable">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gsttaglist.c">Returns a writable copy of @taglist.
If there is only one reference count on @taglist, the caller must be the owner,
and so this function will return the taglist object unchanged. If on the other
hand there is more than one reference on the object, a new taglist object will
be returned. The caller's reference on @taglist will be removed, and instead the
caller will own a reference to the returned object.
In short, this function unrefs the taglist in the argument and refs the taglist
that it returns. Don't access the argument after calling this function. See
also: gst_tag_list_ref().</doc>
<source-position filename="../subprojects/gstreamer/gst/gsttaglist.h"/>
<return-value transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gsttaglist.c">a writable taglist which may or may not be the
same as @taglist</doc>
<type name="TagList" c:type="GstTagList*"/>
</return-value>
<parameters>
<instance-parameter name="taglist" transfer-ownership="full">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gsttaglist.c">a #GstTagList</doc>
<type name="TagList" c:type="GstTagList*"/>
</instance-parameter>
</parameters>
</method>
<method name="merge" c:identifier="gst_tag_list_merge">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gsttaglist.c">Merges the two given lists into a new list. If one of the lists is %NULL, a
copy of the other is returned. If both lists are %NULL, %NULL is returned.
@ -53780,17 +54182,6 @@ buffer</doc>
</parameter>
</parameters>
</function-macro>
<function-macro name="buffer_is_writable" c:identifier="gst_buffer_is_writable" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbuffer.h">Tests if you can safely write to a buffer's metadata or its memory array.
It is only safe to change buffer metadata when the current reference is
writable, i.e. nobody can see the modifications you will make.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstbuffer.h"/>
<parameters>
<parameter name="buf">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbuffer.h">a #GstBuffer</doc>
</parameter>
</parameters>
</function-macro>
<function-macro name="buffer_list_add" c:identifier="gst_buffer_list_add" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbufferlist.c">Append @b at the end of @l.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstbufferlist.h"/>
@ -53803,26 +54194,6 @@ writable, i.e. nobody can see the modifications you will make.</doc>
</parameter>
</parameters>
</function-macro>
<function-macro name="buffer_list_is_writable" c:identifier="gst_buffer_list_is_writable" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbufferlist.h">Tests if you can safely add buffers and groups into a buffer list.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstbufferlist.h"/>
<parameters>
<parameter name="list">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbufferlist.h">a #GstBufferList</doc>
</parameter>
</parameters>
</function-macro>
<function-macro name="buffer_list_make_writable" c:identifier="gst_buffer_list_make_writable" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbufferlist.h">Makes a writable buffer list from the given buffer list. If the source buffer
list is already writable, this will simply return the same buffer list. A
copy will otherwise be made using gst_buffer_list_copy().</doc>
<source-position filename="../subprojects/gstreamer/gst/gstbufferlist.h"/>
<parameters>
<parameter name="list">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbufferlist.h">a #GstBufferList</doc>
</parameter>
</parameters>
</function-macro>
<function name="buffer_list_replace" c:identifier="gst_buffer_list_replace" moved-to="BufferList.replace" version="1.16">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbufferlist.c">Modifies a pointer to a #GstBufferList to point to a different
#GstBufferList. The modification is done atomically (so this is useful for
@ -53870,32 +54241,6 @@ that it takes ownership of @new_list.</doc>
</parameter>
</parameters>
</function>
<function-macro name="buffer_make_writable" c:identifier="gst_buffer_make_writable" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbuffer.h">Returns a writable copy of @buf. If the source buffer is
already writable, this will simply return the same buffer.
Use this function to ensure that a buffer can be safely modified before
making changes to it, including changing the metadata such as PTS/DTS.
If the reference count of the source buffer @buf is exactly one, the caller
is the sole owner and this function will return the buffer object unchanged.
If there is more than one reference on the object, a copy will be made using
gst_buffer_copy(). The passed-in @buf will be unreffed in that case, and the
caller will now own a reference to the new returned buffer object. Note
that this just copies the buffer structure itself, the underlying memory is
not copied if it can be shared amongst multiple buffers.
In short, this function unrefs the buf in the argument and refs the buffer
that it returns. Don't access the argument after calling this function unless
you have an additional reference to it.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstbuffer.h"/>
<parameters>
<parameter name="buf">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstbuffer.h">a #GstBuffer</doc>
</parameter>
</parameters>
</function-macro>
<function-macro name="buffer_new_and_alloc" c:identifier="gst_buffer_new_and_alloc" introspectable="0">
<source-position filename="../subprojects/gstreamer/gst/gstcompat.h"/>
<parameters>
@ -54017,35 +54362,6 @@ when there were nested #GstCaps / #GstStructure deeper than one level.</doc>
</parameter>
</parameters>
</function>
<function-macro name="caps_is_writable" c:identifier="gst_caps_is_writable" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcaps.h">Tests if you can safely modify @caps. It is only safe to modify caps when
there is only one owner of the caps - ie, the object is writable.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstcaps.h"/>
<parameters>
<parameter name="caps">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcaps.h">a #GstCaps</doc>
</parameter>
</parameters>
</function-macro>
<function-macro name="caps_make_writable" c:identifier="gst_caps_make_writable" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcaps.h">Returns a writable copy of @caps.
If there is only one reference count on @caps, the caller must be the owner,
and so this function will return the caps object unchanged. If on the other
hand there is more than one reference on the object, a new caps object will
be returned. The caller's reference on @caps will be removed, and instead the
caller will own a reference to the returned object.
In short, this function unrefs the caps in the argument and refs the caps
that it returns. Don't access the argument after calling this function. See
also: gst_caps_ref().</doc>
<source-position filename="../subprojects/gstreamer/gst/gstcaps.h"/>
<parameters>
<parameter name="caps">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcaps.h">a #GstCaps</doc>
</parameter>
</parameters>
</function-macro>
<function name="caps_replace" c:identifier="gst_caps_replace" moved-to="Caps.replace" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcaps.c">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
@ -54357,26 +54673,6 @@ reference count of the uri is decreased and the pointer is set to %NULL.</doc>
</parameter>
</parameters>
</function>
<function-macro name="context_is_writable" c:identifier="gst_context_is_writable" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcontext.h">Tests if you can safely write into a context's structure or validly
modify the seqnum and timestamp fields.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstcontext.h"/>
<parameters>
<parameter name="context">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcontext.h">a #GstContext</doc>
</parameter>
</parameters>
</function-macro>
<function-macro name="context_make_writable" c:identifier="gst_context_make_writable" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcontext.h">Checks if a context is writable. If not, a writable copy is made and
returned.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstcontext.h"/>
<parameters>
<parameter name="context">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcontext.h">the context to make writable</doc>
</parameter>
</parameters>
</function-macro>
<function name="context_replace" c:identifier="gst_context_replace" moved-to="Context.replace" version="1.2">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstcontext.c">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
@ -55595,27 +55891,6 @@ as well.</doc>
</parameter>
</parameters>
</function>
<function-macro name="event_is_writable" c:identifier="gst_event_is_writable" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstevent.h">Tests if you can safely write data into a event's structure or validly
modify the seqnum and timestamp field.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstevent.h"/>
<parameters>
<parameter name="ev">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstevent.h">a #GstEvent</doc>
</parameter>
</parameters>
</function-macro>
<function-macro name="event_make_writable" c:identifier="gst_event_make_writable" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstevent.h">Makes a writable event from the given event. If the source event is
already writable, this will simply return the same event. A copy will
otherwise be made using gst_event_copy().</doc>
<source-position filename="../subprojects/gstreamer/gst/gstevent.h"/>
<parameters>
<parameter name="ev">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstevent.h">a #GstEvent</doc>
</parameter>
</parameters>
</function-macro>
<function name="event_replace" c:identifier="gst_event_replace" moved-to="Event.replace" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstevent.c">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
@ -56423,13 +56698,6 @@ debug category and flags.</doc>
</parameter>
</parameters>
</function>
<function-macro name="memory_is_writable" c:identifier="gst_memory_is_writable" introspectable="0">
<source-position filename="../subprojects/gstreamer/gst/gstmemory.h"/>
<parameters>
<parameter name="m">
</parameter>
</parameters>
</function-macro>
<function-macro name="memory_lock" c:identifier="gst_memory_lock" introspectable="0">
<source-position filename="../subprojects/gstreamer/gst/gstmemory.h"/>
<parameters>
@ -56439,16 +56707,6 @@ debug category and flags.</doc>
</parameter>
</parameters>
</function-macro>
<function-macro name="memory_make_writable" c:identifier="gst_memory_make_writable" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmemory.h">Returns a writable copy of @m. If the source memory is
already writable, this will simply return the same memory.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstmemory.h"/>
<parameters>
<parameter name="m">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmemory.h">a #GstMemory</doc>
</parameter>
</parameters>
</function-macro>
<function-macro name="memory_unlock" c:identifier="gst_memory_unlock" introspectable="0">
<source-position filename="../subprojects/gstreamer/gst/gstmemory.h"/>
<parameters>
@ -56458,26 +56716,6 @@ already writable, this will simply return the same memory.</doc>
</parameter>
</parameters>
</function-macro>
<function-macro name="message_is_writable" c:identifier="gst_message_is_writable" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmessage.h">Tests if you can safely write into a message's structure or validly
modify the seqnum and timestamp fields.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstmessage.h"/>
<parameters>
<parameter name="msg">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmessage.h">a #GstMessage</doc>
</parameter>
</parameters>
</function-macro>
<function-macro name="message_make_writable" c:identifier="gst_message_make_writable" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmessage.h">Checks if a message is writable. If not, a writable copy is made and
returned.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstmessage.h"/>
<parameters>
<parameter name="msg">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstmessage.h">the message to make writable</doc>
</parameter>
</parameters>
</function-macro>
<function-macro name="message_new_duration" c:identifier="gst_message_new_duration" introspectable="0">
<source-position filename="../subprojects/gstreamer/gst/gstcompat.h"/>
<parameters>
@ -57700,24 +57938,6 @@ checked.</doc>
</parameter>
</parameters>
</function>
<function-macro name="query_is_writable" c:identifier="gst_query_is_writable" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstquery.h">Tests if you can safely write data into a query's structure.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstquery.h"/>
<parameters>
<parameter name="q">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstquery.h">a #GstQuery</doc>
</parameter>
</parameters>
</function-macro>
<function-macro name="query_make_writable" c:identifier="gst_query_make_writable" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstquery.h">Makes a writable query from the given query.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstquery.h"/>
<parameters>
<parameter name="q">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstquery.h">a #GstQuery to make writable</doc>
</parameter>
</parameters>
</function-macro>
<function name="query_replace" c:identifier="gst_query_replace" moved-to="Query.replace" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstquery.c">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
@ -57830,39 +58050,6 @@ Either @new_query or the #GstQuery pointed to by @old_query may be %NULL.</doc>
<type name="GLib.Quark" c:type="GQuark"/>
</return-value>
</function>
<function-macro name="sample_is_writable" c:identifier="gst_sample_is_writable" version="1.16" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstsample.h">Tests if you can safely set the buffer and / or buffer list of @sample.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstsample.h"/>
<parameters>
<parameter name="sample">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstsample.h">A #GstSample</doc>
</parameter>
</parameters>
</function-macro>
<function-macro name="sample_make_writable" c:identifier="gst_sample_make_writable" version="1.16" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstsample.h">Returns a writable copy of @sample. If the source sample is
already writable, this will simply return the same sample.
Use this function to ensure that a sample can be safely modified before
making changes to it, for example before calling gst_sample_set_buffer()
If the reference count of the source sample @sample is exactly one, the caller
is the sole owner and this function will return the sample object unchanged.
If there is more than one reference on the object, a copy will be made using
gst_sample_copy(). The passed-in @sample will be unreffed in that case, and the
caller will now own a reference to the new returned sample object.
In short, this function unrefs the sample in the argument and refs the sample
that it returns. Don't access the argument after calling this function unless
you have an additional reference to it.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstsample.h"/>
<parameters>
<parameter name="sample">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstsample.h">A #GstSample</doc>
</parameter>
</parameters>
</function-macro>
<function name="segtrap_is_enabled" c:identifier="gst_segtrap_is_enabled">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gst.c">Some functions in the GStreamer core might install a custom SIGSEGV handler
to better catch and report errors to the application. Currently this feature
@ -58086,36 +58273,6 @@ You must g_value_unset() the value after use.</doc>
</parameter>
</parameters>
</function-macro>
<function-macro name="tag_list_is_writable" c:identifier="gst_tag_list_is_writable" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gsttaglist.h">Tests if you can safely modify @taglist. It is only safe to modify taglist
when there is only one owner of the taglist - ie, the refcount is 1.</doc>
<source-position filename="../subprojects/gstreamer/gst/gsttaglist.h"/>
<parameters>
<parameter name="taglist">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gsttaglist.h">a #GstTagList</doc>
</parameter>
</parameters>
</function-macro>
<function-macro name="tag_list_make_writable" c:identifier="gst_tag_list_make_writable" introspectable="0">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gsttaglist.h">Returns a writable copy of @taglist.
If there is only one reference count on @taglist, the caller must be the
owner, and so this function will return the taglist object unchanged. If on
the other hand there is more than one reference on the object, a new taglist
object will be returned (which will be a copy of @taglist). The caller's
reference on @taglist will be removed, and instead the caller will own a
reference to the returned object.
In short, this function unrefs the taglist in the argument and refs the
taglist that it returns. Don't access the argument after calling this
function. See also: gst_tag_list_ref().</doc>
<source-position filename="../subprojects/gstreamer/gst/gsttaglist.h"/>
<parameters>
<parameter name="taglist">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gsttaglist.h">a #GstTagList</doc>
</parameter>
</parameters>
</function-macro>
<function name="tag_list_replace" c:identifier="gst_tag_list_replace" moved-to="TagList.replace" version="1.16">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gsttaglist.c">Modifies a pointer to a #GstTagList to point to a different #GstTagList. The
modification is done atomically (so this is useful for ensuring thread

View File

@ -2153,7 +2153,7 @@ out:
static GstCaps *
_add_supported_attributes_to_caps (GstWebRTCBin * webrtc,
WebRTCTransceiver * trans, const GstCaps * caps)
WebRTCTransceiver * trans, GstCaps * caps)
{
GstWebRTCKind kind;
GstCaps *ret;

View File

@ -3162,3 +3162,51 @@ gst_buffer_replace (GstBuffer ** obuf, GstBuffer * nbuf)
return gst_mini_object_replace ((GstMiniObject **) obuf,
(GstMiniObject *) nbuf);
}
/**
* gst_buffer_is_writable: (skip)
* @buf: a #GstBuffer
*
* Tests if you can safely write to a buffer's metadata or its memory array.
* It is only safe to change buffer metadata when the current reference is
* writable, i.e. nobody can see the modifications you will make.
*/
gboolean
gst_buffer_is_writable (const GstBuffer * buf)
{
return gst_mini_object_is_writable (GST_MINI_OBJECT_CONST_CAST (buf));
}
/**
* gst_buffer_make_writable: (skip)
* @buf: (transfer full): a #GstBuffer
*
* Returns a writable copy of @buf. If the source buffer is
* already writable, this will simply return the same buffer.
*
* Use this function to ensure that a buffer can be safely modified before
* making changes to it, including changing the metadata such as PTS/DTS.
*
* If the reference count of the source buffer @buf is exactly one, the caller
* is the sole owner and this function will return the buffer object unchanged.
*
* If there is more than one reference on the object, a copy will be made using
* gst_buffer_copy(). The passed-in @buf will be unreffed in that case, and the
* caller will now own a reference to the new returned buffer object. Note
* that this just copies the buffer structure itself, the underlying memory is
* not copied if it can be shared amongst multiple buffers.
*
* In short, this function unrefs the buf in the argument and refs the buffer
* that it returns. Don't access the argument after calling this function unless
* you have an additional reference to it.
*
* Returns: (transfer full) (nullable): a writable buffer (which may or may not be the
* same as @buf) or %NULL if copying is required but not possible.
*/
GstBuffer *
gst_buffer_make_writable (GstBuffer * buf)
{
return
GST_BUFFER_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST
(buf)));
}

View File

@ -437,7 +437,7 @@ gboolean gst_buffer_unset_flags (GstBuffer * buffer, GstBufferFlags f
static inline GstBuffer *
gst_buffer_ref (GstBuffer * buf)
{
return (GstBuffer *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (buf));
return GST_BUFFER_CAST (gst_mini_object_ref (GST_MINI_OBJECT_CAST (buf)));
}
static inline void
@ -453,10 +453,10 @@ gst_clear_buffer (GstBuffer ** buf_ptr)
}
/* copy buffer */
static inline GstBuffer *
G_GNUC_WARN_UNUSED_RESULT static inline GstBuffer *
gst_buffer_copy (const GstBuffer * buf)
{
return GST_BUFFER (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (buf)));
return GST_BUFFER_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (buf)));
}
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
GST_API
@ -469,11 +469,11 @@ GST_API
void gst_clear_buffer (GstBuffer ** buf_ptr);
GST_API
GstBuffer * gst_buffer_copy (const GstBuffer * buf);
GstBuffer * gst_buffer_copy (const GstBuffer * buf) G_GNUC_WARN_UNUSED_RESULT;
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
GST_API
GstBuffer * gst_buffer_copy_deep (const GstBuffer * buf);
GstBuffer * gst_buffer_copy_deep (const GstBuffer * buf) G_GNUC_WARN_UNUSED_RESULT;
/**
* GstBufferCopyFlags:
@ -535,44 +535,19 @@ gboolean gst_buffer_copy_into (GstBuffer *dest, GstBuffer *src
GstBufferCopyFlags flags,
gsize offset, gsize size);
/**
* gst_buffer_is_writable:
* @buf: a #GstBuffer
*
* Tests if you can safely write to a buffer's metadata or its memory array.
* It is only safe to change buffer metadata when the current reference is
* writable, i.e. nobody can see the modifications you will make.
*/
#define gst_buffer_is_writable(buf) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (buf))
/**
* gst_buffer_make_writable:
* @buf: (transfer full): a #GstBuffer
*
* Returns a writable copy of @buf. If the source buffer is
* already writable, this will simply return the same buffer.
*
* Use this function to ensure that a buffer can be safely modified before
* making changes to it, including changing the metadata such as PTS/DTS.
*
* If the reference count of the source buffer @buf is exactly one, the caller
* is the sole owner and this function will return the buffer object unchanged.
*
* If there is more than one reference on the object, a copy will be made using
* gst_buffer_copy(). The passed-in @buf will be unreffed in that case, and the
* caller will now own a reference to the new returned buffer object. Note
* that this just copies the buffer structure itself, the underlying memory is
* not copied if it can be shared amongst multiple buffers.
*
* In short, this function unrefs the buf in the argument and refs the buffer
* that it returns. Don't access the argument after calling this function unless
* you have an additional reference to it.
*
* Returns: (transfer full) (nullable): a writable buffer (which may or may not be the
* same as @buf) or %NULL if copying is required but not possible.
*/
#define gst_buffer_make_writable(buf) GST_BUFFER_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (buf)))
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
G_GNUC_WARN_UNUSED_RESULT static inline GstBuffer *
gst_buffer_make_writable (GstBuffer * buf)
{
return GST_BUFFER_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (buf)));
}
static inline gboolean
gst_buffer_is_writable (const GstBuffer * buf)
{
return gst_mini_object_is_writable (GST_MINI_OBJECT_CONST_CAST (buf));
}
static inline gboolean
gst_buffer_replace (GstBuffer **obuf, GstBuffer *nbuf)
{
@ -582,6 +557,13 @@ gst_buffer_replace (GstBuffer **obuf, GstBuffer *nbuf)
GST_API
gboolean gst_buffer_replace (GstBuffer ** obuf,
GstBuffer * nbuf);
GST_API
GstBuffer * gst_buffer_make_writable (GstBuffer * buf) G_GNUC_WARN_UNUSED_RESULT;
GST_API
gboolean gst_buffer_is_writable (const GstBuffer * buf);
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
/* creating a region */

View File

@ -657,3 +657,43 @@ gst_buffer_list_take (GstBufferList ** old_list, GstBufferList * new_list)
return gst_mini_object_take ((GstMiniObject **) old_list,
(GstMiniObject *) new_list);
}
/**
* gst_buffer_list_is_writable:
* @list: a #GstEvent
*
* Tests if you can safely modify @list. It is only safe to modify buffer list when
* there is only one owner of the buffer list - ie, the object is writable.
*/
gboolean
gst_buffer_list_is_writable (const GstBufferList * list)
{
return gst_mini_object_is_writable (GST_MINI_OBJECT_CONST_CAST (list));
}
/**
* gst_buffer_list_make_writable:
* @list: (transfer full): a #GstBufferList
*
* Returns a writable copy of @list.
*
* If there is only one reference count on @list, the caller must be the owner,
* and so this function will return the buffer list object unchanged. If on the other
* hand there is more than one reference on the object, a new buffer list object will
* be returned. The caller's reference on @list will be removed, and instead the
* caller will own a reference to the returned object.
*
* In short, this function unrefs the buffer_list in the argument and refs the buffer list
* that it returns. Don't access the argument after calling this function. See
* also: gst_buffer_list_ref().
*
* Returns: (transfer full): a writable buffer list which may or may not be the
* same as @buffer list
*/
GstBufferList *
gst_buffer_list_make_writable (GstBufferList * list)
{
return
GST_BUFFER_LIST_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST
(list)));
}

View File

@ -80,7 +80,7 @@ gst_clear_buffer_list (GstBufferList ** list_ptr)
}
/* copy */
static inline GstBufferList *
G_GNUC_WARN_UNUSED_RESULT 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)));
@ -99,6 +99,18 @@ gst_buffer_list_take (GstBufferList **old_list, GstBufferList *new_list)
return gst_mini_object_take ((GstMiniObject **) old_list,
(GstMiniObject *) new_list);
}
static inline gboolean
gst_buffer_list_is_writable (const GstBufferList * list)
{
return gst_mini_object_is_writable (GST_MINI_OBJECT_CONST_CAST (list));
}
G_GNUC_WARN_UNUSED_RESULT static inline GstBufferList *
gst_buffer_list_make_writable (GstBufferList * list)
{
return GST_BUFFER_LIST_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (list)));
}
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
GST_API
GstBufferList * gst_buffer_list_ref (GstBufferList * list);
@ -110,7 +122,7 @@ GST_API
void gst_clear_buffer_list (GstBufferList ** list_ptr);
GST_API
GstBufferList * gst_buffer_list_copy (const GstBufferList * list);
GstBufferList * gst_buffer_list_copy (const GstBufferList * list) G_GNUC_WARN_UNUSED_RESULT;
GST_API
gboolean gst_buffer_list_replace (GstBufferList ** old_list,
@ -119,29 +131,13 @@ gboolean gst_buffer_list_replace (GstBufferList ** old_list,
GST_API
gboolean gst_buffer_list_take (GstBufferList ** old_list,
GstBufferList * new_list);
GST_API
GstBufferList * gst_buffer_list_make_writable (GstBufferList * list) G_GNUC_WARN_UNUSED_RESULT;
GST_API
gboolean gst_buffer_list_is_writable (const GstBufferList * list);
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
/**
* gst_buffer_list_is_writable:
* @list: a #GstBufferList
*
* Tests if you can safely add buffers and groups into a buffer list.
*/
#define gst_buffer_list_is_writable(list) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (list))
/**
* gst_buffer_list_make_writable:
* @list: (transfer full): a #GstBufferList
*
* Makes a writable buffer list from the given buffer list. If the source buffer
* list is already writable, this will simply return the same buffer list. A
* copy will otherwise be made using gst_buffer_list_copy().
*
* Returns: (transfer full): a writable list, which may or may not be the
* same as @list
*/
#define gst_buffer_list_make_writable(list) GST_BUFFER_LIST_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (list)))
GST_API
GType gst_buffer_list_get_type (void);

View File

@ -3062,9 +3062,10 @@ gst_caps_filter_and_map_in_place (GstCaps * caps, GstCapsFilterMapFunc func,
*
* Returns: (transfer full): the new #GstCaps
*/
GstCaps *(gst_caps_copy) (const GstCaps * caps)
GstCaps *
gst_caps_copy (const GstCaps * caps)
{
return GST_CAPS (gst_mini_object_copy (GST_MINI_OBJECT_CAST (caps)));
return GST_CAPS_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CAST (caps)));
}
/**
@ -3162,3 +3163,43 @@ gst_caps_take (GstCaps ** old_caps, GstCaps * new_caps)
return gst_mini_object_take ((GstMiniObject **) old_caps,
(GstMiniObject *) new_caps);
}
/**
* gst_caps_is_writable:
* @caps: a #GstCaps
*
* Tests if you can safely modify @caps. It is only safe to modify caps when
* there is only one owner of the caps - ie, the object is writable.
*/
gboolean
gst_caps_is_writable (const GstCaps * caps)
{
return gst_mini_object_is_writable (GST_MINI_OBJECT_CONST_CAST (caps));
}
/**
* gst_caps_make_writable:
* @caps: (transfer full): a #GstCaps
*
* Returns a writable copy of @caps.
*
* If there is only one reference count on @caps, the caller must be the owner,
* and so this function will return the caps object unchanged. If on the other
* hand there is more than one reference on the object, a new caps object will
* be returned. The caller's reference on @caps will be removed, and instead the
* caller will own a reference to the returned object.
*
* In short, this function unrefs the caps in the argument and refs the caps
* that it returns. Don't access the argument after calling this function. See
* also: gst_caps_ref().
*
* Returns: (transfer full): a writable caps which may or may not be the
* same as @caps
*/
GstCaps *
gst_caps_make_writable (GstCaps * caps)
{
return
GST_CAPS_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST
(caps)));
}

View File

@ -207,54 +207,14 @@ 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
GstCaps * gst_caps_copy (const GstCaps * caps);
G_GNUC_WARN_UNUSED_RESULT static inline GstCaps *
gst_caps_copy (const GstCaps * caps)
{
return GST_CAPS_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CAST (caps)));
}
#define gst_caps_copy(caps) GST_CAPS (gst_mini_object_copy (GST_MINI_OBJECT_CAST (caps)))
/**
* gst_caps_is_writable:
* @caps: a #GstCaps
*
* Tests if you can safely modify @caps. It is only safe to modify caps when
* there is only one owner of the caps - ie, the object is writable.
*/
#define gst_caps_is_writable(caps) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (caps))
/**
* gst_caps_make_writable:
* @caps: (transfer full): a #GstCaps
*
* Returns a writable copy of @caps.
*
* If there is only one reference count on @caps, the caller must be the owner,
* and so this function will return the caps object unchanged. If on the other
* hand there is more than one reference on the object, a new caps object will
* be returned. The caller's reference on @caps will be removed, and instead the
* caller will own a reference to the returned object.
*
* In short, this function unrefs the caps in the argument and refs the caps
* that it returns. Don't access the argument after calling this function. See
* also: gst_caps_ref().
*
* Returns: (transfer full): a writable caps which may or may not be the
* same as @caps
*/
#define gst_caps_make_writable(caps) GST_CAPS_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (caps)))
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
static inline gboolean
gst_caps_replace (GstCaps **old_caps, GstCaps *new_caps)
{
@ -266,11 +226,40 @@ 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 */
static inline gboolean
gst_caps_is_writable (const GstCaps * caps)
{
return gst_mini_object_is_writable (GST_MINI_OBJECT_CONST_CAST (caps));
}
G_GNUC_WARN_UNUSED_RESULT static inline GstCaps *
gst_caps_make_writable (GstCaps * caps)
{
return GST_CAPS_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (caps)));
}
#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);
GST_API
GstCaps * gst_caps_copy (const GstCaps * caps) G_GNUC_WARN_UNUSED_RESULT;
GST_API
gboolean gst_caps_replace (GstCaps ** old_caps,
GstCaps * new_caps);
GST_API
GstCaps * gst_caps_make_writable (GstCaps * caps) G_GNUC_WARN_UNUSED_RESULT;
GST_API
gboolean gst_caps_is_writable (const GstCaps * caps);
GST_API
gboolean gst_caps_take (GstCaps ** old_caps,
GstCaps * new_caps);

View File

@ -378,3 +378,43 @@ gst_context_replace (GstContext ** old_context, GstContext * new_context)
return gst_mini_object_replace ((GstMiniObject **) old_context,
(GstMiniObject *) new_context);
}
/**
* gst_context_is_writable:
* @context: a #GstContext
*
* Tests if you can safely modify @context. It is only safe to modify context when
* there is only one owner of the context - ie, the object is writable.
*/
gboolean
gst_context_is_writable (const GstContext * context)
{
return gst_mini_object_is_writable (GST_MINI_OBJECT_CONST_CAST (context));
}
/**
* gst_context_make_writable:
* @context: (transfer full): a #GstContext
*
* Returns a writable copy of @context.
*
* If there is only one reference count on @context, the caller must be the owner,
* and so this function will return the context object unchanged. If on the other
* hand there is more than one reference on the object, a new context object will
* be returned. The caller's reference on @context will be removed, and instead the
* caller will own a reference to the returned object.
*
* In short, this function unrefs the context in the argument and refs the context
* that it returns. Don't access the argument after calling this function. See
* also: gst_context_ref().
*
* Returns: (transfer full): a writable context which may or may not be the
* same as @context
*/
GstContext *
gst_context_make_writable (GstContext * context)
{
return
GST_CONTEXT_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST
(context)));
}

View File

@ -66,11 +66,29 @@ gst_clear_context (GstContext ** context_ptr)
}
/* copy context */
static inline GstContext *
G_GNUC_WARN_UNUSED_RESULT static inline GstContext *
gst_context_copy (const GstContext * context)
{
return GST_CONTEXT_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (context)));
}
static inline gboolean
gst_context_is_writable (const GstContext * context)
{
return gst_mini_object_is_writable (GST_MINI_OBJECT_CONST_CAST (context));
}
G_GNUC_WARN_UNUSED_RESULT static inline GstContext *
gst_context_make_writable (GstContext * context)
{
return GST_CONTEXT_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (context)));
}
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
GstContext * gst_context_ref (GstContext * context);
@ -82,40 +100,16 @@ GST_API
void gst_clear_context (GstContext ** context_ptr);
GST_API
GstContext * gst_context_copy (const GstContext * context);
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
GstContext * gst_context_copy (const GstContext * context) G_GNUC_WARN_UNUSED_RESULT;
/**
* gst_context_is_writable:
* @context: a #GstContext
*
* Tests if you can safely write into a context's structure or validly
* modify the seqnum and timestamp fields.
*/
#define gst_context_is_writable(context) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (context))
/**
* gst_context_make_writable:
* @context: (transfer full): the context to make writable
*
* Checks if a context is writable. If not, a writable copy is made and
* returned.
*
* Returns: (transfer full): a context (possibly a duplicate) that is writable.
*
* MT safe
*/
#define gst_context_make_writable(context) GST_CONTEXT_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (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);
GstContext * gst_context_make_writable (GstContext * context) G_GNUC_WARN_UNUSED_RESULT;
GST_API
gboolean gst_context_is_writable (const GstContext * context);
GST_API
gboolean gst_context_replace (GstContext ** old_context,
GstContext * new_context);
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
GST_API

View File

@ -2511,3 +2511,43 @@ gst_event_copy (const GstEvent * event)
GST_EVENT_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST
(event)));
}
/**
* gst_event_is_writable:
* @event: a #GstEvent
*
* Tests if you can safely modify @event. It is only safe to modify event when
* there is only one owner of the event - ie, the object is writable.
*/
gboolean
gst_event_is_writable (const GstEvent * event)
{
return gst_mini_object_is_writable (GST_MINI_OBJECT_CONST_CAST (event));
}
/**
* gst_event_make_writable:
* @event: (transfer full): a #GstEvent
*
* Returns a writable copy of @event.
*
* If there is only one reference count on @event, the caller must be the owner,
* and so this function will return the event object unchanged. If on the other
* hand there is more than one reference on the object, a new event object will
* be returned. The caller's reference on @event will be removed, and instead the
* caller will own a reference to the returned object.
*
* In short, this function unrefs the event in the argument and refs the event
* that it returns. Don't access the argument after calling this function. See
* also: gst_event_ref().
*
* Returns: (transfer full): a writable event which may or may not be the
* same as @event
*/
GstEvent *
gst_event_make_writable (GstEvent * event)
{
return
GST_EVENT_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST
(event)));
}

View File

@ -306,28 +306,19 @@ GST_API GType _gst_event_type;
*/
#define GST_EVENT_IS_STICKY(ev) !!(GST_EVENT_TYPE (ev) & GST_EVENT_TYPE_STICKY)
/**
* gst_event_is_writable:
* @ev: a #GstEvent
*
* Tests if you can safely write data into a event's structure or validly
* modify the seqnum and timestamp field.
*/
#define gst_event_is_writable(ev) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (ev))
/**
* gst_event_make_writable:
* @ev: (transfer full): a #GstEvent
*
* Makes a writable event from the given event. If the source event is
* already writable, this will simply return the same event. A copy will
* otherwise be made using gst_event_copy().
*
* Returns: (transfer full): a writable event which may or may not be the
* same as @ev
*/
#define gst_event_make_writable(ev) GST_EVENT_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (ev)))
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
static inline gboolean
gst_event_is_writable (const GstEvent * event)
{
return gst_mini_object_is_writable (GST_MINI_OBJECT_CONST_CAST (event));
}
G_GNUC_WARN_UNUSED_RESULT static inline GstEvent *
gst_event_make_writable (GstEvent * event)
{
return GST_EVENT_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (event)));
}
static inline gboolean
gst_event_replace(GstEvent** old_event, GstEvent* new_event)
{
@ -346,6 +337,11 @@ 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
GstEvent * gst_event_make_writable (GstEvent * event) G_GNUC_WARN_UNUSED_RESULT;
GST_API
gboolean gst_event_is_writable (const GstEvent * event);
GST_API
gboolean gst_event_replace (GstEvent ** old_event,
GstEvent * new_event);
@ -447,7 +443,7 @@ gst_clear_event (GstEvent ** event_ptr)
}
/* copy event */
static inline GstEvent *
G_GNUC_WARN_UNUSED_RESULT static inline GstEvent *
gst_event_copy (const GstEvent * event)
{
return GST_EVENT_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (event)));
@ -463,7 +459,7 @@ GST_API
void gst_clear_event (GstEvent ** event_ptr);
GST_API
GstEvent * gst_event_copy (const GstEvent * event);
GstEvent * gst_event_copy (const GstEvent * event) G_GNUC_WARN_UNUSED_RESULT;
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
GST_API

View File

@ -494,3 +494,43 @@ gst_memory_unref (GstMemory * memory)
{
gst_mini_object_unref (GST_MINI_OBJECT_CAST (memory));
}
/**
* gst_memory_is_writable:
* @memory: a #GstMemory
*
* Tests if you can safely modify @memory. It is only safe to modify memory when
* there is only one owner of the memory - ie, the object is writable.
*/
gboolean
gst_memory_is_writable (const GstMemory * memory)
{
return gst_mini_object_is_writable (GST_MINI_OBJECT_CONST_CAST (memory));
}
/**
* gst_memory_make_writable:
* @memory: (transfer full): a #GstMemory
*
* Returns a writable copy of @memory.
*
* If there is only one reference count on @memory, the caller must be the owner,
* and so this function will return the memory object unchanged. If on the other
* hand there is more than one reference on the object, a new memory object will
* be returned. The caller's reference on @memory will be removed, and instead the
* caller will own a reference to the returned object.
*
* In short, this function unrefs the memory in the argument and refs the memory
* that it returns. Don't access the argument after calling this function. See
* also: gst_memory_ref().
*
* Returns: (transfer full): a writable memory which may or may not be the
* same as @memory
*/
GstMemory *
gst_memory_make_writable (GstMemory * memory)
{
return
GST_MEMORY_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST
(memory)));
}

View File

@ -340,12 +340,29 @@ gst_memory_unref (GstMemory * memory)
{
gst_mini_object_unref (GST_MINI_OBJECT_CAST (memory));
}
static inline gboolean
gst_memory_is_writable (const GstMemory * memory)
{
return gst_mini_object_is_writable (GST_MINI_OBJECT_CONST_CAST (memory));
}
G_GNUC_WARN_UNUSED_RESULT static inline GstMemory *
gst_memory_make_writable (GstMemory * memory)
{
return GST_MEMORY_CAST (gst_mini_object_make_writable (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);
GST_API
GstMemory * gst_memory_make_writable (GstMemory * memory) G_GNUC_WARN_UNUSED_RESULT;
GST_API
gboolean gst_memory_is_writable (const GstMemory * memory);
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
/* getting/setting memory properties */
@ -358,18 +375,6 @@ void gst_memory_resize (GstMemory *mem, gssize offset, gsize siz
#define gst_memory_lock(m,f) gst_mini_object_lock (GST_MINI_OBJECT_CAST (m), (f))
#define gst_memory_unlock(m,f) gst_mini_object_unlock (GST_MINI_OBJECT_CAST (m), (f))
#define gst_memory_is_writable(m) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (m))
/**
* gst_memory_make_writable:
* @m: (transfer full): a #GstMemory
*
* Returns a writable copy of @m. If the source memory is
* already writable, this will simply return the same memory.
*
* Returns: (transfer full) (nullable): a writable memory (which may or may not be the
* same as @m) or %NULL if copying is required but not possible.
*/
#define gst_memory_make_writable(m) GST_MEMORY_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (m)))
/* retrieving data */

View File

@ -3550,3 +3550,43 @@ gst_message_take (GstMessage ** old_message, GstMessage * new_message)
return gst_mini_object_take ((GstMiniObject **) old_message,
(GstMiniObject *) new_message);
}
/**
* gst_message_is_writable:
* @message: a #GstMessage
*
* Tests if you can safely modify @message. It is only safe to modify message when
* there is only one owner of the message - ie, the object is writable.
*/
gboolean
gst_message_is_writable (const GstMessage * message)
{
return gst_mini_object_is_writable (GST_MINI_OBJECT_CONST_CAST (message));
}
/**
* gst_message_make_writable:
* @message: (transfer full): a #GstMessage
*
* Returns a writable copy of @message.
*
* If there is only one reference count on @message, the caller must be the owner,
* and so this function will return the message object unchanged. If on the other
* hand there is more than one reference on the object, a new message object will
* be returned. The caller's reference on @message will be removed, and instead the
* caller will own a reference to the returned object.
*
* In short, this function unrefs the message in the argument and refs the message
* that it returns. Don't access the argument after calling this function. See
* also: gst_message_ref().
*
* Returns: (transfer full): a writable message which may or may not be the
* same as @message
*/
GstMessage *
gst_message_make_writable (GstMessage * message)
{
return
GST_MESSAGE_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST
(message)));
}

View File

@ -381,49 +381,24 @@ gst_clear_message (GstMessage ** msg_ptr)
}
/* copy message */
static inline GstMessage * gst_message_copy (const GstMessage * msg);
static inline GstMessage *
G_GNUC_WARN_UNUSED_RESULT 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);
static inline gboolean
gst_message_is_writable (const GstMessage * message)
{
return gst_mini_object_is_writable (GST_MINI_OBJECT_CONST_CAST (message));
}
GST_API
void gst_clear_message (GstMessage ** msg_ptr);
G_GNUC_WARN_UNUSED_RESULT static inline GstMessage *
gst_message_make_writable (GstMessage * message)
{
return GST_MESSAGE_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (message)));
}
GST_API
GstMessage * gst_message_copy (const GstMessage * msg);
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
/**
* gst_message_is_writable:
* @msg: a #GstMessage
*
* Tests if you can safely write into a message's structure or validly
* modify the seqnum and timestamp fields.
*/
#define gst_message_is_writable(msg) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (msg))
/**
* gst_message_make_writable:
* @msg: (transfer full): the message to make writable
*
* Checks if a message is writable. If not, a writable copy is made and
* returned.
*
* Returns: (transfer full): a message (possibly a duplicate) that is writable.
*
* MT safe
*/
#define gst_message_make_writable(msg) GST_MESSAGE_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (msg)))
#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)
{
@ -437,6 +412,23 @@ gst_message_take (GstMessage **old_message, GstMessage *new_message)
(GstMiniObject *) new_message);
}
#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) G_GNUC_WARN_UNUSED_RESULT;
GST_API
GstMessage * gst_message_make_writable (GstMessage * message) G_GNUC_WARN_UNUSED_RESULT;
GST_API
gboolean gst_message_is_writable (const GstMessage * message);
GST_API
gboolean gst_message_replace (GstMessage ** old_message,
GstMessage * new_message);

View File

@ -2878,3 +2878,43 @@ gst_query_take (GstQuery ** old_query, GstQuery * new_query)
return gst_mini_object_take ((GstMiniObject **) old_query,
(GstMiniObject *) new_query);
}
/**
* gst_query_is_writable:
* @query: a #GstQuery
*
* Tests if you can safely modify @query. It is only safe to modify query when
* there is only one owner of the query - ie, the object is writable.
*/
gboolean
gst_query_is_writable (const GstQuery * query)
{
return gst_mini_object_is_writable (GST_MINI_OBJECT_CONST_CAST (query));
}
/**
* gst_query_make_writable:
* @query: (transfer full): a #GstQuery
*
* Returns a writable copy of @query.
*
* If there is only one reference count on @query, the caller must be the owner,
* and so this function will return the query object unchanged. If on the other
* hand there is more than one reference on the object, a new query object will
* be returned. The caller's reference on @query will be removed, and instead the
* caller will own a reference to the returned object.
*
* In short, this function unrefs the query in the argument and refs the query
* that it returns. Don't access the argument after calling this function. See
* also: gst_query_ref().
*
* Returns: (transfer full): a writable query which may or may not be the
* same as @query
*/
GstQuery *
gst_query_make_writable (GstQuery * query)
{
return
GST_QUERY_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST
(query)));
}

View File

@ -263,43 +263,24 @@ gst_clear_query (GstQuery ** query_ptr)
}
/* copy query */
static inline GstQuery *
G_GNUC_WARN_UNUSED_RESULT 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);
static inline gboolean
gst_query_is_writable (const GstQuery * query)
{
return gst_mini_object_is_writable (GST_MINI_OBJECT_CONST_CAST (query));
}
GST_API
void gst_clear_query (GstQuery ** query_ptr);
G_GNUC_WARN_UNUSED_RESULT static inline GstQuery *
gst_query_make_writable (GstQuery * query)
{
return GST_QUERY_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (query)));
}
GST_API
GstQuery * gst_query_copy (const GstQuery * q);
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
/**
* gst_query_is_writable:
* @q: a #GstQuery
*
* Tests if you can safely write data into a query's structure.
*/
#define gst_query_is_writable(q) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (q))
/**
* gst_query_make_writable:
* @q: (transfer full): a #GstQuery to make writable
*
* Makes a writable query from the given query.
*
* 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)))
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
static inline gboolean
gst_query_replace (GstQuery **old_query, GstQuery *new_query)
{
@ -313,6 +294,23 @@ gst_query_take (GstQuery **old_query, GstQuery *new_query)
(GstMiniObject *) new_query);
}
#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) G_GNUC_WARN_UNUSED_RESULT;
GST_API
GstQuery * gst_query_make_writable (GstQuery * query) G_GNUC_WARN_UNUSED_RESULT;
GST_API
gboolean gst_query_is_writable (const GstQuery * query);
GST_API
gboolean gst_query_replace (GstQuery ** old_query,
GstQuery * new_query);

View File

@ -498,3 +498,51 @@ gst_clear_sample (GstSample ** sample_ptr)
{
gst_clear_mini_object ((GstMiniObject **) sample_ptr);
}
/**
* gst_sample_is_writable:
* @sample: A #GstSample
*
* Tests if you can safely set the buffer and / or buffer list of @sample.
*
* Since: 1.16
*/
gboolean
gst_sample_is_writable (const GstSample * sample)
{
return gst_mini_object_is_writable (GST_MINI_OBJECT_CONST_CAST (sample));
}
/**
* gst_sample_make_writable:
* @sample: (transfer full): A #GstSample
*
* Returns a writable copy of @sample. If the source sample is
* already writable, this will simply return the same sample.
*
* Use this function to ensure that a sample can be safely modified before
* making changes to it, for example before calling gst_sample_set_buffer()
*
* If the reference count of the source sample @sample is exactly one, the caller
* is the sole owner and this function will return the sample object unchanged.
*
* If there is more than one reference on the object, a copy will be made using
* gst_sample_copy(). The passed-in @sample will be unreffed in that case, and the
* caller will now own a reference to the new returned sample object.
*
* In short, this function unrefs the sample in the argument and refs the sample
* that it returns. Don't access the argument after calling this function unless
* you have an additional reference to it.
*
* Returns: (transfer full): a writable sample which may or may not be the
* same as @sample
*
* Since: 1.16
*/
GstSample *
gst_sample_make_writable (GstSample * sample)
{
return
GST_SAMPLE_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST
(sample)));
}

View File

@ -101,55 +101,9 @@ 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:
* @sample: A #GstSample
*
* Tests if you can safely set the buffer and / or buffer list of @sample.
*
* Since: 1.16
*/
#define gst_sample_is_writable(sample) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (sample))
/**
* gst_sample_make_writable:
* @sample: (transfer full): A #GstSample
*
* Returns a writable copy of @sample. If the source sample is
* already writable, this will simply return the same sample.
*
* Use this function to ensure that a sample can be safely modified before
* making changes to it, for example before calling gst_sample_set_buffer()
*
* If the reference count of the source sample @sample is exactly one, the caller
* is the sole owner and this function will return the sample object unchanged.
*
* If there is more than one reference on the object, a copy will be made using
* gst_sample_copy(). The passed-in @sample will be unreffed in that case, and the
* caller will now own a reference to the new returned sample object.
*
* In short, this function unrefs the sample in the argument and refs the sample
* that it returns. Don't access the argument after calling this function unless
* you have an additional reference to it.
*
* Returns: (transfer full): a writable sample which may or may not be the
* same as @sample
*
* Since: 1.16
*/
#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 */
static inline GstSample *
G_GNUC_WARN_UNUSED_RESULT static inline GstSample *
gst_sample_copy (const GstSample * sample)
{
return GST_SAMPLE_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (sample)));
@ -160,12 +114,35 @@ gst_clear_sample (GstSample ** sample_ptr)
{
gst_clear_mini_object ((GstMiniObject **) sample_ptr);
}
G_GNUC_WARN_UNUSED_RESULT static inline GstSample *
gst_sample_make_writable (GstSample * sample)
{
return GST_SAMPLE_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (sample)));
}
static inline gboolean
gst_sample_is_writable (const GstSample * sample)
{
return gst_mini_object_is_writable (GST_MINI_OBJECT_CONST_CAST (sample));
}
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
GST_API
GstSample * gst_sample_copy (const GstSample * sample);
GstSample * gst_sample_ref (GstSample * sample);
GST_API
void gst_sample_unref (GstSample * sample);
GST_API
GstSample * gst_sample_copy (const GstSample * sample) G_GNUC_WARN_UNUSED_RESULT;
GST_API
void gst_clear_sample (GstSample ** sample_ptr);
GST_API
GstSample * gst_sample_make_writable (GstSample * sample) G_GNUC_WARN_UNUSED_RESULT;
GST_API
gboolean gst_sample_is_writable (const GstSample * sample);
#endif /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
/**

View File

@ -2083,9 +2083,10 @@ gst_tag_list_get_sample_index (const GstTagList * list,
*
* Returns: (transfer full): the new #GstTagList
*/
GstTagList *(gst_tag_list_copy) (const GstTagList * taglist)
GstTagList *
gst_tag_list_copy (const GstTagList * taglist)
{
return GST_TAG_LIST (gst_mini_object_copy (GST_MINI_OBJECT_CAST (taglist)));
return (GstTagList *) (gst_mini_object_copy (GST_MINI_OBJECT_CAST (taglist)));
}
/**
@ -2192,3 +2193,42 @@ _gst_tag_list_structure (const GstTagList * list)
{
return GST_TAG_LIST_STRUCTURE (list);
}
/**
* gst_tag_list_is_writable:
* @taglist: a #GstTagList
*
* Tests if you can safely modify @taglist. It is only safe to modify taglist when
* there is only one owner of the taglist - ie, the object is writable.
*/
gboolean
gst_tag_list_is_writable (const GstTagList * taglist)
{
return gst_mini_object_is_writable (GST_MINI_OBJECT_CONST_CAST (taglist));
}
/**
* gst_tag_list_make_writable:
* @taglist: (transfer full): a #GstTagList
*
* Returns a writable copy of @taglist.
*
* If there is only one reference count on @taglist, the caller must be the owner,
* and so this function will return the taglist object unchanged. If on the other
* hand there is more than one reference on the object, a new taglist object will
* be returned. The caller's reference on @taglist will be removed, and instead the
* caller will own a reference to the returned object.
*
* In short, this function unrefs the taglist in the argument and refs the taglist
* that it returns. Don't access the argument after calling this function. See
* also: gst_tag_list_ref().
*
* Returns: (transfer full): a writable taglist which may or may not be the
* same as @taglist
*/
GstTagList *
gst_tag_list_make_writable (GstTagList * taglist)
{
return (GstTagList
*) (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (taglist)));
}

View File

@ -418,23 +418,13 @@ 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);
G_GNUC_WARN_UNUSED_RESULT static inline GstTagList *
gst_tag_list_copy (const GstTagList * taglist)
{
return (GstTagList *) (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (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)))
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
static inline gboolean
gst_tag_list_replace (GstTagList **old_taglist, GstTagList *new_taglist)
{
@ -448,47 +438,45 @@ gst_tag_list_take (GstTagList **old_taglist, GstTagList *new_taglist)
return gst_mini_object_take ((GstMiniObject **) old_taglist,
(GstMiniObject *) new_taglist);
}
static inline gboolean
gst_tag_list_is_writable (const GstTagList * taglist)
{
return gst_mini_object_is_writable (GST_MINI_OBJECT_CONST_CAST (taglist));
}
G_GNUC_WARN_UNUSED_RESULT static inline GstTagList *
gst_tag_list_make_writable (GstTagList * taglist)
{
return (GstTagList *) (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (taglist)));
}
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
GST_API
gboolean gst_tag_list_replace (GstTagList ** old_taglist,
GstTagList * new_taglist);
GstTagList * gst_tag_list_ref (GstTagList * taglist);
GST_API
gboolean gst_tag_list_take (GstTagList ** old_taglist,
GstTagList * new_taglist);
void gst_tag_list_unref (GstTagList * taglist);
GST_API
void gst_clear_tag_list (GstTagList ** taglist_ptr);
GST_API
GstTagList* gst_tag_list_copy (const GstTagList* taglist) G_GNUC_WARN_UNUSED_RESULT;
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);
GST_API
GstTagList * gst_tag_list_make_writable (GstTagList * taglist) G_GNUC_WARN_UNUSED_RESULT;
GST_API
gboolean gst_tag_list_is_writable (const GstTagList * taglist);
#endif
/**
* gst_tag_list_is_writable:
* @taglist: a #GstTagList
*
* Tests if you can safely modify @taglist. It is only safe to modify taglist
* when there is only one owner of the taglist - ie, the refcount is 1.
*/
#define gst_tag_list_is_writable(taglist) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (taglist))
/**
* gst_tag_list_make_writable:
* @taglist: (transfer full): a #GstTagList
*
* Returns a writable copy of @taglist.
*
* If there is only one reference count on @taglist, the caller must be the
* owner, and so this function will return the taglist object unchanged. If on
* the other hand there is more than one reference on the object, a new taglist
* object will be returned (which will be a copy of @taglist). The caller's
* reference on @taglist will be removed, and instead the caller will own a
* reference to the returned object.
*
* In short, this function unrefs the taglist in the argument and refs the
* taglist that it returns. Don't access the argument after calling this
* function. See also: gst_tag_list_ref().
*
* Returns: (transfer full): a writable taglist which may or may not be the
* same as @taglist
*/
#define gst_tag_list_make_writable(taglist) GST_TAG_LIST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (taglist)))
/* GStreamer core tags */
/**
* GST_TAG_TITLE:

View File

@ -358,7 +358,7 @@ GST_API
GHashTable * gst_uri_get_media_fragment_table (const GstUri * uri);
#ifndef GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS
static inline GstUri *
G_GNUC_WARN_UNUSED_RESULT static inline GstUri *
gst_uri_copy (const GstUri * uri)
{
return GST_URI_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (uri)));
@ -383,7 +383,7 @@ gst_clear_uri (GstUri ** uri_ptr)
}
#else /* GST_DISABLE_MINIOBJECT_INLINE_FUNCTIONS */
GST_API
GstUri * gst_uri_copy (const GstUri * uri);
GstUri * gst_uri_copy (const GstUri * uri) G_GNUC_WARN_UNUSED_RESULT;
GST_API
GstUri * gst_uri_ref (GstUri * uri);