[email protected] | 622b788 | 2010-09-29 17:34:32 | [diff] [blame^] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef REMOTING_BASE_DECODER_VP8_H_ |
| 6 | #define REMOTING_BASE_DECODER_VP8_H_ |
| 7 | |
| 8 | #include "remoting/base/decoder.h" |
| 9 | |
| 10 | typedef struct vpx_codec_ctx vpx_codec_ctx_t; |
| 11 | |
| 12 | namespace remoting { |
| 13 | |
| 14 | class DecoderVp8 : public Decoder { |
| 15 | public: |
| 16 | DecoderVp8(); |
| 17 | ~DecoderVp8(); |
| 18 | |
| 19 | // Decoder implementations. |
| 20 | virtual bool BeginDecode(scoped_refptr<media::VideoFrame> frame, |
| 21 | UpdatedRects* update_rects, |
| 22 | Task* partial_decode_done, |
| 23 | Task* decode_done); |
| 24 | virtual bool PartialDecode(ChromotingHostMessage* message); |
| 25 | virtual void EndDecode(); |
| 26 | |
| 27 | private: |
| 28 | bool HandleBeginRect(ChromotingHostMessage* message); |
| 29 | bool HandleRectData(ChromotingHostMessage* message); |
| 30 | bool HandleEndRect(ChromotingHostMessage* message); |
| 31 | |
| 32 | // The internal state of the decoder. |
| 33 | State state_; |
| 34 | |
| 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. |
| 46 | scoped_refptr<media::VideoFrame> frame_; |
| 47 | UpdatedRects* updated_rects_; |
| 48 | |
| 49 | vpx_codec_ctx_t* codec_; |
| 50 | |
| 51 | DISALLOW_COPY_AND_ASSIGN(DecoderVp8); |
| 52 | }; |
| 53 | |
| 54 | } // namespace remoting |
| 55 | |
| 56 | #endif // REMOTING_BASE_DECODER_VP8_H_ |