summaryrefslogtreecommitdiffstats
path: root/remoting/client/decoder.h
diff options
context:
space:
mode:
Diffstat (limited to 'remoting/client/decoder.h')
-rw-r--r--remoting/client/decoder.h43
1 files changed, 13 insertions, 30 deletions
diff --git a/remoting/client/decoder.h b/remoting/client/decoder.h
index d39be07..ac2fe4d 100644
--- a/remoting/client/decoder.h
+++ b/remoting/client/decoder.h
@@ -7,7 +7,7 @@
#include <vector>
-#include "base/callback.h"
+#include "base/task.h"
#include "base/scoped_ptr.h"
#include "gfx/rect.h"
#include "media/base/video_frame.h"
@@ -15,12 +15,15 @@
namespace remoting {
+// TODO(hclam): Merge this with the one in remoting/host/encoder.h.
+typedef std::vector<gfx::Rect> UpdatedRects;
+
// Defines the behavior of a decoder for decoding images received from the
// host.
//
// Sequence of actions with a decoder is as follows:
//
-// 1. BeginDecode(VideoFrame)
+// 1. BeginDecode(PartialDecodeDone, DecodeDone, VideoFrame)
// 2. PartialDecode(HostMessage)
// ...
// 3. EndDecode()
@@ -34,27 +37,22 @@ namespace remoting {
// decoder (most likely the renderer) and the decoder.
class Decoder {
public:
- typedef std::vector<gfx::Rect> UpdatedRects;
- typedef Callback2<scoped_refptr<media::VideoFrame>, UpdatedRects>::Type
- PartialDecodeDoneCallback;
- typedef Callback1<scoped_refptr<media::VideoFrame> >::Type
- DecodeDoneCallback;
-
- Decoder(PartialDecodeDoneCallback* partial_decode_done_callback,
- DecodeDoneCallback* decode_done_callback)
- : partial_decode_done_(partial_decode_done_callback),
- decode_done_(decode_done_callback) {
- }
virtual ~Decoder() {
}
// Tell the decoder to use |frame| as a target to write the decoded image
// for the coming update stream.
+ // If decode is partially done and |frame| can be read, |partial_decode_done|
+ // is called and |update_rects| contains the updated regions.
+ // If decode is completed |decode_done| is called.
// Return true if the decoder can writes output to |frame| and accept
// the codec format.
// TODO(hclam): Provide more information when calling this function.
- virtual bool BeginDecode(scoped_refptr<media::VideoFrame> frame) = 0;
+ virtual bool BeginDecode(scoped_refptr<media::VideoFrame> frame,
+ UpdatedRects* updated_rects,
+ Task* partial_decode_done,
+ Task* decode_done) = 0;
// Give a HostMessage that contains the update stream packet that contains
// the encoded data to the decoder.
@@ -62,7 +60,7 @@ class Decoder {
// If the decoder has written something into |frame|,
// |partial_decode_done_| is called with |frame| and updated regions.
// Return true if the decoder can accept |message| and decode it.
- virtual bool PartialDecode(chromotocol_pb::HostMessage* message) = 0;
+ virtual bool PartialDecode(HostMessage* message) = 0;
// Notify the decoder that we have received the last update stream packet.
// If the decoding of the update stream has completed |decode_done_| is
@@ -70,21 +68,6 @@ class Decoder {
// If the update stream is not received fully and this method is called the
// decoder should also call |decode_done_| as soon as possible.
virtual void EndDecode() = 0;
-
- protected:
- PartialDecodeDoneCallback* partial_decode_done() {
- return partial_decode_done_.get();
- }
-
- DecodeDoneCallback* decode_done() {
- return decode_done_.get();
- }
-
- private:
- scoped_ptr<PartialDecodeDoneCallback> partial_decode_done_;
- scoped_ptr<DecodeDoneCallback> decode_done_;
-
- DISALLOW_COPY_AND_ASSIGN(Decoder);
};
} // namespace remoting