static void
debug_codec_cap (CodecCap *codec_cap)
{
  gchar *caps;
  if (codec_cap->caps)
  {
    caps = gst_caps_to_string (codec_cap->caps);
    GST_LOG ("%p:%d:media_caps %s\n", codec_cap->caps,
        GST_CAPS_REFCOUNT_VALUE (codec_cap->caps),
        caps);
    g_free (caps);
  }

  if (codec_cap->rtp_caps)
  {
    caps = gst_caps_to_string (codec_cap->rtp_caps);
    GST_LOG ("%p:%d:rtp_caps %s\n", codec_cap->rtp_caps,
        GST_CAPS_REFCOUNT_VALUE (codec_cap->rtp_caps), caps);
    g_free (caps);
    g_assert (gst_caps_get_size (codec_cap->rtp_caps) == 1);
  }

  GST_LOG ("element_list1 -> ");
  debug_pipeline (codec_cap->element_list1);
  GST_LOG ("element_list2 -> ");
  debug_pipeline (codec_cap->element_list2);
}
示例#2
0
static void
test_with_caps (GstElement * src, GstElement * videocrop, GstCaps * caps)
{
    GstClockTime time_run;
    GstElement *pipeline;
    GTimer *timer;
    GstBus *bus;
    GstPad *pad;
    guint hcrop;
    guint vcrop;

    /* caps must be writable, we can't check that here though */
    g_assert (GST_CAPS_REFCOUNT_VALUE (caps) == 1);

    timer = g_timer_new ();
    vcrop = 0;
    hcrop = 0;

    pipeline = GST_ELEMENT (gst_element_get_parent (videocrop));
    g_assert (GST_IS_PIPELINE (pipeline));

    /* at this point the pipeline is in PLAYING state; we only want to capture
     * errors resulting from our on-the-fly changing of the filtercaps */
    bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));

    /* pad to block */
    pad = gst_element_get_static_pad (src, "src");

    time_run = 0;
    do {
        GstClockTime wait_time, waited_for_block;

        if (check_bus_for_errors (bus, 0))
            break;

        wait_time = GST_SECOND / FRAMERATE;

        GST_LOG ("hcrop = %3d, vcrop = %3d", vcrop, hcrop);

        g_timer_reset (timer);

        /* need to block the streaming thread while changing these properties,
         * otherwise we might get random not-negotiated errors (when caps are
         * changed in between upstream calling pad_alloc_buffer() and pushing
         * the processed buffer?) */
        gst_pad_set_blocked (pad, TRUE);
        g_object_set (videocrop, "left", hcrop, "top", vcrop, NULL);
        gst_pad_set_blocked (pad, FALSE);

        waited_for_block = g_timer_elapsed (timer, NULL) * (double) GST_SECOND;
        /* GST_LOG ("waited: %" GST_TIME_FORMAT ", frame len: %" GST_TIME_FORMAT,
           GST_TIME_ARGS (waited_for_block), GST_TIME_ARGS (wait_time)); */
        ++vcrop;
        ++hcrop;

        if (wait_time > waited_for_block) {
            g_usleep ((wait_time - waited_for_block) / GST_MSECOND);
        }

        time_run += wait_time;
    }
    while (time_run < (TIME_PER_TEST * GST_SECOND));

    g_timer_destroy (timer);
    gst_object_unref (bus);
    gst_object_unref (pad);
}
示例#3
0
bool Caps::isWritable() const
{
    GstCaps *caps = object<GstCaps>(); //workaround for bug #653266
    return (GST_CAPS_REFCOUNT_VALUE(caps) == 1);
}