Bug 3438258 Add SurfaceTexture as MediaPlayer sink
This change enables the use of a SurfaceTexture in place of a Surface
as the video sink for an android.media.MediaPlayer. The new API
MediaPlayer.setTexture is currently hidden.
This includes:
- New Java and C++ interfaces
- C++ plumbing and implementation (JNI, Binder)
- Stagefright AwesomePlayer and NuPlayer use ANativeWindow
(either Surface or SurfaceTextureClient)
Change-Id: I2b568bee143d9eaf3dfc6cc4533c1bebbd5afc51
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp
index 761dfa4..517acc9 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerDecoder.cpp
@@ -31,13 +31,15 @@
#include <media/stagefright/MetaData.h>
#include <media/stagefright/Utils.h>
#include <surfaceflinger/Surface.h>
+#include <gui/ISurfaceTexture.h>
namespace android {
NuPlayer::Decoder::Decoder(
- const sp<AMessage> ¬ify, const sp<Surface> &surface)
+ const sp<AMessage> ¬ify,
+ const sp<NativeWindowWrapper> &nativeWindow)
: mNotify(notify),
- mSurface(surface) {
+ mNativeWindow(nativeWindow) {
}
NuPlayer::Decoder::~Decoder() {
@@ -55,8 +57,8 @@
sp<AMessage> format = makeFormat(meta);
- if (mSurface != NULL) {
- format->setObject("surface", mSurface);
+ if (mNativeWindow != NULL) {
+ format->setObject("native-window", mNativeWindow);
}
if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AAC)) {