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/HTTPLiveSource.cpp | 35 +++++++++++++--------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp') diff --git a/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp b/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp index d38ee62..ae67906 100644 --- a/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp +++ b/media/libmediaplayerservice/nuplayer/HTTPLiveSource.cpp @@ -66,7 +66,7 @@ NuPlayer::HTTPLiveSource::~HTTPLiveSource() { } } -void NuPlayer::HTTPLiveSource::start() { +void NuPlayer::HTTPLiveSource::prepareAsync() { mLiveLooper = new ALooper; mLiveLooper->setName("http live"); mLiveLooper->start(); @@ -81,6 +81,26 @@ void NuPlayer::HTTPLiveSource::start() { mURL.c_str(), mExtraHeaders.isEmpty() ? NULL : &mExtraHeaders); mTSParser = new ATSParser; + + notifyVideoSizeChanged(0, 0); + + uint32_t flags = FLAG_CAN_PAUSE; + if (mLiveSession->isSeekable()) { + flags |= FLAG_CAN_SEEK; + flags |= FLAG_CAN_SEEK_BACKWARD; + flags |= FLAG_CAN_SEEK_FORWARD; + } + + if (mLiveSession->hasDynamicDuration()) { + flags |= FLAG_DYNAMIC_DURATION; + } + + notifyFlagsChanged(flags); + + notifyPrepared(); +} + +void NuPlayer::HTTPLiveSource::start() { } sp NuPlayer::HTTPLiveSource::getFormatMeta(bool audio) { @@ -194,18 +214,5 @@ status_t NuPlayer::HTTPLiveSource::seekTo(int64_t seekTimeUs) { return OK; } -uint32_t NuPlayer::HTTPLiveSource::flags() const { - uint32_t flags = 0; - if (mLiveSession->isSeekable()) { - flags |= FLAG_SEEKABLE; - } - - if (mLiveSession->hasDynamicDuration()) { - flags |= FLAG_DYNAMIC_DURATION; - } - - return flags; -} - } // namespace android -- cgit v1.1