summaryrefslogtreecommitdiffstats
path: root/media/webm
diff options
context:
space:
mode:
Diffstat (limited to 'media/webm')
-rw-r--r--media/webm/cluster_builder.cc11
-rw-r--r--media/webm/cluster_builder.h9
-rw-r--r--media/webm/webm_cluster_parser.cc4
-rw-r--r--media/webm/webm_parser_unittest.cc8
4 files changed, 16 insertions, 16 deletions
diff --git a/media/webm/cluster_builder.cc b/media/webm/cluster_builder.cc
index 44c87c8..4c951ad 100644
--- a/media/webm/cluster_builder.cc
+++ b/media/webm/cluster_builder.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -31,7 +31,8 @@ const int kSimpleBlockSizeOffset = 1;
const int kInitialBufferSize = 32768;
-Cluster::Cluster(const uint8* data, int size) : data_(data), size_(size) {}
+Cluster::Cluster(scoped_array<uint8> data, int size)
+ : data_(data.Pass()), size_(size) {}
Cluster::~Cluster() {}
ClusterBuilder::ClusterBuilder() { Reset(); }
@@ -84,14 +85,14 @@ void ClusterBuilder::AddSimpleBlock(int track_num, int64 timecode, int flags,
bytes_used_ += bytes_needed;
}
-Cluster* ClusterBuilder::Finish() {
+scoped_ptr<Cluster> ClusterBuilder::Finish() {
DCHECK_NE(cluster_timecode_, -1);
UpdateUInt64(kClusterSizeOffset, bytes_used_ - (kClusterSizeOffset + 8));
- scoped_ptr<Cluster> ret(new Cluster(buffer_.release(), bytes_used_));
+ scoped_ptr<Cluster> ret(new Cluster(buffer_.Pass(), bytes_used_));
Reset();
- return ret.release();
+ return ret.Pass();
}
void ClusterBuilder::Reset() {
diff --git a/media/webm/cluster_builder.h b/media/webm/cluster_builder.h
index 132da8a..39cd0d0 100644
--- a/media/webm/cluster_builder.h
+++ b/media/webm/cluster_builder.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,15 +13,14 @@ namespace media {
class Cluster {
public:
- // Takes ownership of |data|
- Cluster(const uint8* data, int size);
+ Cluster(scoped_array<uint8> data, int size);
~Cluster();
const uint8* data() const { return data_.get(); }
int size() const { return size_; }
private:
- scoped_array<const uint8> data_;
+ scoped_array<uint8> data_;
int size_;
DISALLOW_IMPLICIT_CONSTRUCTORS(Cluster);
@@ -36,7 +35,7 @@ class ClusterBuilder {
void AddSimpleBlock(int track_num, int64 timecode, int flags,
const uint8* data, int size);
- Cluster* Finish();
+ scoped_ptr<Cluster> Finish();
private:
void Reset();
diff --git a/media/webm/webm_cluster_parser.cc b/media/webm/webm_cluster_parser.cc
index 2d84405..8151ec6 100644
--- a/media/webm/webm_cluster_parser.cc
+++ b/media/webm/webm_cluster_parser.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,7 +13,7 @@ namespace media {
static Buffer* CreateBuffer(const uint8* data, size_t size) {
scoped_array<uint8> buf(new uint8[size]);
memcpy(buf.get(), data, size);
- return new DataBuffer(buf.release(), size);
+ return new DataBuffer(buf.Pass(), size);
}
WebMClusterParser::WebMClusterParser(int64 timecode_scale,
diff --git a/media/webm/webm_parser_unittest.cc b/media/webm/webm_parser_unittest.cc
index bfb5624..751af9e 100644
--- a/media/webm/webm_parser_unittest.cc
+++ b/media/webm/webm_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -46,9 +46,9 @@ static void AddSimpleBlock(ClusterBuilder* cb, int track_num,
cb->AddSimpleBlock(track_num, timecode, 0, data, sizeof(data));
}
-static Cluster* CreateCluster(int timecode,
- const SimpleBlockInfo* block_info,
- int block_count) {
+static scoped_ptr<Cluster> CreateCluster(int timecode,
+ const SimpleBlockInfo* block_info,
+ int block_count) {
ClusterBuilder cb;
cb.SetClusterTimecode(0);