2008-12-09 19:46:00 +00:00
|
|
|
/* vim: set sw=3 ts=3 sts=3 expandtab: */
|
2008-05-23 03:33:04 +00:00
|
|
|
#include "ecdb.h"
|
|
|
|
|
2008-06-04 00:24:13 +00:00
|
|
|
int transcode_data_cb(void *data, int type, void *event);
|
2008-06-04 01:12:34 +00:00
|
|
|
|
2008-06-04 00:24:13 +00:00
|
|
|
void
|
|
|
|
ecdb_audio_project_start(Ecdb_Audio_Project *proj)
|
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
char cmd[PATH_MAX]; //<-- + 20ish?
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* Fork off the gstreamer program for every file to be added
|
|
|
|
* Depending on the number of files, this can be pretty system intensive, so
|
|
|
|
* is there a way to reduce/control this ?
|
|
|
|
*/
|
2009-02-05 04:11:22 +00:00
|
|
|
for (i = 0; ECDB_BURN(proj)->files->children[i]; i++)
|
2008-12-09 05:47:59 +00:00
|
|
|
{
|
|
|
|
snprintf(cmd, PATH_MAX, "ecdb_transcode_helper %s",
|
2009-02-05 04:11:22 +00:00
|
|
|
ECDB_BURN(proj)->files->children[i]->dst);
|
2008-12-09 05:47:59 +00:00
|
|
|
ecore_exe_pipe_run(cmd, ECORE_EXE_PIPE_READ |
|
|
|
|
ECORE_EXE_PIPE_READ_LINE_BUFFERED, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
proj->num_tracks = i + 1;
|
|
|
|
ecore_event_handler_add(ECORE_EXE_EVENT_DATA, transcode_data_cb, proj);
|
2008-06-04 00:24:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
transcode_data_cb(void *data, int type, void *event)
|
|
|
|
{
|
2008-12-09 05:47:59 +00:00
|
|
|
const char *rec;
|
|
|
|
Ecore_Exe_Event_Data *ev = event;
|
|
|
|
Ecdb_Audio_Project *proj = data;
|
|
|
|
|
|
|
|
rec = ev->data;
|
|
|
|
proj->num_transcode_complete++;
|
|
|
|
|
2009-02-23 01:22:02 +00:00
|
|
|
EINA_ERROR_PDBG("Message: %s\n", rec);
|
2008-12-09 05:47:59 +00:00
|
|
|
|
|
|
|
if (!strcmp(rec, "EOS"))
|
|
|
|
{
|
2009-02-23 01:22:02 +00:00
|
|
|
EINA_ERROR_PDBG("Transcode complete\n");
|
2008-12-09 05:47:59 +00:00
|
|
|
proj->num_transcode_complete++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-23 01:22:02 +00:00
|
|
|
EINA_ERROR_PWARN("Error!\n"); // How to handle these?
|
2008-12-09 05:47:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (proj->num_tracks == proj->num_transcode_complete)
|
|
|
|
{
|
2009-02-23 01:22:02 +00:00
|
|
|
EINA_ERROR_PINFO("Hurrah, transcoding is done!\n");
|
2008-12-09 05:47:59 +00:00
|
|
|
|
|
|
|
/* Change to another event later */
|
|
|
|
ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, NULL, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
2008-06-04 00:24:13 +00:00
|
|
|
}
|
|
|
|
|