Chromium Code Reviews| Index: remoting/base/decoder.h |
| diff --git a/remoting/base/decoder.h b/remoting/base/decoder.h |
| index 82211a7f09d5170aad70857663e9718f2c7ed145..bd07fbcfa26d98ec1dd54c7f05ec571ff26c5bda 100644 |
| --- a/remoting/base/decoder.h |
| +++ b/remoting/base/decoder.h |
| @@ -5,6 +5,8 @@ |
| #ifndef REMOTING_BASE_DECODER_H_ |
| #define REMOTING_BASE_DECODER_H_ |
| +#include <vector> |
| + |
| #include "base/task.h" |
| #include "base/scoped_ptr.h" |
| #include "gfx/rect.h" |
| @@ -21,34 +23,39 @@ typedef std::vector<gfx::Rect> UpdatedRects; |
| // TODO(ajwong): Beef up this documentation once the API stablizes. |
| class Decoder { |
| public: |
| + // DecodeResult is returned from DecodePacket() and indicates current state of |
| + // the decoder. DECODE_DONE means that last packet for the frame was |
| + // processed, and the frame can be displayed now. DECODE_IN_PROGRESS |
| + // indicates that the decoder must receive more data before the frame can be |
| + // displayed. DECODE_ERROR is returned if there was an error in the stream. |
| + enum DecodeResult { |
| + DECODE_ERROR = -1, |
| + DECODE_IN_PROGRESS, |
| + DECODE_DONE, |
| + }; |
| + |
| Decoder() {} |
| virtual ~Decoder() {} |
| - // TODO(ajwong): This API is incorrect in the face of a streaming decode |
| - // protocol like VP8. However, it breaks the layering abstraction by |
| - // depending on the network packet protocol buffer type. I'm going to go |
| - // forward with it as is, and then refactor again to support streaming |
| - // decodes. |
| - |
| // Initializes the decoder to draw into the given |frame|. The |clip| |
| // specifies the region to draw into. The clip region must fit inside |
| - // the dimensions of frame. Failure to do so will CHECK Fail. |
| - // |
| - // TODO(ajwong): Should this take the source pixel format? |
| - // TODO(ajwong): Should the protocol be split into basic-types followed |
| - // by packet types? Basic types might include the format enum below. |
| - virtual void Initialize(scoped_refptr<media::VideoFrame> frame, |
| - const gfx::Rect& clip, int bytes_per_src_pixel) = 0; |
| + // the dimensions of frame. Failure to do so will CHECK fail. |
| + virtual void Initialize(scoped_refptr<media::VideoFrame> frame) = 0; |
| + |
| + // Feeds more data into the decoder. |
| + virtual DecodeResult DecodePacket(const VideoPacket* packet) = 0; |
| + |
| + // Returns rects that were updated in the last frame. Can be called only |
| + // after DecodePacket returned DECODE_DONE. Ownership of the result is given |
| + // to the caller. Returns NULL if the whole screen needs to be updated. |
| + virtual UpdatedRects* GetUpdatedRects() = 0; |
|
awong
2010/11/09 01:54:38
I would prefer that this appends to an UpdateRects
Sergey Ulanov
2010/11/09 21:34:42
Done.
|
| // Reset the decoder to an uninitialized state. Release all references to |
| // the initialized |frame|. Initialize() must be called before the decoder |
| // is used again. |
| virtual void Reset() = 0; |
| - // Feeds more data into the decoder. |
| - virtual void DecodeBytes(const std::string& encoded_bytes) = 0; |
| - |
| - // Returns true if decoder is ready to accept data via ProcessRectangleData. |
| + // Returns true if decoder is ready to accept data via DecodePacket. |
| virtual bool IsReadyForData() = 0; |
| virtual VideoPacketFormat::Encoding Encoding() = 0; |