Example #1
0
static void
kms_agnostic_bin2_src_unlinked (GstPad * pad, GstPad * peer,
    KmsAgnosticBin2 * self)
{
  GST_DEBUG_OBJECT (pad, "Unlinked");
  remove_target_pad (pad);
}
Example #2
0
static void
add_linked_pads (GstPad * pad, KmsAgnosticBin2 * self)
{
  if (!gst_pad_is_linked (pad)) {
    return;
  }

  remove_target_pad (pad);
  kms_agnostic_bin2_process_pad (self, pad);
}
Example #3
0
static void
kms_agnostic_bin2_src_unlinked (GstPad * pad, GstPad * peer,
    KmsAgnosticBin2 * self)
{
  GST_DEBUG_OBJECT (pad, "Unlinked");
  KMS_AGNOSTIC_BIN2_LOCK (self);
  GST_OBJECT_FLAG_UNSET (pad, KMS_AGNOSTIC_PAD_STARTED);
  remove_target_pad (pad);
  KMS_AGNOSTIC_BIN2_UNLOCK (self);
}
Example #4
0
/**
 * Process a pad for connecting or disconnecting, it should be always called
 * whint the agnostic lock hold.
 *
 * @self: The #KmsAgnosticBin2 owner of the pad
 * @pad: The pad to be processed
 */
static gboolean
kms_agnostic_bin2_process_pad (KmsAgnosticBin2 * self, GstPad * pad)
{
  GstPad *peer = NULL;

  if (!GST_OBJECT_FLAG_IS_SET (pad, KMS_AGNOSTIC_PAD_STARTED)) {
    return FALSE;
  }

  if (!self->priv->started) {
    return FALSE;
  }

  GST_DEBUG_OBJECT (self, "Processing pad: %" GST_PTR_FORMAT, pad);

  if (pad == NULL) {
    return FALSE;
  }

  peer = gst_pad_get_peer (pad);

  if (peer != NULL) {
    GstPad *target = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));

    if (target) {
      GstCaps *caps = gst_pad_get_current_caps (pad);

      if (caps != NULL) {
        gboolean accepted;

        accepted = gst_pad_query_accept_caps (peer, caps);
        gst_caps_unref (caps);

        if (accepted) {
          GST_DEBUG_OBJECT (self, "No need to reconfigure pad %" GST_PTR_FORMAT,
              pad);
          g_object_unref (target);
          g_object_unref (peer);
          return FALSE;
        }

        remove_target_pad (pad);
      }

      g_object_unref (target);
    }

    kms_agnostic_bin2_link_pad (self, pad, peer);
  }

  return TRUE;
}
Example #5
0
static gboolean
proxy_src_pad_query_function (GstPad * pad, GstObject * parent,
    GstQuery * query)
{
  gboolean ret = gst_pad_query_default (pad, parent, query);

  if (!ret) {
    return ret;
  }

  if (GST_QUERY_TYPE (query) == GST_QUERY_ACCEPT_CAPS) {
    gboolean accepted;

    gst_query_parse_accept_caps_result (query, &accepted);

    if (!accepted) {
      GstProxyPad *gp = gst_proxy_pad_get_internal (GST_PROXY_PAD (pad));
      KmsAgnosticBin2 *self = NULL;

      GST_ERROR_OBJECT (pad, "Caps not accepted: %" GST_PTR_FORMAT, query);

      if (gp) {
        self = KMS_AGNOSTIC_BIN2 (GST_OBJECT_PARENT (gp));
      }

      if (self) {
        KMS_AGNOSTIC_BIN2_LOCK (self);
        remove_target_pad (GST_PAD_CAST (gp));
        kms_agnostic_bin2_process_pad (self, GST_PAD_CAST (gp));
        KMS_AGNOSTIC_BIN2_UNLOCK (self);
      }

      g_object_unref (gp);
    }
  }

  return ret;
}