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