summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBenjamin Otte <otte@gnome.org>2003-10-28 20:25:30 +0000
committerBenjamin Otte <otte@gnome.org>2003-10-28 20:25:30 +0000
commit3235f1d4c09e9298b843f87dfa2849bd1ea00db8 (patch)
tree4cc6ece1cb3bf0c4956bd595e86afa9f34514d67 /tools
parent208c0e30898b429cbe676edca3ad526e1d58c256 (diff)
merge TYPEFIND branch. Major changes:
Original commit message from CVS: merge TYPEFIND branch. Major changes: - totally reworked type(find) system - bytestream is out of the core again - typefind element is now part of gstelements
Diffstat (limited to 'tools')
-rw-r--r--tools/gst-inspect.c63
-rw-r--r--tools/gst-register.c2
-rw-r--r--tools/gst-typefind.c45
-rw-r--r--tools/gst-xmlinspect.c59
4 files changed, 86 insertions, 83 deletions
diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c
index c92f72bf7..f2dbdfb5c 100644
--- a/tools/gst-inspect.c
+++ b/tools/gst-inspect.c
@@ -112,18 +112,11 @@ print_props (GstProps *properties, const gchar *pfx)
}
static void
-print_caps (const GstCaps *caps, const gchar *pfx)
+print_caps (GstCaps *caps, const gchar *pfx)
{
while (caps) {
- GstType *type;
-
g_print ("%s'%s': (%sfixed)\n", pfx, caps->name, (GST_CAPS_IS_FIXED (caps) ? "" : "NOT "));
-
- type = gst_type_find_by_id (caps->id);
- if (type)
- g_print ("%s MIME type: '%s':\n", pfx, type->mime);
- else
- g_print ("%s MIME type: 'unknown/unknown':\n", pfx);
+ g_print ("%s MIME type: '%s':\n", pfx, gst_caps_get_mime (caps));
if (caps->properties) {
gchar *prefix = g_strdup_printf ("%s ", pfx);
@@ -863,20 +856,19 @@ print_element_list (void)
GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
}
#endif
- else if (GST_IS_TYPE_FACTORY (feature)) {
- GstTypeFactory *factory;
-
- factory = GST_TYPE_FACTORY (feature);
- if (factory->exts)
- g_print ("%s type: %s: %s\n", plugin->name,
- factory->mime, factory->exts);
- else
- g_print ("%s type: %s: N/A\n", plugin->name,
- factory->mime);
-
- if (factory->typefindfunc)
- g_print (" Has typefind function: %s\n",
- GST_DEBUG_FUNCPTR_NAME (factory->typefindfunc));
+ else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
+ GstTypeFindFactory *factory;
+
+ factory = GST_TYPE_FIND_FACTORY (feature);
+ if (factory->extensions) {
+ guint i;
+ g_print ("%s type: ", plugin->name);
+ while (factory->extensions[i]) {
+ g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]);
+ i++;
+ }
+ } else
+ g_print ("%s type: N/A\n", plugin->name);
}
else if (GST_IS_SCHEDULER_FACTORY (feature)) {
GstSchedulerFactory *factory;
@@ -957,15 +949,20 @@ print_plugin_info (GstPlugin *plugin)
num_indexes++;
}
#endif
- else if (GST_IS_TYPE_FACTORY (feature)) {
- GstTypeFactory *factory;
-
- factory = GST_TYPE_FACTORY (feature);
- g_print (" %s: %s\n", factory->mime, factory->exts);
+ else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
+ GstTypeFindFactory *factory;
+
+ factory = GST_TYPE_FIND_FACTORY (feature);
+ if (factory->extensions) {
+ guint i;
+ g_print ("%s type: ", plugin->name);
+ while (factory->extensions[i]) {
+ g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]);
+ i++;
+ }
+ } else
+ g_print ("%s type: N/A\n", plugin->name);
- if (factory->typefindfunc)
- g_print (" Has typefind function: %s\n",
- GST_DEBUG_FUNCPTR_NAME (factory->typefindfunc));
num_types++;
}
else if (GST_IS_SCHEDULER_FACTORY (feature)) {
@@ -1066,9 +1063,9 @@ main (int argc, char *argv[])
}
#endif
feature = gst_registry_pool_find_feature (argv[1],
- GST_TYPE_TYPE_FACTORY);
+ GST_TYPE_TYPE_FIND_FACTORY);
if (feature) {
- g_print ("%s: an type\n", argv[1]);
+ g_print ("%s: a typefind function\n", argv[1]);
return 0;
}
#ifndef GST_DISABLE_URI
diff --git a/tools/gst-register.c b/tools/gst-register.c
index e3828a4fd..a58401599 100644
--- a/tools/gst-register.c
+++ b/tools/gst-register.c
@@ -132,7 +132,7 @@ int main (int argc,char *argv[])
dir_list = gst_registry_get_path_list(registry);
for(iter = dir_list; iter; iter = iter->next) {
- dir = g_build_filename((const char *)iter->data, "register-scripts");
+ dir = g_build_filename((const char *)iter->data, "register-scripts", NULL);
spawn_all_in_dir(dir);
g_free(dir);
}
diff --git a/tools/gst-typefind.c b/tools/gst-typefind.c
index fd6571362..fc0551ac4 100644
--- a/tools/gst-typefind.c
+++ b/tools/gst-typefind.c
@@ -12,26 +12,27 @@
**/
gboolean FOUND = FALSE;
-int iterations;
-int max_iterations = 100;
+gchar *filename = NULL;
void
-gst_caps_print (GstCaps *caps)
+gst_caps_print (const char *filename, GstCaps *caps)
{
- g_print ("%s\n", gst_caps_to_string (caps));
+ gchar *caps_str = gst_caps_to_string (caps);
+ g_print ("%s - %s\n", filename, caps_str);
+ g_free (caps_str);
}
void
-have_type_handler (GstElement *typefind, gpointer data)
+have_type_handler (GstElement *typefind, guint probability, GstCaps *caps, gpointer unused)
{
- GstCaps *caps = (GstCaps *) data;
- gst_caps_print (caps);
+ gst_caps_print (filename, caps);
FOUND = TRUE;
}
int
main (int argc, char *argv[])
{
+ guint i = 1;
GstElement *pipeline;
GstElement *source, *typefind;
@@ -41,12 +42,12 @@ main (int argc, char *argv[])
if (argc < 2) {
g_print ("Please give a filename to typefind\n\n");
- exit (1);
+ return 1;
}
+
pipeline = gst_pipeline_new (NULL);
source = gst_element_factory_make ("filesrc", "source");
g_assert (GST_IS_ELEMENT (source));
- g_object_set (source, "location", argv[1], NULL);
typefind = gst_element_factory_make ("typefind", "typefind");
g_assert (GST_IS_ELEMENT (typefind));
gst_bin_add_many (GST_BIN (pipeline), source, typefind, NULL);
@@ -54,19 +55,23 @@ main (int argc, char *argv[])
g_signal_connect (G_OBJECT (typefind), "have-type",
G_CALLBACK (have_type_handler), NULL);
- /* set to play */
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
+ while (i < argc) {
+ FOUND = FALSE;
+ gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
+ filename = argv[i];
+ g_object_set (source, "location", filename, NULL);
+ /* set to play */
+ gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
- while (!FOUND){
- gst_bin_iterate (GST_BIN (pipeline));
- iterations++;
- if(iterations >= max_iterations){
- break;
+ while (!FOUND) {
+ if (!gst_bin_iterate (GST_BIN (pipeline)))
+ break;
}
+ if (!FOUND) {
+ g_print ("%s - No type found\n", argv[i]);
+ }
+ i++;
}
- if (!FOUND) {
- g_print ("No type found\n");
- return 1;
- }
+ g_object_unref (pipeline);
return 0;
}
diff --git a/tools/gst-xmlinspect.c b/tools/gst-xmlinspect.c
index f6620e8ae..81052e891 100644
--- a/tools/gst-xmlinspect.c
+++ b/tools/gst-xmlinspect.c
@@ -159,7 +159,7 @@ print_props (GstProps *properties, gint pfx)
}
static void
-print_caps (const GstCaps *caps, gint pfx)
+print_caps (GstCaps *caps, gint pfx)
{
if (!caps)
return;
@@ -167,16 +167,10 @@ print_caps (const GstCaps *caps, gint pfx)
PUT_START_TAG (pfx, "capscomp");
while (caps) {
- GstType *type;
-
PUT_START_TAG (pfx + 1, "caps");
PUT_ESCAPED (pfx + 2, "name", caps->name);
- type = gst_type_find_by_id (caps->id);
- if (type)
- PUT_ESCAPED (pfx + 2, "type", type->mime);
- else
- PUT_ESCAPED (pfx + 2, "type", "unkown/unknown");
+ PUT_ESCAPED (pfx + 2, "type", gst_caps_get_mime (caps));
if (caps->properties) {
print_props(caps->properties, pfx + 2);
@@ -855,16 +849,19 @@ print_element_list (void)
GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
}
#endif
- else if (GST_IS_TYPE_FACTORY (feature)) {
- GstTypeFactory *factory;
-
- factory = GST_TYPE_FACTORY (feature);
- g_print ("%s type: %s: %s\n", plugin->name,
- factory->mime, factory->exts);
-
- if (factory->typefindfunc)
- g_print (" Has typefind function: %s\n",
- GST_DEBUG_FUNCPTR_NAME (factory->typefindfunc));
+ else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
+ GstTypeFindFactory *factory;
+
+ factory = GST_TYPE_FIND_FACTORY (feature);
+ if (factory->extensions) {
+ guint i;
+ g_print ("%s type: ", plugin->name);
+ while (factory->extensions[i]) {
+ g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]);
+ i++;
+ }
+ } else
+ g_print ("%s type: N/A\n", plugin->name);
}
else if (GST_IS_SCHEDULER_FACTORY (feature)) {
GstSchedulerFactory *factory;
@@ -945,15 +942,19 @@ print_plugin_info (GstPlugin *plugin)
num_indexes++;
}
#endif
- else if (GST_IS_TYPE_FACTORY (feature)) {
- GstTypeFactory *factory;
-
- factory = GST_TYPE_FACTORY (feature);
- g_print (" %s: %s\n", factory->mime, factory->exts);
-
- if (factory->typefindfunc)
- g_print (" Has typefind function: %s\n",
- GST_DEBUG_FUNCPTR_NAME (factory->typefindfunc));
+ else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
+ GstTypeFindFactory *factory;
+
+ factory = GST_TYPE_FIND_FACTORY (feature);
+ if (factory->extensions) {
+ guint i;
+ g_print ("%s type: ", plugin->name);
+ while (factory->extensions[i]) {
+ g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]);
+ i++;
+ }
+ } else
+ g_print ("%s type: N/A\n", plugin->name);
num_types++;
}
else if (GST_IS_SCHEDULER_FACTORY (feature)) {
@@ -1059,9 +1060,9 @@ main (int argc, char *argv[])
}
#endif
feature = gst_registry_pool_find_feature (argv[1],
- GST_TYPE_TYPE_FACTORY);
+ GST_TYPE_TYPE_FIND_FACTORY);
if (feature) {
- g_print ("%s: an type\n", argv[1]);
+ g_print ("%s: a type find function\n", argv[1]);
return 0;
}
#ifndef GST_DISABLE_URI