mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
Added gst_data_needs_copy_on_write()
Original commit message from CVS: Added gst_data_needs_copy_on_write()
This commit is contained in:
parent
edd2819c89
commit
f42d7e6ac8
2 changed files with 21 additions and 0 deletions
|
@ -92,6 +92,26 @@ gst_data_copy (const GstData *data)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_data_needs_copy_on_write:
|
||||
* @data: a #GstData to copy
|
||||
*
|
||||
* Returns: TRUE if the given #GstData is potentially shared and needs to
|
||||
* be copied before it can be modified safely.
|
||||
*/
|
||||
gboolean
|
||||
gst_data_needs_copy_on_write (GstData *data)
|
||||
{
|
||||
gint refcount;
|
||||
|
||||
GST_ATOMIC_INT_READ (&data->refcount, &refcount);
|
||||
|
||||
if (refcount == 1 && !GST_DATA_FLAG_IS_SET (data, GST_DATA_READONLY))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_data_copy_on_write:
|
||||
* @data: a #GstData to copy
|
||||
|
|
|
@ -87,6 +87,7 @@ void gst_data_copy_into (const GstData *data, GstData *target);
|
|||
|
||||
/* basic operations on data */
|
||||
GstData* gst_data_copy (const GstData *data);
|
||||
gboolean gst_data_needs_copy_on_write (GstData *data);
|
||||
GstData* gst_data_copy_on_write (GstData *data);
|
||||
void gst_data_free (GstData *data);
|
||||
|
||||
|
|
Loading…
Reference in a new issue