summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/WVMExtractor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'media/libstagefright/WVMExtractor.cpp')
-rw-r--r--media/libstagefright/WVMExtractor.cpp56
1 files changed, 10 insertions, 46 deletions
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