Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(772)

Unified Diff: media/mp4/track_run_iterator.h

Issue 10651006: Add Common Encryption support to BMFF, including subsample decryption. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove references to non-public encrypted files in tests Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..6923970830c9d4c1abd096925b9b97b4defc4b85 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"
#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. Requires |RunValid()|.
ddorwin 2012/06/26 06:09:19 Did you see || around function names somewhere? I
strobe_ 2012/06/27 02:01:21 I thought so, but I could be mistaken, and if it l
+ bool AuxInfoRequired();
ddorwin 2012/06/26 06:09:19 Is*
strobe_ 2012/06/27 02:01:21 Okay, I renamed this to AuxInfoNeedsToBeCached() b
- // 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
ddorwin 2012/06/26 06:09:19 Is AuxInfo CENC data? If so, the function name sho
strobe_ 2012/06/27 02:01:21 "Auxiliary information" is a generic mechanism in
ddorwin 2012/07/03 21:03:46 As long as the code is not making assumptions abou
+ // 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,36 @@ 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. Reqiures |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().
+ // Properties of the current sample. Requires |SampleValid()|.
ddorwin 2012/06/26 06:09:19 What does requires mean? Maybe "Only valid if Samp
strobe_ 2012/06/27 02:01:21 Done.
int64 offset() const;
int 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();
+
+ // Requires |is_encrypted()| and |!AuxInfoRequired()|.
ddorwin 2012/06/26 06:09:19 Same comment as above. Also, why is this only vali
strobe_ 2012/06/27 02:01:21 Done.
+ scoped_ptr<DecryptConfig> GetDecryptConfig();
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

Powered by Google App Engine
This is Rietveld 408576698