OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_MP4_TRACK_RUN_ITERATOR_H_ | 5 #ifndef MEDIA_MP4_TRACK_RUN_ITERATOR_H_ |
6 #define MEDIA_MP4_TRACK_RUN_ITERATOR_H_ | 6 #define MEDIA_MP4_TRACK_RUN_ITERATOR_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "media/base/media_export.h" | 12 #include "media/base/media_export.h" |
| 13 #include "media/base/media_log.h" |
13 #include "media/mp4/box_definitions.h" | 14 #include "media/mp4/box_definitions.h" |
14 #include "media/mp4/cenc.h" | 15 #include "media/mp4/cenc.h" |
15 | 16 |
16 namespace media { | 17 namespace media { |
17 | 18 |
18 class DecryptConfig; | 19 class DecryptConfig; |
19 | 20 |
20 namespace mp4 { | 21 namespace mp4 { |
21 | 22 |
22 using base::TimeDelta; | 23 using base::TimeDelta; |
23 base::TimeDelta MEDIA_EXPORT TimeDeltaFromRational(int64 numer, int64 denom); | 24 base::TimeDelta MEDIA_EXPORT TimeDeltaFromRational(int64 numer, int64 denom); |
24 | 25 |
25 struct SampleInfo; | 26 struct SampleInfo; |
26 struct TrackRunInfo; | 27 struct TrackRunInfo; |
27 | 28 |
28 class MEDIA_EXPORT TrackRunIterator { | 29 class MEDIA_EXPORT TrackRunIterator { |
29 public: | 30 public: |
30 // Create a new TrackRunIterator. A reference to |moov| will be retained for | 31 // Create a new TrackRunIterator. A reference to |moov| will be retained for |
31 // the lifetime of this object. | 32 // the lifetime of this object. |
32 explicit TrackRunIterator(const Movie* moov); | 33 TrackRunIterator(const Movie* moov, const LogCB& log_cb); |
33 ~TrackRunIterator(); | 34 ~TrackRunIterator(); |
34 | 35 |
35 void Reset(); | 36 void Reset(); |
36 | 37 |
37 // Sets up the iterator to handle all the runs from the current fragment. | 38 // Sets up the iterator to handle all the runs from the current fragment. |
38 bool Init(const MovieFragment& moof); | 39 bool Init(const MovieFragment& moof); |
39 | 40 |
40 // Returns true if the properties of the current run or sample are valid. | 41 // Returns true if the properties of the current run or sample are valid. |
41 bool IsRunValid() const; | 42 bool IsRunValid() const; |
42 bool IsSampleValid() const; | 43 bool IsSampleValid() const; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 86 |
86 // Only call when is_encrypted() is true and AuxInfoNeedsToBeCached() is | 87 // Only call when is_encrypted() is true and AuxInfoNeedsToBeCached() is |
87 // false. Result is owned by caller. | 88 // false. Result is owned by caller. |
88 scoped_ptr<DecryptConfig> GetDecryptConfig(); | 89 scoped_ptr<DecryptConfig> GetDecryptConfig(); |
89 | 90 |
90 private: | 91 private: |
91 void ResetRun(); | 92 void ResetRun(); |
92 const TrackEncryption& track_encryption() const; | 93 const TrackEncryption& track_encryption() const; |
93 | 94 |
94 const Movie* moov_; | 95 const Movie* moov_; |
| 96 LogCB log_cb_; |
95 | 97 |
96 std::vector<TrackRunInfo> runs_; | 98 std::vector<TrackRunInfo> runs_; |
97 std::vector<TrackRunInfo>::const_iterator run_itr_; | 99 std::vector<TrackRunInfo>::const_iterator run_itr_; |
98 std::vector<SampleInfo>::const_iterator sample_itr_; | 100 std::vector<SampleInfo>::const_iterator sample_itr_; |
99 | 101 |
100 std::vector<FrameCENCInfo> cenc_info_; | 102 std::vector<FrameCENCInfo> cenc_info_; |
101 | 103 |
102 int64 sample_dts_; | 104 int64 sample_dts_; |
103 int64 sample_offset_; | 105 int64 sample_offset_; |
104 | 106 |
105 DISALLOW_COPY_AND_ASSIGN(TrackRunIterator); | 107 DISALLOW_COPY_AND_ASSIGN(TrackRunIterator); |
106 }; | 108 }; |
107 | 109 |
108 } // namespace mp4 | 110 } // namespace mp4 |
109 } // namespace media | 111 } // namespace media |
110 | 112 |
111 #endif // MEDIA_MP4_TRACK_RUN_ITERATOR_H_ | 113 #endif // MEDIA_MP4_TRACK_RUN_ITERATOR_H_ |
OLD | NEW |