OLD | NEW |
(Empty) | |
| 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_CLIENT_RECTANGLE_UPDATE_DECODER_H |
| 6 #define REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H |
| 7 |
| 8 #include "base/scoped_ptr.h" |
| 9 #include "base/task.h" |
| 10 #include "media/base/video_frame.h" |
| 11 #include "remoting/base/decoder.h" // For UpdatedRects. |
| 12 |
| 13 class MessageLoop; |
| 14 |
| 15 namespace remoting { |
| 16 |
| 17 class FrameConsumer; |
| 18 class RectangleFormat; |
| 19 class RectangleUpdatePacket; |
| 20 |
| 21 // TODO(ajwong): Re-examine this API, especially with regards to how error |
| 22 // conditions on each step are reported. Should they be CHECKs? Logs? Other? |
| 23 class RectangleUpdateDecoder { |
| 24 public: |
| 25 RectangleUpdateDecoder(MessageLoop* message_loop, |
| 26 FrameConsumer* consumer); |
| 27 ~RectangleUpdateDecoder(); |
| 28 |
| 29 // Decodes the contents of |packet| calling OnPartialFrameOutput() in the |
| 30 // regsitered as data is avaialable. DecodePacket may keep a reference to |
| 31 // |packet| so the |packet| must remain alive and valid until |done| is |
| 32 // executed. |
| 33 // |
| 34 // TODO(ajwong): Should packet be a const pointer to make the lifetime |
| 35 // more clear? |
| 36 void DecodePacket(const RectangleUpdatePacket& packet, Task* done); |
| 37 |
| 38 private: |
| 39 static bool IsValidPacket(const RectangleUpdatePacket& packet); |
| 40 |
| 41 void InitializeDecoder(const RectangleFormat& format, Task* done); |
| 42 |
| 43 void ProcessPacketData(const RectangleUpdatePacket& packet, Task* done); |
| 44 |
| 45 // Pointers to infrastructure objects. Not owned. |
| 46 MessageLoop* message_loop_; |
| 47 FrameConsumer* consumer_; |
| 48 |
| 49 scoped_ptr<Decoder> decoder_; |
| 50 UpdatedRects updated_rects_; |
| 51 |
| 52 // Framebuffer for the decoder. |
| 53 scoped_refptr<media::VideoFrame> frame_; |
| 54 }; |
| 55 |
| 56 } // namespace remoting |
| 57 |
| 58 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::RectangleUpdateDecoder); |
| 59 |
| 60 #endif // REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H |
OLD | NEW |