video_encoder.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright (c) 2012 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_CODEC_VIDEO_ENCODER_H_
  5. #define REMOTING_CODEC_VIDEO_ENCODER_H_
  6. #include <stdint.h>
  7. #include <memory>
  8. namespace webrtc {
  9. class DesktopFrame;
  10. } // namespace webrtc
  11. namespace remoting {
  12. namespace protocol {
  13. class SessionConfig;
  14. } // namespace protocol
  15. class VideoPacket;
  16. // A class to perform the task of encoding a continuous stream of images. The
  17. // interface is asynchronous to enable maximum throughput.
  18. class VideoEncoder {
  19. public:
  20. virtual ~VideoEncoder() {}
  21. // Request that the encoder provide lossless encoding, or color, if possible.
  22. virtual void SetLosslessEncode(bool want_lossless) {}
  23. virtual void SetLosslessColor(bool want_lossless) {}
  24. // Encode an image stored in |frame|. If |frame.updated_region()| is empty
  25. // then the encoder may return a packet (e.g. to top-off previously-encoded
  26. // portions of the frame to higher quality) or return nullptr to indicate that
  27. // there is no work to do.
  28. virtual std::unique_ptr<VideoPacket> Encode(
  29. const webrtc::DesktopFrame& frame) = 0;
  30. static std::unique_ptr<VideoEncoder> Create(
  31. const protocol::SessionConfig& config);
  32. };
  33. } // namespace remoting
  34. #endif // REMOTING_CODEC_VIDEO_ENCODER_H_