11 * find the type of a media file and display it's properties
14 gboolean FOUND = FALSE;
16 int max_iterations = 100;
19 gst_caps_print (GstCaps *caps)
21 g_print ("%s\n", gst_caps_to_string (caps));
25 have_type_handler (GstElement *typefind, gpointer data)
27 GstCaps *caps = (GstCaps *) data;
28 gst_caps_print (caps);
33 main (int argc, char *argv[])
36 GstElement *source, *typefind;
38 setlocale (LC_ALL, "");
40 gst_init (&argc, &argv);
43 g_print ("Please give a filename to typefind\n\n");
46 pipeline = gst_pipeline_new (NULL);
47 source = gst_element_factory_make ("filesrc", "source");
48 g_assert (GST_IS_ELEMENT (source));
49 g_object_set (source, "location", argv[1], NULL);
50 typefind = gst_element_factory_make ("typefind", "typefind");
51 g_assert (GST_IS_ELEMENT (typefind));
52 gst_bin_add_many (GST_BIN (pipeline), source, typefind, NULL);
53 gst_element_link (source, typefind);
54 g_signal_connect (G_OBJECT (typefind), "have-type",
55 G_CALLBACK (have_type_handler), NULL);
58 gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
61 gst_bin_iterate (GST_BIN (pipeline));
63 if(iterations >= max_iterations){
68 g_print ("No type found\n");