Loading libs/gui/Flags.cpp +57 −0 Original line number Diff line number Diff line Loading @@ -79,11 +79,68 @@ sp<SurfaceType> convertParcelableSurfaceTypeToSurface(const ParcelableSurfaceTyp } // namespace flagtools namespace mediaflagtools { sp<MediaSurfaceType> igbpToSurfaceType(const sp<IGraphicBufferProducer>& igbp) { if (igbp == nullptr) { return nullptr; } #if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_MEDIA_MIGRATION) return new Surface(igbp); #else return igbp; #endif } sp<IGraphicBufferProducer> surfaceTypeToIGBP(const sp<MediaSurfaceType>& mst) { if (mst == nullptr) { return nullptr; } #if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_MEDIA_MIGRATION) return mst->getIGraphicBufferProducer(); #else return mst; #endif } sp<SurfaceType> mediaSurfaceToCameraSurfaceType(const sp<MediaSurfaceType>& mst, [[maybe_unused]] bool controlledByApp) { if (mst == nullptr) { return nullptr; } #if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_MEDIA_MIGRATION) #if WB_LIBCAMERASERVICE_WITH_DEPENDENCIES return mst; #else return mst->getGraphicBufferProducer(); #endif #else #if WB_LIBCAMERASERVICE_WITH_DEPENDENCIES return sp<Surface>::make(mst, controlledByApp); #else return mst; #endif #endif } sp<Surface> surfaceTypeToSurface(const sp<MediaSurfaceType>& mst, [[maybe_unused]] bool controlledByApp) { if (mst == nullptr) { return nullptr; } #if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_MEDIA_MIGRATION) return mst; #else return sp<Surface>::make(mst, controlledByApp); #endif } sp<MediaSurfaceType> surfaceToSurfaceType(const sp<Surface>& surface) { if (surface == nullptr) { return nullptr; } #if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_MEDIA_MIGRATION) return surface; #else return surface->getIGraphicBufferProducer(); #endif } } // namespace mediaflagtools } // namespace android No newline at end of file libs/gui/include/gui/Flags.h +5 −0 Original line number Diff line number Diff line Loading @@ -60,5 +60,10 @@ typedef android::sp<android::IGraphicBufferProducer> MediaParcelableSurfaceType; namespace mediaflagtools { sp<MediaSurfaceType> igbpToSurfaceType(const sp<IGraphicBufferProducer>& igbp); sp<IGraphicBufferProducer> surfaceTypeToIGBP(const sp<MediaSurfaceType>& mst); sp<SurfaceType> mediaSurfaceToCameraSurfaceType(const sp<MediaSurfaceType>& mst, bool controlledByApp = false); sp<Surface> surfaceTypeToSurface(const sp<MediaSurfaceType>& mst, bool controlledByApp = false); sp<MediaSurfaceType> surfaceToSurfaceType(const sp<Surface>& surface); } // namespace mediaflagtools } // namespace android libs/gui/include/gui/view/Surface.h +1 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ class Surface : public Parcelable { // functions used to convert to a parcelable Surface so it can be passed over binder. static Surface fromSurface(const sp<android::Surface>& surface); sp<android::Surface> toSurface() const; sp<android::Surface> toSurface(bool controlledByApp = false) const; status_t getUniqueId(/* out */ uint64_t* id) const; Loading libs/gui/view/Surface.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -134,9 +134,9 @@ Surface Surface::fromSurface(const sp<android::Surface>& surface) { return s; } sp<android::Surface> Surface::toSurface() const { sp<android::Surface> Surface::toSurface(bool controlledByApp) const { if (graphicBufferProducer == nullptr) return nullptr; return new android::Surface(graphicBufferProducer, false, surfaceControlHandle); return new android::Surface(graphicBufferProducer, controlledByApp, surfaceControlHandle); } status_t Surface::getUniqueId(uint64_t* out_id) const { Loading Loading
libs/gui/Flags.cpp +57 −0 Original line number Diff line number Diff line Loading @@ -79,11 +79,68 @@ sp<SurfaceType> convertParcelableSurfaceTypeToSurface(const ParcelableSurfaceTyp } // namespace flagtools namespace mediaflagtools { sp<MediaSurfaceType> igbpToSurfaceType(const sp<IGraphicBufferProducer>& igbp) { if (igbp == nullptr) { return nullptr; } #if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_MEDIA_MIGRATION) return new Surface(igbp); #else return igbp; #endif } sp<IGraphicBufferProducer> surfaceTypeToIGBP(const sp<MediaSurfaceType>& mst) { if (mst == nullptr) { return nullptr; } #if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_MEDIA_MIGRATION) return mst->getIGraphicBufferProducer(); #else return mst; #endif } sp<SurfaceType> mediaSurfaceToCameraSurfaceType(const sp<MediaSurfaceType>& mst, [[maybe_unused]] bool controlledByApp) { if (mst == nullptr) { return nullptr; } #if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_MEDIA_MIGRATION) #if WB_LIBCAMERASERVICE_WITH_DEPENDENCIES return mst; #else return mst->getGraphicBufferProducer(); #endif #else #if WB_LIBCAMERASERVICE_WITH_DEPENDENCIES return sp<Surface>::make(mst, controlledByApp); #else return mst; #endif #endif } sp<Surface> surfaceTypeToSurface(const sp<MediaSurfaceType>& mst, [[maybe_unused]] bool controlledByApp) { if (mst == nullptr) { return nullptr; } #if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_MEDIA_MIGRATION) return mst; #else return sp<Surface>::make(mst, controlledByApp); #endif } sp<MediaSurfaceType> surfaceToSurfaceType(const sp<Surface>& surface) { if (surface == nullptr) { return nullptr; } #if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_MEDIA_MIGRATION) return surface; #else return surface->getIGraphicBufferProducer(); #endif } } // namespace mediaflagtools } // namespace android No newline at end of file
libs/gui/include/gui/Flags.h +5 −0 Original line number Diff line number Diff line Loading @@ -60,5 +60,10 @@ typedef android::sp<android::IGraphicBufferProducer> MediaParcelableSurfaceType; namespace mediaflagtools { sp<MediaSurfaceType> igbpToSurfaceType(const sp<IGraphicBufferProducer>& igbp); sp<IGraphicBufferProducer> surfaceTypeToIGBP(const sp<MediaSurfaceType>& mst); sp<SurfaceType> mediaSurfaceToCameraSurfaceType(const sp<MediaSurfaceType>& mst, bool controlledByApp = false); sp<Surface> surfaceTypeToSurface(const sp<MediaSurfaceType>& mst, bool controlledByApp = false); sp<MediaSurfaceType> surfaceToSurfaceType(const sp<Surface>& surface); } // namespace mediaflagtools } // namespace android
libs/gui/include/gui/view/Surface.h +1 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ class Surface : public Parcelable { // functions used to convert to a parcelable Surface so it can be passed over binder. static Surface fromSurface(const sp<android::Surface>& surface); sp<android::Surface> toSurface() const; sp<android::Surface> toSurface(bool controlledByApp = false) const; status_t getUniqueId(/* out */ uint64_t* id) const; Loading
libs/gui/view/Surface.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -134,9 +134,9 @@ Surface Surface::fromSurface(const sp<android::Surface>& surface) { return s; } sp<android::Surface> Surface::toSurface() const { sp<android::Surface> Surface::toSurface(bool controlledByApp) const { if (graphicBufferProducer == nullptr) return nullptr; return new android::Surface(graphicBufferProducer, false, surfaceControlHandle); return new android::Surface(graphicBufferProducer, controlledByApp, surfaceControlHandle); } status_t Surface::getUniqueId(uint64_t* out_id) const { Loading