Add a command line option to list supported types

Make it work without a display connection.
This commit is contained in:
2021-11-18 12:44:25 +01:00
parent 47293cfc10
commit 06af1a3cc9
3 changed files with 42 additions and 7 deletions

View File

@@ -78,6 +78,28 @@ const char *fastiv_io_supported_media_types[] = {
NULL
};
char **
fastiv_io_all_supported_media_types(void)
{
GPtrArray *types = g_ptr_array_new();
for (const char **p = fastiv_io_supported_media_types; *p; p++)
g_ptr_array_add(types, g_strdup(*p));
#ifdef HAVE_GDKPIXBUF
GSList *formats = gdk_pixbuf_get_formats();
for (GSList *iter = formats; iter; iter = iter->next) {
gchar **subtypes = gdk_pixbuf_format_get_mime_types(iter->data);
for (gchar **p = subtypes; *p; p++)
g_ptr_array_add(types, *p);
g_free(subtypes);
}
g_slist_free(formats);
#endif // HAVE_GDKPIXBUF
g_ptr_array_add(types, NULL);
return (char **) g_ptr_array_free(types, FALSE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#define FASTIV_IO_ERROR fastiv_io_error_quark()