Lines Matching refs:mp
42 CMediaPlayer* mp = (CMediaPlayer*) user; in player_handleMediaPlayerEventNotifications() local
43 if (!android::CallbackProtector::enterCbIfOk(mp->mCallbackProtector)) { in player_handleMediaPlayerEventNotifications()
57 SL_LOGV("Received GenericPlayer::kEventPrepared for CMediaPlayer %p", mp); in player_handleMediaPlayerEventNotifications()
64 object_lock_exclusive(&mp->mObject); in player_handleMediaPlayerEventNotifications()
67 assert(mp->mAndroidObjState == ANDROID_PREPARING); in player_handleMediaPlayerEventNotifications()
68 mp->mAndroidObjState = ANDROID_READY; in player_handleMediaPlayerEventNotifications()
79 if (IsInterfaceInitialized(&mp->mObject, MPH_XAPREFETCHSTATUS)) { in player_handleMediaPlayerEventNotifications()
80 mp->mPrefetchStatus.mLevel = 0; in player_handleMediaPlayerEventNotifications()
81 mp->mPrefetchStatus.mStatus = SL_PREFETCHSTATUS_UNDERFLOW; in player_handleMediaPlayerEventNotifications()
82 if (!(~mp->mPrefetchStatus.mCallbackEventsMask & in player_handleMediaPlayerEventNotifications()
84 callback = mp->mPrefetchStatus.mCallback; in player_handleMediaPlayerEventNotifications()
85 callbackPContext = mp->mPrefetchStatus.mContext; in player_handleMediaPlayerEventNotifications()
91 object_unlock_exclusive(&mp->mObject); in player_handleMediaPlayerEventNotifications()
95 (*callback)(&mp->mPrefetchStatus.mItf, callbackPContext, events); in player_handleMediaPlayerEventNotifications()
103 data1, data2, mp); in player_handleMediaPlayerEventNotifications()
105 object_lock_exclusive(&mp->mObject); in player_handleMediaPlayerEventNotifications()
108 for(size_t i=0 ; i < mp->mStreamInfo.mStreamInfoTable.size() ; i++) { in player_handleMediaPlayerEventNotifications()
109 if (XA_DOMAINTYPE_VIDEO == mp->mStreamInfo.mStreamInfoTable.itemAt(i).domain) { in player_handleMediaPlayerEventNotifications()
110 mp->mStreamInfo.mStreamInfoTable.removeAt(i); in player_handleMediaPlayerEventNotifications()
123 StreamInfo &contInfo = mp->mStreamInfo.mStreamInfoTable.editItemAt(0); in player_handleMediaPlayerEventNotifications()
125 ssize_t index = mp->mStreamInfo.mStreamInfoTable.add(streamInfo); in player_handleMediaPlayerEventNotifications()
128 xaStreamEventChangeCallback callback = mp->mStreamInfo.mCallback; in player_handleMediaPlayerEventNotifications()
129 void* callbackPContext = mp->mStreamInfo.mContext; in player_handleMediaPlayerEventNotifications()
131 object_unlock_exclusive(&mp->mObject); in player_handleMediaPlayerEventNotifications()
136 (*callback)(&mp->mStreamInfo.mItf, XA_STREAMCBEVENT_PROPERTYCHANGE /*eventId*/, in player_handleMediaPlayerEventNotifications()
141 SLresult res = EnqueueAsyncCallback_piipp(mp, callback, in player_handleMediaPlayerEventNotifications()
142 /*p1*/ &mp->mStreamInfo.mItf, in player_handleMediaPlayerEventNotifications()
149 callback, &mp->mStreamInfo.mItf, callbackPContext); in player_handleMediaPlayerEventNotifications()
156 SL_LOGV("Received AVPlayer::kEventEndOfStream for CMediaPlayer %p", mp); in player_handleMediaPlayerEventNotifications()
158 object_lock_exclusive(&mp->mObject); in player_handleMediaPlayerEventNotifications()
163 if (mp->mPlay.mEventFlags & XA_PLAYEVENT_HEADATEND) { in player_handleMediaPlayerEventNotifications()
164 playCallback = mp->mPlay.mCallback; in player_handleMediaPlayerEventNotifications()
165 playContext = mp->mPlay.mContext; in player_handleMediaPlayerEventNotifications()
167 mp->mPlay.mState = XA_PLAYSTATE_PAUSED; in player_handleMediaPlayerEventNotifications()
168 object_unlock_exclusive(&mp->mObject); in player_handleMediaPlayerEventNotifications()
173 (*playCallback)(&mp->mPlay.mItf, playContext, XA_PLAYEVENT_HEADATEND); in player_handleMediaPlayerEventNotifications()
175 SLresult res = EnqueueAsyncCallback_ppi(mp, playCallback, &mp->mPlay.mItf, playContext, in player_handleMediaPlayerEventNotifications()
179 &mp->mPlay.mItf, playContext); in player_handleMediaPlayerEventNotifications()
187 object_lock_exclusive(&mp->mObject); in player_handleMediaPlayerEventNotifications()
188 if (UNKNOWN_NUMCHANNELS == mp->mNumChannels && UNKNOWN_NUMCHANNELS != data1) { in player_handleMediaPlayerEventNotifications()
189 mp->mNumChannels = data1; in player_handleMediaPlayerEventNotifications()
190 android_Player_volumeUpdate(mp); in player_handleMediaPlayerEventNotifications()
192 object_unlock_exclusive(&mp->mObject); in player_handleMediaPlayerEventNotifications()
198 if (!IsInterfaceInitialized(&mp->mObject, MPH_XAPREFETCHSTATUS)) { in player_handleMediaPlayerEventNotifications()
205 interface_lock_exclusive(&mp->mPrefetchStatus); in player_handleMediaPlayerEventNotifications()
206 if (mp->mPrefetchStatus.mCallbackEventsMask & SL_PREFETCHEVENT_FILLLEVELCHANGE) { in player_handleMediaPlayerEventNotifications()
207 callback = mp->mPrefetchStatus.mCallback; in player_handleMediaPlayerEventNotifications()
208 callbackPContext = mp->mPrefetchStatus.mContext; in player_handleMediaPlayerEventNotifications()
210 mp->mPrefetchStatus.mLevel = (SLpermille)data1; in player_handleMediaPlayerEventNotifications()
211 interface_unlock_exclusive(&mp->mPrefetchStatus); in player_handleMediaPlayerEventNotifications()
215 (*callback)(&mp->mPrefetchStatus.mItf, callbackPContext, in player_handleMediaPlayerEventNotifications()
223 if (!IsInterfaceInitialized(&mp->mObject, MPH_XAPREFETCHSTATUS)) { in player_handleMediaPlayerEventNotifications()
230 object_lock_exclusive(&mp->mObject); in player_handleMediaPlayerEventNotifications()
231 if (mp->mPrefetchStatus.mCallbackEventsMask & SL_PREFETCHEVENT_STATUSCHANGE) { in player_handleMediaPlayerEventNotifications()
232 callback = mp->mPrefetchStatus.mCallback; in player_handleMediaPlayerEventNotifications()
233 callbackPContext = mp->mPrefetchStatus.mContext; in player_handleMediaPlayerEventNotifications()
236 mp->mPrefetchStatus.mStatus = SL_PREFETCHSTATUS_SUFFICIENTDATA; in player_handleMediaPlayerEventNotifications()
238 mp->mPrefetchStatus.mStatus = SL_PREFETCHSTATUS_UNDERFLOW; in player_handleMediaPlayerEventNotifications()
240 object_unlock_exclusive(&mp->mObject); in player_handleMediaPlayerEventNotifications()
244 (*callback)(&mp->mPrefetchStatus.mItf, callbackPContext, SL_PREFETCHEVENT_STATUSCHANGE); in player_handleMediaPlayerEventNotifications()
252 interface_lock_shared(&mp->mPlay); in player_handleMediaPlayerEventNotifications()
253 slPlayCallback callback = mp->mPlay.mCallback; in player_handleMediaPlayerEventNotifications()
254 void* callbackPContext = mp->mPlay.mContext; in player_handleMediaPlayerEventNotifications()
255 interface_unlock_shared(&mp->mPlay); in player_handleMediaPlayerEventNotifications()
258 (*callback)(&mp->mPlay.mItf, callbackPContext, (SLuint32) data1); // SL_PLAYEVENT_HEAD* in player_handleMediaPlayerEventNotifications()
270 object_lock_exclusive(&mp->mObject); in player_handleMediaPlayerEventNotifications()
271 if (IsInterfaceInitialized(&mp->mObject, MPH_XAPREFETCHSTATUS)) { in player_handleMediaPlayerEventNotifications()
272 mp->mPrefetchStatus.mLevel = 0; in player_handleMediaPlayerEventNotifications()
273 mp->mPrefetchStatus.mStatus = SL_PREFETCHSTATUS_UNDERFLOW; in player_handleMediaPlayerEventNotifications()
274 if (!(~mp->mPrefetchStatus.mCallbackEventsMask & in player_handleMediaPlayerEventNotifications()
276 callback = mp->mPrefetchStatus.mCallback; in player_handleMediaPlayerEventNotifications()
277 callbackPContext = mp->mPrefetchStatus.mContext; in player_handleMediaPlayerEventNotifications()
280 object_unlock_exclusive(&mp->mObject); in player_handleMediaPlayerEventNotifications()
287 (*callback)(&mp->mPrefetchStatus.mItf, callbackPContext, in player_handleMediaPlayerEventNotifications()
299 mp->mCallbackProtector->exitCb(); in player_handleMediaPlayerEventNotifications()
304 XAresult android_Player_checkSourceSink(CMediaPlayer *mp) { in android_Player_checkSourceSink() argument
308 const SLDataSource *pSrc = &mp->mDataSource.u.mSource; in android_Player_checkSourceSink()
309 const SLDataSink *pAudioSnk = &mp->mAudioSink.u.mSink; in android_Player_checkSourceSink()
365 XAresult android_Player_create(CMediaPlayer *mp) { in android_Player_create() argument
370 const SLDataSource *pDataSrc = &mp->mDataSource.u.mSource; in android_Player_create()
380 mp->mAndroidObjType = AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE; in android_Player_create()
385 mp->mAndroidObjType = AUDIOVIDEOPLAYER_FROM_URIFD; in android_Player_create()
390 mp->mAndroidObjType = INVALID_TYPE; in android_Player_create()
397 mp->mAndroidObjState = ANDROID_UNINITIALIZED; in android_Player_create()
398 mp->mStreamType = ANDROID_DEFAULT_OUTPUT_STREAM_TYPE; in android_Player_create()
399 mp->mSessionId = (audio_session_t) android::AudioSystem::newAudioUniqueId( in android_Player_create()
405 mp->mCallbackProtector = new android::CallbackProtector(); in android_Player_create()
413 XAresult android_Player_realize(CMediaPlayer *mp, SLboolean async) { in android_Player_realize() argument
414 SL_LOGV("android_Player_realize_l(%p)", mp); in android_Player_realize()
418 ap_params.sessionId = mp->mSessionId; in android_Player_realize()
419 ap_params.streamType = mp->mStreamType; in android_Player_realize()
421 switch (mp->mAndroidObjType) { in android_Player_realize()
423 mp->mAVPlayer = new android::StreamPlayer(&ap_params, true /*hasVideo*/, in android_Player_realize()
424 &mp->mAndroidBufferQueue, mp->mCallbackProtector); in android_Player_realize()
425 mp->mAVPlayer->init(player_handleMediaPlayerEventNotifications, (void*)mp); in android_Player_realize()
429 mp->mAVPlayer = new android::LocAVPlayer(&ap_params, true /*hasVideo*/); in android_Player_realize()
430 mp->mAVPlayer->init(player_handleMediaPlayerEventNotifications, (void*)mp); in android_Player_realize()
431 switch (mp->mDataSource.mLocator.mLocatorType) { in android_Player_realize()
433 ((android::LocAVPlayer*)mp->mAVPlayer.get())->setDataSource( in android_Player_realize()
434 (const char*)mp->mDataSource.mLocator.mURI.URI); in android_Player_realize()
437 int64_t offset = (int64_t)mp->mDataSource.mLocator.mFD.offset; in android_Player_realize()
438 ((android::LocAVPlayer*)mp->mAVPlayer.get())->setDataSource( in android_Player_realize()
439 (int)mp->mDataSource.mLocator.mFD.fd, in android_Player_realize()
442 (int64_t)mp->mDataSource.mLocator.mFD.length); in android_Player_realize()
447 mp->mDataSource.mLocator.mLocatorType); in android_Player_realize()
464 mp->mImageVideoSink.mLocator.mLocatorType) { in android_Player_realize()
466 mp->mImageVideoSink.mLocator.mNativeDisplay.hWindow; in android_Player_realize()
469 result = android_Player_setNativeWindow(mp, nativeWindow); in android_Player_realize()
478 XAresult android_Player_preDestroy(CMediaPlayer *mp) { in android_Player_preDestroy() argument
479 SL_LOGV("android_Player_preDestroy(%p)", mp); in android_Player_preDestroy()
482 object_unlock_exclusive(&mp->mObject); in android_Player_preDestroy()
483 if (mp->mCallbackProtector != 0) { in android_Player_preDestroy()
484 mp->mCallbackProtector->requestCbExitAndWait(); in android_Player_preDestroy()
486 object_lock_exclusive(&mp->mObject); in android_Player_preDestroy()
488 if (mp->mAVPlayer != 0) { in android_Player_preDestroy()
489 mp->mAVPlayer->preDestroy(); in android_Player_preDestroy()
491 SL_LOGV("android_Player_preDestroy(%p) after mAVPlayer->preDestroy()", mp); in android_Player_preDestroy()
497 XAresult android_Player_destroy(CMediaPlayer *mp) { in android_Player_destroy() argument
498 SL_LOGV("android_Player_destroy(%p)", mp); in android_Player_destroy()
500 mp->mAVPlayer.clear(); in android_Player_destroy()
505 mp->mCallbackProtector.clear(); in android_Player_destroy()
508 mp->mAVPlayer.~sp(); in android_Player_destroy()
509 mp->mCallbackProtector.~sp(); in android_Player_destroy()
515 void android_Player_usePlayEventMask(CMediaPlayer *mp) { in android_Player_usePlayEventMask() argument
516 if (mp->mAVPlayer != 0) { in android_Player_usePlayEventMask()
517 IPlay *pPlayItf = &mp->mPlay; in android_Player_usePlayEventMask()
518 mp->mAVPlayer->setPlayEvents((int32_t) pPlayItf->mEventFlags, in android_Player_usePlayEventMask()
587 void android_Player_volumeUpdate(CMediaPlayer* mp) in android_Player_volumeUpdate() argument
589 android::GenericPlayer* avp = mp->mAVPlayer.get(); in android_Player_volumeUpdate()
593 android_player_volumeUpdate(volumes, &mp->mVolume, mp->mNumChannels, 1.0f, NULL); in android_Player_volumeUpdate()
664 XAresult android_Player_seek(CMediaPlayer *mp, SLmillisecond posMsec) { in android_Player_seek() argument
666 switch (mp->mAndroidObjType) { in android_Player_seek()
668 if (mp->mAVPlayer !=0) { in android_Player_seek()
669 mp->mAVPlayer->seek(posMsec); in android_Player_seek()
685 XAresult android_Player_loop(CMediaPlayer *mp, SLboolean loopEnable) { in android_Player_loop() argument
687 switch (mp->mAndroidObjType) { in android_Player_loop()
689 if (mp->mAVPlayer !=0) { in android_Player_loop()
690 mp->mAVPlayer->loop(loopEnable); in android_Player_loop()
704 void android_Player_androidBufferQueue_clear_l(CMediaPlayer *mp) { in android_Player_androidBufferQueue_clear_l() argument
705 if ((mp->mAndroidObjType == AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE) in android_Player_androidBufferQueue_clear_l()
706 && (mp->mAVPlayer != 0)) { in android_Player_androidBufferQueue_clear_l()
707 android::StreamPlayer* splr = static_cast<android::StreamPlayer*>(mp->mAVPlayer.get()); in android_Player_androidBufferQueue_clear_l()
713 void android_Player_androidBufferQueue_onRefilled_l(CMediaPlayer *mp) { in android_Player_androidBufferQueue_onRefilled_l() argument
714 if ((mp->mAndroidObjType == AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE) in android_Player_androidBufferQueue_onRefilled_l()
715 && (mp->mAVPlayer != 0)) { in android_Player_androidBufferQueue_onRefilled_l()
716 android::StreamPlayer* splr = static_cast<android::StreamPlayer*>(mp->mAVPlayer.get()); in android_Player_androidBufferQueue_onRefilled_l()
728 SLresult android_Player_setNativeWindow(CMediaPlayer *mp, ANativeWindow *nativeWindow) in android_Player_setNativeWindow() argument
730 assert(mp != NULL); in android_Player_setNativeWindow()
731 assert(mp->mAVPlayer != 0); in android_Player_setNativeWindow()
753 mp->mAVPlayer->setVideoSurfaceTexture(nativeSurfaceTexture); in android_Player_setNativeWindow()