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

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: Satisfy mac_rel buildbot 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
« no previous file with comments | « media/mp4/mp4_stream_parser_unittest.cc ('k') | media/mp4/track_run_iterator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mp4/track_run_iterator.h
diff --git a/media/mp4/track_run_iterator.h b/media/mp4/track_run_iterator.h
index ddea39ce7c5cfae92a38c8173858c096d8de10ee..85cadce568aeb0383c713d3de16bca9f45b54c7e 100644
--- a/media/mp4/track_run_iterator.h
+++ b/media/mp4/track_run_iterator.h
@@ -11,12 +11,16 @@
#include "base/time.h"
#include "media/base/media_export.h"
#include "media/mp4/box_definitions.h"
+#include "media/mp4/cenc.h"
namespace media {
+
+class DecryptConfig;
+
namespace mp4 {
using base::TimeDelta;
-base::TimeDelta MEDIA_EXPORT TimeDeltaFromFrac(int64 numer, int64 denom);
+base::TimeDelta MEDIA_EXPORT TimeDeltaFromRational(int64 numer, int64 denom);
struct SampleInfo;
struct TrackRunInfo;
@@ -34,14 +38,23 @@ class MEDIA_EXPORT TrackRunIterator {
bool Init(const MovieFragment& moof);
// Returns true if the properties of the current run or sample are valid.
- bool RunIsValid() const;
- bool SampleIsValid() const;
+ bool IsRunValid() const;
+ bool IsSampleValid() 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 if this track run has auxiliary information and has not yet
+ // been cached. Only valid if IsRunValid().
+ bool AuxInfoNeedsToBeCached();
+
+ // 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
// may clear all data up to this offset before reading the current sample
@@ -52,15 +65,17 @@ class MEDIA_EXPORT TrackRunIterator {
// Returns the minimum timestamp (or kInfiniteDuration if no runs present).
TimeDelta GetMinDecodeTimestamp();
- // Property of the current run. Only valid if RunIsValid().
+ // Property of the current run. Only valid if IsRunValid().
uint32 track_id() const;
+ int64 aux_info_offset() const;
+ int aux_info_size() const;
bool is_encrypted() const;
bool is_audio() const;
// Only one is valid, based on the value of is_audio().
const AudioSampleEntry& audio_description() const;
const VideoSampleEntry& video_description() const;
- // Properties of the current sample. Only valid if SampleIsValid().
+ // Properties of the current sample. Only valid if IsSampleValid().
int64 sample_offset() const;
int sample_size() const;
TimeDelta dts() const;
@@ -68,8 +83,13 @@ class MEDIA_EXPORT TrackRunIterator {
TimeDelta duration() const;
bool is_keyframe() const;
+ // Only call when is_encrypted() is true and AuxInfoNeedsToBeCached() is
+ // false. Result is owned by caller.
+ scoped_ptr<DecryptConfig> GetDecryptConfig();
+
private:
void ResetRun();
+ const TrackEncryption& track_encryption() const;
const Movie* moov_;
@@ -77,6 +97,8 @@ class MEDIA_EXPORT TrackRunIterator {
std::vector<TrackRunInfo>::const_iterator run_itr_;
std::vector<SampleInfo>::const_iterator sample_itr_;
+ std::vector<FrameCENCInfo> cenc_info_;
+
int64 sample_dts_;
int64 sample_offset_;
« no previous file with comments | « media/mp4/mp4_stream_parser_unittest.cc ('k') | media/mp4/track_run_iterator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698