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

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: Add wrong subsample size test Created 8 years, 5 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 9e9b6a17ebe69163d0c1f7832e7bc70c9b55133e..35bfe218304dd115c67d8f27a8b01bb0820b9f7c 100644
--- a/media/mp4/track_run_iterator.h
+++ b/media/mp4/track_run_iterator.h
@@ -8,42 +8,23 @@
#include <vector>
#include "base/time.h"
+#include "media/base/media_export.h"
#include "media/mp4/box_definitions.h"
#include "media/mp4/cenc.h"
namespace media {
-namespace mp4 {
-using base::TimeDelta;
+class DecryptConfig;
-base::TimeDelta TimeDeltaFromFrac(int64 numer, int64 denom);
+namespace mp4 {
-struct SampleInfo {
- int size;
- TimeDelta duration;
- TimeDelta cts_offset;
- bool is_keyframe;
-};
+using base::TimeDelta;
+base::TimeDelta MEDIA_EXPORT TimeDeltaFromFrac(int64 numer, int64 denom);
-struct TrackRunInfo {
- uint32 track_id;
- std::vector<SampleInfo> samples;
- 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;
-
- TrackRunInfo();
- ~TrackRunInfo();
-};
+struct SampleInfo;
+struct TrackRunInfo;
-class TrackRunIterator {
+class MEDIA_EXPORT TrackRunIterator {
public:
TrackRunIterator();
~TrackRunIterator();
@@ -54,20 +35,22 @@ class TrackRunIterator {
bool Init(const Movie& moov, const MovieFragment& moof);
// Returns true if the properties of the current run or sample are valid.
- bool RunValid() const;
- bool SampleValid() const;
+ bool RunIsValid() const;
ddorwin 2012/07/17 01:14:21 Is*
strobe_ 2012/07/19 02:43:35 Done.
+ bool SampleIsValid() const;
// Advance the properties to refer to the next run or sample. Requires that
// the current sample be valid.
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 RunIsValid().
+ bool AuxInfoNeedsToBeCached();
- // Cache the CENC data from the given buffer.
- bool CacheCENC(const uint8* buf, int size);
+ // Caches the CENC data from the given buffer. |buf| must be a buffer starting
+ // 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 +62,34 @@ 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 RunIsValid().
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 SampleIsValid().
+ 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. Result is owned by caller.
+ 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_dts_;
int64 sample_offset_;
- FrameCENCInfo frame_cenc_info_;
};
} // namespace mp4

Powered by Google App Engine
This is Rietveld 408576698