2010-01-29 16:35:00 -05:00
|
|
|
|
|
|
|
#ifndef __DMAP_HELPERS_H__
|
|
|
|
#define __DMAP_HELPERS_H__
|
|
|
|
|
2015-10-19 15:15:29 -04:00
|
|
|
#include <event2/buffer.h>
|
|
|
|
#include <event2/http.h>
|
2010-01-29 16:35:00 -05:00
|
|
|
|
2011-04-02 09:07:26 -04:00
|
|
|
#include "db.h"
|
|
|
|
|
2010-02-08 08:35:29 -05:00
|
|
|
enum dmap_type
|
|
|
|
{
|
2010-02-08 08:43:06 -05:00
|
|
|
DMAP_TYPE_UBYTE = 0x01,
|
|
|
|
DMAP_TYPE_BYTE = 0x02,
|
|
|
|
DMAP_TYPE_USHORT = 0x03,
|
|
|
|
DMAP_TYPE_SHORT = 0x04,
|
|
|
|
DMAP_TYPE_UINT = 0x05,
|
|
|
|
DMAP_TYPE_INT = 0x06,
|
|
|
|
DMAP_TYPE_ULONG = 0x07,
|
|
|
|
DMAP_TYPE_LONG = 0x08,
|
2010-02-08 08:35:29 -05:00
|
|
|
DMAP_TYPE_STRING = 0x09,
|
|
|
|
DMAP_TYPE_DATE = 0x0a,
|
|
|
|
DMAP_TYPE_VERSION = 0x0b,
|
|
|
|
DMAP_TYPE_LIST = 0x0c,
|
|
|
|
};
|
2010-01-29 16:35:00 -05:00
|
|
|
|
2011-04-02 08:40:48 -04:00
|
|
|
struct dmap_field_map {
|
|
|
|
ssize_t mfi_offset;
|
|
|
|
ssize_t pli_offset;
|
|
|
|
ssize_t gri_offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct dmap_field {
|
|
|
|
char *desc;
|
|
|
|
char *tag;
|
|
|
|
const struct dmap_field_map *dfm;
|
|
|
|
enum dmap_type type;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
extern const struct dmap_field_map dfm_dmap_mimc;
|
|
|
|
extern const struct dmap_field_map dfm_dmap_aeSP;
|
|
|
|
|
|
|
|
|
|
|
|
const struct dmap_field *
|
|
|
|
dmap_get_fields_table(int *nfields);
|
|
|
|
|
|
|
|
const struct dmap_field *
|
2017-08-25 13:27:41 -04:00
|
|
|
dmap_find_field_wrapper(const char *str, int len);
|
2011-04-02 08:40:48 -04:00
|
|
|
|
|
|
|
|
2010-01-29 16:35:00 -05:00
|
|
|
void
|
2014-08-21 03:59:59 -04:00
|
|
|
dmap_add_container(struct evbuffer *evbuf, const char *tag, int len);
|
2010-01-29 16:35:00 -05:00
|
|
|
|
|
|
|
void
|
2014-08-21 03:59:59 -04:00
|
|
|
dmap_add_long(struct evbuffer *evbuf, const char *tag, int64_t val);
|
2010-01-29 16:35:00 -05:00
|
|
|
|
|
|
|
void
|
2014-08-21 03:59:59 -04:00
|
|
|
dmap_add_int(struct evbuffer *evbuf, const char *tag, int val);
|
2010-01-29 16:35:00 -05:00
|
|
|
|
|
|
|
void
|
2014-08-21 03:59:59 -04:00
|
|
|
dmap_add_short(struct evbuffer *evbuf, const char *tag, short val);
|
2010-01-29 16:35:00 -05:00
|
|
|
|
|
|
|
void
|
2014-08-21 03:59:59 -04:00
|
|
|
dmap_add_char(struct evbuffer *evbuf, const char *tag, char val);
|
2010-01-29 16:35:00 -05:00
|
|
|
|
|
|
|
void
|
2014-08-21 03:59:59 -04:00
|
|
|
dmap_add_literal(struct evbuffer *evbuf, const char *tag, char *str, int len);
|
2010-01-29 16:35:00 -05:00
|
|
|
|
2013-11-14 17:08:20 -05:00
|
|
|
void
|
|
|
|
dmap_add_raw_uint32(struct evbuffer *evbuf, uint32_t val);
|
|
|
|
|
2010-01-29 16:35:00 -05:00
|
|
|
void
|
2014-08-21 03:59:59 -04:00
|
|
|
dmap_add_string(struct evbuffer *evbuf, const char *tag, const char *str);
|
2010-01-29 16:35:00 -05:00
|
|
|
|
2011-04-02 08:46:51 -04:00
|
|
|
void
|
|
|
|
dmap_add_field(struct evbuffer *evbuf, const struct dmap_field *df, char *strval, int32_t intval);
|
|
|
|
|
2017-10-25 17:33:22 -04:00
|
|
|
void
|
|
|
|
dmap_error_make(struct evbuffer *evbuf, const char *container, const char *errmsg);
|
2011-04-02 08:46:51 -04:00
|
|
|
|
2011-04-02 09:07:26 -04:00
|
|
|
int
|
2023-10-20 18:17:20 -04:00
|
|
|
dmap_encode_file_metadata(struct evbuffer *songlist, struct evbuffer *song, struct db_media_file_info *dbmfi, const struct dmap_field **meta, int nmeta, int sort_tags);
|
2011-04-02 09:07:26 -04:00
|
|
|
|
2016-12-03 14:40:54 -05:00
|
|
|
int
|
|
|
|
dmap_encode_queue_metadata(struct evbuffer *songlist, struct evbuffer *song, struct db_queue_item *queue_item);
|
|
|
|
|
2022-01-17 15:54:54 -05:00
|
|
|
char *
|
|
|
|
dmap_query_parse_sql(const char *dmap_query);
|
|
|
|
|
2010-01-29 16:35:00 -05:00
|
|
|
#endif /* !__DMAP_HELPERS_H__ */
|