Revert of Remove OneClickSigninHelper since it is no longer used. (patchset #5 id...
[chromium-blink-merge.git] / remoting / codec / video_decoder.h
blobb3048a90885bbc72f1d60e8b0164d4db835b9cf6
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
3 // found in the LICENSE file.
5 #ifndef REMOTING_CODEC_VIDEO_DECODER_H_
6 #define REMOTING_CODEC_VIDEO_DECODER_H_
8 #include "base/basictypes.h"
9 #include "remoting/proto/video.pb.h"
11 namespace webrtc {
12 class DesktopRect;
13 class DesktopRegion;
14 class DesktopSize;
15 } // namespace webrtc
17 namespace remoting {
19 // Interface for a decoder that takes a stream of bytes from the network and
20 // outputs frames of data.
21 class VideoDecoder {
22 public:
23 static const int kBytesPerPixel = 4;
25 VideoDecoder() {}
26 virtual ~VideoDecoder() {}
28 // Initializes the decoder and sets the output dimensions.
29 // |screen size| must not be empty.
30 virtual void Initialize(const webrtc::DesktopSize& screen_size) = 0;
32 // Feeds more data into the decoder. Returns true if |packet| was processed
33 // and the frame can be displayed now.
34 virtual bool DecodePacket(const VideoPacket& packet) = 0;
36 // Marks the specified |region| of the view for update the next time
37 // RenderFrame() is called. |region| is expressed in |view_size| coordinates.
38 // |view_size| must not be empty.
39 virtual void Invalidate(const webrtc::DesktopSize& view_size,
40 const webrtc::DesktopRegion& region) = 0;
42 // Copies invalidated pixels within |clip_area| to |image_buffer|. Pixels are
43 // invalidated either by new data received in DecodePacket(), or by explicit
44 // calls to Invalidate(). |clip_area| is specified in |view_size| coordinates.
45 // If |view_size| differs from the source size then the copied pixels will be
46 // scaled accordingly. |view_size| cannot be empty.
48 // |image_buffer|'s origin must correspond to the top-left of |clip_area|,
49 // and the buffer must be large enough to hold |clip_area| RGBA32 pixels.
50 // |image_stride| gives the output buffer's stride in pixels.
52 // On return, |output_region| contains the updated area, in |view_size|
53 // coordinates.
54 virtual void RenderFrame(const webrtc::DesktopSize& view_size,
55 const webrtc::DesktopRect& clip_area,
56 uint8* image_buffer,
57 int image_stride,
58 webrtc::DesktopRegion* output_region) = 0;
60 // Returns the "shape", if any, of the most recently rendered frame.
61 // The shape is returned in source dimensions.
62 virtual const webrtc::DesktopRegion* GetImageShape() = 0;
65 } // namespace remoting
67 #endif // REMOTING_CODEC_VIDEO_DECODER_H_