#ifndef ECDB_COMMON_H
#define ECDB_COMMON_H

/* Typdefs */
typedef struct burn_source BurnSource;
typedef struct burn_disc BurnDisc;
typedef struct burn_session BurnSession;
typedef struct burn_write_opts BurnWriteOpts;
typedef struct burn_track BurnTrack;
typedef struct burn_progress BurnProgress;
typedef struct burn_drive_info BurnDriveInfo;
typedef enum burn_drive_status BurnDriveStatus;

typedef enum _Ecdb_Project_Type Ecdb_Project_Type;
enum _Ecdb_Project_Type
{
	ECDB_BURN_PROJECT,
	ECDB_AUDIO_PROJECT,
	ECDB_ERASE_PROJECT,
	ECDB_COPY_PROJECT
};

typedef struct _Ecdb_Drive_Info Ecdb_Drive_Info;
struct _Ecdb_Drive_Info
{
	/* Speeds */
	int *read_speeds;
	int *write_speeds;

	/* Profiles */
	char *profile_name;
	int profile_loaded;

	/* Drive info */
	char *vendor;
	char *product;
	char *revision;
	char *location;

	unsigned char read_dvdram:1;
	unsigned char read_dvdr:1;
	unsigned char read_dvdrom:1;
	unsigned char read_cdr:1;
	unsigned char read_cdrw:1;
	unsigned char write_dvdram:1;
	unsigned char write_dvdr:1;
	unsigned char write_cdr:1;
	unsigned char write_simulate:1;

	BurnDriveInfo *tangible;
};

typedef struct _Ecdb_Project_Info Ecdb_Project;
struct _Ecdb_Project_Info
{
	/* The drive reference */
	Ecdb_Drive_Info *drive;
	BurnProgress progress;
	BurnDriveStatus stat;
	Ecore_Event_Handler *ev_handler;
	unsigned int type;
};

/* Typecast a pointer to an Ecdb_Source */
#define ECDB_SOURCE(src) ((Ecdb_Source *) src)

typedef struct _Ecdb_Source Ecdb_Source;
struct _Ecdb_Source
{
	char *dst;
	unsigned char dir:1;
	unsigned int num_children;
	Ecdb_Source **children;
	Ecdb_Source *parent;
	IsoNode *node;
};

/* Typecast a pointer to an Ecdb_Project */
#define ECDB_PROJECT(proj) ((Ecdb_Project *) proj)

typedef struct _Ecdb_Burn_Project Ecdb_Burn_Project;
struct _Ecdb_Burn_Project
{
	/* Inherit from normal project */
	Ecdb_Project proj;

	/* Files are important here */
	Ecdb_Source *files;

	/* Ids */
	char *volume_id;
	char *publisher_id;
	char *data_preparer_id;
	char *system_id;
	char *application_id;
	char *copywrite_id;
	char *abstract_id;
	char *biblio_id;

	/* iso options */
	unsigned char iso_level:1;
	unsigned char use_joliet:1;
	unsigned char use_rockridge:1;
	unsigned char follow_symlinks:1;
	unsigned char ignore_hidden:1;
	unsigned char ignore_special:1;
	unsigned char iso1990:1;

	/* burn options */
	unsigned char opc:1;
	unsigned char multi:1;
	unsigned char simulate:1;
	unsigned char underrun_proof:1;
	int speed;

	/* burn stuff */
	int fifo_chunksize;
	int fifo_chunks;
	int burn_mode;
};

/* Typecast a pointer to an Ecdb_Burn_Project */
#define ECDB_BURN(proj) ((Ecdb_Burn_Project *) proj)

typedef struct _Ecdb_Audio_Project Ecdb_Audio_Project;
struct _Ecdb_Audio_Project
{
	/* Inherit from normal project */
	Ecdb_Project proj;

	/* Audio tracks */
	Ecdb_Source *tracks;
	int num_tracks;
	int num_transcode_complete;
};

/* Typecast a pointer to an Ecdb_Audio_Project */
#define ECDB_AUDIO(proj) ((Ecdb_Audio_Project *) proj)

typedef struct _Ecdb_Erase_Project Ecdb_Erase_Project;
struct _Ecdb_Erase_Project
{
	/* Inherit from normal project */
	Ecdb_Project proj;

	/* Speed */
	unsigned char quick:1;
	unsigned char format:1;
};

/* Typecast a pointer to an Ecdb_Erase_Project */
#define ECDB_ERASE(proj) ((Ecdb_Erase_Project *) proj)

#endif
