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

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

Issue 2690003: Copy the (early prototype of) remoting in Chrome into the public tree.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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 | « remoting/chromoting.gyp ('k') | remoting/client/decoder_verbatim.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(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_DECODER_H_
6 #define REMOTING_CLIENT_DECODER_H_
7
8 #include <vector>
9
10 #include "base/callback.h"
11 #include "base/scoped_ptr.h"
12 #include "gfx/rect.h"
13 #include "media/base/video_frame.h"
14 #include "remoting/base/protocol/chromotocol.pb.h"
15
16 namespace remoting {
17
18 // Defines the behavior of a decoder for decoding images received from the
19 // host.
20 //
21 // Sequence of actions with a decoder is as follows:
22 //
23 // 1. BeginDecode(VideoFrame)
24 // 2. PartialDecode(HostMessage)
25 // ...
26 // 3. EndDecode()
27 //
28 // The decoder will reply with:
29 // 1. PartialDecodeDone(VideoFrame, UpdatedRects)
30 // ...
31 // 2. DecodeDone(VideoFrame)
32 //
33 // The format of VideoFrame is a contract between the object that creates the
34 // decoder (most likely the renderer) and the decoder.
35 class Decoder {
36 public:
37 typedef std::vector<gfx::Rect> UpdatedRects;
38 typedef Callback2<scoped_refptr<media::VideoFrame>, UpdatedRects>::Type
39 PartialDecodeDoneCallback;
40 typedef Callback1<scoped_refptr<media::VideoFrame> >::Type
41 DecodeDoneCallback;
42
43 Decoder(PartialDecodeDoneCallback* partial_decode_done_callback,
44 DecodeDoneCallback* decode_done_callback)
45 : partial_decode_done_(partial_decode_done_callback),
46 decode_done_(decode_done_callback) {
47 }
48
49 virtual ~Decoder() {
50 }
51
52 // Tell the decoder to use |frame| as a target to write the decoded image
53 // for the coming update stream.
54 // Return true if the decoder can writes output to |frame| and accept
55 // the codec format.
56 // TODO(hclam): Provide more information when calling this function.
57 virtual bool BeginDecode(scoped_refptr<media::VideoFrame> frame) = 0;
58
59 // Give a HostMessage that contains the update stream packet that contains
60 // the encoded data to the decoder.
61 // The decoder will own |message| and is responsible for deleting it.
62 // If the decoder has written something into |frame|,
63 // |partial_decode_done_| is called with |frame| and updated regions.
64 // Return true if the decoder can accept |message| and decode it.
65 virtual bool PartialDecode(chromotocol_pb::HostMessage* message) = 0;
66
67 // Notify the decoder that we have received the last update stream packet.
68 // If the decoding of the update stream has completed |decode_done_| is
69 // called with |frame|.
70 // If the update stream is not received fully and this method is called the
71 // decoder should also call |decode_done_| as soon as possible.
72 virtual void EndDecode() = 0;
73
74 protected:
75 PartialDecodeDoneCallback* partial_decode_done() {
76 return partial_decode_done_.get();
77 }
78
79 DecodeDoneCallback* decode_done() {
80 return decode_done_.get();
81 }
82
83 private:
84 scoped_ptr<PartialDecodeDoneCallback> partial_decode_done_;
85 scoped_ptr<DecodeDoneCallback> decode_done_;
86
87 DISALLOW_COPY_AND_ASSIGN(Decoder);
88 };
89
90 } // namespace remoting
91
92 #endif // REMOTING_CLIENT_DECODER_H_
OLDNEW
« no previous file with comments | « remoting/chromoting.gyp ('k') | remoting/client/decoder_verbatim.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698