909
909
* push or pull mode, just return. Otherwise dispatches to the pad's activate
910
910
* function to perform the actual activation.
912
* If not @active, checks the pad's current mode and calls
913
* gst_pad_activate_push() or gst_pad_activate_pull(), as appropriate, with a
912
* If not @active, calls gst_pad_activate_mode() with the pad's current mode
913
* and a FALSE argument.
916
915
* Returns: #TRUE if the operation was successful.
1449
1448
* @notify: notify called when @activate will not be used anymore.
1451
1450
* Sets the given activate function for @pad. The activate function will
1452
* dispatch to gst_pad_activate_push() or gst_pad_activate_pull() to perform
1453
* the actual activation. Only makes sense to set on sink pads.
1451
* dispatch to gst_pad_activate_mode() to perform the actual activation.
1452
* Only makes sense to set on sink pads.
1455
1454
* Call this function if your sink pad can start a pull-based task.
3292
3291
GST_DEBUG_OBJECT (pad, "event %s marked received",
3293
3292
GST_EVENT_TYPE_NAME (event));
3294
case GST_FLOW_CUSTOM_SUCCESS:
3295
/* we can't assume the event is received when it was dropped */
3296
GST_DEBUG_OBJECT (pad, "event %s was dropped, mark pending",
3297
GST_EVENT_TYPE_NAME (event));
3298
GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PENDING_EVENTS);
3299
data->ret = GST_FLOW_OK;
3295
3301
case GST_FLOW_NOT_LINKED:
3296
3302
/* not linked is not a problem, we are sticky so the event will be
3297
3303
* sent later but only for non-EOS events */
3298
GST_DEBUG_OBJECT (pad, "pad was not linked");
3304
GST_DEBUG_OBJECT (pad, "pad was not linked, mark pending");
3299
3305
if (GST_EVENT_TYPE (event) != GST_EVENT_EOS)
3300
3306
data->ret = GST_FLOW_OK;
3307
GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PENDING_EVENTS);
3303
GST_DEBUG_OBJECT (pad, "mark pending events");
3310
GST_DEBUG_OBJECT (pad, "result %s, mark pending events",
3311
gst_flow_get_name (data->ret));
3304
3312
GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PENDING_EVENTS);
3337
3345
if (ev && !ev->received) {
3338
3346
data.ret = gst_pad_push_event_unchecked (pad, gst_event_ref (ev->event),
3339
3347
GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM);
3348
/* the event could have been dropped. Because this can only
3349
* happen if the user asked for it, it's not an error */
3350
if (data.ret == GST_FLOW_CUSTOM_SUCCESS)
3351
data.ret = GST_FLOW_OK;
4376
/* must be called with pad object lock */
4364
4377
static gboolean
4365
gst_pad_store_sticky_event (GstPad * pad, GstEvent * event, gboolean locked)
4378
gst_pad_store_sticky_event (GstPad * pad, GstEvent * event)
4368
4381
GstEventType type;
4534
4545
case GST_FLOW_CUSTOM_SUCCESS:
4535
4546
GST_DEBUG_OBJECT (pad, "dropped event");
4539
4549
GST_DEBUG_OBJECT (pad, "an error occured %s", gst_flow_get_name (ret));
4610
4620
if (G_UNLIKELY (GST_PAD_IS_EOS (pad)))
4613
/* srcpad sticky events are store immediately, the received flag is set
4623
/* srcpad sticky events are stored immediately, the received flag is set
4614
4624
* to FALSE and will be set to TRUE when we can successfully push the
4615
4625
* event to the peer pad */
4616
if (gst_pad_store_sticky_event (pad, event, TRUE)) {
4626
if (gst_pad_store_sticky_event (pad, event)) {
4617
4627
GST_DEBUG_OBJECT (pad, "event %s updated", GST_EVENT_TYPE_NAME (event));
4619
4629
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS)
4625
4635
res = (check_sticky (pad) == GST_FLOW_OK);
4628
4640
/* other events are pushed right away */
4629
res = (gst_pad_push_event_unchecked (pad, event, type) == GST_FLOW_OK);
4641
ret = gst_pad_push_event_unchecked (pad, event, type);
4642
/* dropped events by a probe are not an error */
4643
res = (ret == GST_FLOW_OK || ret == GST_FLOW_CUSTOM_SUCCESS);
4631
4645
/* Errors in sticky event pushing are no problem and ignored here
4632
4646
* as they will cause more meaningful errors during data flow.
4825
4839
if (ret == GST_FLOW_OK) {
4840
GST_OBJECT_LOCK (pad);
4841
/* can't store on flushing pads */
4842
if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))
4845
if (G_UNLIKELY (GST_PAD_IS_EOS (pad)))
4826
4848
/* after the event function accepted the event, we can store the sticky
4827
4849
* event on the pad */
4828
gst_pad_store_sticky_event (pad, event, FALSE);
4850
if (gst_pad_store_sticky_event (pad, event)) {
4851
GST_DEBUG_OBJECT (pad, "event %s updated", GST_EVENT_TYPE_NAME (event));
4829
4853
if (event_type == GST_EVENT_EOS)
4830
4854
GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_EOS);
4856
GST_OBJECT_UNLOCK (pad);
4832
4858
gst_event_unref (event);