Audacious  $Id:Doxyfile42802007-03-2104:39:00Znenolod$
Enumerations | Functions
tuple.h File Reference

Basic Tuple handling API. More...

#include <libaudcore/core.h>

Go to the source code of this file.

Enumerations

enum  {
  FIELD_ARTIST = 0, FIELD_TITLE, FIELD_ALBUM, FIELD_COMMENT,
  FIELD_GENRE, FIELD_TRACK_NUMBER, FIELD_LENGTH, FIELD_YEAR,
  FIELD_QUALITY, FIELD_CODEC, FIELD_FILE_NAME, FIELD_FILE_PATH,
  FIELD_FILE_EXT, FIELD_SONG_ARTIST, FIELD_COMPOSER, FIELD_PERFORMER,
  FIELD_COPYRIGHT, FIELD_DATE, FIELD_SUBSONG_ID, FIELD_SUBSONG_NUM,
  FIELD_MIMETYPE, FIELD_BITRATE, FIELD_SEGMENT_START, FIELD_SEGMENT_END,
  FIELD_GAIN_ALBUM_GAIN, FIELD_GAIN_ALBUM_PEAK, FIELD_GAIN_TRACK_GAIN, FIELD_GAIN_TRACK_PEAK,
  FIELD_GAIN_GAIN_UNIT, FIELD_GAIN_PEAK_UNIT, TUPLE_FIELDS
}
 Ordered enum for basic #Tuple fields. More...
 
enum  TupleValueType { TUPLE_STRING, TUPLE_INT, TUPLE_UNKNOWN }
 

Functions

int tuple_field_by_name (const char *name)
 
const char * tuple_field_get_name (int field)
 
TupleValueType tuple_field_get_type (int field)
 
Tuple * tuple_new (void)
 
Tuple * tuple_ref (Tuple *tuple)
 
void tuple_unref (Tuple *tuple)
 
Tuple * tuple_copy (const Tuple *)
 Creates a copy of given Tuple structure, with copied data.
 
void tuple_set_filename (Tuple *tuple, const char *filename)
 Sets filename/URI related fields of a #Tuple structure, based on the given filename argument.
 
Tuple * tuple_new_from_filename (const char *filename)
 Allocates a new #Tuple structure, setting filename/URI related fields based on the given filename argument by calling tuple_set_filename.
 
void tuple_set_int (Tuple *tuple, int nfield, const char *field, int x)
 
void tuple_set_str (Tuple *tuple, int nfield, const char *field, const char *str)
 
void tuple_unset (Tuple *tuple, int nfield, const char *field)
 
TupleValueType tuple_get_value_type (const Tuple *tuple, int nfield, const char *field)
 Returns TupleValueType of given #Tuple field.
 
char * tuple_get_str (const Tuple *tuple, int nfield, const char *field)
 
int tuple_get_int (const Tuple *tuple, int nfield, const char *field)
 Returns integer associated to #Tuple field.
 
void tuple_set_format (Tuple *tuple, const char *format, int channels, int samplerate, int bitrate)
 
void tuple_set_subtunes (Tuple *tuple, int n_subtunes, const int *subtunes)
 
int tuple_get_n_subtunes (Tuple *tuple)
 
int tuple_get_nth_subtune (Tuple *tuple, int n)
 
char * tuple_format_title (Tuple *tuple, const char *format)
 

Detailed Description

Basic Tuple handling API.

Definition in file tuple.h.

Enumeration Type Documentation

anonymous enum

Ordered enum for basic #Tuple fields.

See Also
TupleBasicType
Enumerator
FIELD_ARTIST 
FIELD_TITLE 

Song title.

FIELD_ALBUM 

Album name.

FIELD_COMMENT 

Freeform comment.

FIELD_GENRE 

Song's genre.

FIELD_TRACK_NUMBER 
FIELD_LENGTH 

Track length in milliseconds.

FIELD_YEAR 

Year of production/performance/etc.

FIELD_QUALITY 

String representing quality, such as "lossy", "lossless", "sequenced".

FIELD_CODEC 

Codec name or similar.

FIELD_FILE_NAME 

File name part of the location URI.

FIELD_FILE_PATH 

Path part of the location URI.

FIELD_FILE_EXT 

Filename extension part of the location URI.

FIELD_SONG_ARTIST 
FIELD_COMPOSER 

Composer of song, if different than artist.

FIELD_PERFORMER 
FIELD_COPYRIGHT 
FIELD_DATE 
FIELD_SUBSONG_ID 

Index number of subsong/tune.

FIELD_SUBSONG_NUM 

Total number of subsongs in the file.

FIELD_MIMETYPE 
FIELD_BITRATE 

Bitrate in kbps.

FIELD_SEGMENT_START 
FIELD_SEGMENT_END 
FIELD_GAIN_ALBUM_GAIN 
FIELD_GAIN_ALBUM_PEAK 
FIELD_GAIN_TRACK_GAIN 
FIELD_GAIN_TRACK_PEAK 
FIELD_GAIN_GAIN_UNIT 
FIELD_GAIN_PEAK_UNIT 
TUPLE_FIELDS 

