OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_FORMATS_WEBM_CLUSTER_BUILDER_H_ | 5 #ifndef MEDIA_FORMATS_WEBM_CLUSTER_BUILDER_H_ |
6 #define MEDIA_FORMATS_WEBM_CLUSTER_BUILDER_H_ | 6 #define MEDIA_FORMATS_WEBM_CLUSTER_BUILDER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | |
9 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
10 | 9 |
11 namespace media { | 10 namespace media { |
12 | 11 |
13 class Cluster { | 12 class Cluster { |
14 public: | 13 public: |
15 Cluster(scoped_ptr<uint8[]> data, int size); | 14 Cluster(scoped_ptr<uint8_t[]> data, int size); |
16 ~Cluster(); | 15 ~Cluster(); |
17 | 16 |
18 const uint8* data() const { return data_.get(); } | 17 const uint8_t* data() const { return data_.get(); } |
19 int size() const { return size_; } | 18 int size() const { return size_; } |
20 | 19 |
21 private: | 20 private: |
22 scoped_ptr<uint8[]> data_; | 21 scoped_ptr<uint8_t[]> data_; |
23 int size_; | 22 int size_; |
24 | 23 |
25 DISALLOW_IMPLICIT_CONSTRUCTORS(Cluster); | 24 DISALLOW_IMPLICIT_CONSTRUCTORS(Cluster); |
26 }; | 25 }; |
27 | 26 |
28 class ClusterBuilder { | 27 class ClusterBuilder { |
29 public: | 28 public: |
30 ClusterBuilder(); | 29 ClusterBuilder(); |
31 ~ClusterBuilder(); | 30 ~ClusterBuilder(); |
32 | 31 |
33 void SetClusterTimecode(int64 cluster_timecode); | 32 void SetClusterTimecode(int64_t cluster_timecode); |
34 void AddSimpleBlock(int track_num, int64 timecode, int flags, | 33 void AddSimpleBlock(int track_num, |
35 const uint8* data, int size); | 34 int64_t timecode, |
36 void AddBlockGroup(int track_num, int64 timecode, int duration, int flags, | 35 int flags, |
37 const uint8* data, int size); | 36 const uint8_t* data, |
38 void AddBlockGroupWithoutBlockDuration(int track_num, int64 timecode, | 37 int size); |
39 int flags, const uint8* data, int size); | 38 void AddBlockGroup(int track_num, |
| 39 int64_t timecode, |
| 40 int duration, |
| 41 int flags, |
| 42 const uint8_t* data, |
| 43 int size); |
| 44 void AddBlockGroupWithoutBlockDuration(int track_num, |
| 45 int64_t timecode, |
| 46 int flags, |
| 47 const uint8_t* data, |
| 48 int size); |
40 | 49 |
41 scoped_ptr<Cluster> Finish(); | 50 scoped_ptr<Cluster> Finish(); |
42 scoped_ptr<Cluster> FinishWithUnknownSize(); | 51 scoped_ptr<Cluster> FinishWithUnknownSize(); |
43 | 52 |
44 private: | 53 private: |
45 void AddBlockGroupInternal(int track_num, int64 timecode, | 54 void AddBlockGroupInternal(int track_num, |
46 bool include_block_duration, int duration, | 55 int64_t timecode, |
47 int flags, const uint8* data, int size); | 56 bool include_block_duration, |
| 57 int duration, |
| 58 int flags, |
| 59 const uint8_t* data, |
| 60 int size); |
48 void Reset(); | 61 void Reset(); |
49 void ExtendBuffer(int bytes_needed); | 62 void ExtendBuffer(int bytes_needed); |
50 void UpdateUInt64(int offset, int64 value); | 63 void UpdateUInt64(int offset, int64_t value); |
51 void WriteBlock(uint8* buf, int track_num, int64 timecode, int flags, | 64 void WriteBlock(uint8_t* buf, |
52 const uint8* data, int size); | 65 int track_num, |
| 66 int64_t timecode, |
| 67 int flags, |
| 68 const uint8_t* data, |
| 69 int size); |
53 | 70 |
54 scoped_ptr<uint8[]> buffer_; | 71 scoped_ptr<uint8_t[]> buffer_; |
55 int buffer_size_; | 72 int buffer_size_; |
56 int bytes_used_; | 73 int bytes_used_; |
57 int64 cluster_timecode_; | 74 int64_t cluster_timecode_; |
58 | 75 |
59 DISALLOW_COPY_AND_ASSIGN(ClusterBuilder); | 76 DISALLOW_COPY_AND_ASSIGN(ClusterBuilder); |
60 }; | 77 }; |
61 | 78 |
62 } // namespace media | 79 } // namespace media |
63 | 80 |
64 #endif // MEDIA_FORMATS_WEBM_CLUSTER_BUILDER_H_ | 81 #endif // MEDIA_FORMATS_WEBM_CLUSTER_BUILDER_H_ |
OLD | NEW |