aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViliam Mateicka <viliam.mateicka@gmail.com>2009-12-03 19:39:34 +0100
committerViliam Mateicka <viliam.mateicka@gmail.com>2009-12-03 19:39:34 +0100
commit6d11711a0115c0fa2c51e08475407e4c17c73079 (patch)
tree0da376cf190ea25075b5eed813c10029837ba669
parentbae03e173e46fb0174bc37da13b32b403b19c706 (diff)
downloadmpd-6d11711a0115c0fa2c51e08475407e4c17c73079.tar.gz
mpd-6d11711a0115c0fa2c51e08475407e4c17c73079.tar.xz
mpd-6d11711a0115c0fa2c51e08475407e4c17c73079.zip
encoder: add get_mime_type() method to determine content type by httpd output plugin
-rw-r--r--src/encoder_plugin.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/encoder_plugin.h b/src/encoder_plugin.h
index 958fe97cf..e8f2e4527 100644
--- a/src/encoder_plugin.h
+++ b/src/encoder_plugin.h
@@ -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