Chromium Code Reviews| Index: media/mp4/track_run_iterator.h |
| diff --git a/media/mp4/track_run_iterator.h b/media/mp4/track_run_iterator.h |
| index c1f61c3a2425d4cbd034ec7a9104e2f17b2f00e5..2eadd33d847cf462b8fdb2f97e7bfb33db8cee3f 100644 |
| --- a/media/mp4/track_run_iterator.h |
| +++ b/media/mp4/track_run_iterator.h |
| @@ -8,6 +8,7 @@ |
| #include <vector> |
| #include "base/time.h" |
| +#include "media/base/decrypt_config.h" |
|
xhwang
2012/06/27 19:37:43
Forward declaration of DecryptConfig instead of in
strobe_
2012/07/13 00:47:07
Done.
|
| #include "media/mp4/box_definitions.h" |
| #include "media/mp4/cenc.h" |
| @@ -31,13 +32,12 @@ struct TrackRunInfo { |
| TimeDelta start_dts; |
| int64 sample_start_offset; |
| - bool is_encrypted; |
| - int64 cenc_start_offset; |
| - int cenc_total_size; |
| - uint8 default_cenc_size; |
| - // Only valid if default_cenc_size == 0. (In this case, infer the sample count |
| - // from the 'samples' parameter; they shall be the same.) |
| - std::vector<uint8> cenc_sizes; |
| + int64 aux_info_start_offset; |
| + int aux_info_default_size; |
| + std::vector<uint8> aux_info_sizes; // Present if default_size == 0. |
| + int aux_info_total_size; |
| + |
| + TrackEncryption track_encryption; |
| TrackRunInfo(); |
| ~TrackRunInfo(); |
| @@ -62,12 +62,14 @@ class TrackRunIterator { |
| void AdvanceRun(); |
| void AdvanceSample(); |
| - // Returns true iff the track is encrypted and the common encryption sample |
| - // auxiliary information has not yet been cached for the current track. |
| - bool NeedsCENC(); |
| + // Returns true if this track run has auxiliary information and has not yet |
| + // been cached. Only valid if RunValid(). |
| + bool AuxInfoNeedsToBeCached(); |
| - // Cache the CENC data from the given buffer. |
| - bool CacheCENC(const uint8* buf, int size); |
| + // Cache the CENC data from the given buffer. |buf| must be a buffer starting |
|
xhwang
2012/06/27 19:37:43
Cache->Caches
strobe_
2012/07/13 00:47:07
Done.
|
| + // at the offset given by cenc_offset(), with a |size| of at least |
| + // cenc_size(). Returns true on success, false on error. |
| + bool CacheAuxInfo(const uint8* buf, int size); |
| // Returns the maximum buffer location at which no data earlier in the stream |
| // will be required in order to read the current or any subsequent sample. You |
| @@ -79,37 +81,37 @@ class TrackRunIterator { |
| // Returns the minimum timestamp (or kInfiniteDuration if no runs present). |
| TimeDelta GetMinDecodeTimestamp(); |
| - // Property of the current run. Reqiures RunValid(). |
| + // Property of the current run. Only valid if RunValid(). |
| uint32 track_id() const; |
| + int64 aux_info_offset() const; |
| + int aux_info_size() const; |
| bool is_encrypted() const; |
| - // Only valid if is_encrypted() is true. |
| - int64 cenc_offset() const; |
| - int cenc_size() const; |
| - // Properties of the current sample. Requires SampleValid(). |
| - int64 offset() const; |
| - int size() const; |
| + // Properties of the current sample. Only valid if SampleValid(). |
| + int64 sample_offset() const; |
| + int sample_size() const; |
| TimeDelta dts() const; |
| TimeDelta cts() const; |
| TimeDelta duration() const; |
| bool is_keyframe() const; |
| - // Only valid if is_encrypted() is true and NeedsCENC() is false. |
| - const FrameCENCInfo& frame_cenc_info(); |
| + |
| + // Only call when is_encrypted() is true and AuxInfoNeedsToBeCached() is |
| + // false. |
| + scoped_ptr<DecryptConfig> GetDecryptConfig(); |
|
ddorwin
2012/07/03 21:03:47
I don't think we usually return (or pass) scoped_p
strobe_
2012/07/13 00:47:07
Done.
|
| private: |
| void ResetRun(); |
| std::vector<TrackRunInfo> runs_; |
| std::vector<TrackRunInfo>::const_iterator run_itr_; |
| - |
| std::vector<SampleInfo>::const_iterator sample_itr_; |
| - std::vector<uint8> cenc_cache_; |
| std::vector<int64> min_clear_offsets_; |
| std::vector<int64>::const_iterator min_clear_offset_itr_; |
| + std::vector<FrameCENCInfo> cenc_info_; |
| + |
| TimeDelta sample_dts_; |
| int64 sample_offset_; |
| - FrameCENCInfo frame_cenc_info_; |
| }; |
| } // namespace mp4 |