From 9575c96b6e418914e2ffc6741ecc8d71e3968dbe Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Tue, 5 Feb 2013 13:59:56 -0800 Subject: Support for a "preparation" state that can take care of lengthy operations in NuPlayer and its sources. Sources also can publish their flags now and the mediaplayer UI will be able to pick up on these. Change-Id: I4f2b7e5d105dcb4b6c9132cd0e8799efa0c6a14b --- .../nuplayer/NuPlayerDriver.h | 30 +++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'media/libmediaplayerservice/nuplayer/NuPlayerDriver.h') diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.h b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.h index 553c406..49b8ed2 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.h +++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.h @@ -61,6 +61,8 @@ struct NuPlayerDriver : public MediaPlayerInterface { virtual status_t dump(int fd, const Vector &args) const; + void notifySetDataSourceCompleted(status_t err); + void notifyPrepareCompleted(status_t err); void notifyResetComplete(); void notifySetSurfaceComplete(); void notifyDuration(int64_t durationUs); @@ -68,17 +70,32 @@ struct NuPlayerDriver : public MediaPlayerInterface { void notifySeekComplete(); void notifyFrameStats(int64_t numFramesTotal, int64_t numFramesDropped); void notifyListener(int msg, int ext1 = 0, int ext2 = 0); + void notifyFlagsChanged(uint32_t flags); protected: virtual ~NuPlayerDriver(); private: + enum State { + STATE_IDLE, + STATE_SET_DATASOURCE_PENDING, + STATE_UNPREPARED, + STATE_PREPARING, + STATE_PREPARED, + STATE_RUNNING, + STATE_PAUSED, + STATE_RESET_IN_PROGRESS, + }; + mutable Mutex mLock; Condition mCondition; + State mState; + + status_t mAsyncResult; + // The following are protected through "mLock" // >>> - bool mResetInProgress; bool mSetSurfaceInProgress; int64_t mDurationUs; int64_t mPositionUs; @@ -88,19 +105,14 @@ private: sp mLooper; sp mPlayer; + uint32_t mPlayerFlags; - enum State { - UNINITIALIZED, - STOPPED, - PLAYING, - PAUSED - }; - - State mState; bool mAtEOS; int64_t mStartupSeekTimeUs; + status_t prepare_l(); + DISALLOW_EVIL_CONSTRUCTORS(NuPlayerDriver); }; -- cgit v1.1