libpulseaudio: always use u for userdata
This commit is contained in:
parent
9006223783
commit
8025f606e9
@ -109,8 +109,8 @@ static const char* const valid_modargs[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static void process_render(BufferQueueItf bq, void *context) {
|
static void process_render(BufferQueueItf bq, void *userdata) {
|
||||||
struct userdata* u = (struct userdata*) context;
|
struct userdata* u = userdata;
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
pa_assert(u);
|
pa_assert(u);
|
||||||
@ -149,25 +149,25 @@ static void process_render(BufferQueueItf bq, void *context) {
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pa_init_sles_player(struct userdata *s, SLint32 sl_rate)
|
static int pa_init_sles_player(struct userdata *u, SLint32 sl_rate)
|
||||||
{
|
{
|
||||||
if (s == NULL) return -1;
|
if (u == NULL) return -1;
|
||||||
|
|
||||||
// create engine
|
// create engine
|
||||||
CHK(slCreateEngine(&(s->engineObject), 0, NULL, 0, NULL, NULL));
|
CHK(slCreateEngine(&(u->engineObject), 0, NULL, 0, NULL, NULL));
|
||||||
CHK((*s->engineObject)->Realize(s->engineObject, SL_BOOLEAN_FALSE));
|
CHK((*u->engineObject)->Realize(u->engineObject, SL_BOOLEAN_FALSE));
|
||||||
|
|
||||||
CHK((*s->engineObject)->GetInterface(s->engineObject, SL_IID_ENGINE, &(s->engineEngine)));
|
CHK((*u->engineObject)->GetInterface(u->engineObject, SL_IID_ENGINE, &(u->engineEngine)));
|
||||||
|
|
||||||
// create output mix
|
// create output mix
|
||||||
CHK((*s->engineEngine)->CreateOutputMix(s->engineEngine, &(s->outputMixObject), 0, NULL, NULL));
|
CHK((*u->engineEngine)->CreateOutputMix(u->engineEngine, &(u->outputMixObject), 0, NULL, NULL));
|
||||||
CHK((*s->outputMixObject)->Realize(s->outputMixObject, SL_BOOLEAN_FALSE));
|
CHK((*u->outputMixObject)->Realize(u->outputMixObject, SL_BOOLEAN_FALSE));
|
||||||
|
|
||||||
// create audio player
|
// create audio player
|
||||||
|
|
||||||
SLDataLocator_OutputMix locator_outputmix;
|
SLDataLocator_OutputMix locator_outputmix;
|
||||||
locator_outputmix.locatorType = SL_DATALOCATOR_OUTPUTMIX;
|
locator_outputmix.locatorType = SL_DATALOCATOR_OUTPUTMIX;
|
||||||
locator_outputmix.outputMix = s->outputMixObject;
|
locator_outputmix.outputMix = u->outputMixObject;
|
||||||
|
|
||||||
SLDataLocator_BufferQueue locator_bufferqueue;
|
SLDataLocator_BufferQueue locator_bufferqueue;
|
||||||
locator_bufferqueue.locatorType = DATALOCATOR_BUFFERQUEUE;
|
locator_bufferqueue.locatorType = DATALOCATOR_BUFFERQUEUE;
|
||||||
@ -197,15 +197,15 @@ static int pa_init_sles_player(struct userdata *s, SLint32 sl_rate)
|
|||||||
|
|
||||||
SLInterfaceID ids[1] = {IID_BUFFERQUEUE};
|
SLInterfaceID ids[1] = {IID_BUFFERQUEUE};
|
||||||
SLboolean flags[1] = {SL_BOOLEAN_TRUE};
|
SLboolean flags[1] = {SL_BOOLEAN_TRUE};
|
||||||
CHK((*s->engineEngine)->CreateAudioPlayer(s->engineEngine, &s->bqPlayerObject, &audiosrc, &audiosnk, 1, ids, flags));
|
CHK((*u->engineEngine)->CreateAudioPlayer(u->engineEngine, &u->bqPlayerObject, &audiosrc, &audiosnk, 1, ids, flags));
|
||||||
CHK((*s->bqPlayerObject)->Realize(s->bqPlayerObject, SL_BOOLEAN_FALSE));
|
CHK((*u->bqPlayerObject)->Realize(u->bqPlayerObject, SL_BOOLEAN_FALSE));
|
||||||
|
|
||||||
CHK((*s->bqPlayerObject)->GetInterface(s->bqPlayerObject, SL_IID_PLAY, &s->bqPlayerPlay));
|
CHK((*u->bqPlayerObject)->GetInterface(u->bqPlayerObject, SL_IID_PLAY, &u->bqPlayerPlay));
|
||||||
CHK((*s->bqPlayerObject)->GetInterface(s->bqPlayerObject, IID_BUFFERQUEUE_USED, &s->bqPlayerBufferQueue));
|
CHK((*u->bqPlayerObject)->GetInterface(u->bqPlayerObject, IID_BUFFERQUEUE_USED, &u->bqPlayerBufferQueue));
|
||||||
|
|
||||||
CHK((*s->bqPlayerBufferQueue)->RegisterCallback(s->bqPlayerBufferQueue, process_render, s));
|
CHK((*u->bqPlayerBufferQueue)->RegisterCallback(u->bqPlayerBufferQueue, process_render, u));
|
||||||
|
|
||||||
CHK((*s->bqPlayerPlay)->SetPlayState(s->bqPlayerPlay, SL_PLAYSTATE_PLAYING));
|
CHK((*u->bqPlayerPlay)->SetPlayState(u->bqPlayerPlay, SL_PLAYSTATE_PLAYING));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -215,12 +215,12 @@ fail:
|
|||||||
|
|
||||||
#undef CHK
|
#undef CHK
|
||||||
|
|
||||||
static void pa_destroy_sles_player(struct userdata *s){
|
static void pa_destroy_sles_player(struct userdata *u){
|
||||||
if (s == NULL) return;
|
if (u == NULL) return;
|
||||||
(*s->bqPlayerPlay)->SetPlayState(s->bqPlayerPlay, SL_PLAYSTATE_STOPPED);
|
(*u->bqPlayerPlay)->SetPlayState(u->bqPlayerPlay, SL_PLAYSTATE_STOPPED);
|
||||||
(*s->bqPlayerObject)->Destroy(s->bqPlayerObject);
|
(*u->bqPlayerObject)->Destroy(u->bqPlayerObject);
|
||||||
(*s->outputMixObject)->Destroy(s->outputMixObject);
|
(*u->outputMixObject)->Destroy(u->outputMixObject);
|
||||||
(*s->engineObject)->Destroy(s->engineObject);
|
(*u->engineObject)->Destroy(u->engineObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void thread_func(void *userdata) {
|
static void thread_func(void *userdata) {
|
||||||
|
Loading…
Reference in New Issue
Block a user