aboutsummaryrefslogtreecommitdiff
path: root/fastiv-io.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-11-18 12:44:25 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-11-18 12:46:05 +0100
commit06af1a3cc9920780c7edeba34677fc66b18ff5eb (patch)
tree2be217eba41f38bf5e669920018b756354516e79 /fastiv-io.c
parent47293cfc10c9d752a77c5d1a22319fdea15f1271 (diff)
downloadfiv-06af1a3cc9920780c7edeba34677fc66b18ff5eb.tar.gz
fiv-06af1a3cc9920780c7edeba34677fc66b18ff5eb.tar.xz
fiv-06af1a3cc9920780c7edeba34677fc66b18ff5eb.zip
Add a command line option to list supported types
Make it work without a display connection.
Diffstat (limited to 'fastiv-io.c')
-rw-r--r--fastiv-io.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/fastiv-io.c b/fastiv-io.c
index 82c3229..e1bb60a 100644
--- a/fastiv-io.c
+++ b/fastiv-io.c
@@ -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()