summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drm/drmserver/DrmManager.cpp5
-rw-r--r--media/libstagefright/AwesomePlayer.cpp29
-rw-r--r--media/libstagefright/DRMExtractor.cpp8
-rw-r--r--media/libstagefright/DataSource.cpp2
-rw-r--r--media/libstagefright/MediaExtractor.cpp3
-rw-r--r--media/libstagefright/WVMExtractor.cpp56
-rw-r--r--media/libstagefright/include/WVMExtractor.h8
7 files changed, 27 insertions, 84 deletions
diff --git a/drm/drmserver/DrmManager.cpp b/drm/drmserver/DrmManager.cpp
index f6552dd..3abf3d3 100644
--- a/drm/drmserver/DrmManager.cpp
+++ b/drm/drmserver/DrmManager.cpp
@@ -99,12 +99,11 @@ void DrmManager::removeUniqueId(int uniqueId) {
status_t DrmManager::loadPlugIns() {
- String8 pluginDirPath("/system/lib/drm");
- loadPlugIns(pluginDirPath);
-
String8 vendorPluginDirPath("/vendor/lib/drm");
loadPlugIns(vendorPluginDirPath);
+ String8 pluginDirPath("/system/lib/drm");
+ loadPlugIns(pluginDirPath);
return DRM_NO_ERROR;
}
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 42f18d3..964cb1f 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -335,13 +335,11 @@ status_t AwesomePlayer::setDataSource_l(
return UNKNOWN_ERROR;
}
- if (extractor->getDrmFlag()) {
- dataSource->getDrmInfo(mDecryptHandle, &mDrmManagerClient);
- if (mDecryptHandle != NULL) {
- CHECK(mDrmManagerClient);
- if (RightsStatus::RIGHTS_VALID != mDecryptHandle->status) {
- notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_DRM_NO_LICENSE);
- }
+ dataSource->getDrmInfo(mDecryptHandle, &mDrmManagerClient);
+ if (mDecryptHandle != NULL) {
+ CHECK(mDrmManagerClient);
+ if (RightsStatus::RIGHTS_VALID != mDecryptHandle->status) {
+ notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_DRM_NO_LICENSE);
}
}
@@ -2093,7 +2091,7 @@ status_t AwesomePlayer::finishSetDataSource_l() {
String8 mimeType;
float confidence;
sp<AMessage> dummy;
- bool success = SniffWVM(dataSource, &mimeType, &confidence, &dummy);
+ bool success = SniffDRM(dataSource, &mimeType, &confidence, &dummy);
if (!success
|| strcasecmp(
@@ -2101,11 +2099,8 @@ status_t AwesomePlayer::finishSetDataSource_l() {
return ERROR_UNSUPPORTED;
}
- dataSource->DrmInitialization();
-
mWVMExtractor = new WVMExtractor(dataSource);
mWVMExtractor->setAdaptiveStreamingMode(true);
- mWVMExtractor->setDrmFlag(true);
extractor = mWVMExtractor;
} else {
extractor = MediaExtractor::Create(
@@ -2116,14 +2111,12 @@ status_t AwesomePlayer::finishSetDataSource_l() {
}
}
- if (extractor->getDrmFlag()) {
- dataSource->getDrmInfo(mDecryptHandle, &mDrmManagerClient);
+ dataSource->getDrmInfo(mDecryptHandle, &mDrmManagerClient);
- if (mDecryptHandle != NULL) {
- CHECK(mDrmManagerClient);
- if (RightsStatus::RIGHTS_VALID != mDecryptHandle->status) {
- notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_DRM_NO_LICENSE);
- }
+ if (mDecryptHandle != NULL) {
+ CHECK(mDrmManagerClient);
+ if (RightsStatus::RIGHTS_VALID != mDecryptHandle->status) {
+ notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_DRM_NO_LICENSE);
}
}
diff --git a/media/libstagefright/DRMExtractor.cpp b/media/libstagefright/DRMExtractor.cpp
index afc4a80..1f3d581 100644
--- a/media/libstagefright/DRMExtractor.cpp
+++ b/media/libstagefright/DRMExtractor.cpp
@@ -282,13 +282,13 @@ bool SniffDRM(
if (decryptHandle != NULL) {
if (decryptHandle->decryptApiType == DecryptApiType::CONTAINER_BASED) {
*mimeType = String8("drm+container_based+") + decryptHandle->mimeType;
- *confidence = 10.0f;
} else if (decryptHandle->decryptApiType == DecryptApiType::ELEMENTARY_STREAM_BASED) {
*mimeType = String8("drm+es_based+") + decryptHandle->mimeType;
- *confidence = 10.0f;
- } else {
- return false;
+ } else if (decryptHandle->decryptApiType == DecryptApiType::WV_BASED) {
+ *mimeType = MEDIA_MIMETYPE_CONTAINER_WVM;
+ LOGW("SniffWVM: found match\n");
}
+ *confidence = 10.0f;
return true;
}
diff --git a/media/libstagefright/DataSource.cpp b/media/libstagefright/DataSource.cpp
index d0a7880..e471f73 100644
--- a/media/libstagefright/DataSource.cpp
+++ b/media/libstagefright/DataSource.cpp
@@ -32,7 +32,6 @@
#include "include/DRMExtractor.h"
#include "include/FLACExtractor.h"
#include "include/AACExtractor.h"
-#include "include/WVMExtractor.h"
#include "matroska/MatroskaExtractor.h"
@@ -121,7 +120,6 @@ void DataSource::RegisterDefaultSniffers() {
RegisterSniffer(SniffAAC);
RegisterSniffer(SniffAVI);
RegisterSniffer(SniffMPEG2PS);
- RegisterSniffer(SniffWVM);
char value[PROPERTY_VALUE_MAX];
if (property_get("drm.service.enabled", value, NULL)
diff --git a/media/libstagefright/MediaExtractor.cpp b/media/libstagefright/MediaExtractor.cpp
index d65dc51..2171492 100644
--- a/media/libstagefright/MediaExtractor.cpp
+++ b/media/libstagefright/MediaExtractor.cpp
@@ -114,9 +114,6 @@ sp<MediaExtractor> MediaExtractor::Create(
ret = new AVIExtractor(source);
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_WVM)) {
ret = new WVMExtractor(source);
- if (ret != NULL) {
- isDrm = true;
- }
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AAC_ADTS)) {
ret = new AACExtractor(source, meta);
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_MPEG2PS)) {
diff --git a/media/libstagefright/WVMExtractor.cpp b/media/libstagefright/WVMExtractor.cpp
index 79dedca..26eda0c 100644
--- a/media/libstagefright/WVMExtractor.cpp
+++ b/media/libstagefright/WVMExtractor.cpp
@@ -45,12 +45,17 @@ namespace android {
static Mutex gWVMutex;
WVMExtractor::WVMExtractor(const sp<DataSource> &source)
- : mDataSource(source)
-{
- Mutex::Autolock autoLock(gWVMutex);
+ : mDataSource(source) {
+ {
+ Mutex::Autolock autoLock(gWVMutex);
+ if (gVendorLibHandle == NULL) {
+ gVendorLibHandle = dlopen("libwvm.so", RTLD_NOW);
+ }
- if (!getVendorLibHandle()) {
- return;
+ if (gVendorLibHandle == NULL) {
+ LOGE("Failed to open libwvm.so");
+ return;
+ }
}
typedef WVMLoadableExtractor *(*GetInstanceFunc)(sp<DataSource>);
@@ -66,19 +71,6 @@ WVMExtractor::WVMExtractor(const sp<DataSource> &source)
}
}
-bool WVMExtractor::getVendorLibHandle()
-{
- if (gVendorLibHandle == NULL) {
- gVendorLibHandle = dlopen("libwvm.so", RTLD_NOW);
- }
-
- if (gVendorLibHandle == NULL) {
- LOGE("Failed to open libwvm.so");
- }
-
- return gVendorLibHandle != NULL;
-}
-
WVMExtractor::~WVMExtractor() {
}
@@ -121,33 +113,5 @@ void WVMExtractor::setAdaptiveStreamingMode(bool adaptive) {
}
}
-bool SniffWVM(
- const sp<DataSource> &source, String8 *mimeType, float *confidence,
- sp<AMessage> *) {
-
- Mutex::Autolock autoLock(gWVMutex);
-
- if (!WVMExtractor::getVendorLibHandle()) {
- return false;
- }
-
- typedef WVMLoadableExtractor *(*SnifferFunc)(sp<DataSource>);
- SnifferFunc snifferFunc =
- (SnifferFunc) dlsym(gVendorLibHandle,
- "_ZN7android15IsWidevineMediaENS_2spINS_10DataSourceEEE");
-
- if (snifferFunc) {
- if ((*snifferFunc)(source)) {
- *mimeType = MEDIA_MIMETYPE_CONTAINER_WVM;
- *confidence = 10.0f;
- return true;
- }
- } else {
- LOGE("IsWidevineMedia not found in libwvm.so");
- }
-
- return false;
-}
-
} //namespace android
diff --git a/media/libstagefright/include/WVMExtractor.h b/media/libstagefright/include/WVMExtractor.h
index 9f763f9..deecd25 100644
--- a/media/libstagefright/include/WVMExtractor.h
+++ b/media/libstagefright/include/WVMExtractor.h
@@ -23,8 +23,6 @@
namespace android {
-struct AMessage;
-class String8;
class DataSource;
class WVMLoadableExtractor : public MediaExtractor {
@@ -60,8 +58,6 @@ public:
// is used.
void setAdaptiveStreamingMode(bool adaptive);
- static bool getVendorLibHandle();
-
protected:
virtual ~WVMExtractor();
@@ -73,10 +69,6 @@ private:
WVMExtractor &operator=(const WVMExtractor &);
};
-bool SniffWVM(
- const sp<DataSource> &source, String8 *mimeType, float *confidence,
- sp<AMessage> *);
-
} // namespace android
#endif // DRM_EXTRACTOR_H_