static gboolean dsp_deinit(GstDspDummy *self) { gboolean ret = TRUE; if (self->node) { if (!destroy_node(self->dsp_handle, self->node)) { GST_ERROR("dsp node destroy failed"); ret = FALSE; } self->node = NULL; } if (self->proc) { if (!dsp_detach(self->dsp_handle, self->proc)) { GST_ERROR("dsp detach failed"); ret = FALSE; } self->proc = NULL; } if (self->dsp_handle >= 0) { if (dsp_close(self->dsp_handle) < 0) { GST_ERROR("dsp close failed"); ret = FALSE; } self->dsp_handle = -1; } return ret; }
int main(int argc, const char **argv) { struct dsp_node *node; int ret = 0; unsigned i; signal(SIGINT, signal_handler); #ifdef DEBUG debug_level = 3; #endif ntimes = 1000; argc--; argv++; handle_options(&argc, &argv); dsp_handle = dsp_open(); if (dsp_handle < 0) { pr_err("dsp open failed"); return -1; } if (!dsp_attach(dsp_handle, 0, NULL, &proc)) { pr_err("dsp attach failed"); ret = -1; goto leave; } node = create_node(); if (!node) { pr_err("dsp node creation failed"); ret = -1; goto leave; } run_task(node, ntimes); destroy_node(node); leave: if (proc) { if (!dsp_detach(dsp_handle, proc)) { pr_err("dsp detach failed"); ret = -1; } proc = NULL; } for (i = 0; i < ARRAY_SIZE(events); i++) free(events[i]); if (dsp_handle > 0) { if (dsp_close(dsp_handle) < 0) { pr_err("dsp close failed"); return -1; } } return ret; }
int main(int argc, const char **argv) { struct dsp_node *node; int ret = 0; signal(SIGINT, signal_handler); #ifdef DEBUG debug_level = 3; #endif dsp_handle = dsp_open(); if (dsp_handle < 0) { pr_err("dsp open failed"); return -1; } if (!dsp_attach(dsp_handle, 0, NULL, &proc)) { pr_err("dsp attach failed"); ret = -1; goto leave; } node = create_node(); if (!node) { pr_err("dsp node creation failed"); ret = -1; goto leave; } run_task(node); destroy_node(node); leave: if (proc) { if (!dsp_detach(dsp_handle, proc)) { pr_err("dsp detach failed"); ret = -1; } proc = NULL; } if (dsp_handle > 0) { if (dsp_close(dsp_handle) < 0) { pr_err("dsp close failed"); return -1; } } return ret; }
static gboolean dsp_init(GstDspDummy *self) { int dsp_handle; self->dsp_handle = dsp_handle = dsp_open(); if (dsp_handle < 0) { GST_ERROR("dsp open failed"); return FALSE; } if (!dsp_attach(dsp_handle, 0, NULL, &self->proc)) { GST_ERROR("dsp attach failed"); goto fail; } self->node = create_node(dsp_handle, self->proc); if (!self->node) { GST_ERROR("dsp node creation failed"); goto fail; } return TRUE; fail: if (self->proc) { if (!dsp_detach(dsp_handle, self->proc)) GST_ERROR("dsp detach failed"); self->proc = NULL; } if (self->dsp_handle >= 0) { if (dsp_close(dsp_handle) < 0) GST_ERROR("dsp close failed"); self->dsp_handle = -1; } return FALSE; }
int main(int argc, const char **argv) { int ret = 0; int dsp_handle; void *proc; char *cmd[1]; if (argc != 2) { pr_err("Wrong arguments: %s <dsp_program>", argv[0]); return -1; } dsp_handle = dsp_open(); if (dsp_handle < 0) { pr_err("dsp open failed"); return -1; } if (!dsp_attach(dsp_handle, 0, NULL, &proc)) { pr_err("dsp attach failed"); ret = -1; goto leave; } if (!dsp_stop(dsp_handle, proc)) { pr_err("dsp stop failed"); ret = -1; goto leave; } cmd[0] = (char *) argv[1]; if (!dsp_load(dsp_handle, proc, 1, cmd, NULL)) { pr_err("dsp load failed"); ret = -1; goto leave; } if (!dsp_start(dsp_handle, proc)) { pr_err("dsp start failed"); ret = -1; } leave: if (proc) { if (!dsp_detach(dsp_handle, proc)) { pr_err("dsp detach failed"); ret = -1; } proc = NULL; } if (dsp_handle > 0) { if (dsp_close(dsp_handle) < 0) { pr_err("dsp close failed"); return -1; } } return ret; }