Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: remoting/base/decoder.h

Issue 3124005: Move UpdateStreamEncoding value into the BeginUpdateStreamMessage since we... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | remoting/base/decoder_verbatim.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_H_ 5 #ifndef REMOTING_BASE_DECODER_H_
6 #define REMOTING_BASE_DECODER_H_ 6 #define REMOTING_BASE_DECODER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/task.h" 10 #include "base/task.h"
(...skipping 19 matching lines...) Expand all
30 // 30 //
31 // The decoder will reply with: 31 // The decoder will reply with:
32 // 1. PartialDecodeDone(VideoFrame, UpdatedRects) 32 // 1. PartialDecodeDone(VideoFrame, UpdatedRects)
33 // ... 33 // ...
34 // 2. DecodeDone(VideoFrame) 34 // 2. DecodeDone(VideoFrame)
35 // 35 //
36 // The format of VideoFrame is a contract between the object that creates the 36 // The format of VideoFrame is a contract between the object that creates the
37 // decoder (most likely the renderer) and the decoder. 37 // decoder (most likely the renderer) and the decoder.
38 class Decoder { 38 class Decoder {
39 public: 39 public:
40 40 Decoder()
41 : encoding_(EncodingInvalid),
42 started_(false) {
43 }
41 virtual ~Decoder() { 44 virtual ~Decoder() {
42 } 45 }
43 46
44 // Tell the decoder to use |frame| as a target to write the decoded image 47 // Tell the decoder to use |frame| as a target to write the decoded image
45 // for the coming update stream. 48 // for the coming update stream.
46 // If decode is partially done and |frame| can be read, |partial_decode_done| 49 // If decode is partially done and |frame| can be read, |partial_decode_done|
47 // is called and |update_rects| contains the updated regions. 50 // is called and |update_rects| contains the updated regions.
48 // If decode is completed |decode_done| is called. 51 // If decode is completed |decode_done| is called.
49 // Return true if the decoder can writes output to |frame| and accept 52 // Return true if the decoder can writes output to |frame| and accept
50 // the codec format. 53 // the codec format.
(...skipping 22 matching lines...) Expand all
73 // these messages. 76 // these messages.
74 virtual bool PartialDecode(HostMessage* message) = 0; 77 virtual bool PartialDecode(HostMessage* message) = 0;
75 78
76 // Notify the decoder that we have received the last update stream packet. 79 // Notify the decoder that we have received the last update stream packet.
77 // If the decoding of the update stream has completed |decode_done_| is 80 // If the decoding of the update stream has completed |decode_done_| is
78 // called with |frame|. 81 // called with |frame|.
79 // If the update stream is not received fully and this method is called the 82 // If the update stream is not received fully and this method is called the
80 // decoder should also call |decode_done_| as soon as possible. 83 // decoder should also call |decode_done_| as soon as possible.
81 virtual void EndDecode() = 0; 84 virtual void EndDecode() = 0;
82 85
86 // Return the encoding type that this decoder handles.
87 virtual UpdateStreamEncoding Encoding() { return encoding_; }
88
89 // Return the current state of the decoder: 'true' if we're in the middle
90 // of BeginDecode() / EndDecode().
91 virtual bool IsStarted() { return started_; }
92
83 protected: 93 protected:
84 // Every decoder will have two internal states because there are three 94 // Every decoder will have two internal states because there are three
85 // kinds of messages send to PartialDecode(). 95 // kinds of messages send to PartialDecode().
86 // 96 //
87 // Here's a state diagram: 97 // Here's a state diagram:
88 // 98 //
89 // UpdateStreamBeginRect UpdateStreamRectData 99 // UpdateStreamBeginRect UpdateStreamRectData
90 // .............. ............ 100 // .............. ............
91 // . . . . 101 // . . . .
92 // . v . . 102 // . v . .
93 // kWaitingForBeginRect kWaitingForRectData . 103 // kWaitingForBeginRect kWaitingForRectData .
94 // ^ . ^ . 104 // ^ . ^ .
95 // . . . . 105 // . . . .
96 // .............. ............ 106 // .............. ............
97 // UpdateStreaEndRect 107 // UpdateStreaEndRect
98 enum State { 108 enum State {
99 // In this state the decoder is waiting for UpdateStreamBeginRect. 109 // In this state the decoder is waiting for UpdateStreamBeginRect.
100 // After receiving UpdateStreaBeginRect, the encoder will transit to 110 // After receiving UpdateStreaBeginRect, the encoder will transit to
101 // to kWaitingForRectData state. 111 // to kWaitingForRectData state.
102 kWaitingForBeginRect, 112 kWaitingForBeginRect,
103 113
104 // In this state the decoder is waiting for UpdateStreamRectData. 114 // In this state the decoder is waiting for UpdateStreamRectData.
105 // The decode remains in this state if UpdateStreamRectData is received. 115 // The decode remains in this state if UpdateStreamRectData is received.
106 // The decoder will transit to kWaitingForBeginRect if UpdateStreamEndRect 116 // The decoder will transit to kWaitingForBeginRect if UpdateStreamEndRect
107 // is received. 117 // is received.
108 kWaitingForRectData, 118 kWaitingForRectData,
109 }; 119 };
120
121 // The encoding that this decoder supports.
122 UpdateStreamEncoding encoding_;
123
124 // Has the decoder been started? I.e., has BeginDecode() been called.
125 bool started_;
110 }; 126 };
111 127
112 } // namespace remoting 128 } // namespace remoting
113 129
114 #endif // REMOTING_BASE_DECODER_H_ 130 #endif // REMOTING_BASE_DECODER_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/base/decoder_verbatim.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698