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

Side by Side Diff: remoting/base/encoder_row_based.h

Issue 5382008: Refactor ZLib and Verbatim encoders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments Created 10 years 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
« no previous file with comments | « remoting/base/compressor_zlib.cc ('k') | remoting/base/encoder_row_based.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 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.
4
5 #ifndef REMOTING_BASE_ENCODER_ROW_BASED_H_
6 #define REMOTING_BASE_ENCODER_ROW_BASED_H_
7
8 #include "remoting/base/encoder.h"
9 #include "remoting/proto/video.pb.h"
10
11 #include "gfx/rect.h"
12
13 namespace remoting {
14
15 class Compressor;
16 class UpdateStreamPacket;
17
18 // EncoderRowBased implements an Encoder using zlib or verbatim
19 // compression. Zlib-based encoder must be created using
20 // CreateZlibEncoder(), verbatim encoder is created with
21 // CreateVerbatimEncoder().
22 //
23 // Compressor is reset before encoding each rectangle, so that each
24 // rectangle can be decoded independently.
25 class EncoderRowBased : public Encoder {
26 public:
27 static EncoderRowBased* CreateZlibEncoder();
28 static EncoderRowBased* CreateVerbatimEncoder();
29
30 virtual ~EncoderRowBased();
31
32 virtual void Encode(scoped_refptr<CaptureData> capture_data,
33 bool key_frame,
34 DataAvailableCallback* data_available_callback);
35
36 private:
37 EncoderRowBased(Compressor* compressor, VideoPacketFormat::Encoding encoding);
38 EncoderRowBased(Compressor* compressor, VideoPacketFormat::Encoding encoding,
39 int packet_size);
40
41 // Encode a single dirty rect using compressor.
42 void EncodeRect(const gfx::Rect& rect, size_t rect_index);
43
44 // Marks a packet as the first in a series of rectangle updates.
45 void PrepareUpdateStart(const gfx::Rect& rect, VideoPacket* packet);
46
47 // Retrieves a pointer to the output buffer in |update| used for storing the
48 // encoded rectangle data. Will resize the buffer to |size|.
49 uint8* GetOutputBuffer(VideoPacket* packet, size_t size);
50
51 // Submit |message| to |callback_|.
52 void SubmitMessage(VideoPacket* packet, size_t rect_index);
53
54 // The encoding of the incoming stream.
55 VideoPacketFormat::Encoding encoding_;
56
57 scoped_ptr<Compressor> compressor_;
58
59 scoped_refptr<CaptureData> capture_data_;
60 scoped_ptr<DataAvailableCallback> callback_;
61
62 int packet_size_;
63 };
64
65 } // namespace remoting
66
67 #endif // REMOTING_BASE_ENCODER_ROW_BASED_H_
OLDNEW
« no previous file with comments | « remoting/base/compressor_zlib.cc ('k') | remoting/base/encoder_row_based.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698