adapter: Improve documentation for gst_adapter_available()

When I first read the documentation of gst_adapter_available() and
gst_adapter_available_fast() I got quite confused as it seemed that
both performed the same purpose but one was slower than the other.

I shared it with other people and found they also arrived at the same
wrong conclusion.

Hopefully this patch will make the actual purpose clearer.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-docs/-/issues/12

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7859>
This commit is contained in:
Alicia Boya García 2018-01-29 19:46:26 +01:00 committed by GStreamer Marge Bot
parent 3dcdea9e80
commit 2080aff70c
2 changed files with 19 additions and 5 deletions

View file

@ -207,7 +207,11 @@ buffer pushed in it.</doc>
<method name="available" c:identifier="gst_adapter_available"> <method name="available" c:identifier="gst_adapter_available">
<doc xml:space="preserve" filename="../subprojects/gstreamer/libs/gst/base/gstadapter.c">Gets the maximum amount of bytes available, that is it returns the maximum <doc xml:space="preserve" filename="../subprojects/gstreamer/libs/gst/base/gstadapter.c">Gets the maximum amount of bytes available, that is it returns the maximum
value that can be supplied to gst_adapter_map() without that function value that can be supplied to gst_adapter_map() without that function
returning %NULL.</doc> returning %NULL.
Calling gst_adapter_map() with the amount of bytes returned by this function
may require expensive operations (like copying the data into a temporary
buffer) in some cases.</doc>
<source-position filename="../subprojects/gstreamer/libs/gst/base/gstadapter.h"/> <source-position filename="../subprojects/gstreamer/libs/gst/base/gstadapter.h"/>
<return-value transfer-ownership="none"> <return-value transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gstreamer/libs/gst/base/gstadapter.c">number of bytes available in @adapter</doc> <doc xml:space="preserve" filename="../subprojects/gstreamer/libs/gst/base/gstadapter.c">number of bytes available in @adapter</doc>
@ -221,8 +225,11 @@ returning %NULL.</doc>
</parameters> </parameters>
</method> </method>
<method name="available_fast" c:identifier="gst_adapter_available_fast"> <method name="available_fast" c:identifier="gst_adapter_available_fast">
<doc xml:space="preserve" filename="../subprojects/gstreamer/libs/gst/base/gstadapter.c">Gets the maximum number of bytes that are immediately available without <doc xml:space="preserve" filename="../subprojects/gstreamer/libs/gst/base/gstadapter.c">Gets the maximum number of bytes that can be retrieved in a single map
requiring any expensive operations (like copying the data into a operation without merging buffers.
Calling gst_adapter_map() with the amount of bytes returned by this function
will never require any expensive operations (like copying the data into a
temporary buffer).</doc> temporary buffer).</doc>
<source-position filename="../subprojects/gstreamer/libs/gst/base/gstadapter.h"/> <source-position filename="../subprojects/gstreamer/libs/gst/base/gstadapter.h"/>
<return-value transfer-ownership="none"> <return-value transfer-ownership="none">

View file

@ -1314,6 +1314,10 @@ gst_adapter_get_buffer_list (GstAdapter * adapter, gsize nbytes)
* value that can be supplied to gst_adapter_map() without that function * value that can be supplied to gst_adapter_map() without that function
* returning %NULL. * returning %NULL.
* *
* Calling gst_adapter_map() with the amount of bytes returned by this function
* may require expensive operations (like copying the data into a temporary
* buffer) in some cases.
*
* Returns: number of bytes available in @adapter * Returns: number of bytes available in @adapter
*/ */
gsize gsize
@ -1328,8 +1332,11 @@ gst_adapter_available (GstAdapter * adapter)
* gst_adapter_available_fast: * gst_adapter_available_fast:
* @adapter: a #GstAdapter * @adapter: a #GstAdapter
* *
* Gets the maximum number of bytes that are immediately available without * Gets the maximum number of bytes that can be retrieved in a single map
* requiring any expensive operations (like copying the data into a * operation without merging buffers.
*
* Calling gst_adapter_map() with the amount of bytes returned by this function
* will never require any expensive operations (like copying the data into a
* temporary buffer). * temporary buffer).
* *
* Returns: number of bytes that are available in @adapter without expensive * Returns: number of bytes that are available in @adapter without expensive