Audio transcoding works correctly. Added a bunch of cleanup functions
This commit is contained in:
@ -33,22 +33,33 @@ ecdb_audio_project_init(Ecdb_Audio_Project *proj)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_audio_project_destroy(Ecdb_Audio_Project *proj)
|
||||
{
|
||||
ecdb_source_destroy(proj->tracks);
|
||||
ecdb_project_destroy(ECDB_PROJECT(proj));
|
||||
free(proj);
|
||||
}
|
||||
|
||||
void
|
||||
ecdb_audio_project_start(Ecdb_Audio_Project *proj)
|
||||
{
|
||||
char cmd[PATH_MAX]; //<-- + 20ish?
|
||||
int i;
|
||||
|
||||
/* Fork off the gstreamer program for every file to be added */
|
||||
/* 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 ?
|
||||
*/
|
||||
for (i = 0; proj->tracks->children[i]; i++)
|
||||
{
|
||||
snprintf(cmd, PATH_MAX, "ecdb_transcode_helper %s",
|
||||
proj->tracks->children[i]->dst);
|
||||
ecore_exe_pipe_run(cmd, ECORE_EXE_PIPE_READ |
|
||||
ECORE_EXE_PIPE_AUTO, NULL);
|
||||
ECORE_EXE_PIPE_READ_LINE_BUFFERED, NULL);
|
||||
}
|
||||
|
||||
proj->num_tracks = i - 1;
|
||||
proj->num_tracks = i;
|
||||
ecore_event_handler_add(ECORE_EXE_EVENT_DATA, transcode_data_cb, proj);
|
||||
}
|
||||
|
||||
@ -60,6 +71,7 @@ transcode_data_cb(void *data, int type, void *event)
|
||||
Ecdb_Audio_Project *proj = data;
|
||||
|
||||
rec = ev->data;
|
||||
proj->num_transcode_complete++;
|
||||
|
||||
printf("Message: %s\n", rec);
|
||||
|
||||
@ -74,7 +86,12 @@ transcode_data_cb(void *data, int type, void *event)
|
||||
printf("Error!\n");
|
||||
|
||||
if (proj->num_tracks == proj->num_transcode_complete)
|
||||
{
|
||||
printf("Hurrah, transcoding is done!\n");
|
||||
|
||||
/* Change to another event later */
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user