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

Side by Side Diff: remoting/codec/video_decoder.h

Issue 23440046: Remove dependency on Skia from chromoting client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
OLDNEW
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
11 #include "third_party/skia/include/core/SkRegion.h" 11 namespace webrtc {
12 #include "third_party/skia/include/core/SkSize.h" 12 class DesktopRect;
13 class DesktopRegion;
14 class DesktopSize;
15 } // namespace webrtc
13 16
14 namespace remoting { 17 namespace remoting {
15 18
16 // Interface for a decoder that takes a stream of bytes from the network and 19 // Interface for a decoder that takes a stream of bytes from the network and
17 // outputs frames of data. 20 // outputs frames of data.
18 class VideoDecoder { 21 class VideoDecoder {
19 public: 22 public:
20 // DecodeResult is returned from DecodePacket() and indicates current state 23 // DecodeResult is returned from DecodePacket() and indicates current state
21 // of the decoder. DECODE_DONE means that last packet for the frame was 24 // of the decoder. DECODE_DONE means that last packet for the frame was
22 // processed, and the frame can be displayed now. DECODE_ERROR is returned if 25 // processed, and the frame can be displayed now. DECODE_ERROR is returned if
23 // there was an error in the stream. 26 // there was an error in the stream.
24 enum DecodeResult { 27 enum DecodeResult {
25 DECODE_ERROR, 28 DECODE_ERROR,
26 DECODE_DONE, 29 DECODE_DONE,
27 }; 30 };
28 31
29 VideoDecoder() {} 32 VideoDecoder() {}
30 virtual ~VideoDecoder() {} 33 virtual ~VideoDecoder() {}
31 34
32 // Initializes the decoder and sets the output dimensions. 35 // Initializes the decoder and sets the output dimensions.
33 // |screen size| must not be empty. 36 // |screen size| must not be empty.
34 virtual void Initialize(const SkISize& screen_size) = 0; 37 virtual void Initialize(const webrtc::DesktopSize& screen_size) = 0;
35 38
36 // Feeds more data into the decoder. 39 // Feeds more data into the decoder.
37 virtual DecodeResult DecodePacket(const VideoPacket* packet) = 0; 40 virtual DecodeResult DecodePacket(const VideoPacket* packet) = 0;
38 41
39 // Returns true if decoder is ready to accept data via DecodePacket. 42 // Returns true if decoder is ready to accept data via DecodePacket.
40 virtual bool IsReadyForData() = 0; 43 virtual bool IsReadyForData() = 0;
41 44
42 virtual VideoPacketFormat::Encoding Encoding() = 0; 45 virtual VideoPacketFormat::Encoding Encoding() = 0;
43 46
44 // Marks the specified |region| of the view for update the next time 47 // Marks the specified |region| of the view for update the next time
45 // RenderFrame() is called. |region| is expressed in |view_size| coordinates. 48 // RenderFrame() is called. |region| is expressed in |view_size| coordinates.
46 // |view_size| must not be empty. 49 // |view_size| must not be empty.
47 virtual void Invalidate(const SkISize& view_size, 50 virtual void Invalidate(const webrtc::DesktopSize& view_size,
48 const SkRegion& region) = 0; 51 const webrtc::DesktopRegion& region) = 0;
49 52
50 // Copies invalidated pixels within |clip_area| to |image_buffer|. Pixels are 53 // Copies invalidated pixels within |clip_area| to |image_buffer|. Pixels are
51 // invalidated either by new data received in DecodePacket(), or by explicit 54 // invalidated either by new data received in DecodePacket(), or by explicit
52 // calls to Invalidate(). |clip_area| is specified in |view_size| coordinates. 55 // calls to Invalidate(). |clip_area| is specified in |view_size| coordinates.
53 // If |view_size| differs from the source size then the copied pixels will be 56 // If |view_size| differs from the source size then the copied pixels will be
54 // scaled accordingly. |view_size| cannot be empty. 57 // scaled accordingly. |view_size| cannot be empty.
55 // 58 //
56 // |image_buffer|'s origin must correspond to the top-left of |clip_area|, 59 // |image_buffer|'s origin must correspond to the top-left of |clip_area|,
57 // and the buffer must be large enough to hold |clip_area| RGBA32 pixels. 60 // and the buffer must be large enough to hold |clip_area| RGBA32 pixels.
58 // |image_stride| gives the output buffer's stride in pixels. 61 // |image_stride| gives the output buffer's stride in pixels.
59 // 62 //
60 // On return, |output_region| contains the updated area, in |view_size| 63 // On return, |output_region| contains the updated area, in |view_size|
61 // coordinates. 64 // coordinates.
62 virtual void RenderFrame(const SkISize& view_size, 65 virtual void RenderFrame(const webrtc::DesktopSize& view_size,
63 const SkIRect& clip_area, 66 const webrtc::DesktopRect& clip_area,
64 uint8* image_buffer, 67 uint8* image_buffer,
65 int image_stride, 68 int image_stride,
66 SkRegion* output_region) = 0; 69 webrtc::DesktopRegion* output_region) = 0;
67 70
68 // Returns the "shape", if any, of the most recently rendered frame. 71 // Returns the "shape", if any, of the most recently rendered frame.
69 // The shape is returned in source dimensions. 72 // The shape is returned in source dimensions.
70 virtual const SkRegion* GetImageShape() = 0; 73 virtual const webrtc::DesktopRegion* GetImageShape() = 0;
71 }; 74 };
72 75
73 } // namespace remoting 76 } // namespace remoting
74 77
75 #endif // REMOTING_CODEC_VIDEO_DECODER_H_ 78 #endif // REMOTING_CODEC_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698