mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
pad: Keep track of reconfigure events and the pad-needs-reconfiguring status
This commit is contained in:
parent
25916cff66
commit
5a7ec99214
2 changed files with 25 additions and 18 deletions
25
gst/gstpad.c
25
gst/gstpad.c
|
@ -705,6 +705,12 @@ gst_pad_set_active (GstPad * pad, gboolean active)
|
|||
GST_WARNING_OBJECT (pad, "Failed to activate pad");
|
||||
}
|
||||
GST_OBJECT_UNLOCK (pad);
|
||||
} else {
|
||||
if (!active) {
|
||||
GST_OBJECT_LOCK (pad);
|
||||
GST_OBJECT_FLAG_UNSET (pad, GST_PAD_NEED_RECONFIGURE);
|
||||
GST_OBJECT_UNLOCK (pad);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -2063,7 +2069,7 @@ gst_pad_link_full (GstPad * srcpad, GstPad * sinkpad, GstPadLinkCheck flags)
|
|||
GST_CAT_INFO (GST_CAT_PADS, "linked %s:%s and %s:%s, successful",
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
|
||||
|
||||
gst_pad_send_event (srcpad, gst_event_new_renegotiate ());
|
||||
gst_pad_send_event (srcpad, gst_event_new_reconfigure ());
|
||||
} else {
|
||||
GST_CAT_INFO (GST_CAT_PADS, "link between %s:%s and %s:%s failed",
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
|
||||
|
@ -4541,9 +4547,9 @@ gst_pad_push_event (GstPad * pad, GstEvent * event)
|
|||
goto flushed;
|
||||
}
|
||||
break;
|
||||
case GST_EVENT_RENEGOTIATE:
|
||||
if (GST_PAD_IS_SINK (pad) && GST_PAD_GETCAPSFUNC (pad) == NULL)
|
||||
goto drop_renegotiate;
|
||||
case GST_EVENT_RECONFIGURE:
|
||||
if (GST_PAD_IS_SINK (pad))
|
||||
GST_OBJECT_FLAG_SET (pad, GST_PAD_NEED_RECONFIGURE);
|
||||
default:
|
||||
while (G_UNLIKELY (GST_PAD_IS_BLOCKED (pad))) {
|
||||
/* block the event as long as the pad is blocked */
|
||||
|
@ -4700,6 +4706,9 @@ gst_pad_send_event (GstPad * pad, GstEvent * event)
|
|||
need_unlock = TRUE;
|
||||
GST_OBJECT_LOCK (pad);
|
||||
break;
|
||||
case GST_EVENT_RECONFIGURE:
|
||||
if (GST_PAD_IS_SRC (pad))
|
||||
GST_OBJECT_FLAG_SET (pad, GST_PAD_NEED_RECONFIGURE);
|
||||
default:
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_EVENT, pad, "have event type %s",
|
||||
GST_EVENT_TYPE_NAME (event));
|
||||
|
@ -4925,14 +4934,6 @@ concurrent_stop:
|
|||
GST_OBJECT_UNLOCK (pad);
|
||||
return TRUE;
|
||||
}
|
||||
drop_renegotiate:
|
||||
{
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_EVENT, pad,
|
||||
"No getcaps function on sink pad, dropping renegotiate event");
|
||||
gst_event_unref (event);
|
||||
GST_OBJECT_UNLOCK (pad);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
18
gst/gstpad.h
18
gst/gstpad.h
|
@ -510,18 +510,23 @@ typedef enum {
|
|||
* @GST_PAD_IN_GETCAPS: GstPadGetCapsFunction() is running now
|
||||
* @GST_PAD_IN_SETCAPS: GstPadSetCapsFunction() is running now
|
||||
* @GST_PAD_BLOCKING: is pad currently blocking on a buffer or event
|
||||
* @GST_PAD_NEED_RECONFIGURE: the pad should be reconfigured/renegotiated.
|
||||
* The flag has to be unset manually after
|
||||
* reconfiguration happened.
|
||||
* Since: 0.10.34.
|
||||
* @GST_PAD_FLAG_LAST: offset to define more flags
|
||||
*
|
||||
* Pad state flags
|
||||
*/
|
||||
typedef enum {
|
||||
GST_PAD_BLOCKED = (GST_OBJECT_FLAG_LAST << 0),
|
||||
GST_PAD_FLUSHING = (GST_OBJECT_FLAG_LAST << 1),
|
||||
GST_PAD_IN_GETCAPS = (GST_OBJECT_FLAG_LAST << 2),
|
||||
GST_PAD_IN_SETCAPS = (GST_OBJECT_FLAG_LAST << 3),
|
||||
GST_PAD_BLOCKING = (GST_OBJECT_FLAG_LAST << 4),
|
||||
GST_PAD_BLOCKED = (GST_OBJECT_FLAG_LAST << 0),
|
||||
GST_PAD_FLUSHING = (GST_OBJECT_FLAG_LAST << 1),
|
||||
GST_PAD_IN_GETCAPS = (GST_OBJECT_FLAG_LAST << 2),
|
||||
GST_PAD_IN_SETCAPS = (GST_OBJECT_FLAG_LAST << 3),
|
||||
GST_PAD_BLOCKING = (GST_OBJECT_FLAG_LAST << 4),
|
||||
GST_PAD_NEED_RECONFIGURE = (GST_OBJECT_FLAG_LAST << 5),
|
||||
/* padding */
|
||||
GST_PAD_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 16)
|
||||
GST_PAD_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 16)
|
||||
} GstPadFlags;
|
||||
|
||||
/* FIXME: this awful circular dependency need to be resolved properly (see padtemplate.h) */
|
||||
|
@ -699,6 +704,7 @@ struct _GstPadClass {
|
|||
#define GST_PAD_IS_FLUSHING(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_FLUSHING))
|
||||
#define GST_PAD_IS_IN_GETCAPS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_IN_GETCAPS))
|
||||
#define GST_PAD_IS_IN_SETCAPS(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_IN_SETCAPS))
|
||||
#define GST_PAD_NEEDS_RECONFIGURE(pad) (GST_OBJECT_FLAG_IS_SET (pad, GST_PAD_NEED_RECONFIGURE))
|
||||
#define GST_PAD_IS_SRC(pad) (GST_PAD_DIRECTION(pad) == GST_PAD_SRC)
|
||||
#define GST_PAD_IS_SINK(pad) (GST_PAD_DIRECTION(pad) == GST_PAD_SINK)
|
||||
|
||||
|
|
Loading…
Reference in a new issue