MPD 0.17~git
src/icy_metadata.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2003-2011 The Music Player Daemon Project
00003  * http://www.musicpd.org
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License along
00016  * with this program; if not, write to the Free Software Foundation, Inc.,
00017  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00018  */
00019 
00020 #ifndef ICY_METADATA_H
00021 #define ICY_METADATA_H
00022 
00023 #include <stdbool.h>
00024 #include <stddef.h>
00025 
00026 struct icy_metadata {
00027         size_t data_size, data_rest;
00028 
00029         size_t meta_size, meta_position;
00030         char *meta_data;
00031 
00032         struct tag *tag;
00033 };
00034 
00038 static inline void
00039 icy_clear(struct icy_metadata *im)
00040 {
00041         im->data_size = 0;
00042 }
00043 
00048 static inline void
00049 icy_start(struct icy_metadata *im, size_t data_size)
00050 {
00051         im->data_size = im->data_rest = data_size;
00052         im->meta_size = 0;
00053         im->tag = NULL;
00054 }
00055 
00059 void
00060 icy_reset(struct icy_metadata *im);
00061 
00062 void
00063 icy_deinit(struct icy_metadata *im);
00064 
00068 static inline bool
00069 icy_defined(const struct icy_metadata *im)
00070 {
00071         return im->data_size > 0;
00072 }
00073 
00080 size_t
00081 icy_data(struct icy_metadata *im, size_t length);
00082 
00088 size_t
00089 icy_meta(struct icy_metadata *im, const void *data, size_t length);
00090 
00091 static inline struct tag *
00092 icy_tag(struct icy_metadata *im)
00093 {
00094         struct tag *tag = im->tag;
00095         im->tag = NULL;
00096         return tag;
00097 }
00098 
00099 #endif