| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef REMOTING_CODEC_VIDEO_ENCODER_HELPER_H_ | 5 #ifndef REMOTING_CODEC_VIDEO_ENCODER_HELPER_H_ |
| 6 #define REMOTING_CODEC_VIDEO_ENCODER_HELPER_H_ | 6 #define REMOTING_CODEC_VIDEO_ENCODER_HELPER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 11 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
| 11 | 12 |
| 12 namespace webrtc { | 13 namespace webrtc { |
| 13 class DesktopFrame; | 14 class DesktopFrame; |
| 14 class DesktopRegion; | 15 class DesktopRegion; |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace remoting { | 18 namespace remoting { |
| 18 | 19 |
| 19 class VideoPacket; | 20 class VideoPacket; |
| 20 | 21 |
| 21 class VideoEncoderHelper { | 22 class VideoEncoderHelper { |
| 22 public: | 23 public: |
| 23 VideoEncoderHelper(); | 24 VideoEncoderHelper(); |
| 24 | 25 |
| 25 // Returns a new VideoPacket with common fields (e.g. capture_time_ms, rects | 26 // Returns a new VideoPacket with common fields (e.g. capture_time_ms, rects |
| 26 // list, frame shape if any) initialized based on the supplied |frame|. | 27 // list, frame shape if any) initialized based on the supplied |frame|. |
| 27 // Screen width and height will be set iff |frame|'s size differs from that | 28 // Screen width and height will be set iff |frame|'s size differs from that |
| 28 // of the previously-supplied frame. | 29 // of the previously-supplied frame. |
| 29 scoped_ptr<VideoPacket> CreateVideoPacket(const webrtc::DesktopFrame& frame); | 30 std::unique_ptr<VideoPacket> CreateVideoPacket( |
| 31 const webrtc::DesktopFrame& frame); |
| 30 | 32 |
| 31 // Returns a new VideoPacket with the common fields populated from |frame|, | 33 // Returns a new VideoPacket with the common fields populated from |frame|, |
| 32 // but the updated rects overridden by |updated_region|. This is useful for | 34 // but the updated rects overridden by |updated_region|. This is useful for |
| 33 // encoders which alter the updated region e.g. by expanding it to macroblock | 35 // encoders which alter the updated region e.g. by expanding it to macroblock |
| 34 // boundaries. | 36 // boundaries. |
| 35 scoped_ptr<VideoPacket> CreateVideoPacketWithUpdatedRegion( | 37 std::unique_ptr<VideoPacket> CreateVideoPacketWithUpdatedRegion( |
| 36 const webrtc::DesktopFrame& frame, | 38 const webrtc::DesktopFrame& frame, |
| 37 const webrtc::DesktopRegion& updated_region); | 39 const webrtc::DesktopRegion& updated_region); |
| 40 |
| 38 private: | 41 private: |
| 39 // The most recent screen size. Used to detect screen size changes. | 42 // The most recent screen size. Used to detect screen size changes. |
| 40 webrtc::DesktopSize screen_size_; | 43 webrtc::DesktopSize screen_size_; |
| 41 | 44 |
| 42 DISALLOW_COPY_AND_ASSIGN(VideoEncoderHelper); | 45 DISALLOW_COPY_AND_ASSIGN(VideoEncoderHelper); |
| 43 }; | 46 }; |
| 44 | 47 |
| 45 } // namespace remoting | 48 } // namespace remoting |
| 46 | 49 |
| 47 #endif // REMOTING_CODEC_VIDEO_ENCODER_HELPER_H_ | 50 #endif // REMOTING_CODEC_VIDEO_ENCODER_HELPER_H_ |
| OLD | NEW |