Fix iOS build for XCode 4.6.
[chromium-blink-merge.git] / media / webm / cluster_builder.h
blob2d475996aced33b4c4ff7665018286aff474e2e2
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 MEDIA_WEBM_CLUSTER_BUILDER_H_
6 #define MEDIA_WEBM_CLUSTER_BUILDER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "media/base/buffers.h"
12 namespace media {
14 class Cluster {
15 public:
16 Cluster(scoped_array<uint8> data, int size);
17 ~Cluster();
19 const uint8* data() const { return data_.get(); }
20 int size() const { return size_; }
22 private:
23 scoped_array<uint8> data_;
24 int size_;
26 DISALLOW_IMPLICIT_CONSTRUCTORS(Cluster);
29 class ClusterBuilder {
30 public:
31 ClusterBuilder();
32 ~ClusterBuilder();
34 void SetClusterTimecode(int64 cluster_timecode);
35 void AddSimpleBlock(int track_num, int64 timecode, int flags,
36 const uint8* data, int size);
37 void AddBlockGroup(int track_num, int64 timecode, int duration, int flags,
38 const uint8* data, int size);
40 scoped_ptr<Cluster> Finish();
42 private:
43 void Reset();
44 void ExtendBuffer(int bytes_needed);
45 void UpdateUInt64(int offset, int64 value);
46 void WriteBlock(uint8* buf, int track_num, int64 timecode, int flags,
47 const uint8* data, int size);
49 scoped_array<uint8> buffer_;
50 int buffer_size_;
51 int bytes_used_;
52 int64 cluster_timecode_;
54 DISALLOW_COPY_AND_ASSIGN(ClusterBuilder);
57 } // namespace media
59 #endif // MEDIA_WEBM_CLUSTER_BUILDER_H_