summaryrefslogtreecommitdiffstats
path: root/include/media/stagefright/NativeWindowWrapper.h
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2012-02-21 11:47:18 -0800
committerAndreas Huber <andih@google.com>2012-02-22 15:06:06 -0800
commit5778822d86b0337407514b9372562b86edfa91cd (patch)
treeb8faf8188dfb8865bd88b4dfc778a7d9ab89bb73 /include/media/stagefright/NativeWindowWrapper.h
parentc33305c5dd4cc06e71eb0c66a7150aa6ab647c99 (diff)
downloadframeworks_av-5778822d86b0337407514b9372562b86edfa91cd.zip
frameworks_av-5778822d86b0337407514b9372562b86edfa91cd.tar.gz
frameworks_av-5778822d86b0337407514b9372562b86edfa91cd.tar.bz2
Implementation of a java media codec interface and associated tools.
Change-Id: I13e54062d4de584355c5d82bb027a68aeaf2923b
Diffstat (limited to 'include/media/stagefright/NativeWindowWrapper.h')
-rw-r--r--include/media/stagefright/NativeWindowWrapper.h26
1 files changed, 7 insertions, 19 deletions
diff --git a/include/media/stagefright/NativeWindowWrapper.h b/include/media/stagefright/NativeWindowWrapper.h
index f323cbc..97cc0ce 100644
--- a/include/media/stagefright/NativeWindowWrapper.h
+++ b/include/media/stagefright/NativeWindowWrapper.h
@@ -18,40 +18,28 @@
#define NATIVE_WINDOW_WRAPPER_H_
-#include <surfaceflinger/Surface.h>
#include <gui/SurfaceTextureClient.h>
namespace android {
-// Both Surface and SurfaceTextureClient are RefBase that implement the
-// ANativeWindow interface, but at different addresses. ANativeWindow is not
-// a RefBase but acts like one for use with sp<>. This wrapper converts a
-// Surface or SurfaceTextureClient into a single reference-counted object
-// that holds an sp reference to the underlying Surface or SurfaceTextureClient,
-// It provides a method to get the ANativeWindow.
+// SurfaceTextureClient derives from ANativeWindow which derives from multiple
+// base classes, in order to carry it in AMessages, we'll temporarily wrap it
+// into a NativeWindowWrapper.
struct NativeWindowWrapper : RefBase {
NativeWindowWrapper(
- const sp<Surface> &surface) :
- mSurface(surface) { }
-
- NativeWindowWrapper(
const sp<SurfaceTextureClient> &surfaceTextureClient) :
mSurfaceTextureClient(surfaceTextureClient) { }
sp<ANativeWindow> getNativeWindow() const {
- if (mSurface != NULL) {
- return mSurface;
- } else {
- return mSurfaceTextureClient;
- }
+ return mSurfaceTextureClient;
}
- // If needed later we can provide a method to ask what kind of native window
+ sp<SurfaceTextureClient> getSurfaceTextureClient() const {
+ return mSurfaceTextureClient;
+ }
private:
- // At most one of mSurface and mSurfaceTextureClient will be non-NULL
- const sp<Surface> mSurface;
const sp<SurfaceTextureClient> mSurfaceTextureClient;
DISALLOW_EVIL_CONSTRUCTORS(NativeWindowWrapper);