/* * Copyright (c) 2014 Amlogic, Inc. All rights reserved. * * This source code is subject to the terms and conditions defined in the * file 'LICENSE' which is part of this source code package. * * Description: header file */ #pragma once #include #include // CTvWayland // - 1 UI main surface // - 1 main video subsurface (always created) // - 1 PIP video subsurface (lazy-created when enabled) // - Each video uses a dmabuf "tunnel"; tunnel id can be updated at runtime. // Runtime update is applied safely on the next commit when the current buffer is not busy. class CTvWayland { public: CTvWayland(); ~CTvWayland(); CTvWayland(const CTvWayland&) = delete; CTvWayland& operator=(const CTvWayland&) = delete; // Set tunnel id(s). Prefer calling before init(). // If called after init(): the change is applied lazily (next commit when safe). void setMainTunnelId(int32_t tunnelId); void setPipTunnelId(int32_t tunnelId); // Init display + UI surface + main video plane. // PIP plane is NOT created until enablePip(true). bool init(); void shutdown(); // UI surface destination (viewport destination) void setUiDestination(int32_t w, int32_t h); // Main video plane void setMainVideoPosition(int32_t x, int32_t y); void setMainVideoDestination(int32_t w, int32_t h); bool ensureMainReady(); bool startMainVideo(); void stopMainVideo(); // PIP video plane (lazy) bool startPipVideo(); void stopPipVideo(); void setPipPosition(int32_t x, int32_t y); void setPipDestination(int32_t w, int32_t h); void setPipRect(int32_t x, int32_t y, int32_t w, int32_t h); void setPipAboveMain(bool above); // Commit UI + planes that are visible/ready bool commitAll(); int32_t outputWidth() const; int32_t outputHeight() const; private: struct Impl; std::unique_ptr mImpl; };