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
diff --git a/media/libmediaplayerservice/nuplayer/GenericSource.cpp b/media/libmediaplayerservice/nuplayer/GenericSource.cpp
index 450fae5..b04e7a6 100644
--- a/media/libmediaplayerservice/nuplayer/GenericSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/GenericSource.cpp
@@ -106,6 +106,26 @@
NuPlayer::GenericSource::~GenericSource() {
}
+void NuPlayer::GenericSource::prepareAsync() {
+ if (mVideoTrack.mSource != NULL) {
+ sp<MetaData> meta = mVideoTrack.mSource->getFormat();
+
+ int32_t width, height;
+ CHECK(meta->findInt32(kKeyWidth, &width));
+ CHECK(meta->findInt32(kKeyHeight, &height));
+
+ notifyVideoSizeChanged(width, height);
+ }
+
+ notifyFlagsChanged(
+ FLAG_CAN_PAUSE
+ | FLAG_CAN_SEEK_BACKWARD
+ | FLAG_CAN_SEEK_FORWARD
+ | FLAG_CAN_SEEK);
+
+ notifyPrepared();
+}
+
void NuPlayer::GenericSource::start() {
ALOGI("start");
@@ -262,8 +282,4 @@
}
}
-uint32_t NuPlayer::GenericSource::flags() const {
- return FLAG_SEEKABLE;
-}
-
} // namespace android