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
98 lines
2.5 KiB
C++
98 lines
2.5 KiB
C++
/*
|
|
* Copyright (C) 2011 Google, Inc. All Rights Reserved
|
|
*/
|
|
|
|
#ifndef WVMEXTRACTOR_H_
|
|
|
|
#define WVMEXTRACTOR_H_
|
|
|
|
#include "AndroidConfig.h"
|
|
#include "WVStreamControlAPI.h"
|
|
#include "WVMInfoListener.h"
|
|
#include "WVMExtractor.h"
|
|
#include <media/stagefright/DataSource.h>
|
|
#include <utils/RefBase.h>
|
|
|
|
|
|
// DLL entry - given a data source, instantiate a WVMExtractor object
|
|
|
|
namespace android {
|
|
|
|
WVMLoadableExtractor *GetInstance(sp<DataSource> dataSource);
|
|
bool IsWidevineMedia(const sp<DataSource>& dataSource);
|
|
|
|
class WVMMediaSource;
|
|
class WVMFileSource;
|
|
|
|
class WVMExtractorImpl : public WVMLoadableExtractor {
|
|
public:
|
|
WVMExtractorImpl(sp<DataSource> dataSource);
|
|
|
|
virtual size_t countTracks();
|
|
virtual sp<MediaSource> getTrack(size_t index);
|
|
virtual sp<MetaData> getTrackMetaData(size_t index, uint32_t flags);
|
|
|
|
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();
|
|
|
|
protected:
|
|
virtual ~WVMExtractorImpl();
|
|
void Initialize();
|
|
|
|
private:
|
|
status_t readAVCCMetaData(sp<MetaData> videoMetaData);
|
|
status_t readESDSMetaData(sp<MetaData> audioMetaData);
|
|
|
|
sp<WVMMediaSource> mAudioSource;
|
|
sp<WVMMediaSource> mVideoSource;
|
|
sp<MetaData> mFileMetaData;
|
|
sp<WVMFileSource> mFileSource;
|
|
sp<DataSource> mDataSource;
|
|
sp<WVMInfoListener> mInfoListener;
|
|
|
|
bool mHaveMetaData;
|
|
bool mUseAdaptiveStreaming;
|
|
bool mIsLiveStream;
|
|
bool mAdaptivePrefetching;
|
|
|
|
WVSession *mSession;
|
|
|
|
status_t mSetupStatus;
|
|
|
|
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;
|
|
|
|
WVMExtractorImpl(const WVMExtractorImpl &);
|
|
WVMExtractorImpl &operator=(const WVMExtractorImpl &);
|
|
};
|
|
|
|
} // namespace android
|
|
|
|
#endif // WVMEXTRACTOR_H_
|