diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-28 22:19:48 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-28 22:19:48 +0000 |
commit | df10bf173f91818f1f03d409ec8d60265b44675f (patch) | |
tree | 27dc201712833ce527da84b15e0e4df73bdd56ec /remoting/base/encoder_vp8.h | |
parent | b045a7405237ec931bf137f2c555960fa64a9523 (diff) | |
download | chromium_src-df10bf173f91818f1f03d409ec8d60265b44675f.zip chromium_src-df10bf173f91818f1f03d409ec8d60265b44675f.tar.gz chromium_src-df10bf173f91818f1f03d409ec8d60265b44675f.tar.bz2 |
Implement VP8 encoder for chromoting
Added EncoderVp8 with test for chromoting.
TEST=remoting_unittests
BUG=50235
Review URL: http://codereview.chromium.org/3005036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60854 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/base/encoder_vp8.h')
-rw-r--r-- | remoting/base/encoder_vp8.h | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/remoting/base/encoder_vp8.h b/remoting/base/encoder_vp8.h index 4b8b539..ae29c63 100644 --- a/remoting/base/encoder_vp8.h +++ b/remoting/base/encoder_vp8.h @@ -5,20 +5,11 @@ #ifndef REMOTING_BASE_ENCODER_VP8_H_ #define REMOTING_BASE_ENCODER_VP8_H_ -#include "remoting/host/encoder.h" - +#include "remoting/base/encoder.h" #include "remoting/base/protocol/chromotocol.pb.h" -extern "C" { -// TODO(garykac): fix this link with the correct path to on2 -#include "remoting/third_party/on2/include/on2_encoder.h" -} // extern "C" - -namespace media { - -class DataBuffer; - -} // namespace media +typedef struct vpx_codec_ctx vpx_codec_ctx_t; +typedef struct vpx_image vpx_image_t; namespace remoting { @@ -28,31 +19,27 @@ class EncoderVp8 : public Encoder { EncoderVp8(); virtual ~EncoderVp8(); - virtual void Encode(const DirtyRects& dirty_rects, - const uint8** input_data, - const int* strides, + virtual void Encode(scoped_refptr<CaptureData> capture_data, bool key_frame, - UpdateStreamPacketHeader* header, - scoped_refptr<media::DataBuffer>* output_data, - bool* encode_done, - Task* data_available_task); - virtual void SetSize(int width, int height); - virtual void SetPixelFormat(PixelFormat pixel_format); + DataAvailableCallback* data_available_callback); private: - // Setup the VP8 encoder. - bool Init(); + // Initialize the encoder. Returns true if successful. + bool Init(int width, int height); + + // Prepare |image_| for encoding. Returns true if successful. + bool PrepareImage(scoped_refptr<CaptureData> capture_data); // True if the encoder is initialized. bool initialized_; - int width_; - int height_; - PixelFormat pixel_format_; - on2_codec_ctx_t codec_; - on2_image_t image_; + scoped_ptr<vpx_codec_ctx_t> codec_; + scoped_ptr<vpx_image_t> image_; int last_timestamp_; + // Buffer for storing the yuv image. + scoped_array<uint8> yuv_image_; + DISALLOW_COPY_AND_ASSIGN(EncoderVp8); }; |