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 virtual ~DecoderVp8(); | 17 ~DecoderVp8(); |
18 | 18 |
19 // Decoder implementations. | 19 // Decoder implementations. |
20 virtual void Initialize(scoped_refptr<media::VideoFrame> frame, | 20 virtual bool BeginDecode(scoped_refptr<media::VideoFrame> frame, |
21 const gfx::Rect& clip, int bytes_per_src_pixel); | 21 UpdatedRects* update_rects, |
22 | 22 Task* partial_decode_done, |
23 virtual void Reset(); | 23 Task* decode_done); |
24 | 24 virtual bool PartialDecode(ChromotingHostMessage* message); |
25 // Feeds more data into the decoder. | 25 virtual void EndDecode(); |
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(); | |
32 | 26 |
33 private: | 27 private: |
34 enum State { | 28 bool HandleBeginRect(ChromotingHostMessage* message); |
35 kUninitialized, | 29 bool HandleRectData(ChromotingHostMessage* message); |
36 kReady, | 30 bool HandleEndRect(ChromotingHostMessage* message); |
37 kError, | |
38 }; | |
39 | 31 |
40 // The internal state of the decoder. | 32 // The internal state of the decoder. |
41 State state_; | 33 State state_; |
42 | 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 |
43 // The video frame to write to. | 45 // The video frame to write to. |
44 scoped_refptr<media::VideoFrame> frame_; | 46 scoped_refptr<media::VideoFrame> frame_; |
| 47 UpdatedRects* updated_rects_; |
45 | 48 |
46 vpx_codec_ctx_t* codec_; | 49 vpx_codec_ctx_t* codec_; |
47 | 50 |
48 DISALLOW_COPY_AND_ASSIGN(DecoderVp8); | 51 DISALLOW_COPY_AND_ASSIGN(DecoderVp8); |
49 }; | 52 }; |
50 | 53 |
51 } // namespace remoting | 54 } // namespace remoting |
52 | 55 |
53 #endif // REMOTING_BASE_DECODER_VP8_H_ | 56 #endif // REMOTING_BASE_DECODER_VP8_H_ |
OLD | NEW |