11 * find the type of a media file and display it's properties
14 gboolean FOUND = FALSE;
17 gst_caps_print (GstCaps *caps)
20 g_print ("%s (%s)\n", caps->name, gst_caps_get_mime (caps));
21 if (caps->properties) {
22 g_print ("has properties\n");
29 have_type_handler (GstElement *typefind, gpointer data)
31 GstCaps *caps = (GstCaps *) data;
32 gst_caps_print (caps);
37 main (int argc, char *argv[])
40 GstElement *source, *typefind;
42 setlocale (LC_ALL, "");
44 gst_init (&argc, &argv);
47 g_print ("Please give a filename to typefind\n\n");
50 pipeline = gst_pipeline_new (NULL);
51 source = gst_element_factory_make ("filesrc", "source");
52 g_assert (GST_IS_ELEMENT (source));
53 g_object_set (source, "location", argv[1], NULL);
54 typefind = gst_element_factory_make ("typefind", "typefind");
55 g_assert (GST_IS_ELEMENT (typefind));
56 gst_bin_add_many (GST_BIN (pipeline), source, typefind, NULL);
57 gst_element_link (source, typefind);
58 g_signal_connect (G_OBJECT (typefind), "have-type",
59 G_CALLBACK (have_type_handler), NULL);
62 gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
64 while (gst_bin_iterate (GST_BIN (pipeline)) && !FOUND) ;
66 g_print ("No type found\n");