Files
android/proprietary/wvm/test/Testlibwvm.cpp
Jeff Tinker 9e8923789e Some restructuring of the build was required to support the different
OEM security levels used on tuna vs stingray & crespo. This is part of
the work for b/4598045 Implementing secure video path on TI OMAP4 chip
for ICS.

The Widevine libraries included here, 4.5.0.4321 also contain a fix
for b/4400696 Pinning and unpinning multiple movie for download behavior
is not uniform for multiple tries.

Change-Id: I67f34c06a0353ac7f401f55c1ed4fc2493bc8ab7
2011-08-12 11:38:16 -07:00

82 lines
2.2 KiB
C++

/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dlfcn.h>
#include <iostream>
#include "include/WVMExtractor.h"
#include <media/stagefright/Utils.h>
#include <media/stagefright/DataSource.h>
#include <media/stagefright/MediaSource.h>
#include <media/stagefright/FileSource.h>
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/MetaData.h>
#include <media/stagefright/MediaErrors.h>
#include <media/stagefright/MediaBuffer.h>
#include <media/stagefright/MediaDebug.h>
using namespace android;
using namespace std;
class TestLibWVM
{
public:
TestLibWVM() {}
~TestLibWVM() {}
// Tests
void Load();
};
DrmManagerClient* gDrmManagerClient;
// This test just confirms that there are no unresolved symbols in libwvm and we
// can locate the entry point.
void TestLibWVM::Load()
{
cout << "TestLibWVM::Load" << endl;
const char *path = "/system/lib/libwvm.so";
void *handle = dlopen(path, RTLD_NOW);
if (handle == NULL) {
fprintf(stderr, "Can't open plugin: %s: %s\n", path, dlerror());
exit(-1);
}
typedef MediaExtractor *(*GetInstanceFunc)(sp<DataSource>);
GetInstanceFunc getInstanceFunc =
(GetInstanceFunc) dlsym(handle,
"_ZN7android11GetInstanceENS_2spINS_10DataSourceEEE");
// Basic test - just see if we can instantiate the object and call a method
if (getInstanceFunc) {
LOGD("Found GetInstanceFunc");
} else {
LOGE("Failed to locate GetInstance in libwvm.so");
}
dlclose(handle);
printf("Test successful!\n");
exit(0);
}
int main(int argc, char **argv)
{
TestLibWVM test;
test.Load();
}