OLD | NEW |
| (Empty) |
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_BASE_ENCODER_VP8_H_ | |
6 #define REMOTING_BASE_ENCODER_VP8_H_ | |
7 | |
8 #include "base/gtest_prod_util.h" | |
9 #include "remoting/base/encoder.h" | |
10 #include "third_party/skia/include/core/SkRegion.h" | |
11 | |
12 typedef struct vpx_codec_ctx vpx_codec_ctx_t; | |
13 typedef struct vpx_image vpx_image_t; | |
14 | |
15 namespace remoting { | |
16 | |
17 // A class that uses VP8 to perform encoding. | |
18 class EncoderVp8 : public Encoder { | |
19 public: | |
20 EncoderVp8(); | |
21 virtual ~EncoderVp8(); | |
22 | |
23 virtual void Encode( | |
24 scoped_refptr<CaptureData> capture_data, | |
25 bool key_frame, | |
26 const DataAvailableCallback& data_available_callback) OVERRIDE; | |
27 | |
28 private: | |
29 FRIEND_TEST_ALL_PREFIXES(EncoderVp8Test, AlignAndClipRect); | |
30 | |
31 // Initialize the encoder. Returns true if successful. | |
32 bool Init(const SkISize& size); | |
33 | |
34 // Destroy the encoder. | |
35 void Destroy(); | |
36 | |
37 // Prepare |image_| for encoding. Write updated rectangles into | |
38 // |updated_region|. | |
39 void PrepareImage(scoped_refptr<CaptureData> capture_data, | |
40 SkRegion* updated_region); | |
41 | |
42 // Update the active map according to |updated_region|. Active map is then | |
43 // given to the encoder to speed up encoding. | |
44 void PrepareActiveMap(const SkRegion& updated_region); | |
45 | |
46 // True if the encoder is initialized. | |
47 bool initialized_; | |
48 | |
49 scoped_ptr<vpx_codec_ctx_t> codec_; | |
50 scoped_ptr<vpx_image_t> image_; | |
51 scoped_array<uint8> active_map_; | |
52 int active_map_width_; | |
53 int active_map_height_; | |
54 int last_timestamp_; | |
55 | |
56 // Buffer for storing the yuv image. | |
57 scoped_array<uint8> yuv_image_; | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(EncoderVp8); | |
60 }; | |
61 | |
62 } // namespace remoting | |
63 | |
64 #endif // REMOTING_BASE_ENCODER_VP8_H_ | |
OLD | NEW |