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_CHROMOTING_VIEW_H_ | 5 #ifndef REMOTING_CLIENT_CHROMOTING_VIEW_H_ |
6 #define REMOTING_CLIENT_CHROMOTING_VIEW_H_ | 6 #define REMOTING_CLIENT_CHROMOTING_VIEW_H_ |
7 | 7 |
8 #include "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
9 #include "remoting/base/decoder.h" | 9 #include "remoting/base/decoder.h" |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // This should match the size of the output from the decoder. | 44 // This should match the size of the output from the decoder. |
45 // | 45 // |
46 // TODO(garykac): This handles only 1 screen. We need multi-screen support. | 46 // TODO(garykac): This handles only 1 screen. We need multi-screen support. |
47 virtual void SetHostScreenSize(int width, int height) = 0; | 47 virtual void SetHostScreenSize(int width, int height) = 0; |
48 | 48 |
49 // Handle the BeginUpdateStream message. | 49 // Handle the BeginUpdateStream message. |
50 // This method should perform the following tasks: | 50 // This method should perform the following tasks: |
51 // (1) Perform any platform-specific tasks for start of update stream. | 51 // (1) Perform any platform-specific tasks for start of update stream. |
52 // (2) Make sure the |frame_| has been initialized. | 52 // (2) Make sure the |frame_| has been initialized. |
53 // (3) Delete the HostMessage. | 53 // (3) Delete the HostMessage. |
54 virtual void HandleBeginUpdateStream(HostMessage* msg) = 0; | 54 virtual void HandleBeginUpdateStream(ChromotingHostMessage* msg) = 0; |
55 | 55 |
56 // Handle the UpdateStreamPacket message. | 56 // Handle the UpdateStreamPacket message. |
57 // This method should perform the following tasks: | 57 // This method should perform the following tasks: |
58 // (1) Extract the decoding from the update packet message. | 58 // (1) Extract the decoding from the update packet message. |
59 // (2) Call SetupDecoder with the encoding to lazily initialize the decoder. | 59 // (2) Call SetupDecoder with the encoding to lazily initialize the decoder. |
60 // We don't do this in BeginUpdateStream because the begin message | 60 // We don't do this in BeginUpdateStream because the begin message |
61 // doesn't contain the encoding. | 61 // doesn't contain the encoding. |
62 // (3) Call BeginDecoding if this is the first packet of the stream. | 62 // (3) Call BeginDecoding if this is the first packet of the stream. |
63 // (4) Call the decoder's PartialDecode() method to decode the packet. | 63 // (4) Call the decoder's PartialDecode() method to decode the packet. |
64 // This call will delete the HostMessage. | 64 // This call will delete the HostMessage. |
65 // Note: | 65 // Note: |
66 // * For a given begin/end update stream, the encodings specified in the | 66 // * For a given begin/end update stream, the encodings specified in the |
67 // update packets must all match. We may revisit this constraint at a | 67 // update packets must all match. We may revisit this constraint at a |
68 // later date. | 68 // later date. |
69 virtual void HandleUpdateStreamPacket(HostMessage* msg) = 0; | 69 virtual void HandleUpdateStreamPacket(ChromotingHostMessage* msg) = 0; |
70 | 70 |
71 // Handle the EndUpdateStream message. | 71 // Handle the EndUpdateStream message. |
72 // This method should perform the following tasks: | 72 // This method should perform the following tasks: |
73 // (1) Call EndDecoding(). | 73 // (1) Call EndDecoding(). |
74 // (2) Perform any platform-specific tasks for end of update stream. | 74 // (2) Perform any platform-specific tasks for end of update stream. |
75 // (3) Delete the HostMessage. | 75 // (3) Delete the HostMessage. |
76 virtual void HandleEndUpdateStream(HostMessage* msg) = 0; | 76 virtual void HandleEndUpdateStream(ChromotingHostMessage* msg) = 0; |
77 | 77 |
78 protected: | 78 protected: |
79 // Setup the decoder based on the given encoding. | 79 // Setup the decoder based on the given encoding. |
80 // Returns true if a new decoder has already been started (with a call to | 80 // Returns true if a new decoder has already been started (with a call to |
81 // BeginDecoding). | 81 // BeginDecoding). |
82 bool SetupDecoder(UpdateStreamEncoding encoding); | 82 bool SetupDecoder(UpdateStreamEncoding encoding); |
83 | 83 |
84 // Prepare the decoder to start decoding a chunk of data. | 84 // Prepare the decoder to start decoding a chunk of data. |
85 // This needs to be called if SetupDecoder() returns false. | 85 // This needs to be called if SetupDecoder() returns false. |
86 bool BeginDecoding(Task* partial_decode_done, Task* decode_done); | 86 bool BeginDecoding(Task* partial_decode_done, Task* decode_done); |
87 | 87 |
88 // Decode the given message. | 88 // Decode the given message. |
89 // BeginDecoding() must be called before any calls to Decode(). | 89 // BeginDecoding() must be called before any calls to Decode(). |
90 bool Decode(HostMessage* msg); | 90 bool Decode(ChromotingHostMessage* msg); |
91 | 91 |
92 // Finish decoding and send notifications to update the view. | 92 // Finish decoding and send notifications to update the view. |
93 bool EndDecoding(); | 93 bool EndDecoding(); |
94 | 94 |
95 // Decoder used to decode the video frames (or frame fragements). | 95 // Decoder used to decode the video frames (or frame fragements). |
96 scoped_ptr<Decoder> decoder_; | 96 scoped_ptr<Decoder> decoder_; |
97 | 97 |
98 // Framebuffer for the decoder. | 98 // Framebuffer for the decoder. |
99 scoped_refptr<media::VideoFrame> frame_; | 99 scoped_refptr<media::VideoFrame> frame_; |
100 | 100 |
101 // Dimensions of |frame_| bitmap. | 101 // Dimensions of |frame_| bitmap. |
102 int frame_width_; | 102 int frame_width_; |
103 int frame_height_; | 103 int frame_height_; |
104 | 104 |
105 UpdatedRects update_rects_; | 105 UpdatedRects update_rects_; |
106 UpdatedRects all_update_rects_; | 106 UpdatedRects all_update_rects_; |
107 }; | 107 }; |
108 | 108 |
109 } // namespace remoting | 109 } // namespace remoting |
110 | 110 |
111 #endif // REMOTING_CLIENT_CHROMOTING_VIEW_H_ | 111 #endif // REMOTING_CLIENT_CHROMOTING_VIEW_H_ |
OLD | NEW |