frame_consumer.h 1.22 KB
Newer Older
1
// Copyright 2016 The Chromium Authors. All rights reserved.
2 3 4
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5 6
#ifndef REMOTING_PROTOCOL_FRAME_CONSUMER_H_
#define REMOTING_PROTOCOL_FRAME_CONSUMER_H_
7

8 9
#include <memory>

10
#include "base/callback_forward.h"
11
#include "base/macros.h"
12

13 14
namespace webrtc {
class DesktopFrame;
15
class DesktopSize;
16
}  // namespace webrtc
ajwong@chromium.org's avatar
ajwong@chromium.org committed
17

18
namespace remoting {
19
namespace protocol {
20 21 22

class FrameConsumer {
 public:
23 24
  virtual ~FrameConsumer() {}

25 26 27 28 29 30
  // List of supported pixel formats needed by various platforms.
  enum PixelFormat {
    FORMAT_BGRA,  // Used by the Pepper plugin.
    FORMAT_RGBA,  // Used for Android's Bitmap class.
  };

31
  virtual std::unique_ptr<webrtc::DesktopFrame> AllocateFrame(
32
      const webrtc::DesktopSize& size) = 0;
33

34
  virtual void DrawFrame(std::unique_ptr<webrtc::DesktopFrame> frame,
35
                         const base::Closure& done) = 0;
36

37 38 39
  // Returns the preferred pixel encoding for the platform.
  virtual PixelFormat GetPixelFormat() = 0;

40 41 42
 protected:
  FrameConsumer() {}

43 44 45 46
 private:
  DISALLOW_COPY_AND_ASSIGN(FrameConsumer);
};

47
}  // namespace protocol
48 49
}  // namespace remoting

50
#endif  // REMOTING_PROTOCOL_FRAME_CONSUMER_H_