Add CryptoPluginMode to WV extractor
Allows the WV extractor to run in a mode that is compatible with
the DRM CryptoPlugin HAL API, where decryption is deferred
until the encrypted data is sent through the CryptoPlugin to
the codec.
This patch does:
(1) Adds a flag mCryptoPluginMode that controls this behavior
[Note: need framework support to enable/disable this]
(2) Accumulates information in track metadata to delineate
crypto unit boundaries for the CryptoPlugin
related-to-bug: 5986621
Change-Id: I3318d5cde38c7b02a7bdb56aca9aece852c9781c
This commit is contained in:
@@ -34,11 +34,18 @@ public:
|
||||
|
||||
virtual sp<MetaData> getMetaData();
|
||||
virtual int64_t getCachedDurationUs(status_t *finalStatus);
|
||||
|
||||
virtual void setAdaptiveStreamingMode(bool adaptive);
|
||||
bool getAdaptiveStreamingMode() const;
|
||||
|
||||
virtual void setCryptoPluginMode(bool cryptoPluginMode);
|
||||
bool getCryptoPluginMode() const;
|
||||
|
||||
virtual void setUID(uid_t uid);
|
||||
|
||||
sp<WVMMediaSource> getAudioSource() const { return mAudioSource; }
|
||||
sp<WVMMediaSource> getVideoSource() const { return mVideoSource; }
|
||||
|
||||
static void SocketInfoCallback(int fd, int op, void *context);
|
||||
static void cleanup();
|
||||
|
||||
@@ -69,6 +76,14 @@ private:
|
||||
bool mUIDIsSet;
|
||||
uid_t mUID;
|
||||
|
||||
//
|
||||
// if in CryptoPlugin mode, the extractor doesn't decrypt,
|
||||
// it just accumulates the ranges of data requiring decryption
|
||||
// into the MediaBuffer's metadata, the decryption happens
|
||||
// later via the CryptoPlugin
|
||||
//
|
||||
bool mCryptoPluginMode;
|
||||
|
||||
status_t readMetaData();
|
||||
|
||||
const static size_t kStreamCacheSize = 10 * 1024 * 1024;
|
||||
|
||||
@@ -38,6 +38,8 @@ public:
|
||||
virtual status_t setBuffers(const Vector<MediaBuffer *> &buffers);
|
||||
virtual status_t read(MediaBuffer **buffer, const ReadOptions *options = NULL);
|
||||
|
||||
void addEncryptedSize(size_t size) { mEncryptedSizes.push_back(size); }
|
||||
|
||||
static int sLastError;
|
||||
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
@@ -53,10 +55,13 @@ public:
|
||||
static const int kCryptoBlockSize = 16;
|
||||
unsigned char mIV[kCryptoBlockSize];
|
||||
};
|
||||
static WVStatus DecryptCallback(WVEsSelector esType, void* input, void* output, size_t length,
|
||||
int key, unsigned long long dts, unsigned long long pts, bool au_end);
|
||||
|
||||
static DecryptContext sDecryptContext[2]; // audio vs. video
|
||||
static WVStatus DecryptCallback(WVEsSelector esType, void* input, void* output, size_t length,
|
||||
int key, unsigned long long dts, unsigned long long pts,
|
||||
bool au_end, void *context);
|
||||
DecryptContext& getDecryptContext() { return mDecryptContext; }
|
||||
private:
|
||||
DecryptContext mDecryptContext;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
@@ -74,6 +79,7 @@ private:
|
||||
bool mLogOnce;
|
||||
bool mIsLiveStream;
|
||||
bool mNewSegment;
|
||||
bool mCryptoPluginMode;
|
||||
|
||||
MediaBufferGroup *mGroup;
|
||||
|
||||
@@ -83,6 +89,8 @@ private:
|
||||
sp<WVMFileSource> mFileSource;
|
||||
sp<DataSource> mDataSource;
|
||||
|
||||
Vector<size_t> mEncryptedSizes;
|
||||
|
||||
void allocBufferGroup();
|
||||
|
||||
WVMMediaSource(const WVMMediaSource &);
|
||||
|
||||
Reference in New Issue
Block a user