static gboolean src_activate_mode(GstPad *pad, GstObject *parent, GstPadMode mode, gboolean active)
{
    GstErDtlsEnc *self = GST_ER_DTLS_ENC (parent);
    gboolean success = TRUE;
    g_return_val_if_fail(mode == GST_PAD_MODE_PUSH, FALSE);

    if (active) {
        GST_DEBUG_OBJECT(self, "src pad activating in push mode");

        self->send_initial_events = TRUE;
        success = gst_pad_start_task(pad, (GstTaskFunction) src_task_loop, self->src, NULL);
        if (!success) {
            GST_WARNING_OBJECT(self, "failed to activate pad task");
        }
    } else {
        GST_DEBUG_OBJECT(self, "deactivating src pad");

        g_mutex_lock(&self->queue_lock);
        GST_PAD_MODE(pad) = GST_PAD_MODE_NONE;
        g_cond_signal(&self->queue_cond_add);
        g_mutex_unlock(&self->queue_lock);
        success = gst_pad_stop_task(pad);
        if (!success) {
            GST_WARNING_OBJECT(self, "failed to deactivate pad task");
        }
    }

    return success;
}
示例#2
0
static gboolean progress_buffer_src_event(GstPad *pad, GstObject *parent, GstEvent *event)
{
    ProgressBuffer *element = PROGRESS_BUFFER(parent);
    if (GST_PAD_MODE(pad) == GST_PAD_MODE_PUSH)
    {
        switch (GST_EVENT_TYPE (event))
        {
            case GST_EVENT_SEEK:
                return progress_buffer_perform_push_seek(element, pad, event);
            default:
                break;
        }
    }
    else if (GST_PAD_MODE(pad) == GST_PAD_MODE_PULL) // Isolate the source element from all upcoming events
    {
// INLINE - gst_event_unref()
        gst_event_unref(event);
        return TRUE;
    }

    return gst_pad_event_default(pad, parent, event);
}
static void
gst_type_find_element_have_type (GstTypeFindElement * typefind,
    guint probability, GstCaps * caps)
{
  GstEvent *event;

  g_assert (caps != NULL);

  GST_INFO_OBJECT (typefind, "found caps %" GST_PTR_FORMAT ", probability=%u",
      caps, probability);

  /* Do nothing if downstream is pulling from us */
  if (GST_PAD_MODE (typefind->src) == GST_PAD_MODE_PULL)
    return;

  GST_OBJECT_LOCK (typefind);

  /* Now actually send the CAPS event downstream.
   *
   * Try to directly send the CAPS event downstream that we created in
   * gst_type_find_element_emit_have_type() if it is still there, instead
   * of creating a new one. No need to create an equivalent one, replacing
   * it in the sticky event list and possibly causing renegotiation
   */
  event = gst_pad_get_sticky_event (typefind->src, GST_EVENT_CAPS, 0);
  if (event) {
    GstCaps *event_caps;

    gst_event_parse_caps (event, &event_caps);
    if (caps != event_caps) {
      gst_event_unref (event);
      event = gst_event_new_caps (caps);
    }
  } else {
    event = gst_event_new_caps (caps);
  }

  GST_OBJECT_UNLOCK (typefind);

  gst_pad_push_event (typefind->src, event);
}