From ffea273a28179d2b5bbc24f967517bcf80940c63 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 11 Feb 2012 19:24:51 +0100 Subject: tag_handler: handle arbitrary name/value pairs The new method pair() receives an arbitrary name/value pair. Support for this is being added to a few decoder plugins. --- src/tag_handler.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/tag_handler.h') diff --git a/src/tag_handler.h b/src/tag_handler.h index 13e40f38..65391858 100644 --- a/src/tag_handler.h +++ b/src/tag_handler.h @@ -43,6 +43,12 @@ struct tag_handler { * invalid after returning */ void (*tag)(enum tag_type type, const char *value, void *ctx); + + /** + * A name-value pair has been read. It is the codec specific + * representation of tags. + */ + void (*pair)(const char *key, const char *value, void *ctx); }; static inline void @@ -67,6 +73,18 @@ tag_handler_invoke_tag(const struct tag_handler *handler, void *ctx, handler->tag(type, value, ctx); } +static inline void +tag_handler_invoke_pair(const struct tag_handler *handler, void *ctx, + const char *name, const char *value) +{ + assert(handler != NULL); + assert(name != NULL); + assert(value != NULL); + + if (handler->pair != NULL) + handler->pair(name, value, ctx); +} + /** * This #tag_handler implementation adds tag values to a #tag object * (casted from the context pointer). -- cgit v1.2.3