• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 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_HELPER_H_
6 #define REMOTING_CODEC_VIDEO_ENCODER_HELPER_H_
7 
8 #include "base/memory/scoped_ptr.h"
9 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
10 
11 namespace webrtc {
12 class DesktopFrame;
13 class DesktopRegion;
14 }
15 
16 namespace remoting {
17 
18 class VideoPacket;
19 
20 class VideoEncoderHelper {
21  public:
22   VideoEncoderHelper();
23 
24   // Returns a new VideoPacket with common fields (e.g. capture_time_ms, rects
25   // list, frame shape if any) initialized based on the supplied |frame|.
26   // Screen width and height will be set iff |frame|'s size differs from that
27   // of the previously-supplied frame.
28   scoped_ptr<VideoPacket> CreateVideoPacket(const webrtc::DesktopFrame& frame);
29 
30   // Returns a new VideoPacket with the common fields populated from |frame|,
31   // but the updated rects overridden by |updated_region|. This is useful for
32   // encoders which alter the updated region e.g. by expanding it to macroblock
33   // boundaries.
34   scoped_ptr<VideoPacket> CreateVideoPacketWithUpdatedRegion(
35       const webrtc::DesktopFrame& frame,
36       const webrtc::DesktopRegion& updated_region);
37  private:
38   // The most recent screen size. Used to detect screen size changes.
39   webrtc::DesktopSize screen_size_;
40 
41   DISALLOW_COPY_AND_ASSIGN(VideoEncoderHelper);
42 };
43 
44 }  // namespace remoting
45 
46 #endif  // REMOTING_CODEC_VIDEO_ENCODER_HELPER_H_
47