| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CODEC_VIDEO_DECODER_H_ | 5 #ifndef REMOTING_CODEC_VIDEO_DECODER_H_ |
| 6 #define REMOTING_CODEC_VIDEO_DECODER_H_ | 6 #define REMOTING_CODEC_VIDEO_DECODER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "remoting/proto/video.pb.h" | 9 #include "remoting/proto/video.pb.h" |
| 10 #include "third_party/skia/include/core/SkRect.h" | 10 #include "third_party/skia/include/core/SkRect.h" |
| 11 #include "third_party/skia/include/core/SkRegion.h" | 11 #include "third_party/skia/include/core/SkRegion.h" |
| 12 #include "third_party/skia/include/core/SkSize.h" | 12 #include "third_party/skia/include/core/SkSize.h" |
| 13 | 13 |
| 14 namespace remoting { | 14 namespace remoting { |
| 15 | 15 |
| 16 // Interface for a decoder that takes a stream of bytes from the network and | 16 // Interface for a decoder that takes a stream of bytes from the network and |
| 17 // outputs frames of data. | 17 // outputs frames of data. |
| 18 // | 18 // |
| 19 // TODO(ajwong): Beef up this documentation once the API stablizes. | 19 // TODO(ajwong): Beef up this documentation once the API stablizes. |
| 20 class Decoder { | 20 class VideoDecoder { |
| 21 public: | 21 public: |
| 22 // DecodeResult is returned from DecodePacket() and indicates current state | 22 // DecodeResult is returned from DecodePacket() and indicates current state |
| 23 // of the decoder. DECODE_DONE means that last packet for the frame was | 23 // of the decoder. DECODE_DONE means that last packet for the frame was |
| 24 // processed, and the frame can be displayed now. DECODE_IN_PROGRESS | 24 // processed, and the frame can be displayed now. DECODE_IN_PROGRESS |
| 25 // indicates that the decoder must receive more data before the frame can be | 25 // indicates that the decoder must receive more data before the frame can be |
| 26 // displayed. DECODE_ERROR is returned if there was an error in the stream. | 26 // displayed. DECODE_ERROR is returned if there was an error in the stream. |
| 27 enum DecodeResult { | 27 enum DecodeResult { |
| 28 DECODE_ERROR = -1, | 28 DECODE_ERROR = -1, |
| 29 DECODE_IN_PROGRESS, | 29 DECODE_IN_PROGRESS, |
| 30 DECODE_DONE, | 30 DECODE_DONE, |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 Decoder() {} | 33 VideoDecoder() {} |
| 34 virtual ~Decoder() {} | 34 virtual ~VideoDecoder() {} |
| 35 | 35 |
| 36 // Initializes the decoder and sets the output dimensions. | 36 // Initializes the decoder and sets the output dimensions. |
| 37 // |screen size| must not be empty. | 37 // |screen size| must not be empty. |
| 38 virtual void Initialize(const SkISize& screen_size) = 0; | 38 virtual void Initialize(const SkISize& screen_size) = 0; |
| 39 | 39 |
| 40 // Feeds more data into the decoder. | 40 // Feeds more data into the decoder. |
| 41 virtual DecodeResult DecodePacket(const VideoPacket* packet) = 0; | 41 virtual DecodeResult DecodePacket(const VideoPacket* packet) = 0; |
| 42 | 42 |
| 43 // Returns true if decoder is ready to accept data via DecodePacket. | 43 // Returns true if decoder is ready to accept data via DecodePacket. |
| 44 virtual bool IsReadyForData() = 0; | 44 virtual bool IsReadyForData() = 0; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 66 virtual void RenderFrame(const SkISize& view_size, | 66 virtual void RenderFrame(const SkISize& view_size, |
| 67 const SkIRect& clip_area, | 67 const SkIRect& clip_area, |
| 68 uint8* image_buffer, | 68 uint8* image_buffer, |
| 69 int image_stride, | 69 int image_stride, |
| 70 SkRegion* output_region) = 0; | 70 SkRegion* output_region) = 0; |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 } // namespace remoting | 73 } // namespace remoting |
| 74 | 74 |
| 75 #endif // REMOTING_CODEC_VIDEO_DECODER_H_ | 75 #endif // REMOTING_CODEC_VIDEO_DECODER_H_ |
| OLD | NEW |