OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_VPX_H_ | 5 #ifndef REMOTING_CODEC_VIDEO_ENCODER_VPX_H_ |
6 #define REMOTING_CODEC_VIDEO_ENCODER_VPX_H_ | 6 #define REMOTING_CODEC_VIDEO_ENCODER_VPX_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "remoting/codec/scoped_vpx_codec.h" | 10 #include "remoting/codec/scoped_vpx_codec.h" |
11 #include "remoting/codec/video_encoder.h" | 11 #include "remoting/codec/video_encoder.h" |
12 #include "remoting/codec/video_encoder_helper.h" | 12 #include "remoting/codec/video_encoder_helper.h" |
13 | 13 |
14 typedef struct vpx_image vpx_image_t; | 14 typedef struct vpx_image vpx_image_t; |
15 | 15 |
16 namespace webrtc { | 16 namespace webrtc { |
17 class DesktopRegion; | 17 class DesktopRegion; |
18 class DesktopSize; | 18 class DesktopSize; |
19 } // namespace webrtc | 19 } // namespace webrtc |
20 | 20 |
21 namespace remoting { | 21 namespace remoting { |
22 | 22 |
23 class VideoEncoderVpx : public VideoEncoder { | 23 class VideoEncoderVpx : public VideoEncoder { |
24 public: | 24 public: |
25 // Create encoder for the specified protocol. | 25 // Create encoder for the specified protocol. |
26 static scoped_ptr<VideoEncoderVpx> CreateForVP8(); | 26 static scoped_ptr<VideoEncoderVpx> CreateForVP8(); |
27 static scoped_ptr<VideoEncoderVpx> CreateForVP9(); | 27 static scoped_ptr<VideoEncoderVpx> CreateForVP9(); |
28 | 28 |
29 virtual ~VideoEncoderVpx(); | 29 ~VideoEncoderVpx() override; |
30 | 30 |
31 // VideoEncoder interface. | 31 // VideoEncoder interface. |
32 virtual void SetLosslessEncode(bool want_lossless) override; | 32 void SetLosslessEncode(bool want_lossless) override; |
33 virtual void SetLosslessColor(bool want_lossless) override; | 33 void SetLosslessColor(bool want_lossless) override; |
34 virtual scoped_ptr<VideoPacket> Encode( | 34 scoped_ptr<VideoPacket> Encode(const webrtc::DesktopFrame& frame) override; |
35 const webrtc::DesktopFrame& frame) override; | |
36 | 35 |
37 private: | 36 private: |
38 explicit VideoEncoderVpx(bool use_vp9); | 37 explicit VideoEncoderVpx(bool use_vp9); |
39 | 38 |
40 // Initializes the codec for frames of |size|. Returns true if successful. | 39 // Initializes the codec for frames of |size|. Returns true if successful. |
41 bool Initialize(const webrtc::DesktopSize& size); | 40 bool Initialize(const webrtc::DesktopSize& size); |
42 | 41 |
43 // Prepares |image_| for encoding. Writes updated rectangles into | 42 // Prepares |image_| for encoding. Writes updated rectangles into |
44 // |updated_region|. | 43 // |updated_region|. |
45 void PrepareImage(const webrtc::DesktopFrame& frame, | 44 void PrepareImage(const webrtc::DesktopFrame& frame, |
(...skipping 25 matching lines...) Expand all Loading... |
71 | 70 |
72 // Used to help initialize VideoPackets from DesktopFrames. | 71 // Used to help initialize VideoPackets from DesktopFrames. |
73 VideoEncoderHelper helper_; | 72 VideoEncoderHelper helper_; |
74 | 73 |
75 DISALLOW_COPY_AND_ASSIGN(VideoEncoderVpx); | 74 DISALLOW_COPY_AND_ASSIGN(VideoEncoderVpx); |
76 }; | 75 }; |
77 | 76 |
78 } // namespace remoting | 77 } // namespace remoting |
79 | 78 |
80 #endif // REMOTING_CODEC_VIDEO_ENCODER_VP8_H_ | 79 #endif // REMOTING_CODEC_VIDEO_ENCODER_VP8_H_ |
OLD | NEW |