experimental-legacy/ecdb/trunk/src/ecdb_projects.c

263 lines
4.7 KiB
C

/* vim: set sw=3 ts=3 sts=3 expandtab: */
#include "ecdb.h"
int ecdb_project_init(Ecdb_Project *proj);
int ecdb_burn_project_init(Ecdb_Burn_Project *proj);
int ecdb_erase_project_init(Ecdb_Erase_Project *proj);
int ecdb_audio_project_init(Ecdb_Audio_Project *proj);
int ecdb_data_project_init(Ecdb_Data_Project *proj);
int ecdb_image_project_init(Ecdb_Image_Project *proj);
Ecdb_Project *
ecdb_project_new(void)
{
Ecdb_Project *proj;
proj = calloc(1, sizeof(Ecdb_Project));
if (!proj)
{
return NULL;
}
if (!ecdb_project_init(proj))
{
FREE(proj);
return NULL;
}
return proj;
}
int
ecdb_project_init(Ecdb_Project *proj)
{
return TRUE;
}
void
ecdb_project_destroy(Ecdb_Project *proj)
{
if (proj->ev_handler) ecore_event_handler_del(proj->ev_handler);
if (proj->pipe) ecore_pipe_del(proj->pipe);
printf("Destroying base project\n");
}
void
ecdb_project_type_set(Ecdb_Project *proj, unsigned int t)
{
proj->type = t;
}
Ecdb_Burn_Project *
ecdb_burn_project_new(void)
{
Ecdb_Burn_Project *proj;
proj = calloc(1, sizeof(Ecdb_Burn_Project));
if (!proj)
return NULL;
if (!ecdb_burn_project_init(proj))
{
FREE(proj);
return NULL;
}
return proj;
}
int
ecdb_burn_project_init(Ecdb_Burn_Project *proj)
{
if (!ecdb_project_init(ECDB_PROJECT(proj)))
return FALSE;
/* Create some sane defaults */
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_BURN_PROJECT);
proj->burn_mode = BURN_MODE1;
proj->fifo_chunksize = 2048;
proj->fifo_chunks = 2048;
proj->underrun_proof = TRUE;
proj->files = ecdb_source_new();
proj->opc = TRUE;
proj->multi = TRUE;
return TRUE;
}
void
ecdb_burn_project_destroy(Ecdb_Burn_Project *proj)
{
if (proj->files) ecdb_source_destroy(proj->files);
ecdb_project_destroy(ECDB_PROJECT(proj));
printf("Destroying burn project\n");
}
Ecdb_Erase_Project *
ecdb_erase_project_new(void)
{
Ecdb_Erase_Project *proj;
proj = calloc(1, sizeof(Ecdb_Erase_Project));
if (!proj)
{
return NULL;
}
if (!ecdb_erase_project_init(proj))
{
FREE(proj);
return NULL;
}
return proj;
}
int
ecdb_erase_project_init(Ecdb_Erase_Project *proj)
{
if (!ecdb_project_init(ECDB_PROJECT(proj)))
{
return FALSE;
}
/* Proper defaults */
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_ERASE_PROJECT);
proj->quick = TRUE;
proj->format = FALSE;
return TRUE;
}
void
ecdb_erase_project_destroy(Ecdb_Erase_Project *proj)
{
ecdb_project_destroy(ECDB_PROJECT(proj));
FREE(proj);
}
Ecdb_Audio_Project *
ecdb_audio_project_new(void)
{
Ecdb_Audio_Project *proj;
proj = calloc(1, sizeof(Ecdb_Audio_Project));
if (!proj)
{
return NULL;
}
if (!ecdb_audio_project_init(proj))
{
FREE(proj);
return NULL;
}
return proj;
}
int
ecdb_audio_project_init(Ecdb_Audio_Project *proj)
{
if (!ecdb_burn_project_init(ECDB_BURN(proj)))
{
return FALSE;
}
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_AUDIO_PROJECT);
return TRUE;
}
void
ecdb_audio_project_destroy(Ecdb_Audio_Project *proj)
{
ecdb_burn_project_destroy(ECDB_BURN(proj));
FREE(proj);
}
Ecdb_Data_Project *
ecdb_data_project_new(void)
{
Ecdb_Data_Project *proj;
proj = calloc(1, sizeof(Ecdb_Data_Project));
if (!proj)
{
return NULL;
}
if (!ecdb_data_project_init(proj))
{
FREE(proj);
return NULL;
}
return proj;
}
int
ecdb_data_project_init(Ecdb_Data_Project *proj)
{
if (!ecdb_burn_project_init(ECDB_BURN(proj)))
{
return FALSE;
}
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_DATA_PROJECT);
proj->use_joliet = TRUE;
proj->use_rockridge = TRUE;
proj->iso_level = 3;
return TRUE;
}
void
ecdb_data_project_destroy(Ecdb_Data_Project *proj)
{
FREE(proj->volume_id);
FREE(proj->publisher_id);
FREE(proj->data_preparer_id);
FREE(proj->system_id);
FREE(proj->application_id);
FREE(proj->copywrite_id);
FREE(proj->abstract_id);
FREE(proj->biblio_id);
ecdb_burn_project_destroy(ECDB_BURN(proj));
FREE(proj);
}
Ecdb_Image_Project *
ecdb_image_project_new(void)
{
Ecdb_Image_Project *proj;
proj = calloc(1, sizeof(Ecdb_Image_Project));
if (!proj)
{
return NULL;
}
if (!ecdb_image_project_init(proj))
{
FREE(proj);
return NULL;
}
return proj;
}
int
ecdb_image_project_init(Ecdb_Image_Project *proj)
{
if (!ecdb_burn_project_init(ECDB_BURN(proj)))
return FALSE;
ecdb_project_type_set(ECDB_PROJECT(proj), ECDB_IMAGE_PROJECT);
return TRUE;
}
void
ecdb_image_project_destroy(Ecdb_Image_Project *proj)
{
ecdb_burn_project_destroy(ECDB_BURN(proj));
FREE(proj);
}