Commit 6d11711a authored by Viliam Mateicka's avatar Viliam Mateicka

encoder: add get_mime_type() method to determine content type by httpd output plugin

parent bae03e17
......@@ -58,6 +58,8 @@ struct encoder_plugin {
GError **error);
size_t (*read)(struct encoder *encoder, void *dest, size_t length);
const char *(*get_mime_type)(struct encoder *encoder);
};
/**
......@@ -192,4 +194,19 @@ encoder_read(struct encoder *encoder, void *dest, size_t length)
return encoder->plugin->read(encoder, dest, length);
}
/**
* Get mime type of encoded content.
*
* @param plugin the encoder plugin
* @return an constant string, NULL on failure
*/
static inline const char *
encoder_get_mime_type(struct encoder *encoder)
{
/* this method is optional */
return encoder->plugin->get_mime_type != NULL
? encoder->plugin->get_mime_type(encoder)
: NULL;
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment