+ if (msg) {
+ gst_message_parse_error (msg, &err, NULL);
+ g_printerr ("%s - FAILED: %s\n", filename, err->message);
+ g_error_free (err);
+ gst_message_unref (msg);
+ } else {
+ g_printerr ("%s - FAILED: unknown error\n", filename);
+ }
+ break;
+ }
+ case GST_STATE_CHANGE_SUCCESS:{
+ if (caps) {
+ gchar *caps_str;
+
+ caps_str = gst_caps_to_string (caps);
+ g_print ("%s - %s\n", filename, caps_str);
+ g_free (caps_str);
+ gst_caps_unref (caps);
+ } else {
+ g_print ("%s - %s\n", filename, "No type found");
+ }
+ break;
+ }
+ default:
+ g_assert_not_reached ();
+ }
+
+ gst_element_set_state (pipeline, GST_STATE_NULL);
+ gst_object_unref (pipeline);
+}
+
+int
+main (int argc, char *argv[])
+{
+ gchar **filenames = NULL;
+ guint num, i;
+ GError *err = NULL;
+ GOptionContext *ctx;
+ GOptionEntry options[] = {
+ GST_TOOLS_GOPTION_VERSION,
+ {G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, NULL},
+ {NULL}
+ };
+
+ setlocale (LC_ALL, "");
+
+#ifdef ENABLE_NLS
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+#endif
+
+ g_set_prgname ("gst-typefind-" GST_API_VERSION);
+
+ ctx = g_option_context_new ("FILES");
+ g_option_context_add_main_entries (ctx, options, GETTEXT_PACKAGE);
+ g_option_context_add_group (ctx, gst_init_get_option_group ());
+ if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
+ g_print ("Error initializing: %s\n", GST_STR_NULL (err->message));
+ exit (1);
+ }
+ g_option_context_free (ctx);
+
+ gst_tools_print_version ();
+
+ if (filenames == NULL || *filenames == NULL) {
+ g_print ("Please give one or more filenames to %s\n\n", g_get_prgname ());