~ubuntu-branches/ubuntu/trusty/gstreamer1.0/trusty-proposed

« back to all changes in this revision

Viewing changes to gst/gstpad.c

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2012-10-08 09:59:20 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20121008095920-3k2vlenl0zf6lu7i
Tags: 1.0.1-1
* New upstream stable release:
  + debian/libgstreamer.symbols:
    - Add new symbols.

Show diffs side-by-side

added added

removed removed

Lines of Context:
909
909
 * push or pull mode, just return. Otherwise dispatches to the pad's activate
910
910
 * function to perform the actual activation.
911
911
 *
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
914
 
 * FALSE argument.
 
912
 * If not @active, calls gst_pad_activate_mode() with the pad's current mode
 
913
 * and a FALSE argument.
915
914
 *
916
915
 * Returns: #TRUE if the operation was successful.
917
916
 *
1449
1448
 * @notify: notify called when @activate will not be used anymore.
1450
1449
 *
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.
1454
1453
 *
1455
1454
 * Call this function if your sink pad can start a pull-based task.
1456
1455
 */
3292
3291
      GST_DEBUG_OBJECT (pad, "event %s marked received",
3293
3292
          GST_EVENT_TYPE_NAME (event));
3294
3293
      break;
 
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;
 
3300
      break;
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;
3301
 
      /* fallthrough */
 
3307
      GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_PENDING_EVENTS);
 
3308
      break;
3302
3309
    default:
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);
3305
3313
      break;
3306
3314
  }
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;
3340
3352
      }
3341
3353
    }
3342
3354
  }
4361
4373
  }
4362
4374
}
4363
4375
 
 
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)
4366
4379
{
4367
4380
  guint i, len;
4368
4381
  GstEventType type;
4410
4423
 
4411
4424
    switch (GST_EVENT_TYPE (event)) {
4412
4425
      case GST_EVENT_CAPS:
4413
 
        if (locked)
4414
 
          GST_OBJECT_UNLOCK (pad);
 
4426
        GST_OBJECT_UNLOCK (pad);
4415
4427
 
4416
4428
        GST_DEBUG_OBJECT (pad, "notify caps");
4417
4429
        g_object_notify_by_pspec ((GObject *) pad, pspec_caps);
4418
4430
 
4419
 
        if (locked)
4420
 
          GST_OBJECT_LOCK (pad);
 
4431
        GST_OBJECT_LOCK (pad);
4421
4432
        break;
4422
4433
      default:
4423
4434
        break;
4533
4544
    switch (ret) {
4534
4545
      case GST_FLOW_CUSTOM_SUCCESS:
4535
4546
        GST_DEBUG_OBJECT (pad, "dropped event");
4536
 
        ret = GST_FLOW_OK;
4537
4547
        break;
4538
4548
      default:
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)))
4611
4621
      goto eos;
4612
4622
 
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));
4618
4628
    }
4619
4629
    if (GST_EVENT_TYPE (event) == GST_EVENT_EOS)
4625
4635
    res = (check_sticky (pad) == GST_FLOW_OK);
4626
4636
  }
4627
4637
  if (!sticky) {
 
4638
    GstFlowReturn ret;
 
4639
 
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);
4630
4644
  } else {
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.
4823
4837
 
4824
4838
  if (sticky) {
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)))
 
4843
        goto flushing;
 
4844
 
 
4845
      if (G_UNLIKELY (GST_PAD_IS_EOS (pad)))
 
4846
        goto eos;
 
4847
 
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));
 
4852
      }
4829
4853
      if (event_type == GST_EVENT_EOS)
4830
4854
        GST_OBJECT_FLAG_SET (pad, GST_PAD_FLAG_EOS);
 
4855
 
 
4856
      GST_OBJECT_UNLOCK (pad);
4831
4857
    }
4832
4858
    gst_event_unref (event);
4833
4859
  }