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

Side by Side Diff: media/webm/cluster_builder.h

Issue 9015015: Take advantage of the new Pass() machinery on scoped_ptr{,_malloc}. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased & removed unnecessary include of ffmpeg_common.h from ffmpeg_demuxer.h Created 8 years, 11 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 MEDIA_WEBM_CLUSTER_BUILDER_H_ 5 #ifndef MEDIA_WEBM_CLUSTER_BUILDER_H_
6 #define MEDIA_WEBM_CLUSTER_BUILDER_H_ 6 #define MEDIA_WEBM_CLUSTER_BUILDER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "media/base/buffers.h" 10 #include "media/base/buffers.h"
11 11
12 namespace media { 12 namespace media {
13 13
14 class Cluster { 14 class Cluster {
15 public: 15 public:
16 // Takes ownership of |data| 16 Cluster(scoped_array<uint8> data, int size);
17 Cluster(const uint8* data, int size);
18 ~Cluster(); 17 ~Cluster();
19 18
20 const uint8* data() const { return data_.get(); } 19 const uint8* data() const { return data_.get(); }
21 int size() const { return size_; } 20 int size() const { return size_; }
22 21
23 private: 22 private:
24 scoped_array<const uint8> data_; 23 scoped_array<uint8> data_;
25 int size_; 24 int size_;
26 25
27 DISALLOW_IMPLICIT_CONSTRUCTORS(Cluster); 26 DISALLOW_IMPLICIT_CONSTRUCTORS(Cluster);
28 }; 27 };
29 28
30 class ClusterBuilder { 29 class ClusterBuilder {
31 public: 30 public:
32 ClusterBuilder(); 31 ClusterBuilder();
33 ~ClusterBuilder(); 32 ~ClusterBuilder();
34 33
35 void SetClusterTimecode(int64 cluster_timecode); 34 void SetClusterTimecode(int64 cluster_timecode);
36 void AddSimpleBlock(int track_num, int64 timecode, int flags, 35 void AddSimpleBlock(int track_num, int64 timecode, int flags,
37 const uint8* data, int size); 36 const uint8* data, int size);
38 37
39 Cluster* Finish(); 38 Cluster* Finish();
acolwell GONE FROM CHROMIUM 2012/01/03 19:27:06 I think this could become a scoped_ptr too.
Ami GONE FROM CHROMIUM 2012/01/03 20:58:34 Done.
40 39
41 private: 40 private:
42 void Reset(); 41 void Reset();
43 void ExtendBuffer(int bytes_needed); 42 void ExtendBuffer(int bytes_needed);
44 void UpdateUInt64(int offset, int64 value); 43 void UpdateUInt64(int offset, int64 value);
45 44
46 scoped_array<uint8> buffer_; 45 scoped_array<uint8> buffer_;
47 int buffer_size_; 46 int buffer_size_;
48 int bytes_used_; 47 int bytes_used_;
49 int64 cluster_timecode_; 48 int64 cluster_timecode_;
50 49
51 DISALLOW_COPY_AND_ASSIGN(ClusterBuilder); 50 DISALLOW_COPY_AND_ASSIGN(ClusterBuilder);
52 }; 51 };
53 52
54 } // namespace media 53 } // namespace media
55 54
56 #endif // MEDIA_WEBM_CLUSTER_BUILDER_H_ 55 #endif // MEDIA_WEBM_CLUSTER_BUILDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698