summaryrefslogtreecommitdiffstats
path: root/remoting/base/encoder.h
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-23 00:54:47 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-23 00:54:47 +0000
commitbe2da4de5227f4f1cbb8455a58045c5e51076474 (patch)
treed69b7cb3b045d01adb953b007086fbe9c864af40 /remoting/base/encoder.h
parent452390cc7dc08a33a2c9b5729372b830f6966095 (diff)
downloadchromium_src-be2da4de5227f4f1cbb8455a58045c5e51076474.zip
chromium_src-be2da4de5227f4f1cbb8455a58045c5e51076474.tar.gz
chromium_src-be2da4de5227f4f1cbb8455a58045c5e51076474.tar.bz2
Moving Encoder and Decoder to remoting/base
Putting Encder and Decoder together so we can have test that tests both of them. TEST=remoting_unittests Review URL: http://codereview.chromium.org/2840036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53427 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/base/encoder.h')
-rw-r--r--remoting/base/encoder.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/remoting/base/encoder.h b/remoting/base/encoder.h
new file mode 100644
index 0000000..0c1fd50f
--- /dev/null
+++ b/remoting/base/encoder.h
@@ -0,0 +1,61 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_BASE_ENCODER_H_
+#define REMOTING_BASE_ENCODER_H_
+
+#include "base/basictypes.h"
+#include "base/callback.h"
+#include "media/base/data_buffer.h"
+#include "remoting/base/protocol/chromotocol.pb.h"
+
+namespace media {
+ class DataBuffer;
+}
+
+namespace remoting {
+
+class CaptureData;
+class HostMessage;
+
+// A class to perform the task of encoding a continous stream of
+// images.
+// This class operates asynchronously to enable maximum throughput.
+class Encoder {
+ public:
+
+ // EncodingState is a bitfield that tracks the state of the encoding.
+ // An encoding that consists of a single block could concievably be starting
+ // inprogress and ended at the same time.
+ enum {
+ EncodingStarting = 1 << 0,
+ EncodingInProgress = 1 << 1,
+ EncodingEnded = 1 << 2
+ };
+ typedef int EncodingState;
+
+ // DataAvailableCallback is called as blocks of data are made available
+ // from the encoder. Data made available by the encoder is in the form
+ // of HostMessage to reduce the amount of memory copies.
+ // The callback takes ownership of the HostMessage and is responsible for
+ // deleting it.
+ typedef Callback2<HostMessage*, EncodingState>::Type DataAvailableCallback;
+
+ virtual ~Encoder() {}
+
+ // Encode an image stored in |capture_data|.
+ //
+ // If |key_frame| is true, the encoder should not reference
+ // previous encode and encode the full frame.
+ //
+ // When encoded data is available, partial or full |data_available_callback|
+ // is called.
+ virtual void Encode(scoped_refptr<CaptureData> capture_data,
+ bool key_frame,
+ DataAvailableCallback* data_available_callback) = 0;
+};
+
+} // namespace remoting
+
+#endif // REMOTING_BASE_ENCODER_H_