Loading libs/gui/Flags.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <gui/IGraphicBufferProducer.h> #include <gui/Surface.h> #include <gui/view/Surface.h> #include <system/window.h> namespace android { namespace flagtools { Loading Loading @@ -78,6 +79,20 @@ sp<SurfaceType> convertParcelableSurfaceTypeToSurface(const ParcelableSurfaceTyp } } // namespace flagtools namespace mediaflagtools { sp<MediaSurfaceType> nativeWindowToSurfaceType(ANativeWindow* anw) { if (anw == nullptr) { return nullptr; } sp<Surface> surface = Surface::from(anw); #if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_MEDIA_MIGRATION) return surface; #else return surface->getIGraphicBufferProducer(); #endif } sp<MediaSurfaceType> igbpToSurfaceType(const sp<IGraphicBufferProducer>& igbp) { if (igbp == nullptr) { return nullptr; Loading libs/gui/Surface.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,10 @@ Surface::~Surface() { #endif // !defined(NO_BINDER) } sp<Surface> Surface::from(ANativeWindow* anw) { return sp<Surface>::fromExisting(static_cast<Surface*>(anw)); } #ifndef NO_BINDER sp<ISurfaceComposer> Surface::composerService() const { return ComposerService::getComposerService(); Loading libs/gui/include/gui/Flags.h +3 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ #include <com_android_graphics_libgui_flags.h> #include <utils/StrongPointer.h> struct ANativeWindow; namespace android { class IGraphicBufferProducer; Loading Loading @@ -59,6 +61,7 @@ typedef android::sp<android::IGraphicBufferProducer> MediaParcelableSurfaceType; #endif namespace mediaflagtools { sp<MediaSurfaceType> nativeWindowToSurfaceType(ANativeWindow* anw); sp<MediaSurfaceType> igbpToSurfaceType(const sp<IGraphicBufferProducer>& igbp); sp<IGraphicBufferProducer> surfaceTypeToIGBP(const sp<MediaSurfaceType>& mst); sp<SurfaceType> mediaSurfaceToCameraSurfaceType(const sp<MediaSurfaceType>& mst, Loading libs/gui/include/gui/Surface.h +5 −0 Original line number Diff line number Diff line Loading @@ -132,6 +132,11 @@ public: explicit Surface(const sp<IGraphicBufferProducer>& bufferProducer, bool controlledByApp = false, const sp<IBinder>& surfaceControlHandle = nullptr); /* * Get the underlying Surface from the given ANativeWindow. */ static sp<Surface> from(ANativeWindow* anw); /* getIGraphicBufferProducer() returns the IGraphicBufferProducer this * Surface was created with. Usually it's an error to use the * IGraphicBufferProducer while the Surface is connected. Loading Loading
libs/gui/Flags.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <gui/IGraphicBufferProducer.h> #include <gui/Surface.h> #include <gui/view/Surface.h> #include <system/window.h> namespace android { namespace flagtools { Loading Loading @@ -78,6 +79,20 @@ sp<SurfaceType> convertParcelableSurfaceTypeToSurface(const ParcelableSurfaceTyp } } // namespace flagtools namespace mediaflagtools { sp<MediaSurfaceType> nativeWindowToSurfaceType(ANativeWindow* anw) { if (anw == nullptr) { return nullptr; } sp<Surface> surface = Surface::from(anw); #if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_MEDIA_MIGRATION) return surface; #else return surface->getIGraphicBufferProducer(); #endif } sp<MediaSurfaceType> igbpToSurfaceType(const sp<IGraphicBufferProducer>& igbp) { if (igbp == nullptr) { return nullptr; Loading
libs/gui/Surface.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,10 @@ Surface::~Surface() { #endif // !defined(NO_BINDER) } sp<Surface> Surface::from(ANativeWindow* anw) { return sp<Surface>::fromExisting(static_cast<Surface*>(anw)); } #ifndef NO_BINDER sp<ISurfaceComposer> Surface::composerService() const { return ComposerService::getComposerService(); Loading
libs/gui/include/gui/Flags.h +3 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ #include <com_android_graphics_libgui_flags.h> #include <utils/StrongPointer.h> struct ANativeWindow; namespace android { class IGraphicBufferProducer; Loading Loading @@ -59,6 +61,7 @@ typedef android::sp<android::IGraphicBufferProducer> MediaParcelableSurfaceType; #endif namespace mediaflagtools { sp<MediaSurfaceType> nativeWindowToSurfaceType(ANativeWindow* anw); sp<MediaSurfaceType> igbpToSurfaceType(const sp<IGraphicBufferProducer>& igbp); sp<IGraphicBufferProducer> surfaceTypeToIGBP(const sp<MediaSurfaceType>& mst); sp<SurfaceType> mediaSurfaceToCameraSurfaceType(const sp<MediaSurfaceType>& mst, Loading
libs/gui/include/gui/Surface.h +5 −0 Original line number Diff line number Diff line Loading @@ -132,6 +132,11 @@ public: explicit Surface(const sp<IGraphicBufferProducer>& bufferProducer, bool controlledByApp = false, const sp<IBinder>& surfaceControlHandle = nullptr); /* * Get the underlying Surface from the given ANativeWindow. */ static sp<Surface> from(ANativeWindow* anw); /* getIGraphicBufferProducer() returns the IGraphicBufferProducer this * Surface was created with. Usually it's an error to use the * IGraphicBufferProducer while the Surface is connected. Loading