encoder: add get_mime_type() method to determine content type by httpd output plugin
This commit is contained in:
parent
bae03e173e
commit
6d11711a01
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user