Exemple #1
0
void test_registry()
{
    GList *g;
    GstRegistry *registry;
    //xmlfile = "test_registry";
    std_log(LOG_FILENAME_LINE, "Test Started test_registry");
    registry = gst_registry_get_default ();

    for (g = registry->plugins; g; g = g->next) {
        GstPlugin *plugin = GST_PLUGIN (g->data);

        ASSERT_OBJECT_REFCOUNT (plugin, "plugin in registry", 1);
        GST_DEBUG ("refcount %d %s", GST_OBJECT_REFCOUNT_VALUE (plugin),
                   plugin->desc.name);
    }
    for (g = registry->features; g; g = g->next) {
        GstPluginFeature *feature = GST_PLUGIN_FEATURE (g->data);

        fail_if (GST_OBJECT_REFCOUNT_VALUE (feature) != 1,
                 "Feature in registry should have refcount of 1");
        GST_DEBUG ("refcount %d %s", GST_OBJECT_REFCOUNT_VALUE (feature),
                   feature->name);
    }
    std_log(LOG_FILENAME_LINE, "Test Successful");
    create_xml(0);
}
void RefPointerTest::refTest1()
{
    GstElement *element = gst_bin_new(NULL);
    GstObject *bin1 = GST_OBJECT(element);
    QCOMPARE(GST_OBJECT_REFCOUNT_VALUE(element), 1);

    GstObject *bin2 = GST_OBJECT(gst_object_ref_sink(bin1));
    QCOMPARE(GST_OBJECT_REFCOUNT_VALUE(bin2), 1);
    QGst::ObjectPtr object = QGst::ObjectPtr::wrap(bin2, false);
    QCOMPARE(GST_OBJECT_REFCOUNT_VALUE(bin2), 1);
}
Exemple #3
0
void test_typefind()
{
    GstPlugin *plugin;
    GstPluginFeature *feature;
    GstTypeFind typefind = {
        peek,
        suggest,
        NULL,
        NULL,
        GST_PADDING_INIT
    };
//xmlfile = "test_typefind";
    std_log(LOG_FILENAME_LINE, "Test Started test_typefind");
    plugin = gst_default_registry_find_plugin ("typefindfunctions");
    fail_if (plugin == NULL, "Failed to find typefind functions");
    fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 2,
             "Refcount of plugin in registry should be 2");
    /*
       //commented
         fail_if (gst_plugin_is_loaded (plugin), "Expected plugin to be unloaded");
    */
    feature = gst_registry_find_feature (gst_registry_get_default (),
                                         "audio/x-au", GST_TYPE_TYPE_FIND_FACTORY);
    fail_if (feature == NULL, "Failed to find audio/x-aw typefind factory");


#ifndef __SYMBIAN32__
    fail_if (feature->plugin != plugin,
             "Expected identity to be from coreelements plugin");
    fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 3,
             "Refcount of plugin in registry+feature should be 3");
    gst_type_find_factory_call_function (GST_TYPE_FIND_FACTORY (feature),
                                         &typefind);
    gst_object_unref (feature->plugin);


