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

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

Issue 9720019: Use scoped_ptr<> to pass ownership in more places. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 8 years, 9 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) 2010 The Chromium Authors. All rights reserved. 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 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_BASE_ENCODER_H_ 5 #ifndef REMOTING_BASE_ENCODER_H_
6 #define REMOTING_BASE_ENCODER_H_ 6 #define REMOTING_BASE_ENCODER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "media/base/data_buffer.h" 10 #include "media/base/data_buffer.h"
11 11
12 namespace media { 12 namespace media {
13 class DataBuffer; 13 class DataBuffer;
14 } 14 }
15 15
16 namespace remoting { 16 namespace remoting {
17 17
18 class CaptureData; 18 class CaptureData;
19 class VideoPacket; 19 class VideoPacket;
20 20
21 // A class to perform the task of encoding a continous stream of 21 // A class to perform the task of encoding a continous stream of
22 // images. 22 // images.
23 // This class operates asynchronously to enable maximum throughput. 23 // This class operates asynchronously to enable maximum throughput.
24 class Encoder { 24 class Encoder {
25 public: 25 public:
26 26
27 // DataAvailableCallback is called as blocks of data are made available 27 // DataAvailableCallback is called as blocks of data are made available
28 // from the encoder. Data made available by the encoder is in the form 28 // from the encoder. Data made available by the encoder is in the form
29 // of HostMessage to reduce the amount of memory copies. 29 // of HostMessage to reduce the amount of memory copies.
30 // The callback takes ownership of the HostMessage and is responsible for 30 typedef base::Callback<void(scoped_ptr<VideoPacket>)> DataAvailableCallback;
31 // deleting it.
32 typedef base::Callback<void(VideoPacket*)> DataAvailableCallback;
33 31
34 virtual ~Encoder() {} 32 virtual ~Encoder() {}
35 33
36 // Encode an image stored in |capture_data|. 34 // Encode an image stored in |capture_data|.
37 // 35 //
38 // If |key_frame| is true, the encoder should not reference 36 // If |key_frame| is true, the encoder should not reference
39 // previous encode and encode the full frame. 37 // previous encode and encode the full frame.
40 // 38 //
41 // When encoded data is available, partial or full |data_available_callback| 39 // When encoded data is available, partial or full |data_available_callback|
42 // is called. 40 // is called.
43 virtual void Encode(scoped_refptr<CaptureData> capture_data, 41 virtual void Encode(scoped_refptr<CaptureData> capture_data,
44 bool key_frame, 42 bool key_frame,
45 const DataAvailableCallback& data_available_callback) = 0; 43 const DataAvailableCallback& data_available_callback) = 0;
46 }; 44 };
47 45
48 } // namespace remoting 46 } // namespace remoting
49 47
50 #endif // REMOTING_BASE_ENCODER_H_ 48 #endif // REMOTING_BASE_ENCODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698