| 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_DECODER_VP8_H_ | 5 #ifndef REMOTING_BASE_DECODER_VP8_H_ |
| 6 #define REMOTING_BASE_DECODER_VP8_H_ | 6 #define REMOTING_BASE_DECODER_VP8_H_ |
| 7 | 7 |
| 8 #include "remoting/base/decoder.h" | 8 #include "remoting/base/decoder.h" |
| 9 | 9 |
| 10 typedef struct vpx_codec_ctx vpx_codec_ctx_t; | 10 typedef struct vpx_codec_ctx vpx_codec_ctx_t; |
| 11 | 11 |
| 12 namespace remoting { | 12 namespace remoting { |
| 13 | 13 |
| 14 class DecoderVp8 : public Decoder { | 14 class DecoderVp8 : public Decoder { |
| 15 public: | 15 public: |
| 16 DecoderVp8(); | 16 DecoderVp8(); |
| 17 ~DecoderVp8(); | 17 virtual ~DecoderVp8(); |
| 18 | 18 |
| 19 // Decoder implementations. | 19 // Decoder implementations. |
| 20 virtual bool BeginDecode(scoped_refptr<media::VideoFrame> frame, | 20 virtual void Initialize(scoped_refptr<media::VideoFrame> frame, |
| 21 UpdatedRects* update_rects, | 21 const gfx::Rect& clip, int bytes_per_src_pixel); |
| 22 Task* partial_decode_done, | 22 |
| 23 Task* decode_done); | 23 virtual void Reset(); |
| 24 virtual bool PartialDecode(ChromotingHostMessage* message); | 24 |
| 25 virtual void EndDecode(); | 25 // Feeds more data into the decoder. |
| 26 virtual void DecodeBytes(const std::string& encoded_bytes); |
| 27 |
| 28 // Returns true if decoder is ready to accept data via ProcessRectangleData. |
| 29 virtual bool IsReadyForData(); |
| 30 |
| 31 virtual VideoPacketFormat::Encoding Encoding(); |
| 26 | 32 |
| 27 private: | 33 private: |
| 28 bool HandleBeginRect(ChromotingHostMessage* message); | 34 enum State { |
| 29 bool HandleRectData(ChromotingHostMessage* message); | 35 kUninitialized, |
| 30 bool HandleEndRect(ChromotingHostMessage* message); | 36 kReady, |
| 37 kError, |
| 38 }; |
| 31 | 39 |
| 32 // The internal state of the decoder. | 40 // The internal state of the decoder. |
| 33 State state_; | 41 State state_; |
| 34 | 42 |
| 35 // Keeps track of the updating rect. | |
| 36 int rect_x_; | |
| 37 int rect_y_; | |
| 38 int rect_width_; | |
| 39 int rect_height_; | |
| 40 | |
| 41 // Tasks to call when decode is done. | |
| 42 scoped_ptr<Task> partial_decode_done_; | |
| 43 scoped_ptr<Task> decode_done_; | |
| 44 | |
| 45 // The video frame to write to. | 43 // The video frame to write to. |
| 46 scoped_refptr<media::VideoFrame> frame_; | 44 scoped_refptr<media::VideoFrame> frame_; |
| 47 UpdatedRects* updated_rects_; | |
| 48 | 45 |
| 49 vpx_codec_ctx_t* codec_; | 46 vpx_codec_ctx_t* codec_; |
| 50 | 47 |
| 51 DISALLOW_COPY_AND_ASSIGN(DecoderVp8); | 48 DISALLOW_COPY_AND_ASSIGN(DecoderVp8); |
| 52 }; | 49 }; |
| 53 | 50 |
| 54 } // namespace remoting | 51 } // namespace remoting |
| 55 | 52 |
| 56 #endif // REMOTING_BASE_DECODER_VP8_H_ | 53 #endif // REMOTING_BASE_DECODER_VP8_H_ |
| OLD | NEW |