mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 17:51:16 +00:00
sample: add gst_sample_set/get_buffer_list apis
Allowed to set/get buffer list to sample if needed https://bugzilla.gnome.org/show_bug.cgi?id=751026
This commit is contained in:
parent
7d5a3acf88
commit
e8db96b033
2 changed files with 53 additions and 0 deletions
|
@ -42,6 +42,7 @@ struct _GstSample
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
GstSegment segment;
|
GstSegment segment;
|
||||||
GstStructure *info;
|
GstStructure *info;
|
||||||
|
GstBufferList *buffer_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
GType _gst_sample_type = 0;
|
GType _gst_sample_type = 0;
|
||||||
|
@ -64,6 +65,10 @@ _gst_sample_copy (GstSample * sample)
|
||||||
copy = gst_sample_new (sample->buffer, sample->caps, &sample->segment,
|
copy = gst_sample_new (sample->buffer, sample->caps, &sample->segment,
|
||||||
(sample->info) ? gst_structure_copy (sample->info) : NULL);
|
(sample->info) ? gst_structure_copy (sample->info) : NULL);
|
||||||
|
|
||||||
|
if (sample->buffer_list)
|
||||||
|
copy->buffer_list = (GstBufferList *)
|
||||||
|
gst_mini_object_ref (GST_MINI_OBJECT_CAST (sample->buffer_list));
|
||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +85,9 @@ _gst_sample_free (GstSample * sample)
|
||||||
gst_structure_set_parent_refcount (sample->info, NULL);
|
gst_structure_set_parent_refcount (sample->info, NULL);
|
||||||
gst_structure_free (sample->info);
|
gst_structure_free (sample->info);
|
||||||
}
|
}
|
||||||
|
if (sample->buffer_list)
|
||||||
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (sample->buffer_list));
|
||||||
|
|
||||||
g_slice_free1 (sizeof (GstSample), sample);
|
g_slice_free1 (sizeof (GstSample), sample);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,3 +216,46 @@ gst_sample_get_info (GstSample * sample)
|
||||||
|
|
||||||
return sample->info;
|
return sample->info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_sample_get_buffer_list:
|
||||||
|
* @sample: a #GstSample
|
||||||
|
*
|
||||||
|
* Get the buffer list associated with @sample
|
||||||
|
*
|
||||||
|
* Returns: (transfer none) (nullable): the buffer list of @sample or %NULL
|
||||||
|
* when there is no buffer list. The buffer list remains valid as long as
|
||||||
|
* @sample is valid. If you need to hold on to it for longer than
|
||||||
|
* that, take a ref to the buffer list with gst_mini_object_ref ().
|
||||||
|
*
|
||||||
|
* Since: 1.6
|
||||||
|
*/
|
||||||
|
GstBufferList *
|
||||||
|
gst_sample_get_buffer_list (GstSample * sample)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GST_IS_SAMPLE (sample), NULL);
|
||||||
|
|
||||||
|
return sample->buffer_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_sample_set_buffer_list:
|
||||||
|
* @sample: a #GstSample
|
||||||
|
* @buffer_list: a #GstBufferList
|
||||||
|
*
|
||||||
|
* Set the buffer list associated with @sample
|
||||||
|
*
|
||||||
|
* Since: 1.6
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gst_sample_set_buffer_list (GstSample * sample, GstBufferList * buffer_list)
|
||||||
|
{
|
||||||
|
GstBufferList *old = NULL;
|
||||||
|
g_return_if_fail (GST_IS_SAMPLE (sample));
|
||||||
|
old = sample->buffer_list;
|
||||||
|
sample->buffer_list = (GstBufferList *)
|
||||||
|
gst_mini_object_ref (GST_MINI_OBJECT_CAST (buffer_list));
|
||||||
|
|
||||||
|
if (old)
|
||||||
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (old));
|
||||||
|
}
|
||||||
|
|
|
@ -58,6 +58,8 @@ GstBuffer * gst_sample_get_buffer (GstSample *sample);
|
||||||
GstCaps * gst_sample_get_caps (GstSample *sample);
|
GstCaps * gst_sample_get_caps (GstSample *sample);
|
||||||
GstSegment * gst_sample_get_segment (GstSample *sample);
|
GstSegment * gst_sample_get_segment (GstSample *sample);
|
||||||
const GstStructure * gst_sample_get_info (GstSample *sample);
|
const GstStructure * gst_sample_get_info (GstSample *sample);
|
||||||
|
GstBufferList * gst_sample_get_buffer_list (GstSample *sample);
|
||||||
|
void gst_sample_set_buffer_list (GstSample *sample, GstBufferList *buffer_list);
|
||||||
|
|
||||||
/* refcounting */
|
/* refcounting */
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue