static int cdumb_init (DB_fileinfo_t *_info, DB_playItem_t *it) { trace ("cdumb_init %s\n", deadbeef->pl_find_meta (it, ":URI")); dumb_info_t *info = (dumb_info_t *)_info; int is_dos, is_it, is_ptcompat; deadbeef->pl_lock (); { const char *uri = deadbeef->pl_find_meta (it, ":URI"); const char *ext = uri + strlen (uri) - 1; while (*ext != '.' && ext > uri) { ext--; } ext++; const char *ftype; info->duh = g_open_module (uri, &is_it, &is_dos, &is_ptcompat, 0, &ftype); } deadbeef->pl_unlock (); dumb_it_do_initial_runthrough (info->duh); _info->plugin = &plugin; _info->fmt.bps = conf_bps; _info->fmt.channels = 2; _info->fmt.samplerate = conf_samplerate; _info->readpos = 0; _info->fmt.channelmask = _info->fmt.channels == 1 ? DDB_SPEAKER_FRONT_LEFT : (DDB_SPEAKER_FRONT_LEFT | DDB_SPEAKER_FRONT_RIGHT); if (cdumb_startrenderer (_info) < 0) { return -1; } trace ("cdumb_init success (ptr=%p)\n", _info); return 0; }
static DB_playItem_t * cdumb_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { const char *ext = strrchr (fname, '.'); if (ext) { ext++; } else { ext = ""; } int is_it; int is_dos; int is_ptcompat; const char *ftype = NULL; DUH* duh = g_open_module(fname, &is_it, &is_dos, &is_ptcompat, 0, &ftype); if (!duh) { return NULL; } DB_playItem_t *it = deadbeef->pl_item_alloc_init (fname, plugin.plugin.id); DUMB_IT_SIGDATA * itsd = duh_get_it_sigdata(duh); read_metadata_internal (it, itsd); dumb_it_do_initial_runthrough (duh); deadbeef->plt_set_item_duration (plt, it, duh_get_length (duh)/65536.0f); deadbeef->pl_add_meta (it, ":FILETYPE", ftype); // printf ("duration: %f\n", _info->duration); after = deadbeef->plt_insert_item (plt, after, it); deadbeef->pl_item_unref (it); unload_duh (duh); return after; }
DUH *dumb_load_any(const char *filename, int restrict_, int subsong) { DUH *duh = dumb_load_any_quick(filename, restrict_, subsong); dumb_it_do_initial_runthrough(duh); return duh; }
DUH *DUMBEXPORT dumb_read_amf(DUMBFILE *f) { DUH *duh = dumb_read_amf_quick(f); dumb_it_do_initial_runthrough(duh); return duh; }
/* dumb_load_amf(): loads a AMF file into a DUH struct, returning a pointer * to the DUH struct. When you have finished with it, you must pass the * pointer to unload_duh() so that the memory can be freed. */ DUH *dumb_load_amf(const char *filename) { DUH *duh = dumb_load_amf_quick(filename); dumb_it_do_initial_runthrough(duh); return duh; }
DUH *dumb_read_mod(DUMBFILE *f, int _drestrict) { DUH *duh = dumb_read_mod_quick(f, _drestrict); dumb_it_do_initial_runthrough(duh); return duh; }
DUH *DUMBEXPORT dumb_load_mod(const char *filename, int restrict_) { DUH *duh = dumb_load_mod_quick(filename, restrict_); dumb_it_do_initial_runthrough(duh); return duh; }
DUH *dumb_read_xm(DUMBFILE *f) { DUH *duh = dumb_read_xm_quick(f); dumb_it_do_initial_runthrough(duh); return duh; }
/* dumb_load_mtm(): loads a MTM file into a DUH struct, returning a pointer * to the DUH struct. When you have finished with it, you must pass the * pointer to unload_duh() so that the memory can be freed. */ DUH *DUMBEXPORT dumb_load_mtm(const char *filename) { DUH *duh = dumb_load_mtm_quick(filename); dumb_it_do_initial_runthrough(duh); return duh; }