00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00025 #ifndef AUDACIOUS_TUPLE_H
00026 #define AUDACIOUS_TUPLE_H
00027
00028 #include <glib.h>
00029 #include <mowgli.h>
00030
00031 G_BEGIN_DECLS
00032
00036 enum {
00037 FIELD_ARTIST = 0,
00038 FIELD_TITLE,
00039 FIELD_ALBUM,
00040 FIELD_COMMENT,
00041 FIELD_GENRE,
00043 FIELD_TRACK,
00044 FIELD_TRACK_NUMBER,
00045 FIELD_LENGTH,
00046 FIELD_YEAR,
00047 FIELD_QUALITY,
00050 FIELD_CODEC,
00051 FIELD_FILE_NAME,
00052 FIELD_FILE_PATH,
00053 FIELD_FILE_EXT,
00054 FIELD_SONG_ARTIST,
00055
00056 FIELD_MTIME,
00057 FIELD_FORMATTER,
00058 FIELD_PERFORMER,
00059 FIELD_COPYRIGHT,
00060 FIELD_DATE,
00061
00062 FIELD_SUBSONG_ID,
00063 FIELD_SUBSONG_NUM,
00064 FIELD_MIMETYPE,
00065 FIELD_BITRATE,
00067 FIELD_SEGMENT_START,
00068 FIELD_SEGMENT_END,
00069
00070
00071
00072
00073
00074
00075
00076 FIELD_GAIN_ALBUM_GAIN,
00077 FIELD_GAIN_ALBUM_PEAK,
00078 FIELD_GAIN_TRACK_GAIN,
00079 FIELD_GAIN_TRACK_PEAK,
00080 FIELD_GAIN_GAIN_UNIT,
00081 FIELD_GAIN_PEAK_UNIT,
00082
00083 FIELD_COMPOSER,
00085
00086 FIELD_LAST
00087 };
00088
00089 typedef enum {
00090 TUPLE_STRING,
00091 TUPLE_INT,
00092 TUPLE_UNKNOWN
00093 } TupleValueType;
00094
00095 typedef struct {
00096 gchar *name;
00097 TupleValueType type;
00098 } TupleBasicType;
00099
00100 extern const TupleBasicType tuple_fields[FIELD_LAST];
00101
00102 typedef struct {
00103 TupleValueType type;
00104 union {
00105 gchar *string;
00106 gint integer;
00107 } value;
00108 } TupleValue;
00109
00114 typedef struct _Tuple {
00115 mowgli_object_t parent;
00116 mowgli_dictionary_t *dict;
00117 TupleValue *values[FIELD_LAST];
00118 gint nsubtunes;
00121 gint *subtunes;
00124 } Tuple;
00125
00126
00127 Tuple *tuple_new(void);
00128 Tuple *tuple_copy(const Tuple *);
00129 void tuple_set_filename(Tuple *tuple, const gchar *filename);
00130 Tuple *tuple_new_from_filename(const gchar *filename);
00131 gboolean tuple_associate_string_rel(Tuple *tuple, const gint nfield, const gchar *field, gchar *string);
00132 gboolean tuple_associate_string(Tuple *tuple, const gint nfield, const gchar *field, const gchar *string);
00133 gboolean tuple_associate_int(Tuple *tuple, const gint nfield, const gchar *field, gint integer);
00134 void tuple_disassociate(Tuple *tuple, const gint nfield, const gchar *field);
00135 void tuple_disassociate_now(TupleValue *value);
00136 TupleValueType tuple_get_value_type (const Tuple * tuple, gint nfield,
00137 const gchar * field);
00138 const gchar * tuple_get_string (const Tuple * tuple, gint nfield, const gchar *
00139 field);
00140 gint tuple_get_int (const Tuple * tuple, gint nfield, const gchar * field);
00141 #define tuple_free(x) mowgli_object_unref(x);
00142
00143 G_END_DECLS
00144
00145 #endif