OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_WEBM_CLUSTER_BUILDER_H_ |
| 6 #define MEDIA_WEBM_CLUSTER_BUILDER_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/scoped_ptr.h" |
| 10 #include "media/base/buffers.h" |
| 11 |
| 12 namespace media { |
| 13 |
| 14 class Cluster { |
| 15 public: |
| 16 // Takes ownership of |data| |
| 17 Cluster(const uint8* data, int size); |
| 18 ~Cluster(); |
| 19 |
| 20 const uint8* data() const { return data_.get(); } |
| 21 int size() const { return size_; } |
| 22 |
| 23 private: |
| 24 scoped_array<const uint8> data_; |
| 25 int size_; |
| 26 |
| 27 DISALLOW_IMPLICIT_CONSTRUCTORS(Cluster); |
| 28 }; |
| 29 |
| 30 class ClusterBuilder { |
| 31 public: |
| 32 ClusterBuilder(); |
| 33 |
| 34 void SetClusterTimecode(int64 cluster_timecode); |
| 35 void AddSimpleBlock(int track_num, int64 timecode, int flags, |
| 36 const uint8* data, int size); |
| 37 |
| 38 Cluster* Finish(); |
| 39 |
| 40 private: |
| 41 void Reset(); |
| 42 void ExtendBuffer(int bytes_needed); |
| 43 void UpdateUInt64(int offset, int64 value); |
| 44 |
| 45 scoped_array<uint8> buffer_; |
| 46 int buffer_size_; |
| 47 int bytes_used_; |
| 48 int64 cluster_timecode_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(ClusterBuilder); |
| 51 }; |
| 52 |
| 53 } // namespace media |
| 54 |
| 55 #endif // MEDIA_WEBM_CLUSTER_BUILDER_H_ |
OLD | NEW |