• Main Page
  • Related Pages
  • Classes
  • Files
  • File List
  • File Members

tuple.h

Go to the documentation of this file.
00001 /*
00002  * Audacious
00003  * Copyright (c) 2006-2007 Audacious team
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; under version 3 of the License.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses>.
00016  *
00017  * The Audacious team does not consider modular code linking to
00018  * Audacious or using our public API to be a derived work.
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     /* Preserving replay gain information accurately is a challenge since there
00071      * are several differents formats around.  We use an integer fraction, with
00072      * the denominator stored in the *_UNIT fields.  For example, if ALBUM_GAIN
00073      * is 512 and GAIN_UNIT is 256, then the album gain is +2 dB.  If TRACK_PEAK
00074      * is 787 and PEAK_UNIT is 1000, then the peak volume is 0.787 in a -1.0 to
00075      * 1.0 range. */
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     /* Special field, must always be last */
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 /* AUDACIOUS_TUPLE_H */

Generated on Wed Apr 6 2011 for Audacious by  doxygen 1.7.1