Definition at line 34 of file tuple.h.

Enumerator
TUPLE_STRING 
TUPLE_INT 
TUPLE_UNKNOWN 

Definition at line 82 of file tuple.h.

Function Documentation

Tuple* tuple_copy ( const Tuple *  old)

Creates a copy of given Tuple structure, with copied data.

Parameters
[in]srcTuple structure to be made a copy of.
Returns
Pointer to newly allocated Tuple.

Definition at line 335 of file tuple.c.

int tuple_field_by_name ( const char *  name)
const char* tuple_field_get_name ( int  field)

Definition at line 179 of file tuple.c.

Referenced by audacious_rc_get_tuple_fields().

TupleValueType tuple_field_get_type ( int  field)

Definition at line 187 of file tuple.c.

Referenced by tuple_evalctx_add_var().

char* tuple_format_title ( Tuple *  tuple,
const char *  format 
)

Definition at line 598 of file tuple.c.

Referenced by title_from_tuple().

int tuple_get_int ( const Tuple *  tuple,
int  nfield,
const char *  field 
)

Returns integer associated to #Tuple field.

Desired field can be specified either by key name or if it is one of basic fields, by TupleBasicType index.

Parameters
[in]tuple#Tuple structure pointer.
[in]cnfieldTupleBasicType index or -1 if key name is to be used instead.
[in]fieldString acting as key name or NULL if nfield is used.
Returns
Integer value or 0 if the field/key did not exist.
Bug:
There is no way to distinguish error situations if the associated value is zero.

Definition at line 507 of file tuple.c.

Referenced by entry_set_tuple_real(), read_gain_from_tuple(), tf_get_fieldval(), tuple_compare_int(), and tuple_value_to_gvalue().

int tuple_get_n_subtunes ( Tuple *  tuple)

Definition at line 576 of file tuple.c.

Referenced by add_file().

int tuple_get_nth_subtune ( Tuple *  tuple,
int  n 
)

Definition at line 586 of file tuple.c.

Referenced by add_file().

char* tuple_get_str ( const Tuple *  tuple,
int  nfield,
const char *  field 
)
TupleValueType tuple_get_value_type ( const Tuple *  tuple,
int  nfield,
const char *  field 
)

Returns TupleValueType of given #Tuple field.

Desired field can be specified either by key name or if it is one of basic fields, by TupleBasicType index.

Parameters
[in]tuple#Tuple structure pointer.
[in]cnfieldTupleBasicType index or -1 if key name is to be used instead.
[in]fieldString acting as key name or NULL if nfield is used.
Returns
TupleValueType of the field or TUPLE_UNKNOWN if there was an error.

Definition at line 457 of file tuple.c.

Referenced by entry_set_tuple_real(), tf_get_fieldval(), tuple_compare_int(), and tuple_value_to_gvalue().

Tuple* tuple_new ( void  )

Definition at line 268 of file tuple.c.

Referenced by tuple_copy(), and tuple_new_from_filename().

Tuple* tuple_new_from_filename ( const char *  filename)

Allocates a new #Tuple structure, setting filename/URI related fields based on the given filename argument by calling tuple_set_filename.

Parameters
[in]filenameFilename URI.
Returns
Pointer to newly allocated Tuple.

Definition at line 371 of file tuple.c.

Referenced by entry_set_failed().

Tuple* tuple_ref ( Tuple *  tuple)

Definition at line 275 of file tuple.c.

Referenced by playback_entry_get_tuple(), and playlist_entry_get_tuple().

void tuple_set_filename ( Tuple *  tuple,
const char *  filename 
)

Sets filename/URI related fields of a #Tuple structure, based on the given filename argument.

The fields set are: FIELD_FILE_PATH, FIELD_FILE_NAME and FIELD_FILE_EXT.

Parameters
[in]filenameFilename URI.
[in,out]tupleTuple structure to manipulate.

Definition at line 303 of file tuple.c.

Referenced by tuple_new_from_filename().

void tuple_set_format ( Tuple *  tuple,
const char *  format,
int  channels,
int  samplerate,
int  bitrate 
)

Definition at line 529 of file tuple.c.

void tuple_set_int ( Tuple *  tuple,
int  nfield,
const char *  field,
int  x 
)

Definition at line 379 of file tuple.c.

Referenced by tuple_set_filename(), and tuple_set_format().

void tuple_set_str ( Tuple *  tuple,
int  nfield,
const char *  field,
const char *  str 
)

Definition at line 394 of file tuple.c.

Referenced by tuple_set_filename(), and tuple_set_format().

void tuple_set_subtunes ( Tuple *  tuple,
int  n_subtunes,
const int subtunes 
)

Definition at line 562 of file tuple.c.

void tuple_unref ( Tuple *  tuple)
void tuple_unset ( Tuple *  tuple,
int  nfield,
const char *  field 
)

Definition at line 423 of file tuple.c.

Referenced by tuple_set_str().