Cue Parser

Cue Parser — CUE Parser.

Synopsis

#include <rclib-cue.h>

struct              RCLibCueData;
enum                RCLibCueInputType;
struct              RCLibCueTrack;
void                rclib_cue_free                      (RCLibCueData *data);
const gchar *       rclib_cue_get_fallback_encoding     ();
gboolean            rclib_cue_get_track_num             (const gchar *path,
                                                         gchar **cue_path,
                                                         gint *track_num);
guint               rclib_cue_read_data                 (const gchar *input,
                                                         RCLibCueInputType type,
                                                         RCLibCueData *data);
void                rclib_cue_set_fallback_encoding     (const gchar *encoding);

Description

The data structures and functions for parse track data in CUE sheet files.

Details

struct RCLibCueData

struct RCLibCueData {
    RCLibCueInputType type;
    gchar *file;
    gchar *performer;
    gchar *title;
    gchar *genre;
    guint year;
    guint length;
    RCLibCueTrack *track;
};

The structure for CUE sheet data.

RCLibCueInputType type;

the input type of the CUE file

gchar *file;

the audio file URI

gchar *performer;

the performer

gchar *title;

the title (it is usually the album name)

gchar *genre;

the genre

guint year;

the year number

guint length;

the track length (number)

RCLibCueTrack *track;

the track data

enum RCLibCueInputType

typedef enum {
    RCLIB_CUE_INPUT_URI = 0,
    RCLIB_CUE_INPUT_PATH = 1,
    RCLIB_CUE_INPUT_EMBEDDED = 2
} RCLibCueInputType;

The input data type of CUE.

RCLIB_CUE_INPUT_URI

the input data is a URI

RCLIB_CUE_INPUT_PATH

the input data is a file path

RCLIB_CUE_INPUT_EMBEDDED

the input data is from a embedded CUE tag

struct RCLibCueTrack

struct RCLibCueTrack {
    guint index;
    gchar *title;
    gchar *performer;
    guint64 time0;
    guint64 time1;
};

The track data structure of CUE data.

guint index;

the track index

gchar *title;

the track title

gchar *performer;

the track performer (artist)

guint64 time0;

the INDEX 00 time

guint64 time1;

the INDEX 01 time (start time)

rclib_cue_free ()

void                rclib_cue_free                      (RCLibCueData *data);

Free the CUE data. Notice that the pointer itself will not be free.

data :

the CUE data to free

rclib_cue_get_fallback_encoding ()

const gchar *       rclib_cue_get_fallback_encoding     ();

Get the fallback encoding used in the CUE parser, NULL if not set.


rclib_cue_get_track_num ()

gboolean            rclib_cue_get_track_num             (const gchar *path,
                                                         gchar **cue_path,
                                                         gint *track_num);

Get the CUE path/URI and track number from given path/URI.

e.g. For the given path "/home/test/1.cue:1", you will get path "/home/test/1.cue", and track number 1.

path :

the file path or URI

cue_path :

the file path or URI of the CUE file. [out][allow-none]

track_num :

the track number. [out][allow-none]

Returns :

Whether the path/URI is valid.

rclib_cue_read_data ()

guint               rclib_cue_read_data                 (const gchar *input,
                                                         RCLibCueInputType type,
                                                         RCLibCueData *data);

Read and parse data from CUE file or string.

input :

the input data

type :

the data type of the input data

data :

the parsed CUE data. [out]

Returns :

The track number, 0 if the CUE data is incorrect.

rclib_cue_set_fallback_encoding ()

void                rclib_cue_set_fallback_encoding     (const gchar *encoding);

Set the fallback encoding for CUE parser.

encoding :

the new fallback encoding