Esempio n. 1
0
static gboolean
gst_wildmidi_activate (GstPad * sinkpad)
{
  if (gst_pad_check_pull_range (sinkpad))
    return gst_pad_activate_pull (sinkpad, TRUE);

  return gst_pad_activate_push (sinkpad, TRUE);
}
static gboolean
gst_tta_parse_activate (GstPad * pad)
{
  if (gst_pad_check_pull_range (pad)) {
    return gst_pad_activate_pull (pad, TRUE);
  }
  return FALSE;
}
Esempio n. 3
0
static gboolean
gst_musepackdec_sink_activate (GstPad * sinkpad)
{
    if (!gst_pad_check_pull_range (sinkpad))
        return FALSE;

    return gst_pad_activate_pull (sinkpad, TRUE);
}
Esempio n. 4
0
static gboolean
gst_timidity_activate (GstPad * sinkpad)
{
  if (gst_pad_check_pull_range (sinkpad))
    return gst_pad_activate_pull (sinkpad, TRUE);

  return FALSE;
}
Esempio n. 5
0
/* this function is called when the pad is activated and should start
 * processing data.
 *
 * We check if we can do random access to decide if we work push or
 * pull based.
 */
static gboolean
gst_pngdec_sink_activate (GstPad * sinkpad)
{
  if (gst_pad_check_pull_range (sinkpad)) {
    return gst_pad_activate_pull (sinkpad, TRUE);
  } else {
    return gst_pad_activate_push (sinkpad, TRUE);
  }
}
static gboolean
gst_type_find_element_checkgetrange (GstPad * srcpad)
{
  GstTypeFindElement *typefind;

  typefind = GST_TYPE_FIND_ELEMENT (GST_PAD_PARENT (srcpad));

  return gst_pad_check_pull_range (typefind->sink);
}
Esempio n. 7
0
static gboolean
gst_rnd_buffer_size_activate (GstPad * pad)
{
  if (gst_pad_check_pull_range (pad)) {
    return gst_pad_activate_pull (pad, TRUE);
  } else {
    GST_INFO_OBJECT (pad, "push mode not supported");
    return FALSE;
  }
}
Esempio n. 8
0
static gboolean
gst_proxy_pad_do_checkgetrange (GstPad * pad)
{
  gboolean result;
  GstPad *internal = GST_PROXY_PAD_INTERNAL (pad);

  result = gst_pad_check_pull_range (internal);

  return result;
}
Esempio n. 9
0
static gboolean
gst_raw_parse_sink_activate (GstPad * sinkpad)
{
  if (gst_pad_check_pull_range (sinkpad)) {
    GST_RAW_PARSE (GST_PAD_PARENT (sinkpad))->mode = GST_ACTIVATE_PULL;
    return gst_pad_activate_pull (sinkpad, TRUE);
  } else {
    GST_RAW_PARSE (GST_PAD_PARENT (sinkpad))->mode = GST_ACTIVATE_PUSH;
    return gst_pad_activate_push (sinkpad, TRUE);
  }
}
Esempio n. 10
0
static gboolean
gst_freeze_sink_activate (GstPad * sinkpad)
{
  GstFreeze *freeze;

  freeze = GST_FREEZE (GST_PAD_PARENT (sinkpad));

  if (gst_pad_check_pull_range (sinkpad)) {
    return gst_pad_activate_pull (sinkpad, TRUE);
  } else {
    return gst_pad_activate_push (sinkpad, TRUE);
  }
}
Esempio n. 11
0
static gboolean progress_buffer_checkgetrange(GstPad *pad)
{
    ProgressBuffer *element = PROGRESS_BUFFER(GST_PAD_PARENT(pad));
#if ENABLE_PULL_MODE
    gboolean    result = FALSE;
    GstStructure *s = gst_structure_new(GETRANGE_QUERY_NAME, NULL, NULL);
    GstQuery *query = gst_query_new_custom(GST_QUERY_CUSTOM, s);
    if (gst_pad_peer_query(pad, query))
        result = gst_structure_get_boolean(s, GETRANGE_QUERY_SUPPORTS_FIELDNANE, &result) && result;
// INLINE - gst_query_unref()
    gst_query_unref(query);
    return result;
#else
    return gst_pad_check_pull_range(element->sinkpad);
#endif
}
Esempio n. 12
0
static gboolean
gst_cdxa_parse_sink_activate (GstPad * sinkpad)
{
  GstCDXAParse *cdxa = GST_CDXA_PARSE (GST_PAD_PARENT (sinkpad));

  if (!gst_pad_check_pull_range (sinkpad) ||
      !gst_pad_activate_pull (sinkpad, TRUE)) {
    GST_DEBUG_OBJECT (cdxa, "No pull mode");
    return FALSE;
  }

  /* If we can activate pull_range upstream, then read the header
   * and see if it's really a RIFF CDXA file. */
  GST_DEBUG_OBJECT (cdxa, "Activated pull mode. Reading RIFF header");
  if (!gst_cdxa_parse_stream_init (cdxa))
    return FALSE;

  return TRUE;
}
static gboolean
gst_decklink_src_audio_src_activate (GstPad * pad)
{
    GstDecklinkSrc *decklinksrc;
    gboolean ret;

    decklinksrc = GST_DECKLINK_SRC (gst_pad_get_parent (pad));

    GST_DEBUG_OBJECT (decklinksrc, "activate");

    if (gst_pad_check_pull_range (pad)) {
        GST_DEBUG_OBJECT (pad, "activating pull");
        ret = gst_pad_activate_pull (pad, TRUE);
    } else {
        GST_DEBUG_OBJECT (pad, "activating push");
        ret = gst_pad_activate_push (pad, TRUE);
    }

    gst_object_unref (decklinksrc);
    return ret;
}
Esempio n. 14
0
static gboolean
gst_decklink_sink_videosink_activate (GstPad * pad)
{
  GstDecklinkSink *decklinksink;
  gboolean ret;

  decklinksink = GST_DECKLINK_SINK (gst_pad_get_parent (pad));

  GST_DEBUG_OBJECT (decklinksink, "activate");

  if (gst_pad_check_pull_range (pad)) {
    GST_DEBUG_OBJECT (pad, "activating pull");
    ret = gst_pad_activate_pull (pad, TRUE);
  } else {
    GST_DEBUG_OBJECT (pad, "activating push");
    ret = gst_pad_activate_push (pad, TRUE);
  }

  gst_object_unref (decklinksink);
  return ret;
}
Esempio n. 15
0
static gboolean
gst_aiff_parse_sink_activate (GstPad * sinkpad)
{
  GstAiffParse *aiff = GST_AIFF_PARSE (gst_pad_get_parent (sinkpad));
  gboolean res;

  if (aiff->adapter)
    g_object_unref (aiff->adapter);

  if (gst_pad_check_pull_range (sinkpad)) {
    GST_DEBUG ("going to pull mode");
    aiff->streaming = FALSE;
    aiff->adapter = NULL;
    res = gst_pad_activate_pull (sinkpad, TRUE);
  } else {
    GST_DEBUG ("going to push (streaming) mode");
    aiff->streaming = TRUE;
    aiff->adapter = gst_adapter_new ();
    res = gst_pad_activate_push (sinkpad, TRUE);
  }
  gst_object_unref (aiff);
  return res;
}
Esempio n. 16
0
static gboolean
gst_nuv_demux_sink_activate (GstPad * sinkpad)
{
  gboolean res = TRUE;
  GstNuvDemux *nuv = GST_NUV_DEMUX (gst_pad_get_parent (sinkpad));

  if (gst_pad_check_pull_range (sinkpad)) {
    nuv->mode = 0;
    if (nuv->adapter != NULL) {
      gst_object_unref (nuv->adapter);
      nuv->adapter = NULL;
    }
    res = gst_pad_activate_pull (sinkpad, TRUE);
  } else {
    nuv->mode = 1;
    if (!nuv->adapter) {
      nuv->adapter = gst_adapter_new ();
    }
    res = gst_pad_activate_push (sinkpad, TRUE);
  }

  g_object_unref (nuv);
  return res;
}
static gboolean
gst_type_find_element_activate (GstPad * pad)
{
  GstTypeFindProbability probability = 0;
  GstCaps *found_caps = NULL;
  GstTypeFindElement *typefind;

  typefind = GST_TYPE_FIND_ELEMENT (GST_OBJECT_PARENT (pad));

  /* if we have force caps, use those */
  if (typefind->force_caps) {
    found_caps = gst_caps_ref (typefind->force_caps);
    probability = GST_TYPE_FIND_MAXIMUM;
    goto done;
  }

  /* 1. try to activate in pull mode. if not, switch to push and succeed.
     2. try to pull type find.
     3. deactivate pull mode.
     4. src pad might have been activated push by the state change. deactivate.
     5. if we didn't find any caps, try getting the uri extension by doing an uri
     query.
     6. if we didn't find any caps, fail.
     7. emit have-type; maybe the app connected the source pad to something.
     8. if the sink pad is activated, we are in pull mode. succeed.
     otherwise activate both pads in push mode and succeed.
   */

  /* 1 */
  if (!gst_pad_check_pull_range (pad) || !gst_pad_activate_pull (pad, TRUE)) {
    start_typefinding (typefind);
    return gst_pad_activate_push (pad, TRUE);
  }

  /* 2 */
  {
    GstPad *peer;

    peer = gst_pad_get_peer (pad);
    if (peer) {
      gint64 size;
      GstFormat format = GST_FORMAT_BYTES;

      if (!gst_pad_query_duration (peer, &format, &size)) {
        GST_WARNING_OBJECT (typefind, "Could not query upstream length!");
        gst_object_unref (peer);
        return FALSE;
      }

      /* the size if 0, we cannot continue */
      if (size == 0) {
        /* keep message in sync with message in sink event handler */
        GST_ELEMENT_ERROR (typefind, STREAM, TYPE_NOT_FOUND,
            (_("Stream contains no data.")), ("Can't typefind empty stream"));
        gst_object_unref (peer);
        return FALSE;
      }

      found_caps = gst_type_find_helper_get_range (GST_OBJECT_CAST (peer),
          (GstTypeFindHelperGetRangeFunction) (GST_PAD_GETRANGEFUNC (peer)),
          (guint64) size, &probability);

      gst_object_unref (peer);
    }
  }

  /* 3 */
  gst_pad_activate_pull (pad, FALSE);

  /* 4 */
  gst_pad_activate_push (typefind->src, FALSE);

  /* 5 */
  if (!found_caps || probability < typefind->min_probability) {
    found_caps = gst_type_find_guess_by_extension (typefind, pad, &probability);
  }

  /* 6 */
  if (!found_caps || probability < typefind->min_probability) {
    GST_ELEMENT_ERROR (typefind, STREAM, TYPE_NOT_FOUND, (NULL), (NULL));
    gst_caps_replace (&found_caps, NULL);
    return FALSE;
  }

done:
  /* 7 */
  g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE],
      0, probability, found_caps);
  gst_caps_unref (found_caps);
  typefind->mode = MODE_NORMAL;

  /* 8 */
  if (gst_pad_is_active (pad))
    return TRUE;
  else {
    gboolean ret;

    ret = gst_pad_activate_push (typefind->src, TRUE);
    ret &= gst_pad_activate_push (pad, TRUE);
    return ret;
  }
}