mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-18 21:35:44 +00:00
event: make _parse_nth_stream_config_header() and _parse_setup_data() return a boolean
As they can fail (only one of stream headers or setup data is usually present).
This commit is contained in:
parent
4d937fafbb
commit
7329843fe6
2 changed files with 21 additions and 10 deletions
|
@ -750,16 +750,20 @@ gst_event_set_stream_config_setup_data (GstEvent * event, GstBuffer * buf)
|
|||
* %NULL in @buf if the event contains no setup data. The buffer returned
|
||||
* will remain valid as long as @event remains valid. The caller should
|
||||
* acquire a reference to to @buf if needed.
|
||||
*
|
||||
* Returns: TRUE if @event contained setup data and @buf has been set,
|
||||
* otherwise FALSE.
|
||||
*/
|
||||
void
|
||||
gboolean
|
||||
gst_event_parse_stream_config_setup_data (GstEvent * event, GstBuffer ** buf)
|
||||
{
|
||||
const GValue *val;
|
||||
GstStructure *s;
|
||||
|
||||
g_return_if_fail (GST_IS_EVENT (event));
|
||||
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_CONFIG);
|
||||
g_return_if_fail (buf != NULL);
|
||||
g_return_val_if_fail (GST_IS_EVENT (event), FALSE);
|
||||
g_return_val_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_CONFIG,
|
||||
FALSE);
|
||||
g_return_val_if_fail (buf != NULL, FALSE);
|
||||
|
||||
s = GST_EVENT_STRUCTURE (event);
|
||||
val = gst_structure_id_get_value (s, GST_QUARK (SETUP_DATA));
|
||||
|
@ -767,6 +771,8 @@ gst_event_parse_stream_config_setup_data (GstEvent * event, GstBuffer ** buf)
|
|||
*buf = g_value_get_boxed (val);
|
||||
else
|
||||
*buf = NULL;
|
||||
|
||||
return (*buf != NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -851,8 +857,11 @@ gst_event_get_n_stream_config_headers (GstEvent * event)
|
|||
* Retrieves the n-th stream header buffer attached to the stream config
|
||||
* event and stores it in @buf. Will store %NULL in @buf if there is no such
|
||||
* stream header.
|
||||
*
|
||||
* Returns: TRUE if @event contained a stream header at @index and @buf has
|
||||
* been set, otherwise FALSE.
|
||||
*/
|
||||
void
|
||||
gboolean
|
||||
gst_event_parse_nth_stream_config_header (GstEvent * event, guint index,
|
||||
GstBuffer ** buf)
|
||||
{
|
||||
|
@ -860,9 +869,10 @@ gst_event_parse_nth_stream_config_header (GstEvent * event, guint index,
|
|||
GstStructure *s;
|
||||
GstBuffer *ret = NULL;
|
||||
|
||||
g_return_if_fail (GST_IS_EVENT (event));
|
||||
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_CONFIG);
|
||||
g_return_if_fail (buf != NULL);
|
||||
g_return_val_if_fail (GST_IS_EVENT (event), FALSE);
|
||||
g_return_val_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_CONFIG,
|
||||
FALSE);
|
||||
g_return_val_if_fail (buf != NULL, FALSE);
|
||||
|
||||
s = GST_EVENT_STRUCTURE (event);
|
||||
val = gst_structure_id_get_value (s, GST_QUARK (STREAM_HEADERS));
|
||||
|
@ -874,6 +884,7 @@ gst_event_parse_nth_stream_config_header (GstEvent * event, guint index,
|
|||
}
|
||||
|
||||
*buf = ret;
|
||||
return (ret != NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -503,14 +503,14 @@ void gst_event_parse_stream_config (GstEvent * event, Gs
|
|||
|
||||
void gst_event_set_stream_config_setup_data (GstEvent * event, GstBuffer * buf);
|
||||
|
||||
void gst_event_parse_stream_config_setup_data (GstEvent * event, GstBuffer ** buf);
|
||||
gboolean gst_event_parse_stream_config_setup_data (GstEvent * event, GstBuffer ** buf);
|
||||
|
||||
|
||||
void gst_event_add_stream_config_header (GstEvent * event, GstBuffer * buf);
|
||||
|
||||
guint gst_event_get_n_stream_config_headers (GstEvent * event);
|
||||
|
||||
void gst_event_parse_nth_stream_config_header (GstEvent * event, guint index, GstBuffer ** buf);
|
||||
gboolean gst_event_parse_nth_stream_config_header (GstEvent * event, guint index, GstBuffer ** buf);
|
||||
|
||||
/* segment event */
|
||||
GstEvent* gst_event_new_segment (const GstSegment *segment) G_GNUC_MALLOC;
|
||||
|
|
Loading…
Reference in a new issue