static SLresult IAndroidBufferQueue_RegisterCallback(SLAndroidBufferQueueItf self, slAndroidBufferQueueCallback callback, void *pContext) { SL_ENTER_INTERFACE IAndroidBufferQueue *thiz = (IAndroidBufferQueue *) self; interface_lock_exclusive(thiz); // verify pre-condition that media object is in the SL_PLAYSTATE_STOPPED state if (SL_PLAYSTATE_STOPPED == getAssociatedState(thiz)) { thiz->mCallback = callback; thiz->mContext = pContext; // FIXME investigate why these two cases are not handled symmetrically any more switch (InterfaceToObjectID(thiz)) { case SL_OBJECTID_AUDIOPLAYER: result = android_audioPlayer_androidBufferQueue_registerCallback_l( (CAudioPlayer*) thiz->mThis); break; case XA_OBJECTID_MEDIAPLAYER: result = SL_RESULT_SUCCESS; break; default: result = SL_RESULT_PARAMETER_INVALID; } } else { result = SL_RESULT_PRECONDITIONS_VIOLATED; } interface_unlock_exclusive(thiz); SL_LEAVE_INTERFACE }
static SLresult IAndroidBufferQueue_RegisterCallback(SLAndroidBufferQueueItf self, slAndroidBufferQueueCallback callback, void *pContext) { SL_ENTER_INTERFACE IAndroidBufferQueue *thiz = (IAndroidBufferQueue *) self; interface_lock_exclusive(thiz); // verify pre-condition that media object is in the SL_PLAYSTATE_STOPPED state if (SL_PLAYSTATE_STOPPED == getAssociatedState(thiz)) { thiz->mCallback = callback; thiz->mContext = pContext; result = SL_RESULT_SUCCESS; } else { result = SL_RESULT_PRECONDITIONS_VIOLATED; } interface_unlock_exclusive(thiz); SL_LEAVE_INTERFACE }