"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "gst/gstutils.c" between
gstreamer-1.22.2.tar.xz and gstreamer-1.22.3.tar.xz

About: GStreamer is a library for constructing of graphs of media-handling components (for e.g. simple Ogg/Vorbis playback, audio/video streaming to complex audio (mixing) and video (non-linear editing) processing). The core library and elements.

gstutils.c  (gstreamer-1.22.2.tar.xz):gstutils.c  (gstreamer-1.22.3.tar.xz)
skipping to change at line 201 skipping to change at line 201
g_return_if_fail (G_IS_OBJECT (object)); g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (name != NULL); g_return_if_fail (name != NULL);
g_return_if_fail (value != NULL); g_return_if_fail (value != NULL);
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), name); pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), name);
if (!pspec) if (!pspec)
return; return;
value_type = pspec->value_type; value_type = pspec->value_type;
GST_DEBUG ("pspec->flags is %d, pspec->value_type is %s", GST_CAT_DEBUG_OBJECT (GST_CAT_PARAMS, object,
"pspec->flags is %d, pspec->value_type is %s",
pspec->flags, g_type_name (value_type)); pspec->flags, g_type_name (value_type));
if (!(pspec->flags & G_PARAM_WRITABLE)) if (!(pspec->flags & G_PARAM_WRITABLE))
return; return;
g_value_init (&v, value_type); g_value_init (&v, value_type);
/* special case for element <-> xml (de)serialisation */ /* special case for element <-> xml (de)serialisation */
if (value_type == GST_TYPE_STRUCTURE && strcmp (value, "NULL") == 0) { if (value_type == GST_TYPE_STRUCTURE && strcmp (value, "NULL") == 0) {
g_value_set_boxed (&v, NULL); g_value_set_boxed (&v, NULL);
skipping to change at line 1147 skipping to change at line 1148
GstIterator *pads; GstIterator *pads;
GstPadTemplate *templ; GstPadTemplate *templ;
GstCaps *templcaps; GstCaps *templcaps;
GstPad *foundpad = NULL; GstPad *foundpad = NULL;
gboolean done; gboolean done;
GValue padptr = { 0, }; GValue padptr = { 0, };
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL); g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
g_return_val_if_fail (GST_IS_PAD (pad), NULL); g_return_val_if_fail (GST_IS_PAD (pad), NULL);
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, GST_CAT_DEBUG_OBJECT (GST_CAT_ELEMENT_PADS, element,
"finding pad in %s compatible with %s:%s", "finding pad compatible with %s:%s", GST_DEBUG_PAD_NAME (pad));
GST_ELEMENT_NAME (element), GST_DEBUG_PAD_NAME (pad));
g_return_val_if_fail (GST_PAD_PEER (pad) == NULL, NULL); g_return_val_if_fail (GST_PAD_PEER (pad) == NULL, NULL);
done = FALSE; done = FALSE;
/* try to get an existing unlinked pad */ /* try to get an existing unlinked pad */
if (GST_PAD_IS_SRC (pad)) { if (GST_PAD_IS_SRC (pad)) {
pads = gst_element_iterate_sink_pads (element); pads = gst_element_iterate_sink_pads (element);
} else if (GST_PAD_IS_SINK (pad)) { } else if (GST_PAD_IS_SINK (pad)) {
pads = gst_element_iterate_src_pads (element); pads = gst_element_iterate_src_pads (element);
skipping to change at line 1175 skipping to change at line 1175
switch (gst_iterator_next (pads, &padptr)) { switch (gst_iterator_next (pads, &padptr)) {
case GST_ITERATOR_OK: case GST_ITERATOR_OK:
{ {
GstPad *peer; GstPad *peer;
GstPad *current; GstPad *current;
GstPad *srcpad; GstPad *srcpad;
GstPad *sinkpad; GstPad *sinkpad;
current = g_value_get_object (&padptr); current = g_value_get_object (&padptr);
GST_CAT_LOG (GST_CAT_ELEMENT_PADS, "examining pad %s:%s", GST_CAT_LOG_OBJECT (GST_CAT_ELEMENT_PADS, element,
GST_DEBUG_PAD_NAME (current)); "examining pad %s:%s", GST_DEBUG_PAD_NAME (current));
if (GST_PAD_IS_SRC (current)) { if (GST_PAD_IS_SRC (current)) {
srcpad = current; srcpad = current;
sinkpad = pad; sinkpad = pad;
} else { } else {
srcpad = pad; srcpad = pad;
sinkpad = current; sinkpad = current;
} }
peer = gst_pad_get_peer (current); peer = gst_pad_get_peer (current);
skipping to change at line 1206 skipping to change at line 1206
} else { } else {
intersection = temp; intersection = temp;
} }
temp = gst_pad_query_caps (current, NULL); temp = gst_pad_query_caps (current, NULL);
compatible = gst_caps_can_intersect (temp, intersection); compatible = gst_caps_can_intersect (temp, intersection);
gst_caps_unref (temp); gst_caps_unref (temp);
gst_caps_unref (intersection); gst_caps_unref (intersection);
if (compatible) { if (compatible) {
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, GST_CAT_DEBUG_OBJECT (GST_CAT_ELEMENT_PADS, element,
"found existing unlinked compatible pad %s:%s", "found existing unlinked compatible pad %s:%s",
GST_DEBUG_PAD_NAME (current)); GST_DEBUG_PAD_NAME (current));
gst_iterator_free (pads); gst_iterator_free (pads);
current = gst_object_ref (current); current = gst_object_ref (current);
g_value_unset (&padptr); g_value_unset (&padptr);
return current; return current;
} else { } else {
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "incompatible pads"); GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "incompatible pads");
skipping to change at line 1264 skipping to change at line 1264
templcaps = inter; templcaps = inter;
} }
templ = gst_pad_template_new ((gchar *) GST_PAD_NAME (pad), templ = gst_pad_template_new ((gchar *) GST_PAD_NAME (pad),
GST_PAD_DIRECTION (pad), GST_PAD_ALWAYS, templcaps); GST_PAD_DIRECTION (pad), GST_PAD_ALWAYS, templcaps);
gst_caps_unref (templcaps); gst_caps_unref (templcaps);
foundpad = gst_element_request_compatible_pad (element, templ); foundpad = gst_element_request_compatible_pad (element, templ);
gst_object_unref (templ); gst_object_unref (templ);
if (foundpad) { if (foundpad) {
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, GST_CAT_DEBUG_OBJECT (GST_CAT_ELEMENT_PADS, element,
"found existing request pad %s:%s", GST_DEBUG_PAD_NAME (foundpad)); "found existing request pad %s:%s", GST_DEBUG_PAD_NAME (foundpad));
return foundpad; return foundpad;
} }
GST_CAT_INFO_OBJECT (GST_CAT_ELEMENT_PADS, element, GST_CAT_INFO_OBJECT (GST_CAT_ELEMENT_PADS, element,
"Could not find a compatible pad to link to %s:%s", "Could not find a compatible pad to link to %s:%s",
GST_DEBUG_PAD_NAME (pad)); GST_DEBUG_PAD_NAME (pad));
return NULL; return NULL;
} }
skipping to change at line 1619 skipping to change at line 1619
GstObject *root; GstObject *root;
GstObject *e1, *e2; GstObject *e1, *e2;
GSList *pads_created_local = NULL; GSList *pads_created_local = NULL;
g_assert (pads_created); g_assert (pads_created);
e1 = GST_OBJECT_PARENT (*src); e1 = GST_OBJECT_PARENT (*src);
e2 = GST_OBJECT_PARENT (*sink); e2 = GST_OBJECT_PARENT (*sink);
if (G_UNLIKELY (e1 == NULL)) { if (G_UNLIKELY (e1 == NULL)) {
GST_WARNING ("Trying to ghost a pad that doesn't have a parent: %" GST_CAT_WARNING (GST_CAT_ELEMENT_PADS,
GST_PTR_FORMAT, *src); "Trying to ghost a pad that doesn't have a parent: %" GST_PTR_FORMAT,
*src);
return FALSE; return FALSE;
} }
if (G_UNLIKELY (e2 == NULL)) { if (G_UNLIKELY (e2 == NULL)) {
GST_WARNING ("Trying to ghost a pad that doesn't have a parent: %" GST_CAT_WARNING (GST_CAT_ELEMENT_PADS,
GST_PTR_FORMAT, *sink); "Trying to ghost a pad that doesn't have a parent: %" GST_PTR_FORMAT,
*sink);
return FALSE; return FALSE;
} }
if (GST_OBJECT_PARENT (e1) == GST_OBJECT_PARENT (e2)) { if (GST_OBJECT_PARENT (e1) == GST_OBJECT_PARENT (e2)) {
GST_CAT_INFO (GST_CAT_PADS, "%s and %s in same bin, no need for ghost pads", GST_CAT_INFO (GST_CAT_PADS, "%s and %s in same bin, no need for ghost pads",
GST_OBJECT_NAME (e1), GST_OBJECT_NAME (e2)); GST_OBJECT_NAME (e1), GST_OBJECT_NAME (e2));
return TRUE; return TRUE;
} }
GST_CAT_INFO (GST_CAT_PADS, "%s and %s not in same bin, making ghost pads", GST_CAT_INFO (GST_CAT_PADS, "%s and %s not in same bin, making ghost pads",
skipping to change at line 2159 skipping to change at line 2161
g_return_val_if_fail (filter == NULL || GST_IS_CAPS (filter), FALSE); g_return_val_if_fail (filter == NULL || GST_IS_CAPS (filter), FALSE);
if (filter) { if (filter) {
GstElement *capsfilter; GstElement *capsfilter;
GstObject *parent; GstObject *parent;
GstState state, pending; GstState state, pending;
gboolean lr1, lr2; gboolean lr1, lr2;
capsfilter = gst_element_factory_make ("capsfilter", NULL); capsfilter = gst_element_factory_make ("capsfilter", NULL);
if (!capsfilter) { if (!capsfilter) {
GST_ERROR ("Could not make a capsfilter"); GST_CAT_ERROR (GST_CAT_ELEMENT_PADS, "Could not make a capsfilter");
return FALSE; return FALSE;
} }
parent = gst_object_get_parent (GST_OBJECT (src)); parent = gst_object_get_parent (GST_OBJECT (src));
g_return_val_if_fail (GST_IS_BIN (parent), FALSE); g_return_val_if_fail (GST_IS_BIN (parent), FALSE);
gst_element_get_state (GST_ELEMENT_CAST (parent), &state, &pending, 0); gst_element_get_state (GST_ELEMENT_CAST (parent), &state, &pending, 0);
if (!gst_bin_add (GST_BIN (parent), capsfilter)) { if (!gst_bin_add (GST_BIN (parent), capsfilter)) {
GST_ERROR ("Could not add capsfilter"); GST_CAT_ERROR (GST_CAT_ELEMENT_PADS, "Could not add capsfilter");
gst_object_unref (parent); gst_object_unref (parent);
return FALSE; return FALSE;
} }
if (pending != GST_STATE_VOID_PENDING) if (pending != GST_STATE_VOID_PENDING)
state = pending; state = pending;
gst_element_set_state (capsfilter, state); gst_element_set_state (capsfilter, state);
gst_object_unref (parent); gst_object_unref (parent);
skipping to change at line 2328 skipping to change at line 2330
g_return_if_fail (srcpadname != NULL); g_return_if_fail (srcpadname != NULL);
g_return_if_fail (dest != NULL); g_return_if_fail (dest != NULL);
g_return_if_fail (GST_IS_ELEMENT (dest)); g_return_if_fail (GST_IS_ELEMENT (dest));
g_return_if_fail (destpadname != NULL); g_return_if_fail (destpadname != NULL);
/* obtain the pads requested */ /* obtain the pads requested */
if (!(srcpad = gst_element_get_static_pad (src, srcpadname))) if (!(srcpad = gst_element_get_static_pad (src, srcpadname)))
if ((srcpad = gst_element_request_pad_simple (src, srcpadname))) if ((srcpad = gst_element_request_pad_simple (src, srcpadname)))
srcrequest = TRUE; srcrequest = TRUE;
if (srcpad == NULL) { if (srcpad == NULL) {
GST_WARNING_OBJECT (src, "source element has no pad \"%s\"", srcpadname); GST_CAT_WARNING_OBJECT (GST_CAT_ELEMENT_PADS, src,
"source element has no pad \"%s\"", srcpadname);
return; return;
} }
if (!(destpad = gst_element_get_static_pad (dest, destpadname))) if (!(destpad = gst_element_get_static_pad (dest, destpadname)))
if ((destpad = gst_element_request_pad_simple (dest, destpadname))) if ((destpad = gst_element_request_pad_simple (dest, destpadname)))
destrequest = TRUE; destrequest = TRUE;
if (destpad == NULL) { if (destpad == NULL) {
GST_WARNING_OBJECT (dest, "destination element has no pad \"%s\"", GST_CAT_WARNING_OBJECT (GST_CAT_ELEMENT_PADS, dest,
destpadname); "destination element has no pad \"%s\"", destpadname);
goto free_src; goto free_src;
} }
/* we're satisfied they can be unlinked, let's do it */ /* we're satisfied they can be unlinked, let's do it */
gst_pad_unlink (srcpad, destpad); gst_pad_unlink (srcpad, destpad);
if (destrequest) if (destrequest)
gst_element_release_request_pad (dest, destpad); gst_element_release_request_pad (dest, destpad);
gst_object_unref (destpad); gst_object_unref (destpad);
skipping to change at line 2814 skipping to change at line 2817
static gboolean static gboolean
query_caps_func (GstPad * pad, QueryCapsData * data) query_caps_func (GstPad * pad, QueryCapsData * data)
{ {
gboolean empty = FALSE; gboolean empty = FALSE;
if (G_LIKELY (gst_pad_peer_query (pad, data->query))) { if (G_LIKELY (gst_pad_peer_query (pad, data->query))) {
GstCaps *peercaps, *intersection; GstCaps *peercaps, *intersection;
gst_query_parse_caps_result (data->query, &peercaps); gst_query_parse_caps_result (data->query, &peercaps);
GST_DEBUG_OBJECT (pad, "intersect with result %" GST_PTR_FORMAT, peercaps); GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
"intersect with result %" GST_PTR_FORMAT, peercaps);
intersection = gst_caps_intersect (data->ret, peercaps); intersection = gst_caps_intersect (data->ret, peercaps);
GST_DEBUG_OBJECT (pad, "intersected %" GST_PTR_FORMAT, intersection); GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
"intersected %" GST_PTR_FORMAT, intersection);
gst_caps_unref (data->ret); gst_caps_unref (data->ret);
data->ret = intersection; data->ret = intersection;
/* stop when empty */ /* stop when empty */
empty = gst_caps_is_empty (intersection); empty = gst_caps_is_empty (intersection);
} }
return empty; return empty;
} }
skipping to change at line 3195 skipping to change at line 3200
g_return_val_if_fail (GST_IS_PAD (pad), FALSE); g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
g_return_val_if_fail (GST_IS_CAPS (caps), FALSE); g_return_val_if_fail (GST_IS_CAPS (caps), FALSE);
GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, pad, "accept caps of %" GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, pad, "accept caps of %"
GST_PTR_FORMAT, caps); GST_PTR_FORMAT, caps);
query = gst_query_new_accept_caps (caps); query = gst_query_new_accept_caps (caps);
if (gst_pad_query (pad, query)) { if (gst_pad_query (pad, query)) {
gst_query_parse_accept_caps_result (query, &res); gst_query_parse_accept_caps_result (query, &res);
GST_DEBUG_OBJECT (pad, "query returned %d", res); GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, pad, "query returned %d", res);
} }
gst_query_unref (query); gst_query_unref (query);
return res; return res;
} }
/** /**
* gst_pad_peer_query_accept_caps: * gst_pad_peer_query_accept_caps:
* @pad: a #GstPad to check the peer of * @pad: a #GstPad to check the peer of
* @caps: a #GstCaps to check on the pad * @caps: a #GstCaps to check on the pad
skipping to change at line 3224 skipping to change at line 3229
{ {
gboolean res = TRUE; gboolean res = TRUE;
GstQuery *query; GstQuery *query;
g_return_val_if_fail (GST_IS_PAD (pad), FALSE); g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
g_return_val_if_fail (GST_IS_CAPS (caps), FALSE); g_return_val_if_fail (GST_IS_CAPS (caps), FALSE);
query = gst_query_new_accept_caps (caps); query = gst_query_new_accept_caps (caps);
if (gst_pad_peer_query (pad, query)) { if (gst_pad_peer_query (pad, query)) {
gst_query_parse_accept_caps_result (query, &res); gst_query_parse_accept_caps_result (query, &res);
GST_DEBUG_OBJECT (pad, "query returned %d", res); GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, pad, "query returned %d", res);
} }
gst_query_unref (query); gst_query_unref (query);
return res; return res;
} }
static GstPad * static GstPad *
element_find_unlinked_pad (GstElement * element, GstPadDirection direction) element_find_unlinked_pad (GstElement * element, GstPadDirection direction)
{ {
GstIterator *iter; GstIterator *iter;
skipping to change at line 3257 skipping to change at line 3262
g_return_val_if_reached (NULL); g_return_val_if_reached (NULL);
} }
done = FALSE; done = FALSE;
while (!done) { while (!done) {
switch (gst_iterator_next (iter, &data)) { switch (gst_iterator_next (iter, &data)) {
case GST_ITERATOR_OK:{ case GST_ITERATOR_OK:{
GstPad *peer; GstPad *peer;
GstPad *pad = g_value_get_object (&data); GstPad *pad = g_value_get_object (&data);
GST_CAT_LOG (GST_CAT_ELEMENT_PADS, "examining pad %s:%s", GST_CAT_LOG_OBJECT (GST_CAT_ELEMENT_PADS, element,
GST_DEBUG_PAD_NAME (pad)); "examining pad %s:%s", GST_DEBUG_PAD_NAME (pad));
peer = gst_pad_get_peer (pad); peer = gst_pad_get_peer (pad);
if (peer == NULL) { if (peer == NULL) {
unlinked_pad = gst_object_ref (pad); unlinked_pad = gst_object_ref (pad);
done = TRUE; done = TRUE;
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, GST_CAT_DEBUG_OBJECT (GST_CAT_ELEMENT_PADS, element,
"found existing unlinked pad %s:%s", "found existing unlinked pad %s:%s",
GST_DEBUG_PAD_NAME (unlinked_pad)); GST_DEBUG_PAD_NAME (unlinked_pad));
} else { } else {
gst_object_unref (peer); gst_object_unref (peer);
} }
g_value_reset (&data); g_value_reset (&data);
break; break;
} }
case GST_ITERATOR_DONE: case GST_ITERATOR_DONE:
done = TRUE; done = TRUE;
skipping to change at line 4192 skipping to change at line 4197
GstEvent *event; GstEvent *event;
gchar *ret = NULL; gchar *ret = NULL;
g_return_val_if_fail (GST_IS_PAD (pad), NULL); g_return_val_if_fail (GST_IS_PAD (pad), NULL);
event = gst_pad_get_sticky_event (pad, GST_EVENT_STREAM_START, 0); event = gst_pad_get_sticky_event (pad, GST_EVENT_STREAM_START, 0);
if (event != NULL) { if (event != NULL) {
gst_event_parse_stream_start (event, &stream_id); gst_event_parse_stream_start (event, &stream_id);
ret = g_strdup (stream_id); ret = g_strdup (stream_id);
gst_event_unref (event); gst_event_unref (event);
GST_LOG_OBJECT (pad, "pad has stream-id '%s'", ret); GST_CAT_LOG_OBJECT (GST_CAT_PADS, pad, "pad has stream-id '%s'", ret);
} else { } else {
GST_DEBUG_OBJECT (pad, "pad has not received a stream-start event yet"); GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
"pad has not received a stream-start event yet");
} }
return ret; return ret;
} }
/** /**
* gst_pad_get_stream: * gst_pad_get_stream:
* @pad: A source #GstPad * @pad: A source #GstPad
* *
* Returns the current #GstStream for the @pad, or %NULL if none has been * Returns the current #GstStream for the @pad, or %NULL if none has been
skipping to change at line 4227 skipping to change at line 4233
{ {
GstStream *stream = NULL; GstStream *stream = NULL;
GstEvent *event; GstEvent *event;
g_return_val_if_fail (GST_IS_PAD (pad), NULL); g_return_val_if_fail (GST_IS_PAD (pad), NULL);
event = gst_pad_get_sticky_event (pad, GST_EVENT_STREAM_START, 0); event = gst_pad_get_sticky_event (pad, GST_EVENT_STREAM_START, 0);
if (event != NULL) { if (event != NULL) {
gst_event_parse_stream (event, &stream); gst_event_parse_stream (event, &stream);
gst_event_unref (event); gst_event_unref (event);
GST_LOG_OBJECT (pad, "pad has stream object %p", stream); GST_CAT_LOG_OBJECT (GST_CAT_PADS, pad, "pad has stream object %p", stream);
} else { } else {
GST_DEBUG_OBJECT (pad, "pad has not received a stream-start event yet"); GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad,
"pad has not received a stream-start event yet");
} }
return stream; return stream;
} }
/** /**
* gst_util_group_id_next: * gst_util_group_id_next:
* *
* Return a constantly incrementing group id. * Return a constantly incrementing group id.
* *
 End of changes. 21 change blocks. 
28 lines changed or deleted 35 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)