aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorPaul Adenot <[email protected]>2022-09-21 11:07:18 -0700
committerMatthew Gregan <[email protected]>2022-09-22 08:32:32 +1200
commitbc0450628e120dbee89fb8ad0b29abbd24dc3729 (patch)
treee061392cd719e1248135e67bcd2bef5afbf3ec8f /src
parent28c8aa4a9c3568187e16e3a47a0d16371d1c5d33 (diff)
downloadcubeb-bc0450628e120dbee89fb8ad0b29abbd24dc3729.tar.gz
cubeb-bc0450628e120dbee89fb8ad0b29abbd24dc3729.zip
Simplify initialization of opensl backend
Diffstat (limited to 'src')
-rw-r--r--src/cubeb-sles.h38
-rw-r--r--src/cubeb_opensl.c13
2 files changed, 7 insertions, 44 deletions
diff --git a/src/cubeb-sles.h b/src/cubeb-sles.h
deleted file mode 100644
index ca93543..0000000
--- a/src/cubeb-sles.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright © 2016 Mozilla Foundation
- *
- * This program is made available under an ISC-style license. See the
- * accompanying file LICENSE for details.
- */
-
-#ifndef _CUBEB_SLES_H_
-#define _CUBEB_SLES_H_
-#include <SLES/OpenSLES.h>
-
-static SLresult
-cubeb_get_sles_engine(SLObjectItf * pEngine, SLuint32 numOptions,
- const SLEngineOption * pEngineOptions,
- SLuint32 numInterfaces,
- const SLInterfaceID * pInterfaceIds,
- const SLboolean * pInterfaceRequired)
-{
- return slCreateEngine(pEngine, numOptions, pEngineOptions, numInterfaces,
- pInterfaceIds, pInterfaceRequired);
-}
-
-static void
-cubeb_destroy_sles_engine(SLObjectItf * self)
-{
- if (*self != NULL) {
- (**self)->Destroy(*self);
- *self = NULL;
- }
-}
-
-static SLresult
-cubeb_realize_sles_engine(SLObjectItf self)
-{
- return (*self)->Realize(self, SL_BOOLEAN_FALSE);
-}
-
-#endif
diff --git a/src/cubeb_opensl.c b/src/cubeb_opensl.c
index e596998..efac34d 100644
--- a/src/cubeb_opensl.c
+++ b/src/cubeb_opensl.c
@@ -23,7 +23,6 @@
#endif
#include "android/cubeb-output-latency.h"
#include "cubeb-internal.h"
-#include "cubeb-sles.h"
#include "cubeb/cubeb.h"
#include "cubeb_android.h"
#include "cubeb_array_queue.h"
@@ -728,14 +727,14 @@ opensl_init(cubeb ** context, char const * context_name)
const SLEngineOption opt[] = {{SL_ENGINEOPTION_THREADSAFE, SL_BOOLEAN_TRUE}};
SLresult res;
- res = cubeb_get_sles_engine(&ctx->engObj, 1, opt, 0, NULL, NULL);
+ res = f_slCreateEngine(&ctx->engObj, 1, opt, 0, NULL, NULL);
if (res != SL_RESULT_SUCCESS) {
opensl_destroy(ctx);
return CUBEB_ERROR;
}
- res = cubeb_realize_sles_engine(ctx->engObj);
+ res = (*ctx->engObj)->Realize(ctx->engObj, SL_BOOLEAN_FALSE);
if (res != SL_RESULT_SUCCESS) {
opensl_destroy(ctx);
return CUBEB_ERROR;
@@ -796,10 +795,12 @@ opensl_get_max_channel_count(cubeb * ctx, uint32_t * max_channels)
static void
opensl_destroy(cubeb * ctx)
{
- if (ctx->outmixObj)
+ if (ctx->outmixObj) {
(*ctx->outmixObj)->Destroy(ctx->outmixObj);
- if (ctx->engObj)
- cubeb_destroy_sles_engine(&ctx->engObj);
+ }
+ if (ctx->engObj) {
+ (*ctx->engObj)->Destroy(ctx->engObj);
+ }
dlclose(ctx->lib);
if (ctx->p_output_latency_function)
cubeb_output_latency_unload_method(ctx->p_output_latency_function);