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_MP2T_TIMESTAMP_UNROLLER_H_ | 5 #ifndef MEDIA_FORMATS_MP2T_TIMESTAMP_UNROLLER_H_ |
6 #define MEDIA_FORMATS_MP2T_TIMESTAMP_UNROLLER_H_ | 6 #define MEDIA_FORMATS_MP2T_TIMESTAMP_UNROLLER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include <stdint.h> |
| 9 |
9 #include "base/macros.h" | 10 #include "base/macros.h" |
10 #include "media/base/media_export.h" | 11 #include "media/base/media_export.h" |
11 | 12 |
12 namespace media { | 13 namespace media { |
13 namespace mp2t { | 14 namespace mp2t { |
14 | 15 |
15 class MEDIA_EXPORT TimestampUnroller { | 16 class MEDIA_EXPORT TimestampUnroller { |
16 public: | 17 public: |
17 TimestampUnroller(); | 18 TimestampUnroller(); |
18 ~TimestampUnroller(); | 19 ~TimestampUnroller(); |
19 | 20 |
20 // Given that |timestamp| is coded using 33 bits (accuracy of MPEG-2 TS | 21 // Given that |timestamp| is coded using 33 bits (accuracy of MPEG-2 TS |
21 // timestamps), GetUnrolledTimestamp returns the corresponding unrolled | 22 // timestamps), GetUnrolledTimestamp returns the corresponding unrolled |
22 // timestamp. | 23 // timestamp. |
23 // The unrolled timestamp is defined by: | 24 // The unrolled timestamp is defined by: |
24 // |timestamp| + k * (2 ^ 33) | 25 // |timestamp| + k * (2 ^ 33) |
25 // where k is estimated so that the unrolled timestamp is as close as | 26 // where k is estimated so that the unrolled timestamp is as close as |
26 // possible to the previous unrolled timestamp returned by this function | 27 // possible to the previous unrolled timestamp returned by this function |
27 // (if this function has not been called before, it will return the timestamp | 28 // (if this function has not been called before, it will return the timestamp |
28 // unmodified). | 29 // unmodified). |
29 int64 GetUnrolledTimestamp(int64 timestamp); | 30 int64_t GetUnrolledTimestamp(int64_t timestamp); |
30 | 31 |
31 // Reset the TimestampUnroller to its initial state. | 32 // Reset the TimestampUnroller to its initial state. |
32 void Reset(); | 33 void Reset(); |
33 | 34 |
34 private: | 35 private: |
35 // Indicate whether the value of |previous_unrolled_timestamp_| is valid. | 36 // Indicate whether the value of |previous_unrolled_timestamp_| is valid. |
36 bool is_previous_timestamp_valid_; | 37 bool is_previous_timestamp_valid_; |
37 | 38 |
38 // This is the last output of GetUnrolledTimestamp. | 39 // This is the last output of GetUnrolledTimestamp. |
39 int64 previous_unrolled_timestamp_; | 40 int64_t previous_unrolled_timestamp_; |
40 | 41 |
41 DISALLOW_COPY_AND_ASSIGN(TimestampUnroller); | 42 DISALLOW_COPY_AND_ASSIGN(TimestampUnroller); |
42 }; | 43 }; |
43 | 44 |
44 } // namespace mp2t | 45 } // namespace mp2t |
45 } // namespace media | 46 } // namespace media |
46 | 47 |
47 #endif // MEDIA_FORMATS_MP2T_TIMESTAMP_UNROLLER_H_ | 48 #endif // MEDIA_FORMATS_MP2T_TIMESTAMP_UNROLLER_H_ |
OLD | NEW |