#endif





    gst_object_unref (plugin);

    fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 1,
             "Refcount of plugin in after list free should be 1");


    std_log(LOG_FILENAME_LINE, "Test Successful");
    create_xml(0);
}
Exemple #4
0
void RefPointerTest::refTest2()
{
    GstObject *bin = GST_OBJECT(gst_object_ref(GST_OBJECT(gst_bin_new(NULL))));
    gst_object_sink(bin);
    {
        QGst::ObjectPtr object = QGst::ObjectPtr::wrap(bin);
        QCOMPARE(GST_OBJECT_REFCOUNT_VALUE(bin), 2);
        {
            QGst::ObjectPtr object2 = object;
            QCOMPARE(GST_OBJECT_REFCOUNT_VALUE(bin), 3);
        }
    }
    QCOMPARE(GST_OBJECT_REFCOUNT_VALUE(bin), 1);
    gst_object_unref(bin);
}
Exemple #5
0
void RefPointerTest::refTest1()
{
    GstObject *bin = GST_OBJECT(gst_object_ref(GST_OBJECT(gst_bin_new(NULL))));
    gst_object_sink(bin);
    QGst::ObjectPtr object = QGst::ObjectPtr::wrap(bin, false);
    QCOMPARE(GST_OBJECT_REFCOUNT_VALUE(bin), 1);
}
Exemple #6
0
void test_find_feature()
{
    GstPluginFeature *feature;
    //xmlfile = "test_find_feature";
    std_log(LOG_FILENAME_LINE, "Test Started test_find_feature");
    feature = gst_registry_find_feature (gst_registry_get_default (),
                                         "identity", GST_TYPE_ELEMENT_FACTORY);
    fail_if (feature == NULL, "Failed to find identity element factory");
    fail_if (strcmp (feature->plugin_name, "coreelements"),
             "Expected identity to be from coreelements plugin");
    fail_if (GST_OBJECT_REFCOUNT_VALUE (feature) != 2,
             "Refcount of feature should be 2");
    GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (feature));
    gst_object_unref (feature);
    std_log(LOG_FILENAME_LINE, "Test Successful");
    create_xml(0);
}
Exemple #7
0
void test_load_coreelements()
{
    GstPlugin *unloaded_plugin;
    GstPlugin *loaded_plugin;
    //xmlfile = "test_load_coreelements";
    std_log(LOG_FILENAME_LINE, "Test Started test_load_coreelements");
    unloaded_plugin = gst_default_registry_find_plugin ("coreelements");
    fail_if (unloaded_plugin == NULL, "Failed to find coreelements plugin");
    fail_if (GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin) != 2,
             "Refcount of unloaded plugin in registry initially should be 2");
    GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin));
    loaded_plugin = gst_plugin_load (unloaded_plugin);
    fail_if (loaded_plugin == NULL, "Failed to load plugin");
    if (loaded_plugin != unloaded_plugin) {
        fail_if (GST_OBJECT_REFCOUNT_VALUE (loaded_plugin) != 2,
                 "Refcount of loaded plugin in registry should be 2");
        GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (loaded_plugin));
        fail_if (GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin) != 1,
                 "Refcount of replaced plugin should be 1");
        GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin));
    }

    gst_object_unref (unloaded_plugin);
    gst_object_unref (loaded_plugin);
    std_log(LOG_FILENAME_LINE, "Test Successful");
    create_xml(0);
}
Exemple #8
0
void test_find_element()
{
    GstElementFactory *element_factory;
    //xmlfile = "test_find_element";
    std_log(LOG_FILENAME_LINE, "Test Started test_find_element");
    element_factory = gst_element_factory_find ("identity");
    fail_if (element_factory == NULL, "Failed to find identity element factory");
    fail_if (GST_OBJECT_REFCOUNT_VALUE (element_factory) != 2,
             "Refcount of plugin in registry+feature should be 2");
    gst_object_unref (element_factory);
    std_log(LOG_FILENAME_LINE, "Test Successful");
    create_xml(0);
}
Exemple #9
0
void test_registry_get_plugin_list()
{
    GList *list;
    GstPlugin *plugin;
    //xmlfile = "test_registry_get_plugin_list";
    std_log(LOG_FILENAME_LINE, "Test Started test_registry_get_plugin_list");
    plugin = gst_default_registry_find_plugin ("coreelements");
    fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 2,
             "Refcount of plugin in registry should be 2");
    list = gst_registry_get_plugin_list (gst_registry_get_default ());


    fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 3,
             "Refcount of plugin in registry+list should be 3");
    gst_plugin_list_free (list);

    fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 2,
             "Refcount of plugin in after list free should be 2");
    gst_object_unref (plugin);
    std_log(LOG_FILENAME_LINE, "Test Successful");
    create_xml(0);
}
Exemple #10
0
void tsmf_gstreamer_clean_up(TSMFGstreamerDecoder* mdecoder)
{
	if (!mdecoder || !mdecoder->pipe)
		return;

	if (mdecoder->pipe && GST_OBJECT_REFCOUNT_VALUE(mdecoder->pipe) > 0)
	{
		tsmf_gstreamer_pipeline_set_state(mdecoder, GST_STATE_NULL);
		gst_object_unref(mdecoder->pipe);
	}

	tsmf_window_destroy(mdecoder);
	mdecoder->ready = FALSE;
	mdecoder->pipe = NULL;
	mdecoder->src = NULL;
}
static void
debug_pipeline (GList *pipeline)
{
  GList *walk;

  GST_DEBUG ("pipeline: ");
  for (walk = pipeline; walk; walk = g_list_next (walk))
  {
    GList *walk2;
    for (walk2 = g_list_first (walk->data); walk2; walk2 = g_list_next (walk2))
      GST_DEBUG ("%p:%d:%s ", walk2->data,
        GST_OBJECT_REFCOUNT_VALUE (GST_OBJECT (walk2->data)),
        gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (walk2->data)));
    GST_DEBUG ("--");
  }
  GST_DEBUG ("\n");
}
Exemple #12
0
void CQMedia::_updateDecoder()
{
    GstElement *videodecoder = gst_bin_get_by_name((GstBin*)pipeline,"v_dec");
    GstStateChangeReturn ret=gst_element_set_state(videodecoder,GST_STATE_NULL);
    if(GST_STATE_CHANGE_SUCCESS==ret)
    {
        qDebug("set videodecoder to null SUCCESS!!");
        if(gst_bin_remove(GST_BIN(pipeline),videodecoder))
        {
            qDebug("remove videodecoder success!!");
            int refCount = GST_OBJECT_REFCOUNT_VALUE(videodecoder);
            for(int i = 0;i < refCount; i++)
                gst_object_unref(videodecoder);
            videodecoder =  gst_element_factory_make("mfw_vpudecoder","v_dec");
            g_object_set(G_OBJECT(videodecoder),"parser",false,"dbkenable",false,"profiling",false,
                         "framedrop",true,"min-latency",true,"fmt",(guint64)0,NULL);
            GstElement *queue2 = gst_bin_get_by_name((GstBin*)pipeline,"queue2");
            GstElement *v_sink = gst_bin_get_by_name((GstBin*)pipeline,"v_sink");
            gst_bin_add_many (GST_BIN (pipeline),videodecoder,NULL);
            if(gst_element_link_many ( queue2,videodecoder,v_sink,NULL))
            {
                qDebug("link videodecoder  SUCCESS!!");
            }
            else
            {
                qDebug("link videodecoder  FAILED!!");
            }
            gst_object_unref(queue2);
            gst_object_unref(v_sink);
        }
        else
        {
            qDebug("remove videodecoder failed!!");
        }
    }
    else
    {
        qDebug("set videodecoder to null FAILED!!");
    }
}
static void
gst_camerabin_image_dispose (GstCameraBinImage * img)
{
  GST_DEBUG_OBJECT (img, "disposing");

  g_string_free (img->filename, TRUE);
  img->filename = NULL;

  if (img->elements) {
    g_list_free (img->elements);
    img->elements = NULL;
  }

  if (img->sink) {
    GST_LOG_OBJECT (img, "disposing %s with refcount %d",
        GST_ELEMENT_NAME (img->sink), GST_OBJECT_REFCOUNT_VALUE (img->sink));
    gst_object_unref (img->sink);
    img->sink = NULL;
  }

  if (img->formatter) {
    GST_LOG_OBJECT (img, "disposing %s with refcount %d",
        GST_ELEMENT_NAME (img->formatter),
        GST_OBJECT_REFCOUNT_VALUE (img->formatter));
    gst_object_unref (img->formatter);
    img->formatter = NULL;
  }

  if (img->app_formatter) {
    gst_object_sink (img->app_formatter);
    GST_LOG_OBJECT (img, "disposing %s with refcount %d",
        GST_ELEMENT_NAME (img->app_formatter),
        GST_OBJECT_REFCOUNT_VALUE (img->app_formatter));
    gst_object_unref (img->app_formatter);
    img->app_formatter = NULL;
  }

  if (img->enc) {
    GST_LOG_OBJECT (img, "disposing %s with refcount %d",
        GST_ELEMENT_NAME (img->enc), GST_OBJECT_REFCOUNT_VALUE (img->enc));
    gst_object_unref (img->enc);
    img->enc = NULL;
  }

  if (img->csp) {
    GST_LOG_OBJECT (img, "disposing %s with refcount %d",
        GST_ELEMENT_NAME (img->csp), GST_OBJECT_REFCOUNT_VALUE (img->csp));
    gst_object_unref (img->csp);
    img->csp = NULL;
  }

  /* Note: if imagebin was never set to READY state the
     ownership of elements created by application were never
     taken by bin and therefore gst_object_sink is called for
     these elements (they may still be in floating state
     and not unreffed properly without sinking first)
   */
  if (img->app_enc) {
    gst_object_sink (img->app_enc);
    GST_LOG_OBJECT (img, "disposing %s with refcount %d",
        GST_ELEMENT_NAME (img->app_enc),
        GST_OBJECT_REFCOUNT_VALUE (img->app_enc));
    gst_object_unref (img->app_enc);
    img->app_enc = NULL;
  }

  if (img->post) {
    gst_object_sink (img->post);
    GST_LOG_OBJECT (img, "disposing %s with refcount %d",
        GST_ELEMENT_NAME (img->post), GST_OBJECT_REFCOUNT_VALUE (img->post));
    gst_object_unref (img->post);
    img->post = NULL;
  }

  G_OBJECT_CLASS (parent_class)->dispose ((GObject *) img);
}