mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
fix refcounting tests so that they compile and run, but they fail currently: gst leaks obscene amounts of memory ;) f...
Original commit message from CVS: * fix refcounting tests so that they compile and run, but they fail currently: gst leaks obscene amounts of memory ;) * fix plugin loading test so that it only refers to plugins within the gstreamer/ tree * store gst plugin paths in the registry * is GST_REGISTRY is set, only use the user registry with the PLUGIN_PATH explictly specified by the user * all tests should pass now except refcounting
This commit is contained in:
parent
4b8c43a3d9
commit
1f0374782c
16 changed files with 294 additions and 357 deletions
22
gst/gst.c
22
gst/gst.c
|
@ -40,6 +40,7 @@ gchar *_gst_progname;
|
|||
gboolean _gst_registry_auto_load = TRUE;
|
||||
static GstRegistry *_global_registry;
|
||||
static GstRegistry *_user_registry;
|
||||
static gboolean _gst_registry_fixed = FALSE;
|
||||
|
||||
extern gint _gst_trace_on;
|
||||
|
||||
|
@ -287,12 +288,9 @@ init_pre (void)
|
|||
gst_registry_add_path (_global_registry, PLUGINS_DIR);
|
||||
#endif /* PLUGINS_USE_BUILDDIR */
|
||||
|
||||
gst_registry_pool_add (_global_registry, 100);
|
||||
|
||||
homedir = g_get_home_dir ();
|
||||
user_reg = g_strjoin ("/", homedir, LOCAL_REGISTRY_FILE, NULL);
|
||||
_user_registry = gst_xml_registry_new ("user_registry", user_reg);
|
||||
gst_registry_pool_add (_user_registry, 50);
|
||||
|
||||
g_free (user_reg);
|
||||
}
|
||||
|
@ -369,6 +367,21 @@ init_post (void)
|
|||
_gst_buffer_initialize ();
|
||||
_gst_buffer_pool_initialize ();
|
||||
|
||||
if (!_gst_registry_fixed) {
|
||||
/* don't override command-line options */
|
||||
if (g_getenv ("GST_REGISTRY")) {
|
||||
g_object_set (_user_registry, "location", g_getenv ("GST_REGISTRY"), NULL);
|
||||
_gst_registry_fixed = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_gst_registry_fixed) {
|
||||
gst_registry_pool_add (_global_registry, 100);
|
||||
gst_registry_pool_add (_user_registry, 50);
|
||||
} else {
|
||||
gst_registry_pool_add (_user_registry, 50);
|
||||
}
|
||||
|
||||
if (_gst_registry_auto_load) {
|
||||
gst_registry_pool_load_all ();
|
||||
}
|
||||
|
@ -465,7 +478,8 @@ init_popt_callback (poptContext context, enum poptCallbackReason reason,
|
|||
gst_scheduler_factory_set_default_name (arg);
|
||||
break;
|
||||
case ARG_REGISTRY:
|
||||
GST_XML_REGISTRY (_global_registry)->location = g_strdup (arg);
|
||||
g_object_set (G_OBJECT (_user_registry), "location", arg, NULL);
|
||||
_gst_registry_fixed = TRUE;
|
||||
break;
|
||||
default:
|
||||
g_warning ("option %d not recognized", option->val);
|
||||
|
|
|
@ -195,15 +195,26 @@ gst_registry_unload (GstRegistry *registry)
|
|||
* gst_registry_add_path:
|
||||
* @registry: the registry to add the path to
|
||||
*
|
||||
* Add the given pathstring to the registry. The syntax of the
|
||||
* pathstring is specific to the registry.
|
||||
* Add the given path to the registry. The syntax of the
|
||||
* path is specific to the registry. If the path has already been
|
||||
* added, do nothing.
|
||||
*/
|
||||
void
|
||||
gst_registry_add_path (GstRegistry *registry, const gchar *path)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
g_return_if_fail (GST_IS_REGISTRY (registry));
|
||||
g_return_if_fail (path != NULL);
|
||||
|
||||
l = registry->paths;
|
||||
while (l) {
|
||||
if (strcmp (l->data, path) == 0)
|
||||
return;
|
||||
|
||||
l = g_list_next (l);
|
||||
}
|
||||
|
||||
registry->paths = g_list_append (registry->paths, g_strdup (path));
|
||||
}
|
||||
|
||||
|
|
|
@ -62,12 +62,12 @@ static gboolean gst_xml_registry_save (GstRegistry *registry);
|
|||
static gboolean gst_xml_registry_rebuild (GstRegistry *registry);
|
||||
|
||||
static void gst_xml_registry_get_perms_func (GstXMLRegistry *registry);
|
||||
static void gst_xml_registry_add_path_list_func (GstXMLRegistry *registry);
|
||||
static gboolean gst_xml_registry_open_func (GstXMLRegistry *registry, GstXMLRegistryMode mode);
|
||||
static gboolean gst_xml_registry_load_func (GstXMLRegistry *registry, gchar *data, gssize *size);
|
||||
static gboolean gst_xml_registry_save_func (GstXMLRegistry *registry, gchar *format, ...);
|
||||
static gboolean gst_xml_registry_close_func (GstXMLRegistry *registry);
|
||||
|
||||
|
||||
static GstRegistryReturn gst_xml_registry_load_plugin (GstRegistry *registry, GstPlugin *plugin);
|
||||
|
||||
static void gst_xml_registry_start_element (GMarkupParseContext *context,
|
||||
|
@ -94,6 +94,23 @@ static void gst_xml_registry_error (GMarkupParseContext *context,
|
|||
GError *error,
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
static void gst_xml_registry_paths_start_element (GMarkupParseContext *context,
|
||||
const gchar *element_name,
|
||||
const gchar **attribute_names,
|
||||
const gchar **attribute_values,
|
||||
gpointer user_data,
|
||||
GError **error);
|
||||
static void gst_xml_registry_paths_end_element (GMarkupParseContext *context,
|
||||
const gchar *element_name,
|
||||
gpointer user_data,
|
||||
GError **error);
|
||||
static void gst_xml_registry_paths_text (GMarkupParseContext *context,
|
||||
const gchar *text,
|
||||
gsize text_len,
|
||||
gpointer user_data,
|
||||
GError **error);
|
||||
|
||||
static GstRegistryClass *parent_class = NULL;
|
||||
/* static guint gst_xml_registry_signals[LAST_SIGNAL] = { 0 }; */
|
||||
|
||||
|
@ -107,6 +124,16 @@ gst_xml_registry_parser =
|
|||
gst_xml_registry_error,
|
||||
};
|
||||
|
||||
static const GMarkupParser
|
||||
gst_xml_registry_paths_parser =
|
||||
{
|
||||
gst_xml_registry_paths_start_element,
|
||||
gst_xml_registry_paths_end_element,
|
||||
gst_xml_registry_paths_text,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
GType
|
||||
gst_xml_registry_get_type (void)
|
||||
|
@ -159,6 +186,7 @@ gst_xml_registry_class_init (GstXMLRegistryClass *klass)
|
|||
gstregistry_class->load_plugin = GST_DEBUG_FUNCPTR (gst_xml_registry_load_plugin);
|
||||
|
||||
gstxmlregistry_class->get_perms_func = GST_DEBUG_FUNCPTR (gst_xml_registry_get_perms_func);
|
||||
gstxmlregistry_class->add_path_list_func = GST_DEBUG_FUNCPTR (gst_xml_registry_add_path_list_func);
|
||||
gstxmlregistry_class->open_func = GST_DEBUG_FUNCPTR (gst_xml_registry_open_func);
|
||||
gstxmlregistry_class->load_func = GST_DEBUG_FUNCPTR (gst_xml_registry_load_func);
|
||||
gstxmlregistry_class->save_func = GST_DEBUG_FUNCPTR (gst_xml_registry_save_func);
|
||||
|
@ -222,6 +250,9 @@ gst_xml_registry_set_property (GObject* object, guint prop_id,
|
|||
|
||||
if (CLASS (object)->get_perms_func)
|
||||
CLASS (object)->get_perms_func (registry);
|
||||
|
||||
if (CLASS (object)->add_path_list_func)
|
||||
CLASS (object)->add_path_list_func (registry);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -307,6 +338,46 @@ static void gst_xml_registry_get_perms_func (GstXMLRegistry *registry)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_xml_registry_add_path_list_func (GstXMLRegistry *registry)
|
||||
{
|
||||
FILE *reg;
|
||||
GMarkupParseContext *context;
|
||||
gchar *text;
|
||||
gssize size;
|
||||
GError *error = NULL;
|
||||
|
||||
context = g_markup_parse_context_new (&gst_xml_registry_paths_parser, 0, registry, NULL);
|
||||
|
||||
if (! (reg = fopen (registry->location, "r"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
text = g_malloc (BLOCK_SIZE);
|
||||
|
||||
size = fread (text, 1, BLOCK_SIZE, reg);
|
||||
|
||||
while (size) {
|
||||
g_markup_parse_context_parse (context, text, size, &error);
|
||||
|
||||
if (error) {
|
||||
fprintf(stderr, "ERROR: parsing registry: %s\n", error->message);
|
||||
g_free (text);
|
||||
fclose (reg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (registry->state == GST_XML_REGISTRY_PATHS_DONE)
|
||||
break;
|
||||
|
||||
size = fread (text, 1, BLOCK_SIZE, reg);
|
||||
}
|
||||
|
||||
fclose (reg);
|
||||
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
plugin_times_older_than_recurse(gchar *path, time_t regtime)
|
||||
{
|
||||
|
@ -360,16 +431,9 @@ plugin_times_older_than(GList *paths, time_t regtime)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
plugin_added_func (GstRegistry *registry, GstPlugin *plugin, gpointer user_data)
|
||||
{
|
||||
GST_INFO (GST_CAT_PLUGIN_LOADING, "added plugin %s with %d features\n", plugin->name, plugin->numfeatures);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_xml_registry_open_func (GstXMLRegistry *registry, GstXMLRegistryMode mode)
|
||||
{
|
||||
gulong handler_id;
|
||||
GstRegistry *gst_registry;
|
||||
GList *paths;
|
||||
|
||||
|
@ -384,13 +448,8 @@ gst_xml_registry_open_func (GstXMLRegistry *registry, GstXMLRegistryMode mode)
|
|||
if (!plugin_times_older_than (paths, get_time (registry->location))) {
|
||||
GST_INFO (GST_CAT_GST_INIT, "Registry out of date, rebuilding...");
|
||||
|
||||
handler_id = g_signal_connect (registry, "plugin_added",
|
||||
G_CALLBACK (plugin_added_func), NULL);
|
||||
|
||||
gst_registry_rebuild (gst_registry);
|
||||
|
||||
g_signal_handler_disconnect (registry, handler_id);
|
||||
|
||||
if (gst_registry->flags & GST_REGISTRY_WRITABLE) {
|
||||
gst_registry_save (gst_registry);
|
||||
if (!plugin_times_older_than (paths, get_time (registry->location))) {
|
||||
|
@ -452,13 +511,15 @@ gst_xml_registry_close_func (GstXMLRegistry *registry)
|
|||
static gboolean
|
||||
gst_xml_registry_load (GstRegistry *registry)
|
||||
{
|
||||
GstXMLRegistry *xmlregistry = GST_XML_REGISTRY (registry);
|
||||
GstXMLRegistry *xmlregistry;
|
||||
gchar *text;
|
||||
gssize size;
|
||||
GError *error = NULL;
|
||||
GTimer *timer;
|
||||
gdouble seconds;
|
||||
|
||||
xmlregistry = GST_XML_REGISTRY (registry);
|
||||
|
||||
timer = g_timer_new();
|
||||
|
||||
xmlregistry->context = g_markup_parse_context_new (&gst_xml_registry_parser, 0, registry, NULL);
|
||||
|
@ -475,17 +536,19 @@ gst_xml_registry_load (GstRegistry *registry)
|
|||
while (size) {
|
||||
g_markup_parse_context_parse (xmlregistry->context, text, size, &error);
|
||||
|
||||
if (error) {
|
||||
fprintf(stderr, "ERROR: parsing registry: %s\n", error->message);
|
||||
g_free (text);
|
||||
CLASS (xmlregistry)->close_func (xmlregistry);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
size = BLOCK_SIZE;
|
||||
CLASS (xmlregistry)->load_func (xmlregistry, text, &size);
|
||||
}
|
||||
|
||||
g_free (text);
|
||||
|
||||
if (error) {
|
||||
fprintf(stderr, "ERROR: parsing registry: %s\n", error->message);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_timer_stop (timer);
|
||||
|
||||
seconds = g_timer_elapsed (timer, NULL);
|
||||
|
@ -974,6 +1037,67 @@ gst_xml_registry_error (GMarkupParseContext *context, GError *error,
|
|||
{
|
||||
g_print ("error %s\n", error->message);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_xml_registry_paths_start_element (GMarkupParseContext *context, const gchar *element_name,
|
||||
const gchar **attribute_names, const gchar **attribute_values,
|
||||
gpointer user_data, GError **error)
|
||||
{
|
||||
GstXMLRegistry *xmlregistry = GST_XML_REGISTRY (user_data);
|
||||
|
||||
switch (xmlregistry->state) {
|
||||
case GST_XML_REGISTRY_NONE:
|
||||
if (!strcmp (element_name, "GST-PluginRegistry")) {
|
||||
xmlregistry->state = GST_XML_REGISTRY_TOP;
|
||||
}
|
||||
break;
|
||||
case GST_XML_REGISTRY_TOP:
|
||||
if (!strcmp (element_name, "gst-registry-paths")) {
|
||||
xmlregistry->state = GST_XML_REGISTRY_PATHS;
|
||||
}
|
||||
break;
|
||||
case GST_XML_REGISTRY_PATHS:
|
||||
if (!strcmp (element_name, "path")) {
|
||||
xmlregistry->state = GST_XML_REGISTRY_PATH;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_xml_registry_paths_end_element (GMarkupParseContext *context, const gchar *element_name,
|
||||
gpointer user_data, GError **error)
|
||||
{
|
||||
GstXMLRegistry *xmlregistry = GST_XML_REGISTRY (user_data);
|
||||
|
||||
switch (xmlregistry->state) {
|
||||
case GST_XML_REGISTRY_PATH:
|
||||
if (!strcmp (element_name, "path")) {
|
||||
xmlregistry->state = GST_XML_REGISTRY_PATHS;
|
||||
}
|
||||
break;
|
||||
case GST_XML_REGISTRY_PATHS:
|
||||
if (!strcmp (element_name, "gst-plugin-paths")) {
|
||||
xmlregistry->state = GST_XML_REGISTRY_PATHS_DONE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_xml_registry_paths_text (GMarkupParseContext *context, const gchar *text,
|
||||
gsize text_len, gpointer user_data, GError **error)
|
||||
{
|
||||
GstXMLRegistry *xmlregistry = GST_XML_REGISTRY (user_data);
|
||||
|
||||
if (xmlregistry->state == GST_XML_REGISTRY_PATH)
|
||||
gst_registry_add_path (GST_REGISTRY (xmlregistry), g_strndup (text, text_len));
|
||||
}
|
||||
|
||||
/*
|
||||
* Save
|
||||
*/
|
||||
|
@ -1220,11 +1344,22 @@ gst_xml_registry_save (GstRegistry *registry)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
walk = g_list_last (registry->plugins);
|
||||
|
||||
CLASS (xmlregistry)->save_func (xmlregistry, "<?xml version=\"1.0\"?>\n");
|
||||
CLASS (xmlregistry)->save_func (xmlregistry, "<GST-PluginRegistry>\n");
|
||||
|
||||
walk = g_list_last (gst_registry_get_path_list (GST_REGISTRY (registry)));
|
||||
|
||||
CLASS (xmlregistry)->save_func (xmlregistry, "<gst-plugin-paths>\n");
|
||||
while (walk) {
|
||||
CLASS (xmlregistry)->save_func (xmlregistry, "<path>");
|
||||
CLASS (xmlregistry)->save_func (xmlregistry, (gchar*)walk->data);
|
||||
CLASS (xmlregistry)->save_func (xmlregistry, "</path>\n");
|
||||
walk = g_list_previous (walk);
|
||||
}
|
||||
CLASS (xmlregistry)->save_func (xmlregistry, "</gst-plugin-paths>\n");
|
||||
|
||||
walk = g_list_last (registry->plugins);
|
||||
|
||||
while (walk) {
|
||||
GstPlugin *plugin = GST_PLUGIN (walk->data);
|
||||
|
||||
|
|
|
@ -47,6 +47,9 @@ typedef struct _GstXMLRegistryClass GstXMLRegistryClass;
|
|||
typedef enum {
|
||||
GST_XML_REGISTRY_NONE,
|
||||
GST_XML_REGISTRY_TOP,
|
||||
GST_XML_REGISTRY_PATHS,
|
||||
GST_XML_REGISTRY_PATH,
|
||||
GST_XML_REGISTRY_PATHS_DONE,
|
||||
GST_XML_REGISTRY_PLUGIN,
|
||||
GST_XML_REGISTRY_FEATURE,
|
||||
GST_XML_REGISTRY_PADTEMPLATE,
|
||||
|
@ -60,11 +63,8 @@ typedef enum {
|
|||
GST_XML_REGISTRY_WRITE,
|
||||
} GstXMLRegistryMode;
|
||||
|
||||
enum {
|
||||
GST_XML_REGISTRY_OPEN = (1 << 1)
|
||||
};
|
||||
|
||||
typedef void (*GstXMLRegistryGetPerms) (GstXMLRegistry *registry);
|
||||
typedef void (*GstXMLRegistryAddPathList) (GstXMLRegistry *registry);
|
||||
typedef gboolean (*GstXMLRegistryParser) (GMarkupParseContext *context,
|
||||
const gchar *tag,
|
||||
const gchar *text,
|
||||
|
@ -113,6 +113,7 @@ struct _GstXMLRegistryClass {
|
|||
GstRegistryClass parent_class;
|
||||
|
||||
GstXMLRegistryGetPerms get_perms_func;
|
||||
GstXMLRegistryAddPathList add_path_list_func;
|
||||
GstXMLRegistryOpen open_func;
|
||||
GstXMLRegistryLoad load_func;
|
||||
GstXMLRegistrySave save_func;
|
||||
|
|
|
@ -14,13 +14,13 @@ main (int argc, char *argv[])
|
|||
g_print ("%d plugins loaded\n", numplugins);
|
||||
g_mem_chunk_info ();
|
||||
|
||||
plugin = gst_registry_pool_find_plugin ("ossaudio");
|
||||
plugin = gst_registry_pool_find_plugin ("testplugin");
|
||||
g_assert (plugin != NULL);
|
||||
|
||||
g_print ("%d features in plugin\n", g_list_length (gst_plugin_get_feature_list (plugin)));
|
||||
|
||||
|
||||
g_print ("ossaudio: %p loaded: %s\n", plugin, (gst_plugin_is_loaded (plugin) ? "true": "false"));
|
||||
g_print ("testplugin: %p loaded: %s\n", plugin, (gst_plugin_is_loaded (plugin) ? "true": "false"));
|
||||
|
||||
loaded = gst_plugin_load_plugin (plugin);
|
||||
g_assert (loaded == TRUE);
|
||||
|
@ -30,9 +30,9 @@ main (int argc, char *argv[])
|
|||
|
||||
g_mem_chunk_info ();
|
||||
|
||||
plugin = gst_registry_pool_find_plugin ("ossaudio");
|
||||
plugin = gst_registry_pool_find_plugin ("testplugin");
|
||||
g_assert (plugin != NULL);
|
||||
g_print ("ossaudio: %p loaded: %s\n", plugin, (gst_plugin_is_loaded (plugin) ? "true": "false"));
|
||||
g_print ("testplugin: %p loaded: %s\n", plugin, (gst_plugin_is_loaded (plugin) ? "true": "false"));
|
||||
|
||||
g_print ("%d features in plugin\n", g_list_length (gst_plugin_get_feature_list (plugin)));
|
||||
|
||||
|
@ -46,9 +46,9 @@ main (int argc, char *argv[])
|
|||
|
||||
g_mem_chunk_info ();
|
||||
|
||||
plugin = gst_registry_pool_find_plugin ("ossaudio");
|
||||
plugin = gst_registry_pool_find_plugin ("testplugin");
|
||||
g_assert (plugin != NULL);
|
||||
g_print ("ossaudio: %p loaded: %s\n", plugin, (gst_plugin_is_loaded (plugin) ? "true": "false"));
|
||||
g_print ("testplugin: %p loaded: %s\n", plugin, (gst_plugin_is_loaded (plugin) ? "true": "false"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
# GstObject is no longer instantiatable in glib2
|
||||
# neither is GstElement
|
||||
if BUILD_FAILING_TESTS
|
||||
tests_failing = element
|
||||
tests_failing = element bin element_pad pad
|
||||
else
|
||||
tests_failing =
|
||||
endif
|
||||
tests_working = bin element_pad pad
|
||||
tests_working =
|
||||
|
||||
element_SOURCES = element.c mem.c
|
||||
pad_SOURCES = pad.c mem.c
|
||||
|
|
|
@ -11,10 +11,10 @@ create_bin (void)
|
|||
GstElement *element;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_element_set_name (element, "test1");
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_element_set_name (element, "test2");
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
|
||||
|
@ -28,16 +28,12 @@ create_bin_ghostpads (void)
|
|||
GstElement *element1, *element2;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element1 = gst_element_new ();
|
||||
gst_element_set_name (element1, "test1");
|
||||
gst_element_add_pad (element1, gst_pad_new ("src1", GST_PAD_SRC));
|
||||
element1 = gst_element_factory_make ("identity", NULL);
|
||||
gst_bin_add (GST_BIN (bin), element1);
|
||||
element2 = gst_element_new ();
|
||||
gst_element_set_name (element2, "test2");
|
||||
gst_element_add_pad (element2, gst_pad_new ("sink1", GST_PAD_SINK));
|
||||
element2 = gst_element_factory_make ("fakesink", NULL);
|
||||
gst_bin_add (GST_BIN (bin), element2);
|
||||
gst_element_connect (element1, "src1", element2, "sink1");
|
||||
gst_element_add_ghost_pad (bin, gst_element_get_pad (element2, "sink1"), "ghost_sink");
|
||||
gst_element_connect_pads (element1, "src", element2, "sink");
|
||||
gst_element_add_ghost_pad (bin, gst_element_get_pad (element1, "sink"), "ghost_sink");
|
||||
|
||||
return bin;
|
||||
}
|
||||
|
@ -49,7 +45,7 @@ add_remove_test1 (void)
|
|||
GstElement *element;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_element_set_name (element, "test1");
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
|
@ -66,7 +62,7 @@ add_remove_test2 (void)
|
|||
GstElement *element;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_element_set_name (element, "test1");
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
|
@ -90,7 +86,7 @@ add_remove_test3 (void)
|
|||
GstElement *element;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_element_set_name (element, "test1");
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
|
@ -109,7 +105,7 @@ add_remove_test4 (void)
|
|||
GstElement *element;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_element_set_name (element, "test1");
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
|
|
|
@ -21,17 +21,17 @@ main (int argc, gchar *argv[])
|
|||
g_print ("starting test\n");
|
||||
usage1 = vmsize();
|
||||
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
g_print ("create/unref new element %ld\n", vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("create/unref %d elements %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
gst_object_sink (GST_OBJECT (element));
|
||||
|
@ -41,14 +41,14 @@ main (int argc, gchar *argv[])
|
|||
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
gst_object_sink (GST_OBJECT (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("create/ref/sink/unref %d elements %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
g_assert (!GST_OBJECT_DESTROYED (element));
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
g_assert (GST_OBJECT_DESTROYED (element));
|
||||
|
@ -56,27 +56,27 @@ main (int argc, gchar *argv[])
|
|||
g_print ("create/destroy/unref new element %ld\n", vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("create/destroy/unref %d element %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
g_print ("create/ref/unref/unref new element %ld\n", vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("create/ref/unref/unref %d element %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
|
@ -84,7 +84,7 @@ main (int argc, gchar *argv[])
|
|||
g_print ("craete/ref/destroy/unref/unref new element %ld\n", vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
|
@ -93,7 +93,7 @@ main (int argc, gchar *argv[])
|
|||
g_print ("craete/ref/destroy/unref/unref %d elements %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
gst_element_set_name (element, "testing123");
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
|
@ -103,7 +103,7 @@ main (int argc, gchar *argv[])
|
|||
}
|
||||
g_print ("craete/ref/destroy/unref/unref %d elements with name %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
for (i=0; i<iters;i++) {
|
||||
gst_element_set_name (element, "testing");
|
||||
}
|
||||
|
|
|
@ -4,19 +4,6 @@
|
|||
#include <stdlib.h>
|
||||
#include "mem.h"
|
||||
|
||||
static GstElement*
|
||||
create_element (gchar *padname, GstPadDirection dir)
|
||||
{
|
||||
GstElement *element;
|
||||
GstPad *pad;
|
||||
|
||||
element = gst_element_new ();
|
||||
pad = gst_pad_new (padname, dir);
|
||||
gst_element_add_pad (element, pad);
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, gchar *argv[])
|
||||
{
|
||||
|
@ -37,7 +24,7 @@ main (int argc, gchar *argv[])
|
|||
g_print ("starting element with pad test with %d iterations\n", iters);
|
||||
usage1 = vmsize();
|
||||
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element = gst_element_factory_make ("fakesink", NULL);;
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
g_assert (!GST_OBJECT_FLOATING (pad));
|
||||
|
@ -46,45 +33,46 @@ main (int argc, gchar *argv[])
|
|||
g_print ("create/addpad/unref new element %ld\n", vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element = gst_element_factory_make
|
||||
("fakesink", NULL);;
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("create/addpad/unref %d elements %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters/2; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element2 = create_element ("src", GST_PAD_SRC);
|
||||
gst_element_connect (element, "sink", element2, "src");
|
||||
g_assert (GST_PAD_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
g_assert (GST_PAD_CONNECTED (gst_element_get_pad (element, "sink")));
|
||||
element = gst_element_factory_make ("fakesink", NULL);
|
||||
element2 = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_element_connect_pads (element, "sink", element2, "src");
|
||||
g_assert (GST_PAD_IS_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
g_assert (GST_PAD_IS_CONNECTED (gst_element_get_pad (element, "sink")));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
g_assert (!GST_PAD_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
g_assert (!GST_PAD_IS_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
gst_object_unref (GST_OBJECT (element2));
|
||||
}
|
||||
g_print ("create/connect/unref %d elements %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters/2; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element2 = create_element ("src", GST_PAD_SRC);
|
||||
gst_element_connect (element, "sink", element2, "src");
|
||||
g_assert (GST_PAD_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
g_assert (GST_PAD_CONNECTED (gst_element_get_pad (element, "sink")));
|
||||
element = gst_element_factory_make ("fakesink", NULL);
|
||||
element2 = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_element_connect_pads (element, "sink", element2, "src");
|
||||
g_assert (GST_PAD_IS_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
g_assert (GST_PAD_IS_CONNECTED (gst_element_get_pad (element, "sink")));
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
g_assert (GST_OBJECT_DESTROYED (element));
|
||||
g_assert (!GST_PAD_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
g_assert (!GST_PAD_IS_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
gst_object_unref (GST_OBJECT (element2));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("create/connect/destroy %d elements %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element = gst_element_factory_make ("fakesink", NULL);;
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
gst_element_remove_pad (element, pad);
|
||||
g_assert (gst_element_get_pad (element, "sink") == NULL);
|
||||
|
||||
g_print ("pad removal ok %ld\n", vmsize()-usage1);
|
||||
for (i=0; i<iters/2; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element = gst_element_factory_make ("fakesink", NULL);;
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
gst_element_remove_pad (element, pad);
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
|
@ -92,7 +80,7 @@ main (int argc, gchar *argv[])
|
|||
g_print ("pad removal loop %d %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters/2; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element = gst_element_factory_make ("fakesink", NULL);;
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
gst_object_ref (GST_OBJECT (pad));
|
||||
gst_element_remove_pad (element, pad);
|
||||
|
@ -102,7 +90,7 @@ main (int argc, gchar *argv[])
|
|||
}
|
||||
g_print ("pad removal and test loop %d %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element = gst_element_factory_make ("fakesink", NULL);;
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
g_assert (GST_OBJECT_DESTROYED (element));
|
||||
|
@ -112,7 +100,7 @@ main (int argc, gchar *argv[])
|
|||
g_print ("pad destroy/removal ok %ld\n", vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters/2; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element = gst_element_factory_make ("fakesink", NULL);;
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
|
@ -120,7 +108,7 @@ main (int argc, gchar *argv[])
|
|||
g_print ("pad destroy/removal loop %d %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters/2; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element = gst_element_factory_make ("fakesink", NULL);;
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
gst_object_destroy (GST_OBJECT (pad));
|
||||
g_assert (gst_element_get_pad (element, "sink") == NULL);
|
||||
|
|
|
@ -8,7 +8,6 @@ int
|
|||
main (int argc, gchar *argv[])
|
||||
{
|
||||
GstPad *pad;
|
||||
GstPad *pad2;
|
||||
GstPadTemplate *padtempl;
|
||||
long usage1;
|
||||
gint i, iters;
|
||||
|
@ -111,99 +110,6 @@ main (int argc, gchar *argv[])
|
|||
gst_object_unref (GST_OBJECT (pad));
|
||||
g_print ("set name %d times %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||
|
||||
gst_pad_connect (pad2, pad);
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad));
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad2));
|
||||
gst_pad_disconnect (pad2, pad);
|
||||
g_assert (!GST_PAD_IS_CONNECTED (pad));
|
||||
g_assert (!GST_PAD_IS_CONNECTED (pad2));
|
||||
g_print ("connect/disconnect pad %ld\n", vmsize()-usage1);
|
||||
gst_pad_connect (pad, pad2);
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad));
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad2));
|
||||
gst_pad_disconnect (pad, pad2);
|
||||
g_assert (!GST_PAD_IS_CONNECTED (pad));
|
||||
g_assert (!GST_PAD_IS_CONNECTED (pad2));
|
||||
g_print ("connect/disconnect pad wrong direction %ld\n", vmsize()-usage1);
|
||||
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
gst_object_unref (GST_OBJECT (pad2));
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||
gst_pad_connect (pad2, pad);
|
||||
gst_pad_disconnect (pad2, pad);
|
||||
gst_pad_connect (pad, pad2);
|
||||
gst_pad_disconnect (pad, pad2);
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
gst_object_unref (GST_OBJECT (pad2));
|
||||
}
|
||||
g_print ("connect/disconnect %d pads %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||
|
||||
gst_pad_connect (pad2, pad);
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad2));
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad));
|
||||
|
||||
gst_object_unref (GST_OBJECT (pad2));
|
||||
g_assert (!GST_PAD_IS_CONNECTED (pad));
|
||||
g_assert (!GST_OBJECT_DESTROYED (pad));
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||
|
||||
gst_pad_connect (pad2, pad);
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad2));
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad));
|
||||
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
g_assert (!GST_PAD_IS_CONNECTED (pad2));
|
||||
g_assert (!GST_OBJECT_DESTROYED (pad2));
|
||||
gst_object_unref (GST_OBJECT (pad2));
|
||||
|
||||
g_print ("pad unref effects on connect pad ok %ld\n", vmsize()-usage1);
|
||||
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||
|
||||
gst_pad_connect (pad2, pad);
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad2));
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad));
|
||||
|
||||
gst_object_destroy (GST_OBJECT (pad2));
|
||||
g_assert (GST_OBJECT_DESTROYED (pad2));
|
||||
g_assert (!GST_OBJECT_DESTROYED (pad));
|
||||
g_assert (!GST_PAD_IS_CONNECTED (pad));
|
||||
gst_object_unref (GST_OBJECT (pad2));
|
||||
g_assert (!GST_OBJECT_DESTROYED (pad));
|
||||
g_assert (!GST_PAD_IS_CONNECTED (pad));
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||
|
||||
gst_pad_connect (pad2, pad);
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad2));
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad));
|
||||
|
||||
gst_object_destroy (GST_OBJECT (pad));
|
||||
g_assert (GST_OBJECT_DESTROYED (pad));
|
||||
g_assert (!GST_OBJECT_DESTROYED (pad2));
|
||||
g_assert (!GST_PAD_IS_CONNECTED (pad2));
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
g_assert (!GST_OBJECT_DESTROYED (pad2));
|
||||
g_assert (!GST_PAD_IS_CONNECTED (pad2));
|
||||
gst_object_unref (GST_OBJECT (pad2));
|
||||
|
||||
g_print ("pad destroy effects on connect pad ok %ld\n", vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
padtempl = gst_pad_template_new ("sink%d", GST_PAD_SINK, GST_PAD_SOMETIMES, NULL);
|
||||
gst_object_unref (GST_OBJECT (padtempl));
|
||||
|
|
|
@ -14,13 +14,13 @@ main (int argc, char *argv[])
|
|||
g_print ("%d plugins loaded\n", numplugins);
|
||||
g_mem_chunk_info ();
|
||||
|
||||
plugin = gst_registry_pool_find_plugin ("ossaudio");
|
||||
plugin = gst_registry_pool_find_plugin ("testplugin");
|
||||
g_assert (plugin != NULL);
|
||||
|
||||
g_print ("%d features in plugin\n", g_list_length (gst_plugin_get_feature_list (plugin)));
|
||||
|
||||
|
||||
g_print ("ossaudio: %p loaded: %s\n", plugin, (gst_plugin_is_loaded (plugin) ? "true": "false"));
|
||||
g_print ("testplugin: %p loaded: %s\n", plugin, (gst_plugin_is_loaded (plugin) ? "true": "false"));
|
||||
|
||||
loaded = gst_plugin_load_plugin (plugin);
|
||||
g_assert (loaded == TRUE);
|
||||
|
@ -30,9 +30,9 @@ main (int argc, char *argv[])
|
|||
|
||||
g_mem_chunk_info ();
|
||||
|
||||
plugin = gst_registry_pool_find_plugin ("ossaudio");
|
||||
plugin = gst_registry_pool_find_plugin ("testplugin");
|
||||
g_assert (plugin != NULL);
|
||||
g_print ("ossaudio: %p loaded: %s\n", plugin, (gst_plugin_is_loaded (plugin) ? "true": "false"));
|
||||
g_print ("testplugin: %p loaded: %s\n", plugin, (gst_plugin_is_loaded (plugin) ? "true": "false"));
|
||||
|
||||
g_print ("%d features in plugin\n", g_list_length (gst_plugin_get_feature_list (plugin)));
|
||||
|
||||
|
@ -46,9 +46,9 @@ main (int argc, char *argv[])
|
|||
|
||||
g_mem_chunk_info ();
|
||||
|
||||
plugin = gst_registry_pool_find_plugin ("ossaudio");
|
||||
plugin = gst_registry_pool_find_plugin ("testplugin");
|
||||
g_assert (plugin != NULL);
|
||||
g_print ("ossaudio: %p loaded: %s\n", plugin, (gst_plugin_is_loaded (plugin) ? "true": "false"));
|
||||
g_print ("testplugin: %p loaded: %s\n", plugin, (gst_plugin_is_loaded (plugin) ? "true": "false"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
# GstObject is no longer instantiatable in glib2
|
||||
# neither is GstElement
|
||||
if BUILD_FAILING_TESTS
|
||||
tests_failing = element
|
||||
tests_failing = element bin element_pad pad
|
||||
else
|
||||
tests_failing =
|
||||
endif
|
||||
tests_working = bin element_pad pad
|
||||
tests_working =
|
||||
|
||||
element_SOURCES = element.c mem.c
|
||||
pad_SOURCES = pad.c mem.c
|
||||
|
|
|
@ -11,10 +11,10 @@ create_bin (void)
|
|||
GstElement *element;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_element_set_name (element, "test1");
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_element_set_name (element, "test2");
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
|
||||
|
@ -28,16 +28,12 @@ create_bin_ghostpads (void)
|
|||
GstElement *element1, *element2;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element1 = gst_element_new ();
|
||||
gst_element_set_name (element1, "test1");
|
||||
gst_element_add_pad (element1, gst_pad_new ("src1", GST_PAD_SRC));
|
||||
element1 = gst_element_factory_make ("identity", NULL);
|
||||
gst_bin_add (GST_BIN (bin), element1);
|
||||
element2 = gst_element_new ();
|
||||
gst_element_set_name (element2, "test2");
|
||||
gst_element_add_pad (element2, gst_pad_new ("sink1", GST_PAD_SINK));
|
||||
element2 = gst_element_factory_make ("fakesink", NULL);
|
||||
gst_bin_add (GST_BIN (bin), element2);
|
||||
gst_element_connect (element1, "src1", element2, "sink1");
|
||||
gst_element_add_ghost_pad (bin, gst_element_get_pad (element2, "sink1"), "ghost_sink");
|
||||
gst_element_connect_pads (element1, "src", element2, "sink");
|
||||
gst_element_add_ghost_pad (bin, gst_element_get_pad (element1, "sink"), "ghost_sink");
|
||||
|
||||
return bin;
|
||||
}
|
||||
|
@ -49,7 +45,7 @@ add_remove_test1 (void)
|
|||
GstElement *element;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_element_set_name (element, "test1");
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
|
@ -66,7 +62,7 @@ add_remove_test2 (void)
|
|||
GstElement *element;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_element_set_name (element, "test1");
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
|
@ -90,7 +86,7 @@ add_remove_test3 (void)
|
|||
GstElement *element;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_element_set_name (element, "test1");
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
|
@ -109,7 +105,7 @@ add_remove_test4 (void)
|
|||
GstElement *element;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_element_set_name (element, "test1");
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
|
|
|
@ -21,17 +21,17 @@ main (int argc, gchar *argv[])
|
|||
g_print ("starting test\n");
|
||||
usage1 = vmsize();
|
||||
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
g_print ("create/unref new element %ld\n", vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("create/unref %d elements %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
gst_object_sink (GST_OBJECT (element));
|
||||
|
@ -41,14 +41,14 @@ main (int argc, gchar *argv[])
|
|||
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
gst_object_sink (GST_OBJECT (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("create/ref/sink/unref %d elements %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
g_assert (!GST_OBJECT_DESTROYED (element));
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
g_assert (GST_OBJECT_DESTROYED (element));
|
||||
|
@ -56,27 +56,27 @@ main (int argc, gchar *argv[])
|
|||
g_print ("create/destroy/unref new element %ld\n", vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("create/destroy/unref %d element %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
g_print ("create/ref/unref/unref new element %ld\n", vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("create/ref/unref/unref %d element %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
|
@ -84,7 +84,7 @@ main (int argc, gchar *argv[])
|
|||
g_print ("craete/ref/destroy/unref/unref new element %ld\n", vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
|
@ -93,7 +93,7 @@ main (int argc, gchar *argv[])
|
|||
g_print ("craete/ref/destroy/unref/unref %d elements %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
gst_element_set_name (element, "testing123");
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
|
@ -103,7 +103,7 @@ main (int argc, gchar *argv[])
|
|||
}
|
||||
g_print ("craete/ref/destroy/unref/unref %d elements with name %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
element = gst_element_new ();
|
||||
element = gst_element_factory_make ("fakesrc", NULL);
|
||||
for (i=0; i<iters;i++) {
|
||||
gst_element_set_name (element, "testing");
|
||||
}
|
||||
|
|
|
@ -4,19 +4,6 @@
|
|||
#include <stdlib.h>
|
||||
#include "mem.h"
|
||||
|
||||
static GstElement*
|
||||
create_element (gchar *padname, GstPadDirection dir)
|
||||
{
|
||||
GstElement *element;
|
||||
GstPad *pad;
|
||||
|
||||
element = gst_element_new ();
|
||||
pad = gst_pad_new (padname, dir);
|
||||
gst_element_add_pad (element, pad);
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, gchar *argv[])
|
||||
{
|
||||
|
@ -37,7 +24,7 @@ main (int argc, gchar *argv[])
|
|||
g_print ("starting element with pad test with %d iterations\n", iters);
|
||||
usage1 = vmsize();
|
||||
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element = gst_element_factory_make ("fakesink", NULL);;
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
g_assert (!GST_OBJECT_FLOATING (pad));
|
||||
|
@ -46,45 +33,46 @@ main (int argc, gchar *argv[])
|
|||
g_print ("create/addpad/unref new element %ld\n", vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element = gst_element_factory_make
|
||||
("fakesink", NULL);;
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("create/addpad/unref %d elements %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters/2; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element2 = create_element ("src", GST_PAD_SRC);
|
||||
gst_element_connect (element, "sink", element2, "src");
|
||||
g_assert (GST_PAD_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
g_assert (GST_PAD_CONNECTED (gst_element_get_pad (element, "sink")));
|
||||
element = gst_element_factory_make ("fakesink", NULL);
|
||||
element2 = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_element_connect_pads (element, "sink", element2, "src");
|
||||
g_assert (GST_PAD_IS_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
g_assert (GST_PAD_IS_CONNECTED (gst_element_get_pad (element, "sink")));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
g_assert (!GST_PAD_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
g_assert (!GST_PAD_IS_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
gst_object_unref (GST_OBJECT (element2));
|
||||
}
|
||||
g_print ("create/connect/unref %d elements %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters/2; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element2 = create_element ("src", GST_PAD_SRC);
|
||||
gst_element_connect (element, "sink", element2, "src");
|
||||
g_assert (GST_PAD_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
g_assert (GST_PAD_CONNECTED (gst_element_get_pad (element, "sink")));
|
||||
element = gst_element_factory_make ("fakesink", NULL);
|
||||
element2 = gst_element_factory_make ("fakesrc", NULL);
|
||||
gst_element_connect_pads (element, "sink", element2, "src");
|
||||
g_assert (GST_PAD_IS_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
g_assert (GST_PAD_IS_CONNECTED (gst_element_get_pad (element, "sink")));
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
g_assert (GST_OBJECT_DESTROYED (element));
|
||||
g_assert (!GST_PAD_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
g_assert (!GST_PAD_IS_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
gst_object_unref (GST_OBJECT (element2));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("create/connect/destroy %d elements %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element = gst_element_factory_make ("fakesink", NULL);;
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
gst_element_remove_pad (element, pad);
|
||||
g_assert (gst_element_get_pad (element, "sink") == NULL);
|
||||
|
||||
g_print ("pad removal ok %ld\n", vmsize()-usage1);
|
||||
for (i=0; i<iters/2; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element = gst_element_factory_make ("fakesink", NULL);;
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
gst_element_remove_pad (element, pad);
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
|
@ -92,7 +80,7 @@ main (int argc, gchar *argv[])
|
|||
g_print ("pad removal loop %d %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters/2; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element = gst_element_factory_make ("fakesink", NULL);;
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
gst_object_ref (GST_OBJECT (pad));
|
||||
gst_element_remove_pad (element, pad);
|
||||
|
@ -102,7 +90,7 @@ main (int argc, gchar *argv[])
|
|||
}
|
||||
g_print ("pad removal and test loop %d %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element = gst_element_factory_make ("fakesink", NULL);;
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
g_assert (GST_OBJECT_DESTROYED (element));
|
||||
|
@ -112,7 +100,7 @@ main (int argc, gchar *argv[])
|
|||
g_print ("pad destroy/removal ok %ld\n", vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters/2; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element = gst_element_factory_make ("fakesink", NULL);;
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
|
@ -120,7 +108,7 @@ main (int argc, gchar *argv[])
|
|||
g_print ("pad destroy/removal loop %d %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters/2; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element = gst_element_factory_make ("fakesink", NULL);;
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
gst_object_destroy (GST_OBJECT (pad));
|
||||
g_assert (gst_element_get_pad (element, "sink") == NULL);
|
||||
|
|
|
@ -8,7 +8,6 @@ int
|
|||
main (int argc, gchar *argv[])
|
||||
{
|
||||
GstPad *pad;
|
||||
GstPad *pad2;
|
||||
GstPadTemplate *padtempl;
|
||||
long usage1;
|
||||
gint i, iters;
|
||||
|
@ -111,99 +110,6 @@ main (int argc, gchar *argv[])
|
|||
gst_object_unref (GST_OBJECT (pad));
|
||||
g_print ("set name %d times %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||
|
||||
gst_pad_connect (pad2, pad);
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad));
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad2));
|
||||
gst_pad_disconnect (pad2, pad);
|
||||
g_assert (!GST_PAD_IS_CONNECTED (pad));
|
||||
g_assert (!GST_PAD_IS_CONNECTED (pad2));
|
||||
g_print ("connect/disconnect pad %ld\n", vmsize()-usage1);
|
||||
gst_pad_connect (pad, pad2);
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad));
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad2));
|
||||
gst_pad_disconnect (pad, pad2);
|
||||
g_assert (!GST_PAD_IS_CONNECTED (pad));
|
||||
g_assert (!GST_PAD_IS_CONNECTED (pad2));
|
||||
g_print ("connect/disconnect pad wrong direction %ld\n", vmsize()-usage1);
|
||||
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
gst_object_unref (GST_OBJECT (pad2));
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||
gst_pad_connect (pad2, pad);
|
||||
gst_pad_disconnect (pad2, pad);
|
||||
gst_pad_connect (pad, pad2);
|
||||
gst_pad_disconnect (pad, pad2);
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
gst_object_unref (GST_OBJECT (pad2));
|
||||
}
|
||||
g_print ("connect/disconnect %d pads %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||
|
||||
gst_pad_connect (pad2, pad);
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad2));
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad));
|
||||
|
||||
gst_object_unref (GST_OBJECT (pad2));
|
||||
g_assert (!GST_PAD_IS_CONNECTED (pad));
|
||||
g_assert (!GST_OBJECT_DESTROYED (pad));
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||
|
||||
gst_pad_connect (pad2, pad);
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad2));
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad));
|
||||
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
g_assert (!GST_PAD_IS_CONNECTED (pad2));
|
||||
g_assert (!GST_OBJECT_DESTROYED (pad2));
|
||||
gst_object_unref (GST_OBJECT (pad2));
|
||||
|
||||
g_print ("pad unref effects on connect pad ok %ld\n", vmsize()-usage1);
|
||||
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||
|
||||
gst_pad_connect (pad2, pad);
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad2));
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad));
|
||||
|
||||
gst_object_destroy (GST_OBJECT (pad2));
|
||||
g_assert (GST_OBJECT_DESTROYED (pad2));
|
||||
g_assert (!GST_OBJECT_DESTROYED (pad));
|
||||
g_assert (!GST_PAD_IS_CONNECTED (pad));
|
||||
gst_object_unref (GST_OBJECT (pad2));
|
||||
g_assert (!GST_OBJECT_DESTROYED (pad));
|
||||
g_assert (!GST_PAD_IS_CONNECTED (pad));
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||
|
||||
gst_pad_connect (pad2, pad);
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad2));
|
||||
g_assert (GST_PAD_IS_CONNECTED (pad));
|
||||
|
||||
gst_object_destroy (GST_OBJECT (pad));
|
||||
g_assert (GST_OBJECT_DESTROYED (pad));
|
||||
g_assert (!GST_OBJECT_DESTROYED (pad2));
|
||||
g_assert (!GST_PAD_IS_CONNECTED (pad2));
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
g_assert (!GST_OBJECT_DESTROYED (pad2));
|
||||
g_assert (!GST_PAD_IS_CONNECTED (pad2));
|
||||
gst_object_unref (GST_OBJECT (pad2));
|
||||
|
||||
g_print ("pad destroy effects on connect pad ok %ld\n", vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
padtempl = gst_pad_template_new ("sink%d", GST_PAD_SINK, GST_PAD_SOMETIMES, NULL);
|
||||
gst_object_unref (GST_OBJECT (padtempl));
|
||||
|
|
Loading…
Reference in a new issue