Skip to content
Snippets Groups Projects
Commit 93ff79ea authored by Mans Rullgard's avatar Mans Rullgard
Browse files

bluos_ssc: support latest version

parent a573e87e
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,12 @@ static struct ssc_decode *(*lssc_decode_open)(
int *channels, int *rate1, int *bits, int rate2,
get_samples_fn, consume_fn, write_samples_fn, write_size_fn,
int *fd, void **cb_data, int options, const char *device);
static struct ssc_decode *(*lssc_decode_open_reader)(
int *channels, int *rate1, int *bits, int rate2,
get_samples_fn, consume_fn, write_samples_fn, write_size_fn,
int *fd, void **cb_data, int options, int device_options,
int16_t *debug, const char *device, const char **devstr,
const char *blob);
static int (*lssc_decode_read)(struct ssc_decode *);
static const char *(*lssc_decode_device)(struct ssc_decode *);
static const char *(*lssc_decode_status)(struct ssc_decode *);
......@@ -51,11 +57,11 @@ static void (*lssc_render_close)(struct ssc_render *sscr);
static int ssc_error;
static void *do_dlsym(void *dl, const char *sym)
static void *do_dlsym(void *dl, const char *sym, int opt)
{
void *r = dlsym(dl, sym);
if (!r) {
if (!r && !opt) {
fprintf(stderr, "%s\n", dlerror());
ssc_error |= 1;
}
......@@ -70,22 +76,29 @@ int ssc_init(const char *lib)
if (!lib)
lib = "libbluos_ssc.so";
dl = dlopen(lib, RTLD_LAZY | RTLD_LOCAL);
dl = dlopen(lib, RTLD_NOW | RTLD_LOCAL);
if (!dl) {
fprintf(stderr, "%s: %s\n", lib, dlerror());
return -1;
}
lssc_decode_open = do_dlsym(dl, "ssc_decode_open");
lssc_decode_read = do_dlsym(dl, "ssc_decode_read");
lssc_decode_device = do_dlsym(dl, "ssc_decode_device");
lssc_decode_status = do_dlsym(dl, "ssc_decode_status");
lssc_decode_close = do_dlsym(dl, "ssc_decode_close");
lssc_decode_open = do_dlsym(dl, "ssc_decode_open", 1);
lssc_decode_open_reader = do_dlsym(dl, "ssc_decode_open_reader", 1);
if (!lssc_decode_open && !lssc_decode_open_reader) {
fprintf(stderr, "%s\n", dlerror());
return -1;
}
lssc_render_init = do_dlsym(dl, "ssc_render_init");
lssc_render = do_dlsym(dl, "ssc_render");
lssc_render_free = do_dlsym(dl, "ssc_render_free");
lssc_render_close = do_dlsym(dl, "ssc_render_close");
lssc_decode_read = do_dlsym(dl, "ssc_decode_read", 0);
lssc_decode_device = do_dlsym(dl, "ssc_decode_device", 1);
lssc_decode_status = do_dlsym(dl, "ssc_decode_status", 0);
lssc_decode_close = do_dlsym(dl, "ssc_decode_close", 0);
lssc_render_init = do_dlsym(dl, "ssc_render_init", 0);
lssc_render = do_dlsym(dl, "ssc_render", 0);
lssc_render_free = do_dlsym(dl, "ssc_render_free", 0);
lssc_render_close = do_dlsym(dl, "ssc_render_close", 0);
return ssc_error ? -1 : 0;
}
......@@ -96,11 +109,26 @@ int ssc_decode_open(struct ssc_decode **sscd,
write_samples_fn write_samples, write_size_fn write_size,
void *cb_data, int options)
{
const char *dev;
const char *dev = NULL;
int ssc_api;
int dummy = 0;
int nc = 0;
if (lssc_decode_open_reader) {
*sscd = lssc_decode_open_reader(
&channels, &rate1, &bits, rate2,
get_samples, consume, write_samples, write_size,
&dummy, &cb_data, options, 0,
NULL, "dev", &dev, "default");
if (!*sscd) {
fprintf(stderr, "ssc_decode_open_reader failed\n");
return -1;
}
return 2;
}
*sscd = lssc_decode_open(&channels, &rate1, &bits, rate2,
get_samples, consume, write_samples,
write_size, &dummy, &cb_data,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment