mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
gst: Update for new GstIterator API
This commit is contained in:
parent
38f05ba0d4
commit
64851f12c0
7 changed files with 102 additions and 67 deletions
|
@ -344,6 +344,7 @@ gst_adder_query_duration (GstAdder * adder, GstQuery * query)
|
||||||
GstFormat format;
|
GstFormat format;
|
||||||
GstIterator *it;
|
GstIterator *it;
|
||||||
gboolean done;
|
gboolean done;
|
||||||
|
GValue item = { 0, };
|
||||||
|
|
||||||
/* parse format */
|
/* parse format */
|
||||||
gst_query_parse_duration (query, &format, NULL);
|
gst_query_parse_duration (query, &format, NULL);
|
||||||
|
@ -356,8 +357,6 @@ gst_adder_query_duration (GstAdder * adder, GstQuery * query)
|
||||||
while (!done) {
|
while (!done) {
|
||||||
GstIteratorResult ires;
|
GstIteratorResult ires;
|
||||||
|
|
||||||
gpointer item;
|
|
||||||
|
|
||||||
ires = gst_iterator_next (it, &item);
|
ires = gst_iterator_next (it, &item);
|
||||||
switch (ires) {
|
switch (ires) {
|
||||||
case GST_ITERATOR_DONE:
|
case GST_ITERATOR_DONE:
|
||||||
|
@ -365,8 +364,7 @@ gst_adder_query_duration (GstAdder * adder, GstQuery * query)
|
||||||
break;
|
break;
|
||||||
case GST_ITERATOR_OK:
|
case GST_ITERATOR_OK:
|
||||||
{
|
{
|
||||||
GstPad *pad = GST_PAD_CAST (item);
|
GstPad *pad = g_value_get_object (&item);
|
||||||
|
|
||||||
gint64 duration;
|
gint64 duration;
|
||||||
|
|
||||||
/* ask sink peer for duration */
|
/* ask sink peer for duration */
|
||||||
|
@ -382,7 +380,7 @@ gst_adder_query_duration (GstAdder * adder, GstQuery * query)
|
||||||
else if (duration > max)
|
else if (duration > max)
|
||||||
max = duration;
|
max = duration;
|
||||||
}
|
}
|
||||||
gst_object_unref (pad);
|
g_value_reset (&item);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_ITERATOR_RESYNC:
|
case GST_ITERATOR_RESYNC:
|
||||||
|
@ -396,6 +394,7 @@ gst_adder_query_duration (GstAdder * adder, GstQuery * query)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_value_unset (&item);
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
|
@ -416,6 +415,7 @@ gst_adder_query_latency (GstAdder * adder, GstQuery * query)
|
||||||
gboolean res;
|
gboolean res;
|
||||||
GstIterator *it;
|
GstIterator *it;
|
||||||
gboolean done;
|
gboolean done;
|
||||||
|
GValue item = { 0, };
|
||||||
|
|
||||||
res = TRUE;
|
res = TRUE;
|
||||||
done = FALSE;
|
done = FALSE;
|
||||||
|
@ -429,8 +429,6 @@ gst_adder_query_latency (GstAdder * adder, GstQuery * query)
|
||||||
while (!done) {
|
while (!done) {
|
||||||
GstIteratorResult ires;
|
GstIteratorResult ires;
|
||||||
|
|
||||||
gpointer item;
|
|
||||||
|
|
||||||
ires = gst_iterator_next (it, &item);
|
ires = gst_iterator_next (it, &item);
|
||||||
switch (ires) {
|
switch (ires) {
|
||||||
case GST_ITERATOR_DONE:
|
case GST_ITERATOR_DONE:
|
||||||
|
@ -438,7 +436,7 @@ gst_adder_query_latency (GstAdder * adder, GstQuery * query)
|
||||||
break;
|
break;
|
||||||
case GST_ITERATOR_OK:
|
case GST_ITERATOR_OK:
|
||||||
{
|
{
|
||||||
GstPad *pad = GST_PAD_CAST (item);
|
GstPad *pad = g_value_get_object (&item);
|
||||||
GstQuery *peerquery;
|
GstQuery *peerquery;
|
||||||
GstClockTime min_cur, max_cur;
|
GstClockTime min_cur, max_cur;
|
||||||
gboolean live_cur;
|
gboolean live_cur;
|
||||||
|
@ -464,7 +462,7 @@ gst_adder_query_latency (GstAdder * adder, GstQuery * query)
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_query_unref (peerquery);
|
gst_query_unref (peerquery);
|
||||||
gst_object_unref (pad);
|
g_value_reset (&item);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_ITERATOR_RESYNC:
|
case GST_ITERATOR_RESYNC:
|
||||||
|
@ -480,6 +478,7 @@ gst_adder_query_latency (GstAdder * adder, GstQuery * query)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_value_unset (&item);
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
|
@ -545,8 +544,9 @@ typedef struct
|
||||||
} EventData;
|
} EventData;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
forward_event_func (GstPad * pad, GValue * ret, EventData * data)
|
forward_event_func (const GValue * val, GValue * ret, EventData * data)
|
||||||
{
|
{
|
||||||
|
GstPad *pad = g_value_get_object (val);
|
||||||
GstEvent *event = data->event;
|
GstEvent *event = data->event;
|
||||||
|
|
||||||
gst_event_ref (event);
|
gst_event_ref (event);
|
||||||
|
@ -563,7 +563,6 @@ forward_event_func (GstPad * pad, GValue * ret, EventData * data)
|
||||||
GST_LOG_OBJECT (pad, "Sent event %p (%s).",
|
GST_LOG_OBJECT (pad, "Sent event %p (%s).",
|
||||||
event, GST_EVENT_TYPE_NAME (event));
|
event, GST_EVENT_TYPE_NAME (event));
|
||||||
}
|
}
|
||||||
gst_object_unref (pad);
|
|
||||||
|
|
||||||
/* continue on other pads, even if one failed */
|
/* continue on other pads, even if one failed */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -594,7 +593,8 @@ forward_event (GstAdder * adder, GstEvent * event, gboolean flush)
|
||||||
g_value_set_boolean (&vret, FALSE);
|
g_value_set_boolean (&vret, FALSE);
|
||||||
it = gst_element_iterate_sink_pads (GST_ELEMENT_CAST (adder));
|
it = gst_element_iterate_sink_pads (GST_ELEMENT_CAST (adder));
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
ires = gst_iterator_fold (it, (GstIteratorFoldFunction) forward_event_func,
|
ires =
|
||||||
|
gst_iterator_fold (it, (GstIteratorFoldFunction) forward_event_func,
|
||||||
&vret, &data);
|
&vret, &data);
|
||||||
switch (ires) {
|
switch (ires) {
|
||||||
case GST_ITERATOR_RESYNC:
|
case GST_ITERATOR_RESYNC:
|
||||||
|
|
|
@ -1511,8 +1511,9 @@ stream_error:
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
release_pads (GstPad * pad, GstElement * elt)
|
release_pads (const GValue * item, GstElement * elt)
|
||||||
{
|
{
|
||||||
|
GstPad *pad = g_value_get_object (item);
|
||||||
GstPad *peer = NULL;
|
GstPad *peer = NULL;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (elt, "Releasing pad %s:%s", GST_DEBUG_PAD_NAME (pad));
|
GST_DEBUG_OBJECT (elt, "Releasing pad %s:%s", GST_DEBUG_PAD_NAME (pad));
|
||||||
|
@ -1528,9 +1529,6 @@ release_pads (GstPad * pad, GstElement * elt)
|
||||||
|
|
||||||
/* Release it from the object */
|
/* Release it from the object */
|
||||||
gst_element_release_request_pad (elt, pad);
|
gst_element_release_request_pad (elt, pad);
|
||||||
|
|
||||||
/* And remove the reference added by the iterator */
|
|
||||||
gst_object_unref (pad);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void inline
|
static void inline
|
||||||
|
@ -1604,7 +1602,9 @@ stream_group_free (GstEncodeBin * ebin, StreamGroup * sgroup)
|
||||||
GstIteratorResult itret = GST_ITERATOR_OK;
|
GstIteratorResult itret = GST_ITERATOR_OK;
|
||||||
|
|
||||||
while (itret == GST_ITERATOR_OK || itret == GST_ITERATOR_RESYNC) {
|
while (itret == GST_ITERATOR_OK || itret == GST_ITERATOR_RESYNC) {
|
||||||
itret = gst_iterator_foreach (it, (GFunc) release_pads, sgroup->combiner);
|
itret =
|
||||||
|
gst_iterator_foreach (it, (GstIteratorForeachFunction) release_pads,
|
||||||
|
sgroup->combiner);
|
||||||
gst_iterator_resync (it);
|
gst_iterator_resync (it);
|
||||||
}
|
}
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
|
@ -1616,7 +1616,9 @@ stream_group_free (GstEncodeBin * ebin, StreamGroup * sgroup)
|
||||||
GstIterator *it = gst_element_iterate_src_pads (sgroup->splitter);
|
GstIterator *it = gst_element_iterate_src_pads (sgroup->splitter);
|
||||||
GstIteratorResult itret = GST_ITERATOR_OK;
|
GstIteratorResult itret = GST_ITERATOR_OK;
|
||||||
while (itret == GST_ITERATOR_OK || itret == GST_ITERATOR_RESYNC) {
|
while (itret == GST_ITERATOR_OK || itret == GST_ITERATOR_RESYNC) {
|
||||||
itret = gst_iterator_foreach (it, (GFunc) release_pads, sgroup->splitter);
|
itret =
|
||||||
|
gst_iterator_foreach (it, (GstIteratorForeachFunction) release_pads,
|
||||||
|
sgroup->splitter);
|
||||||
gst_iterator_resync (it);
|
gst_iterator_resync (it);
|
||||||
}
|
}
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
|
|
|
@ -1236,6 +1236,7 @@ static GstPad *
|
||||||
get_our_ghost_pad (GstDecodeBin * decode_bin, GstPad * pad)
|
get_our_ghost_pad (GstDecodeBin * decode_bin, GstPad * pad)
|
||||||
{
|
{
|
||||||
GstIterator *pad_it = NULL;
|
GstIterator *pad_it = NULL;
|
||||||
|
GValue item = { 0, };
|
||||||
GstPad *db_pad = NULL;
|
GstPad *db_pad = NULL;
|
||||||
gboolean done = FALSE;
|
gboolean done = FALSE;
|
||||||
|
|
||||||
|
@ -1248,8 +1249,9 @@ get_our_ghost_pad (GstDecodeBin * decode_bin, GstPad * pad)
|
||||||
pad_it = gst_element_iterate_src_pads (GST_ELEMENT (decode_bin));
|
pad_it = gst_element_iterate_src_pads (GST_ELEMENT (decode_bin));
|
||||||
while (!done) {
|
while (!done) {
|
||||||
db_pad = NULL;
|
db_pad = NULL;
|
||||||
switch (gst_iterator_next (pad_it, (gpointer) & db_pad)) {
|
switch (gst_iterator_next (pad_it, &item)) {
|
||||||
case GST_ITERATOR_OK:
|
case GST_ITERATOR_OK:{
|
||||||
|
db_pad = g_value_get_object (&item);
|
||||||
GST_DEBUG_OBJECT (decode_bin, "looking at pad %s:%s",
|
GST_DEBUG_OBJECT (decode_bin, "looking at pad %s:%s",
|
||||||
GST_DEBUG_PAD_NAME (db_pad));
|
GST_DEBUG_PAD_NAME (db_pad));
|
||||||
if (GST_IS_GHOST_PAD (db_pad)) {
|
if (GST_IS_GHOST_PAD (db_pad)) {
|
||||||
|
@ -1268,8 +1270,9 @@ get_our_ghost_pad (GstDecodeBin * decode_bin, GstPad * pad)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Not the right one */
|
/* Not the right one */
|
||||||
gst_object_unref (db_pad);
|
g_value_reset (&item);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case GST_ITERATOR_RESYNC:
|
case GST_ITERATOR_RESYNC:
|
||||||
gst_iterator_resync (pad_it);
|
gst_iterator_resync (pad_it);
|
||||||
break;
|
break;
|
||||||
|
@ -1281,6 +1284,7 @@ get_our_ghost_pad (GstDecodeBin * decode_bin, GstPad * pad)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_value_unset (&item);
|
||||||
gst_iterator_free (pad_it);
|
gst_iterator_free (pad_it);
|
||||||
|
|
||||||
return db_pad;
|
return db_pad;
|
||||||
|
@ -1295,7 +1299,7 @@ remove_element_chain (GstDecodeBin * decode_bin, GstPad * pad)
|
||||||
{
|
{
|
||||||
GstIterator *iter;
|
GstIterator *iter;
|
||||||
gboolean done = FALSE;
|
gboolean done = FALSE;
|
||||||
gpointer item;
|
GValue item = { 0, };
|
||||||
GstElement *elem = GST_ELEMENT (GST_OBJECT_PARENT (pad));
|
GstElement *elem = GST_ELEMENT (GST_OBJECT_PARENT (pad));
|
||||||
|
|
||||||
while (GST_OBJECT_PARENT (elem) &&
|
while (GST_OBJECT_PARENT (elem) &&
|
||||||
|
@ -1322,7 +1326,7 @@ remove_element_chain (GstDecodeBin * decode_bin, GstPad * pad)
|
||||||
GstPad *ghostpad;
|
GstPad *ghostpad;
|
||||||
GstPad *peer;
|
GstPad *peer;
|
||||||
|
|
||||||
pad = GST_PAD (item);
|
pad = g_value_get_object (&item);
|
||||||
GST_DEBUG_OBJECT (decode_bin, "inspecting internal pad %s:%s",
|
GST_DEBUG_OBJECT (decode_bin, "inspecting internal pad %s:%s",
|
||||||
GST_DEBUG_PAD_NAME (pad));
|
GST_DEBUG_PAD_NAME (pad));
|
||||||
|
|
||||||
|
@ -1336,6 +1340,7 @@ remove_element_chain (GstDecodeBin * decode_bin, GstPad * pad)
|
||||||
|
|
||||||
gst_element_remove_pad (GST_ELEMENT (decode_bin), ghostpad);
|
gst_element_remove_pad (GST_ELEMENT (decode_bin), ghostpad);
|
||||||
gst_object_unref (ghostpad);
|
gst_object_unref (ghostpad);
|
||||||
|
g_value_reset (&item);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (decode_bin, "not one of our ghostpads");
|
GST_DEBUG_OBJECT (decode_bin, "not one of our ghostpads");
|
||||||
|
@ -1368,7 +1373,7 @@ remove_element_chain (GstDecodeBin * decode_bin, GstPad * pad)
|
||||||
}
|
}
|
||||||
gst_object_unref (peer);
|
gst_object_unref (peer);
|
||||||
}
|
}
|
||||||
gst_object_unref (item);
|
g_value_reset (&item);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_ITERATOR_RESYNC:
|
case GST_ITERATOR_RESYNC:
|
||||||
|
@ -1384,7 +1389,7 @@ remove_element_chain (GstDecodeBin * decode_bin, GstPad * pad)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GST_DEBUG_OBJECT (decode_bin, "removing %s", GST_ELEMENT_NAME (elem));
|
GST_DEBUG_OBJECT (decode_bin, "removing %s", GST_ELEMENT_NAME (elem));
|
||||||
|
g_value_unset (&item);
|
||||||
gst_iterator_free (iter);
|
gst_iterator_free (iter);
|
||||||
|
|
||||||
no_iter:
|
no_iter:
|
||||||
|
@ -1860,16 +1865,17 @@ disconnect_unlinked_signals (GstDecodeBin * decode_bin, GstElement * element)
|
||||||
{
|
{
|
||||||
GstIterator *pad_it = NULL;
|
GstIterator *pad_it = NULL;
|
||||||
gboolean done = FALSE;
|
gboolean done = FALSE;
|
||||||
|
GstPad *pad = NULL;
|
||||||
|
GValue item = { 0, };
|
||||||
|
|
||||||
pad_it = gst_element_iterate_src_pads (element);
|
pad_it = gst_element_iterate_src_pads (element);
|
||||||
while (!done) {
|
while (!done) {
|
||||||
GstPad *pad = NULL;
|
switch (gst_iterator_next (pad_it, &item)) {
|
||||||
|
|
||||||
switch (gst_iterator_next (pad_it, (gpointer) & pad)) {
|
|
||||||
case GST_ITERATOR_OK:
|
case GST_ITERATOR_OK:
|
||||||
|
pad = g_value_get_object (&item);
|
||||||
g_signal_handlers_disconnect_by_func (pad, (gpointer) unlinked,
|
g_signal_handlers_disconnect_by_func (pad, (gpointer) unlinked,
|
||||||
decode_bin);
|
decode_bin);
|
||||||
gst_object_unref (pad);
|
g_value_reset (&item);
|
||||||
break;
|
break;
|
||||||
case GST_ITERATOR_RESYNC:
|
case GST_ITERATOR_RESYNC:
|
||||||
gst_iterator_resync (pad_it);
|
gst_iterator_resync (pad_it);
|
||||||
|
@ -1879,6 +1885,7 @@ disconnect_unlinked_signals (GstDecodeBin * decode_bin, GstElement * element)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_value_unset (&item);
|
||||||
gst_iterator_free (pad_it);
|
gst_iterator_free (pad_it);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1889,6 +1896,9 @@ cleanup_decodebin (GstDecodeBin * decode_bin)
|
||||||
GstIterator *elem_it = NULL, *gpad_it = NULL;
|
GstIterator *elem_it = NULL, *gpad_it = NULL;
|
||||||
GstPad *typefind_pad = NULL;
|
GstPad *typefind_pad = NULL;
|
||||||
gboolean done = FALSE;
|
gboolean done = FALSE;
|
||||||
|
GstElement *element = NULL;
|
||||||
|
GstPad *pad = NULL;
|
||||||
|
GValue item = { 0, };
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_DECODE_BIN (decode_bin));
|
g_return_if_fail (GST_IS_DECODE_BIN (decode_bin));
|
||||||
|
|
||||||
|
@ -1902,17 +1912,16 @@ cleanup_decodebin (GstDecodeBin * decode_bin)
|
||||||
|
|
||||||
elem_it = gst_bin_iterate_elements (GST_BIN (decode_bin));
|
elem_it = gst_bin_iterate_elements (GST_BIN (decode_bin));
|
||||||
while (!done) {
|
while (!done) {
|
||||||
GstElement *element = NULL;
|
switch (gst_iterator_next (elem_it, &item)) {
|
||||||
|
|
||||||
switch (gst_iterator_next (elem_it, (gpointer) & element)) {
|
|
||||||
case GST_ITERATOR_OK:
|
case GST_ITERATOR_OK:
|
||||||
|
element = g_value_get_object (&item);
|
||||||
if (element != decode_bin->typefind && element != decode_bin->fakesink) {
|
if (element != decode_bin->typefind && element != decode_bin->fakesink) {
|
||||||
GST_DEBUG_OBJECT (element, "removing autoplugged element");
|
GST_DEBUG_OBJECT (element, "removing autoplugged element");
|
||||||
disconnect_unlinked_signals (decode_bin, element);
|
disconnect_unlinked_signals (decode_bin, element);
|
||||||
gst_element_set_state (element, GST_STATE_NULL);
|
gst_element_set_state (element, GST_STATE_NULL);
|
||||||
gst_bin_remove (GST_BIN (decode_bin), element);
|
gst_bin_remove (GST_BIN (decode_bin), element);
|
||||||
}
|
}
|
||||||
gst_object_unref (element);
|
g_value_reset (&item);
|
||||||
break;
|
break;
|
||||||
case GST_ITERATOR_RESYNC:
|
case GST_ITERATOR_RESYNC:
|
||||||
gst_iterator_resync (elem_it);
|
gst_iterator_resync (elem_it);
|
||||||
|
@ -1925,22 +1934,22 @@ cleanup_decodebin (GstDecodeBin * decode_bin)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_value_unset (&item);
|
||||||
gst_iterator_free (elem_it);
|
gst_iterator_free (elem_it);
|
||||||
|
|
||||||
done = FALSE;
|
done = FALSE;
|
||||||
gpad_it = gst_element_iterate_pads (GST_ELEMENT (decode_bin));
|
gpad_it = gst_element_iterate_pads (GST_ELEMENT (decode_bin));
|
||||||
while (!done) {
|
while (!done) {
|
||||||
GstPad *pad = NULL;
|
switch (gst_iterator_next (gpad_it, &item)) {
|
||||||
|
|
||||||
switch (gst_iterator_next (gpad_it, (gpointer) & pad)) {
|
|
||||||
case GST_ITERATOR_OK:
|
case GST_ITERATOR_OK:
|
||||||
|
pad = g_value_get_object (&item);
|
||||||
GST_DEBUG_OBJECT (pad, "inspecting pad %s:%s",
|
GST_DEBUG_OBJECT (pad, "inspecting pad %s:%s",
|
||||||
GST_DEBUG_PAD_NAME (pad));
|
GST_DEBUG_PAD_NAME (pad));
|
||||||
if (GST_IS_GHOST_PAD (pad) && GST_PAD_IS_SRC (pad)) {
|
if (GST_IS_GHOST_PAD (pad) && GST_PAD_IS_SRC (pad)) {
|
||||||
GST_DEBUG_OBJECT (pad, "removing ghost pad");
|
GST_DEBUG_OBJECT (pad, "removing ghost pad");
|
||||||
gst_element_remove_pad (GST_ELEMENT (decode_bin), pad);
|
gst_element_remove_pad (GST_ELEMENT (decode_bin), pad);
|
||||||
}
|
}
|
||||||
gst_object_unref (pad);
|
g_value_reset (&item);
|
||||||
break;
|
break;
|
||||||
case GST_ITERATOR_RESYNC:
|
case GST_ITERATOR_RESYNC:
|
||||||
gst_iterator_resync (gpad_it);
|
gst_iterator_resync (gpad_it);
|
||||||
|
@ -1953,6 +1962,7 @@ cleanup_decodebin (GstDecodeBin * decode_bin)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_value_unset (&item);
|
||||||
gst_iterator_free (gpad_it);
|
gst_iterator_free (gpad_it);
|
||||||
|
|
||||||
if (GST_IS_PAD (typefind_pad)) {
|
if (GST_IS_PAD (typefind_pad)) {
|
||||||
|
|
|
@ -2740,6 +2740,7 @@ gst_decode_group_control_demuxer_pad (GstDecodeGroup * group, GstPad * pad)
|
||||||
GstDecodeBin *dbin;
|
GstDecodeBin *dbin;
|
||||||
GstPad *srcpad, *sinkpad;
|
GstPad *srcpad, *sinkpad;
|
||||||
GstIterator *it = NULL;
|
GstIterator *it = NULL;
|
||||||
|
GValue item = { 0, };
|
||||||
|
|
||||||
dbin = group->dbin;
|
dbin = group->dbin;
|
||||||
|
|
||||||
|
@ -2762,19 +2763,19 @@ gst_decode_group_control_demuxer_pad (GstDecodeGroup * group, GstPad * pad)
|
||||||
|
|
||||||
it = gst_pad_iterate_internal_links (sinkpad);
|
it = gst_pad_iterate_internal_links (sinkpad);
|
||||||
|
|
||||||
if (!it || (gst_iterator_next (it, (gpointer) & srcpad)) != GST_ITERATOR_OK
|
if (!it || (gst_iterator_next (it, &item)) != GST_ITERATOR_OK
|
||||||
|| srcpad == NULL) {
|
|| ((srcpad = g_value_dup_object (&item)) == NULL)) {
|
||||||
GST_ERROR_OBJECT (dbin,
|
GST_ERROR_OBJECT (dbin,
|
||||||
"Couldn't get srcpad from multiqueue for sinkpad %" GST_PTR_FORMAT,
|
"Couldn't get srcpad from multiqueue for sinkpad %" GST_PTR_FORMAT,
|
||||||
sinkpad);
|
sinkpad);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHAIN_MUTEX_LOCK (group->parent);
|
CHAIN_MUTEX_LOCK (group->parent);
|
||||||
group->reqpads = g_list_prepend (group->reqpads, gst_object_ref (sinkpad));
|
group->reqpads = g_list_prepend (group->reqpads, gst_object_ref (sinkpad));
|
||||||
CHAIN_MUTEX_UNLOCK (group->parent);
|
CHAIN_MUTEX_UNLOCK (group->parent);
|
||||||
|
|
||||||
beach:
|
beach:
|
||||||
|
g_value_unset (&item);
|
||||||
if (it)
|
if (it)
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
gst_object_unref (sinkpad);
|
gst_object_unref (sinkpad);
|
||||||
|
@ -3065,11 +3066,13 @@ _gst_element_get_linked_caps (GstElement * src, GstElement * sink)
|
||||||
GstPad *pad, *peer;
|
GstPad *pad, *peer;
|
||||||
gboolean done = FALSE;
|
gboolean done = FALSE;
|
||||||
GstCaps *caps = NULL;
|
GstCaps *caps = NULL;
|
||||||
|
GValue item = { 0, };
|
||||||
|
|
||||||
it = gst_element_iterate_src_pads (src);
|
it = gst_element_iterate_src_pads (src);
|
||||||
while (!done) {
|
while (!done) {
|
||||||
switch (gst_iterator_next (it, (gpointer) & pad)) {
|
switch (gst_iterator_next (it, &item)) {
|
||||||
case GST_ITERATOR_OK:
|
case GST_ITERATOR_OK:
|
||||||
|
pad = g_value_get_object (&item);
|
||||||
peer = gst_pad_get_peer (pad);
|
peer = gst_pad_get_peer (pad);
|
||||||
if (peer) {
|
if (peer) {
|
||||||
parent = gst_pad_get_parent_element (peer);
|
parent = gst_pad_get_parent_element (peer);
|
||||||
|
@ -3082,7 +3085,7 @@ _gst_element_get_linked_caps (GstElement * src, GstElement * sink)
|
||||||
gst_object_unref (parent);
|
gst_object_unref (parent);
|
||||||
gst_object_unref (peer);
|
gst_object_unref (peer);
|
||||||
}
|
}
|
||||||
gst_object_unref (pad);
|
g_value_reset (&item);
|
||||||
break;
|
break;
|
||||||
case GST_ITERATOR_RESYNC:
|
case GST_ITERATOR_RESYNC:
|
||||||
gst_iterator_resync (it);
|
gst_iterator_resync (it);
|
||||||
|
@ -3093,7 +3096,7 @@ _gst_element_get_linked_caps (GstElement * src, GstElement * sink)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_value_unset (&item);
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
|
@ -3592,13 +3595,13 @@ find_sink_pad (GstElement * element)
|
||||||
{
|
{
|
||||||
GstIterator *it;
|
GstIterator *it;
|
||||||
GstPad *pad = NULL;
|
GstPad *pad = NULL;
|
||||||
gpointer point;
|
GValue item = { 0, };
|
||||||
|
|
||||||
it = gst_element_iterate_sink_pads (element);
|
it = gst_element_iterate_sink_pads (element);
|
||||||
|
|
||||||
if ((gst_iterator_next (it, &point)) == GST_ITERATOR_OK)
|
if ((gst_iterator_next (it, &item)) == GST_ITERATOR_OK)
|
||||||
pad = (GstPad *) point;
|
pad = g_value_dup_object (&item);
|
||||||
|
g_value_unset (&item);
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
|
|
||||||
return pad;
|
return pad;
|
||||||
|
|
|
@ -952,15 +952,14 @@ typedef struct
|
||||||
} FindPropertyHelper;
|
} FindPropertyHelper;
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
find_property (GstElement * element, FindPropertyHelper * helper)
|
find_property (const GValue * item, FindPropertyHelper * helper)
|
||||||
{
|
{
|
||||||
|
GstElement *element = g_value_get_object (item);
|
||||||
if (helper->need_sink && !element_is_sink (element)) {
|
if (helper->need_sink && !element_is_sink (element)) {
|
||||||
gst_object_unref (element);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!element_has_property (element, helper->prop_name, helper->prop_type)) {
|
if (!element_has_property (element, helper->prop_name, helper->prop_type)) {
|
||||||
gst_object_unref (element);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -983,15 +982,18 @@ gst_play_sink_find_property_sinks (GstPlaySink * playsink, GstElement * obj,
|
||||||
if (element_has_property (obj, name, expected_type)) {
|
if (element_has_property (obj, name, expected_type)) {
|
||||||
result = obj;
|
result = obj;
|
||||||
} else if (GST_IS_BIN (obj)) {
|
} else if (GST_IS_BIN (obj)) {
|
||||||
|
gboolean found;
|
||||||
|
GValue item = { 0, };
|
||||||
FindPropertyHelper helper = { name, expected_type, TRUE };
|
FindPropertyHelper helper = { name, expected_type, TRUE };
|
||||||
|
|
||||||
it = gst_bin_iterate_recurse (GST_BIN_CAST (obj));
|
it = gst_bin_iterate_recurse (GST_BIN_CAST (obj));
|
||||||
result = gst_iterator_find_custom (it,
|
found = gst_iterator_find_custom (it,
|
||||||
(GCompareFunc) find_property, &helper);
|
(GCompareFunc) find_property, &item, &helper);
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
|
if (found)
|
||||||
|
result = g_value_get_object (&item);
|
||||||
/* we don't need the extra ref */
|
/* we don't need the extra ref */
|
||||||
if (result)
|
g_value_unset (&item);
|
||||||
gst_object_unref (result);
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1005,12 +1007,17 @@ gst_play_sink_find_property (GstPlaySink * playsink, GstElement * obj,
|
||||||
GstIterator *it;
|
GstIterator *it;
|
||||||
|
|
||||||
if (GST_IS_BIN (obj)) {
|
if (GST_IS_BIN (obj)) {
|
||||||
|
gboolean found;
|
||||||
|
GValue item = { 0, };
|
||||||
FindPropertyHelper helper = { name, expected_type, FALSE };
|
FindPropertyHelper helper = { name, expected_type, FALSE };
|
||||||
|
|
||||||
it = gst_bin_iterate_recurse (GST_BIN_CAST (obj));
|
it = gst_bin_iterate_recurse (GST_BIN_CAST (obj));
|
||||||
result = gst_iterator_find_custom (it,
|
found = gst_iterator_find_custom (it,
|
||||||
(GCompareFunc) find_property, &helper);
|
(GCompareFunc) find_property, &item, &helper);
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
|
if (found)
|
||||||
|
result = g_value_dup_object (&item);
|
||||||
|
g_value_unset (&item);
|
||||||
} else {
|
} else {
|
||||||
if (element_has_property (obj, name, expected_type)) {
|
if (element_has_property (obj, name, expected_type)) {
|
||||||
result = obj;
|
result = obj;
|
||||||
|
@ -2241,6 +2248,7 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
|
||||||
goto no_chain;
|
goto no_chain;
|
||||||
|
|
||||||
if (!playsink->video_sinkpad_stream_synchronizer) {
|
if (!playsink->video_sinkpad_stream_synchronizer) {
|
||||||
|
GValue item = { 0, };
|
||||||
GstIterator *it;
|
GstIterator *it;
|
||||||
|
|
||||||
playsink->video_sinkpad_stream_synchronizer =
|
playsink->video_sinkpad_stream_synchronizer =
|
||||||
|
@ -2249,8 +2257,9 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
|
||||||
it = gst_pad_iterate_internal_links
|
it = gst_pad_iterate_internal_links
|
||||||
(playsink->video_sinkpad_stream_synchronizer);
|
(playsink->video_sinkpad_stream_synchronizer);
|
||||||
g_assert (it);
|
g_assert (it);
|
||||||
gst_iterator_next (it,
|
gst_iterator_next (it, &item);
|
||||||
(gpointer *) & playsink->video_srcpad_stream_synchronizer);
|
playsink->video_srcpad_stream_synchronizer = g_value_dup_object (&item);
|
||||||
|
g_value_unset (&item);
|
||||||
g_assert (playsink->video_srcpad_stream_synchronizer);
|
g_assert (playsink->video_srcpad_stream_synchronizer);
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
}
|
}
|
||||||
|
@ -2397,6 +2406,7 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!playsink->audio_sinkpad_stream_synchronizer) {
|
if (!playsink->audio_sinkpad_stream_synchronizer) {
|
||||||
|
GValue item = { 0, };
|
||||||
GstIterator *it;
|
GstIterator *it;
|
||||||
|
|
||||||
playsink->audio_sinkpad_stream_synchronizer =
|
playsink->audio_sinkpad_stream_synchronizer =
|
||||||
|
@ -2405,8 +2415,9 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
|
||||||
it = gst_pad_iterate_internal_links
|
it = gst_pad_iterate_internal_links
|
||||||
(playsink->audio_sinkpad_stream_synchronizer);
|
(playsink->audio_sinkpad_stream_synchronizer);
|
||||||
g_assert (it);
|
g_assert (it);
|
||||||
gst_iterator_next (it,
|
gst_iterator_next (it, &item);
|
||||||
(gpointer *) & playsink->audio_srcpad_stream_synchronizer);
|
playsink->audio_srcpad_stream_synchronizer = g_value_dup_object (&item);
|
||||||
|
g_value_unset (&item);
|
||||||
g_assert (playsink->audio_srcpad_stream_synchronizer);
|
g_assert (playsink->audio_srcpad_stream_synchronizer);
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
}
|
}
|
||||||
|
@ -2516,14 +2527,17 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
|
||||||
add_chain (GST_PLAY_CHAIN (playsink->textchain), TRUE);
|
add_chain (GST_PLAY_CHAIN (playsink->textchain), TRUE);
|
||||||
|
|
||||||
if (!playsink->text_sinkpad_stream_synchronizer) {
|
if (!playsink->text_sinkpad_stream_synchronizer) {
|
||||||
|
GValue item = { 0, };
|
||||||
|
|
||||||
playsink->text_sinkpad_stream_synchronizer =
|
playsink->text_sinkpad_stream_synchronizer =
|
||||||
gst_element_get_request_pad (GST_ELEMENT_CAST
|
gst_element_get_request_pad (GST_ELEMENT_CAST
|
||||||
(playsink->stream_synchronizer), "sink_%d");
|
(playsink->stream_synchronizer), "sink_%d");
|
||||||
it = gst_pad_iterate_internal_links
|
it = gst_pad_iterate_internal_links
|
||||||
(playsink->text_sinkpad_stream_synchronizer);
|
(playsink->text_sinkpad_stream_synchronizer);
|
||||||
g_assert (it);
|
g_assert (it);
|
||||||
gst_iterator_next (it,
|
gst_iterator_next (it, &item);
|
||||||
(gpointer *) & playsink->text_srcpad_stream_synchronizer);
|
playsink->text_srcpad_stream_synchronizer = g_value_dup_object (&item);
|
||||||
|
g_value_unset (&item);
|
||||||
g_assert (playsink->text_srcpad_stream_synchronizer);
|
g_assert (playsink->text_srcpad_stream_synchronizer);
|
||||||
gst_iterator_free (it);
|
gst_iterator_free (it);
|
||||||
|
|
||||||
|
|
|
@ -633,13 +633,15 @@ static GstIterator *
|
||||||
gst_stream_selector_pad_iterate_linked_pads (GstPad * pad)
|
gst_stream_selector_pad_iterate_linked_pads (GstPad * pad)
|
||||||
{
|
{
|
||||||
GstStreamSelector *sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
|
GstStreamSelector *sel = GST_STREAM_SELECTOR (gst_pad_get_parent (pad));
|
||||||
|
GValue value = { 0, };
|
||||||
GstPad *otherpad;
|
GstPad *otherpad;
|
||||||
GstIterator *ret;
|
GstIterator *ret;
|
||||||
|
|
||||||
otherpad = gst_stream_selector_get_linked_pad (pad, TRUE);
|
otherpad = gst_stream_selector_get_linked_pad (pad, TRUE);
|
||||||
ret =
|
g_value_init (&value, GST_TYPE_PAD);
|
||||||
gst_iterator_new_single (GST_TYPE_PAD, otherpad,
|
g_value_set_object (&value, otherpad);
|
||||||
(GstCopyFunction) gst_object_ref, (GFreeFunc) gst_object_unref);
|
ret = gst_iterator_new_single (GST_TYPE_PAD, &value);
|
||||||
|
g_value_unset (&value);
|
||||||
|
|
||||||
if (otherpad)
|
if (otherpad)
|
||||||
gst_object_unref (otherpad);
|
gst_object_unref (otherpad);
|
||||||
|
|
|
@ -121,8 +121,12 @@ gst_stream_synchronizer_iterate_internal_links (GstPad * pad)
|
||||||
|
|
||||||
opad = gst_stream_get_other_pad_from_pad (pad);
|
opad = gst_stream_get_other_pad_from_pad (pad);
|
||||||
if (opad) {
|
if (opad) {
|
||||||
it = gst_iterator_new_single (GST_TYPE_PAD, opad,
|
GValue value = { 0, };
|
||||||
(GstCopyFunction) gst_object_ref, (GFreeFunc) gst_object_unref);
|
|
||||||
|
g_value_init (&value, GST_TYPE_PAD);
|
||||||
|
g_value_set_object (&value, opad);
|
||||||
|
it = gst_iterator_new_single (GST_TYPE_PAD, &value);
|
||||||
|
g_value_unset (&value);
|
||||||
gst_object_unref (opad);
|
gst_object_unref (opad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue