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