10 * find the type of a media file and display it's properties
13 gboolean FOUND = FALSE;
16 gst_caps_print (GstCaps *caps)
19 g_print ("%s (%s)\n", caps->name, gst_caps_get_mime (caps));
20 if (caps->properties) {
21 g_print ("has properties\n");
28 have_type_handler (GstElement *typefind, gpointer data)
30 GstCaps *caps = (GstCaps *) data;
31 gst_caps_print (caps);
36 main (int argc, char *argv[])
39 GstElement *source, *typefind;
41 gst_init (&argc, &argv);
44 g_print ("Please give a filename to typefind\n\n");
47 pipeline = gst_pipeline_new (NULL);
48 source = gst_element_factory_make ("filesrc", "source");
49 g_assert (GST_IS_ELEMENT (source));
50 g_object_set (source, "location", argv[1], NULL);
51 typefind = gst_element_factory_make ("typefind", "typefind");
52 g_assert (GST_IS_ELEMENT (typefind));
53 gst_bin_add_many (GST_BIN (pipeline), source, typefind, NULL);
54 gst_element_link (source, typefind);
55 g_signal_connect (G_OBJECT (typefind), "have-type",
56 G_CALLBACK (have_type_handler), NULL);
59 gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
61 while (gst_bin_iterate (GST_BIN (pipeline)) && !FOUND) ;
63 g_print ("No type found\n");