| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_BASE_ENCODER_VP8_H_ | 5 #ifndef REMOTING_BASE_ENCODER_VP8_H_ |
| 6 #define REMOTING_BASE_ENCODER_VP8_H_ | 6 #define REMOTING_BASE_ENCODER_VP8_H_ |
| 7 | 7 |
| 8 #include "remoting/host/encoder.h" | 8 #include "remoting/base/encoder.h" |
| 9 | |
| 10 #include "remoting/base/protocol/chromotocol.pb.h" | 9 #include "remoting/base/protocol/chromotocol.pb.h" |
| 11 | 10 |
| 12 extern "C" { | 11 typedef struct vpx_codec_ctx vpx_codec_ctx_t; |
| 13 // TODO(garykac): fix this link with the correct path to on2 | 12 typedef struct vpx_image vpx_image_t; |
| 14 #include "remoting/third_party/on2/include/on2_encoder.h" | |
| 15 } // extern "C" | |
| 16 | |
| 17 namespace media { | |
| 18 | |
| 19 class DataBuffer; | |
| 20 | |
| 21 } // namespace media | |
| 22 | 13 |
| 23 namespace remoting { | 14 namespace remoting { |
| 24 | 15 |
| 25 // A class that uses VP8 to perform encoding. | 16 // A class that uses VP8 to perform encoding. |
| 26 class EncoderVp8 : public Encoder { | 17 class EncoderVp8 : public Encoder { |
| 27 public: | 18 public: |
| 28 EncoderVp8(); | 19 EncoderVp8(); |
| 29 virtual ~EncoderVp8(); | 20 virtual ~EncoderVp8(); |
| 30 | 21 |
| 31 virtual void Encode(const DirtyRects& dirty_rects, | 22 virtual void Encode(scoped_refptr<CaptureData> capture_data, |
| 32 const uint8** input_data, | |
| 33 const int* strides, | |
| 34 bool key_frame, | 23 bool key_frame, |
| 35 UpdateStreamPacketHeader* header, | 24 DataAvailableCallback* data_available_callback); |
| 36 scoped_refptr<media::DataBuffer>* output_data, | |
| 37 bool* encode_done, | |
| 38 Task* data_available_task); | |
| 39 virtual void SetSize(int width, int height); | |
| 40 virtual void SetPixelFormat(PixelFormat pixel_format); | |
| 41 | 25 |
| 42 private: | 26 private: |
| 43 // Setup the VP8 encoder. | 27 // Initialize the encoder. Returns true if successful. |
| 44 bool Init(); | 28 bool Init(int width, int height); |
| 29 |
| 30 // Prepare |image_| for encoding. Returns true if successful. |
| 31 bool PrepareImage(scoped_refptr<CaptureData> capture_data); |
| 45 | 32 |
| 46 // True if the encoder is initialized. | 33 // True if the encoder is initialized. |
| 47 bool initialized_; | 34 bool initialized_; |
| 48 | 35 |
| 49 int width_; | 36 scoped_ptr<vpx_codec_ctx_t> codec_; |
| 50 int height_; | 37 scoped_ptr<vpx_image_t> image_; |
| 51 PixelFormat pixel_format_; | |
| 52 on2_codec_ctx_t codec_; | |
| 53 on2_image_t image_; | |
| 54 int last_timestamp_; | 38 int last_timestamp_; |
| 55 | 39 |
| 40 // Buffer for storing the yuv image. |
| 41 scoped_array<uint8> yuv_image_; |
| 42 |
| 56 DISALLOW_COPY_AND_ASSIGN(EncoderVp8); | 43 DISALLOW_COPY_AND_ASSIGN(EncoderVp8); |
| 57 }; | 44 }; |
| 58 | 45 |
| 59 } // namespace remoting | 46 } // namespace remoting |
| 60 | 47 |
| 61 #endif // REMOTING_BASE_ENCODER_VP8_H_ | 48 #endif // REMOTING_BASE_ENCODER_VP8_H_ |
| OLD | NEW |