frame_consumer.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2016 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef REMOTING_PROTOCOL_FRAME_CONSUMER_H_
  5. #define REMOTING_PROTOCOL_FRAME_CONSUMER_H_
  6. #include <memory>
  7. #include "base/callback_forward.h"
  8. namespace webrtc {
  9. class DesktopFrame;
  10. class DesktopSize;
  11. } // namespace webrtc
  12. namespace remoting {
  13. namespace protocol {
  14. class FrameConsumer {
  15. public:
  16. FrameConsumer(const FrameConsumer&) = delete;
  17. FrameConsumer& operator=(const FrameConsumer&) = delete;
  18. virtual ~FrameConsumer() {}
  19. // List of supported pixel formats needed by various platforms.
  20. enum PixelFormat {
  21. FORMAT_BGRA, // Used by the Pepper plugin.
  22. FORMAT_RGBA, // Used for Android's Bitmap class.
  23. };
  24. virtual std::unique_ptr<webrtc::DesktopFrame> AllocateFrame(
  25. const webrtc::DesktopSize& size) = 0;
  26. virtual void DrawFrame(std::unique_ptr<webrtc::DesktopFrame> frame,
  27. base::OnceClosure done) = 0;
  28. // Returns the preferred pixel encoding for the platform.
  29. virtual PixelFormat GetPixelFormat() = 0;
  30. protected:
  31. FrameConsumer() {}
  32. };
  33. } // namespace protocol
  34. } // namespace remoting
  35. #endif // REMOTING_PROTOCOL_FRAME_CONSUMER_H_