Revert Widevine 6.0.0 -> 4.5.0 libraries
Includes Widevine libraries Version 4.5.0.7809 Also fixed samplePlayer's MediaCodec mode not running and WVDrmInfoRequestStatusKey returning incorrect value. Change-Id: Ibcc6d313790670a908ada93be80d6bf55a67b4ed related-to-bug: 6929628 related-to-bug: 6833718 related-to-bug: 6889322
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES:= \
|
||||
WVCryptoPlugin.cpp
|
||||
ifeq ($(BOARD_WIDEVINE_OEMCRYPTO_LEVEL),1)
|
||||
LOCAL_CFLAGS := -DREQUIRE_SECURE_BUFFERS
|
||||
endif
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
WVCryptoPlugin.cpp
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
vendor/widevine/proprietary/wvm/include \
|
||||
$(TOP)/vendor/widevine/proprietary/wvm/include \
|
||||
$(TOP)/external/openssl/include
|
||||
|
||||
LOCAL_MODULE:= libwvdecryptcommon
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
@@ -16,16 +16,20 @@
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "wv_crypto_plugin"
|
||||
#include <cutils/properties.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include "WVCryptoPlugin.h"
|
||||
#include <string.h>
|
||||
#include <openssl/md5.h>
|
||||
|
||||
#include <media/stagefright/foundation/ADebug.h>
|
||||
#include <media/stagefright/foundation/hexdump.h>
|
||||
#include <media/stagefright/MediaErrors.h>
|
||||
|
||||
#include "WVCryptoPlugin.h"
|
||||
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
#include <OEMCrypto_L1.h>
|
||||
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
android::CryptoFactory *createCryptoFactory() {
|
||||
return new android::WVCryptoFactory;
|
||||
@@ -40,30 +44,35 @@ const uint8_t WVCryptoFactory::kUUIDWidevine[16] = {
|
||||
};
|
||||
|
||||
WVCryptoPlugin::WVCryptoPlugin(const void *data, size_t size)
|
||||
: mInitCheck(NO_INIT) {
|
||||
|
||||
: mInitCheck(NO_INIT)
|
||||
{
|
||||
// not using data at this time, require
|
||||
// size to be zero.
|
||||
if (size > 0) {
|
||||
mInitCheck = -EINVAL;
|
||||
} else {
|
||||
mInitCheck = OK;
|
||||
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
OEMCryptoResult res = OEMCrypto_Initialize();
|
||||
if (res != OEMCrypto_SUCCESS) {
|
||||
ALOGE("OEMCrypto_Initialize failed: %d", res);
|
||||
mInitCheck = -EINVAL;
|
||||
} else {
|
||||
mInitCheck = OK;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
WVCryptoPlugin::~WVCryptoPlugin() {
|
||||
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
if (mInitCheck == OK) {
|
||||
OEMCryptoResult res = OEMCrypto_Terminate();
|
||||
if (res != OEMCrypto_SUCCESS) {
|
||||
ALOGW("OEMCrypto_Terminate failed: %d", res);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
status_t WVCryptoPlugin::initCheck() const {
|
||||
@@ -71,9 +80,16 @@ status_t WVCryptoPlugin::initCheck() const {
|
||||
}
|
||||
|
||||
bool WVCryptoPlugin::requiresSecureDecoderComponent(const char *mime) const {
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
return !strncasecmp(mime, "video/", 6);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Returns negative values for error code and
|
||||
// positive values for the size of decrypted data, which can be larger
|
||||
// than the input length.
|
||||
ssize_t WVCryptoPlugin::decrypt(
|
||||
bool secure,
|
||||
const uint8_t key[16],
|
||||
@@ -85,10 +101,11 @@ ssize_t WVCryptoPlugin::decrypt(
|
||||
AString *errorDetailMsg) {
|
||||
Mutex::Autolock autoLock(mLock);
|
||||
|
||||
//ALOGD("mode=%d, secure=%d, numSubSamples=%d", mode, secure, numSubSamples);
|
||||
|
||||
CHECK(mode == kMode_Unencrypted || mode == kMode_AES_WV);
|
||||
|
||||
size_t offset = 0;
|
||||
size_t srcOffset = 0;
|
||||
size_t dstOffset = 0;
|
||||
for (size_t i = 0; i < numSubSamples; ++i) {
|
||||
const SubSample &ss = subSamples[i];
|
||||
|
||||
@@ -104,7 +121,9 @@ ssize_t WVCryptoPlugin::decrypt(
|
||||
|
||||
//ALOGD("size[%d]=%d", i, srcSize);
|
||||
|
||||
OEMCrypto_UINT32 dstLength = srcSize;
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
// decrypt using OEMCrypto API, used for L1 devices
|
||||
OEMCrypto_UINT32 dstSize = srcSize;
|
||||
|
||||
OEMCryptoResult res;
|
||||
|
||||
@@ -120,19 +139,19 @@ ssize_t WVCryptoPlugin::decrypt(
|
||||
//ALOGD("calling DecryptVideo, size=%d", srcSize);
|
||||
res = OEMCrypto_DecryptVideo(
|
||||
iv,
|
||||
(const OEMCrypto_UINT8 *)srcPtr + offset,
|
||||
(const OEMCrypto_UINT8 *)srcPtr + srcOffset,
|
||||
srcSize,
|
||||
(OEMCrypto_UINT32)dstPtr,
|
||||
offset,
|
||||
&dstLength);
|
||||
dstOffset,
|
||||
&dstSize);
|
||||
} else {
|
||||
//ALOGD("calling DecryptAudio: size=%d", srcSize);
|
||||
res = OEMCrypto_DecryptAudio(
|
||||
iv,
|
||||
(const OEMCrypto_UINT8 *)srcPtr + offset,
|
||||
(const OEMCrypto_UINT8 *)srcPtr + srcOffset,
|
||||
srcSize,
|
||||
(OEMCrypto_UINT8 *)dstPtr + offset,
|
||||
&dstLength);
|
||||
(OEMCrypto_UINT8 *)dstPtr + dstOffset,
|
||||
&dstSize);
|
||||
}
|
||||
|
||||
if (res != OEMCrypto_SUCCESS) {
|
||||
@@ -140,9 +159,88 @@ ssize_t WVCryptoPlugin::decrypt(
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
offset += dstLength;
|
||||
dstOffset += dstSize;
|
||||
#else
|
||||
if (mode == kMode_Unencrypted) {
|
||||
memcpy((char *)dstPtr + dstOffset, (char *)srcPtr + srcOffset, srcSize);
|
||||
} else {
|
||||
status_t status = decryptSW(key, (uint8_t *)dstPtr + dstOffset,
|
||||
(const uint8_t *)srcPtr + srcOffset, srcSize);
|
||||
if (status != OK) {
|
||||
ALOGE("decryptSW returned %d", status);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
dstOffset += srcSize;
|
||||
#endif
|
||||
srcOffset += srcSize;
|
||||
} // for each subsample
|
||||
|
||||
return static_cast<ssize_t>(dstOffset);
|
||||
}
|
||||
|
||||
// SW AES CTS decrypt, used only for L3 devices
|
||||
status_t WVCryptoPlugin::decryptSW(const uint8_t *key, uint8_t *out,
|
||||
const uint8_t *in, size_t length)
|
||||
{
|
||||
#ifndef REQUIRE_SECURE_BUFFERS
|
||||
unsigned char iv[kAES128BlockSize] = {0};
|
||||
|
||||
if (memcmp(key, mEncKey, sizeof(mEncKey)) != 0) {
|
||||
// key has changed, recompute mAesKey from key
|
||||
uint8_t hash[MD5_DIGEST_LENGTH];
|
||||
char value[PROPERTY_VALUE_MAX] = {0};
|
||||
char seed[] = "34985woeirsdlkfjxc";
|
||||
|
||||
property_get("ro.serialno", value, NULL);
|
||||
|
||||
MD5_CTX ctx;
|
||||
MD5_Init(&ctx);
|
||||
MD5_Update(&ctx, (uint8_t *)seed, sizeof(seed));
|
||||
MD5_Update(&ctx, (uint8_t *)value, strlen(value));
|
||||
MD5_Final(hash, &ctx);
|
||||
|
||||
AES_KEY aesKey;
|
||||
if (AES_set_decrypt_key(hash, sizeof(hash) * 8, &aesKey) == 0) {
|
||||
uint8_t clearKey[kAES128BlockSize];
|
||||
AES_ecb_encrypt(key, clearKey, &aesKey, 0);
|
||||
|
||||
if (AES_set_decrypt_key(clearKey, sizeof(hash) * 8, &mAesKey) == 0) {
|
||||
memcpy(mEncKey, key, sizeof(mEncKey));
|
||||
} else {
|
||||
return -EINVAL;
|
||||
}
|
||||
} else {
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
size_t k, r = length % kAES128BlockSize;
|
||||
|
||||
if (r) {
|
||||
k = length - r - kAES128BlockSize;
|
||||
} else {
|
||||
k = length;
|
||||
}
|
||||
|
||||
AES_cbc_encrypt(in, out, k, &mAesKey, iv, 0);
|
||||
|
||||
if (r) {
|
||||
// cipher text stealing - Schneier Figure 9.5 p 196
|
||||
unsigned char peniv[kAES128BlockSize] = {0};
|
||||
memcpy(peniv, in + k + kAES128BlockSize, r);
|
||||
|
||||
AES_cbc_encrypt(in + k, out + k, kAES128BlockSize, &mAesKey, peniv, 0);
|
||||
|
||||
// exchange the final plaintext and ciphertext
|
||||
for (size_t i = 0; i < r; i++) {
|
||||
*(out + k + kAES128BlockSize + i) = *(out + k + i);
|
||||
*(out + k + i) = *(in + k + kAES128BlockSize + i);
|
||||
}
|
||||
AES_cbc_encrypt(out + k, out + k, kAES128BlockSize, &mAesKey, iv, 0);
|
||||
}
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <media/hardware/CryptoAPI.h>
|
||||
#include <utils/threads.h>
|
||||
#include <openssl/aes.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
@@ -27,14 +28,16 @@ struct WVCryptoPlugin : public CryptoPlugin {
|
||||
WVCryptoPlugin(const void *data, size_t size);
|
||||
virtual ~WVCryptoPlugin();
|
||||
|
||||
const static size_t kAES128BlockSize = 16;
|
||||
|
||||
status_t initCheck() const;
|
||||
|
||||
virtual bool requiresSecureDecoderComponent(const char *mime) const;
|
||||
|
||||
virtual ssize_t decrypt(
|
||||
bool secure,
|
||||
const uint8_t key[16],
|
||||
const uint8_t iv[16],
|
||||
const uint8_t key[kAES128BlockSize],
|
||||
const uint8_t iv[kAES128BlockSize],
|
||||
Mode mode,
|
||||
const void *srcPtr,
|
||||
const SubSample *subSamples, size_t numSubSamples,
|
||||
@@ -42,9 +45,13 @@ struct WVCryptoPlugin : public CryptoPlugin {
|
||||
AString *errorDetailMsg);
|
||||
|
||||
private:
|
||||
status_t decryptSW(const uint8_t *key, uint8_t *out, const uint8_t *in, size_t length);
|
||||
|
||||
Mutex mLock;
|
||||
|
||||
status_t mInitCheck;
|
||||
AES_KEY mAesKey;
|
||||
uint8_t mEncKey[kAES128BlockSize];
|
||||
|
||||
WVCryptoPlugin(const WVCryptoPlugin &);
|
||||
WVCryptoPlugin &operator=(const WVCryptoPlugin &);
|
||||
|
||||
@@ -3,18 +3,14 @@
|
||||
# Widevine wvm static library. Sets up includes and defines the core libraries
|
||||
# required.
|
||||
#
|
||||
include vendor/widevine/proprietary/wvm/common.mk
|
||||
include $(TOP)/vendor/widevine/proprietary/wvm/common.mk
|
||||
|
||||
ifndef BOARD_WIDEVINE_OEMCRYPTO_LEVEL
|
||||
$(error BOARD_WIDEVINE_OEMCRYPTO_LEVEL not defined!)
|
||||
endif
|
||||
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := \
|
||||
libwvdecryptcommon
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libstagefright_foundation \
|
||||
libutils \
|
||||
libwvdecryptcommon
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := \
|
||||
liboemcrypto \
|
||||
liboemcrypto
|
||||
|
||||
@@ -34,7 +34,7 @@ include $(BUILD_JAVA_LIBRARY)
|
||||
ifneq ($(filter arm x86,$(TARGET_ARCH)),)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
include vendor/widevine/proprietary/drmwvmplugin/common.mk
|
||||
include $(TOP)/vendor/widevine/proprietary/drmwvmplugin/common.mk
|
||||
|
||||
LOCAL_SRC_FILES:= \
|
||||
src/WVMDrmPlugin.cpp \
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
LOCAL_C_INCLUDES:= \
|
||||
bionic \
|
||||
bionic/libstdc++/include \
|
||||
external/stlport/stlport \
|
||||
vendor/widevine/proprietary/streamcontrol/include \
|
||||
vendor/widevine/proprietary/drmwvmplugin/include \
|
||||
frameworks/av/drm/libdrmframework/include \
|
||||
frameworks/av/drm/libdrmframework/plugins/common/include \
|
||||
frameworks/av/include
|
||||
$(TOP)/bionic \
|
||||
$(TOP)/bionic/libstdc++/include \
|
||||
$(TOP)/external/stlport/stlport \
|
||||
$(TOP)/vendor/widevine/proprietary/streamcontrol/include \
|
||||
$(TOP)/vendor/widevine/proprietary/drmwvmplugin/include \
|
||||
$(TOP)/frameworks/av/drm/libdrmframework/include \
|
||||
$(TOP)/frameworks/av/drm/libdrmframework/plugins/common/include \
|
||||
$(TOP)/frameworks/av/include
|
||||
|
||||
ifeq ($(TARGET_ARCH),x86)
|
||||
LOCAL_C_INCLUDES += system/core/include/arch/linux-x86
|
||||
LOCAL_C_INCLUDES += $(TOP)/system/core/include/arch/linux-x86
|
||||
endif
|
||||
|
||||
@@ -31,7 +31,8 @@ class WVDRMPluginAPI {
|
||||
// provisionedFlags
|
||||
enum {
|
||||
DEVICE_IS_PROVISIONED,
|
||||
DEVICE_IS_NOT_PROVISIONED
|
||||
DEVICE_IS_NOT_PROVISIONED,
|
||||
DEVICE_IS_PROVISIONED_SD_ONLY
|
||||
};
|
||||
|
||||
static const int PlaybackMode_Default = 0;
|
||||
@@ -70,7 +71,7 @@ class WVDRMPluginAPI {
|
||||
virtual bool RemoveRights(std::string &path) = 0;
|
||||
virtual bool RemoveAllRights() = 0;
|
||||
virtual bool Prepare(char *data, int len) = 0;
|
||||
virtual int Operate(char *in, char *out, int len, char *iv) = 0;
|
||||
virtual int Operate(char *in, int inLength, char *out, int outLength, char *iv) = 0;
|
||||
|
||||
enum EventType {
|
||||
EventType_AcquireDrmInfoFailed,
|
||||
|
||||
@@ -8,6 +8,7 @@ ifneq ($(BOARD_USES_GENERIC_WIDEVINE),false)
|
||||
# libwvdrm_L?.so
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := libwvdrm_L$(BOARD_WIDEVINE_OEMCRYPTO_LEVEL)
|
||||
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
|
||||
LOCAL_MODULE_SUFFIX := .so
|
||||
@@ -23,6 +24,7 @@ include $(BUILD_PREBUILT)
|
||||
# libwvocs_L?.a
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := libwvocs_L$(BOARD_WIDEVINE_OEMCRYPTO_LEVEL)
|
||||
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
|
||||
LOCAL_MODULE_SUFFIX := .a
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3,7 +3,7 @@
|
||||
# Widevine DRM plugin. Sets up includes and defines the core libraries
|
||||
# required to build the plugin.
|
||||
#
|
||||
include vendor/widevine/proprietary/drmwvmplugin/common.mk
|
||||
include $(TOP)/vendor/widevine/proprietary/drmwvmplugin/common.mk
|
||||
|
||||
ifndef BOARD_WIDEVINE_OEMCRYPTO_LEVEL
|
||||
$(error BOARD_WIDEVINE_OEMCRYPTO_LEVEL not defined!)
|
||||
|
||||
@@ -851,10 +851,8 @@ status_t WVMDrmPlugin::onDecrypt(int uniqueId, DecryptHandle* decryptHandle, int
|
||||
if (*decBuffer == NULL)
|
||||
return DRM_ERROR_DECRYPT;
|
||||
|
||||
(*decBuffer)->length = encBuffer->length;
|
||||
|
||||
int status;
|
||||
status = mDrmPluginImpl->Operate(encBuffer->data, (*decBuffer)->data, encBuffer->length, iv);
|
||||
status = mDrmPluginImpl->Operate(encBuffer->data, encBuffer->length, (*decBuffer)->data, (*decBuffer)->length, iv);
|
||||
if (status != WVDRMPluginAPI::RIGHTS_VALID) {
|
||||
(*decBuffer)->length = 0;
|
||||
usleep(1000); // prevent spinning
|
||||
|
||||
@@ -17,7 +17,7 @@ LOCAL_C_INCLUDES+= \
|
||||
frameworks/av/drm/libdrmframework/plugins/common/include
|
||||
|
||||
ifeq ($(TARGET_ARCH),x86)
|
||||
LOCAL_C_INCLUDES += system/core/include/arch/linux-x86
|
||||
LOCAL_C_INCLUDES += $(TOP)/system/core/include/arch/linux-x86
|
||||
endif
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
|
||||
@@ -207,6 +207,7 @@ class CodecState {
|
||||
} catch (MediaCodec.CryptoException e) {
|
||||
Log.d(TAG, "CryptoException w/ errorCode "
|
||||
+ e.getErrorCode() + ", '" + e.getMessage() + "'");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -527,6 +528,8 @@ class MediaCodecView extends SurfaceView
|
||||
if (isAudio) {
|
||||
mAudioTrackState = state;
|
||||
}
|
||||
// set video view size
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void start() {
|
||||
@@ -722,4 +725,14 @@ class MediaCodecView extends SurfaceView
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int width = 720;
|
||||
int height = 480;
|
||||
|
||||
Log.d(TAG, "setting size: " + width + 'x' + height);
|
||||
setMeasuredDimension(width, height);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ public class WidevineDrm {
|
||||
private WidevineDrmLogEventListener logEventListener;
|
||||
private final static long DEVICE_IS_PROVISIONED = 0;
|
||||
private final static long DEVICE_IS_NOT_PROVISIONED = 1;
|
||||
private final static long DEVICE_IS_PROVISIONED_SD_ONLY = 2;
|
||||
private long mWVDrmInfoRequestStatusKey = DEVICE_IS_PROVISIONED;
|
||||
|
||||
public StringBuffer logBuffer = new StringBuffer();
|
||||
@@ -129,7 +130,10 @@ public class WidevineDrm {
|
||||
}
|
||||
|
||||
public boolean isProvisionedDevice() {
|
||||
return (mWVDrmInfoRequestStatusKey == DEVICE_IS_PROVISIONED);
|
||||
logMessage("mWVDrmInfoRequestStatusKey = " + mWVDrmInfoRequestStatusKey + "\n");
|
||||
|
||||
return ((mWVDrmInfoRequestStatusKey == DEVICE_IS_PROVISIONED) ||
|
||||
(mWVDrmInfoRequestStatusKey == DEVICE_IS_PROVISIONED_SD_ONLY));
|
||||
}
|
||||
|
||||
public void registerPortal(String portal) {
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/****************************************************************************************************
|
||||
* WVControlSettings.h
|
||||
*
|
||||
* (c) Copyright 2011-2012 Google, Inc.
|
||||
*
|
||||
* Widevine API types
|
||||
***************************************************************************************************/
|
||||
|
||||
#ifndef __WVCONTROLSETTINGS_H__
|
||||
#define __WVCONTROLSETTINGS_H__
|
||||
|
||||
#include <string>
|
||||
|
||||
/* WVCredentials is used in both WVPlaybackAPI and WVStreamControlAPI. */
|
||||
struct WVCredentials {
|
||||
std::string deviceID; // unique player device ID from CinemaNow
|
||||
std::string streamID; // unique streamID from CinemaNow
|
||||
std::string clientIP; // IP address of client
|
||||
std::string drmServerURL; // URL for DRM server
|
||||
std::string userData; // Additional optional user data, TBD
|
||||
std::string portal; // Identifies the operator
|
||||
std::string storefront; // Identifies store run by operator
|
||||
std::string drmAckServerURL; // URL for server that receives
|
||||
// entitlement confirmations
|
||||
std::string heartbeatURL; // URL to receive client heartbeats
|
||||
unsigned int heartbeatPeriod;// Duration between consecutive heartbeats in
|
||||
// seconds. 0 indicates no heatbeats requested
|
||||
unsigned int cnDeviceType; // device type identifier defined by CinemaNow
|
||||
};
|
||||
|
||||
/* WVProxySettings is used in both WVPlaybackAPI and WVStreamControlAPI. */
|
||||
struct WVProxySettings {
|
||||
bool enable; // If true, proxy use is enable, otherwise disabled
|
||||
std::string ipAddr; // IP address of proxy server, e.g. "1.2.3.4" or host name
|
||||
unsigned short ipPort; // IP port number
|
||||
std::string userId; // User ID if authentication is needed, otherwise "" to disable authentication
|
||||
std::string password; // Password if userID is not ""
|
||||
};
|
||||
|
||||
|
||||
#endif // __WVCONTROLSETTINGS_H__
|
||||
@@ -1,176 +0,0 @@
|
||||
/****************************************************************************************************
|
||||
* WVDictionaryKeys.h
|
||||
*
|
||||
* Key and value constants for dictionaries
|
||||
*
|
||||
* (c) Copyright 2011 Google, Inc.
|
||||
***************************************************************************************************/
|
||||
|
||||
#ifndef __WVDICTIONARYKEYS_H__
|
||||
#define __WVDICTIONARYKEYS_H__
|
||||
|
||||
|
||||
// Keys for Credentials dictionary
|
||||
#define kCredentialsKey_DeviceId "CredentialsKey_DeviceId" // Device ID (WVString)
|
||||
#define kCredentialsKey_ClientId "CredentialsKey_ClientId" // Client ID (WVString)
|
||||
#define kCredentialsKey_StreamId "CredentialsKey_StreamId" // Stream ID (WVString)
|
||||
#define kCredentialsKey_SessionId "CredentialsKey_SessionId" // Session ID (WVString)
|
||||
#define kCredentialsKey_ClientIp "CredentialsKey_ClientIp" // Client IP (WVString)
|
||||
#define kCredentialsKey_Portal "CredentialsKey_Portal" // Media portal (WVString)
|
||||
#define kCredentialsKey_Storefront "CredentialsKey_Storefront" // Media storefront (WVString)
|
||||
#define kCredentialsKey_OptionalData "CredentialsKey_OptionalData" // Optional data (WVString)
|
||||
#define kCredentialsKey_AssetRegistryId "CredentialsKey_AssetRegistryId" // Asset Registry ID to store/retrieve licenses (WVString)
|
||||
#define kCredentialsKey_DrmServerUrl "CredentialsKey_DrmServerUrl" // DRM server URL to retrieve entitlements (WVString)
|
||||
#define kCredentialsKey_DrmAckServerUrl "CredentialsKey_DrmAckServerUrl" // DRM ACK server URL (WVString)
|
||||
#define kCredentialsKey_HeartbeatUrl "CredentialsKey_HeartbeatUrl" // Heartbeat sever URL (WVString)
|
||||
#define kCredentialsKey_DrmLicenseUsageUrl "CredentialsKey_DrmLicenseUsageUrl" // DRM License usage URL (WVString)
|
||||
#define kCredentialsKey_SignOnUrl "CredentialsKey_SignOnUrl" // Sign-on server URL (WVString)
|
||||
#define kCredentialsKey_AppSignatureUrl "CredentialsKey_AppSignatureUrl" // DCP application signature URL (WVString)
|
||||
#define kCredentialsKey_DcpLogUrl "CredentialsKey_DcpLogUrl" // DCP logging URL (WVString)
|
||||
#define kCredentialsKey_HeartbeatPeriod "CredentialsKey_HeartbeatPeriod" // Heartbeat period (WVUnsignedInt)
|
||||
#define kCredentialsKey_UserAgent "CredentialsKey_UserAgent" // UserAgent for HTTP requests (WVString)
|
||||
#define kCredentialsKey_PreloadTimeout "CredentialsKey_PreloadTimeout" // Preload timeout in microseconds (WVUnsignedInt)
|
||||
#define kCredentialsKey_CacheSize "CredentialsKey_CacheSize" // Size of donwload/adaptive cache in bytes (WVUnsignedInt).
|
||||
#define kCredentialsKey_DataStorePath "CredentialsKey_DataStorePath" // Optional path to license data store (WVString)
|
||||
#define kCredentialsKey_PlaybackMode "CredentialsKey_PlaybackMode" // Playback mode (WVUnsignedInt), see kPlaybackMode constants
|
||||
#define kCredentialsKey_CaToken "CredentialsKey_CaToken" // Conditional access token
|
||||
#define kCredentialsKey_CommandChannel "CredentialsKey_CommandChannel" // Enable control back channel (WVBoolean).
|
||||
#define kCredentialsKey_Pda "CredentialsKey_Pda" // Enable player-driven adaptation (WVBoolean)
|
||||
#define kCredentialsKey_AssetFsRoot "CredentialsKey_AssetFsRoot" // File system root directory for assets (WVString)
|
||||
#define kCredentialsKey_UseJSON "CredentialsKey_UseJSON" // Use JSON format for EMM (WVBoolean)
|
||||
|
||||
// Keys for Asset Registry query results dictionary
|
||||
#define kAssetRegistryKey_AssetPath "AssetRegistryKey_AssetPath" // Asset path (WVString)
|
||||
#define kAssetRegistryKey_AssetStatus "AssetRegistryKey_AssetStatus" // Asset status (WVUnsignedInt)
|
||||
|
||||
|
||||
// Keys for asset information containing dictionaries
|
||||
#define kAssetInfoKey_SystemId "AssetInfoKey_SystemId" // CA system ID (WVUnsignedInt)
|
||||
#define kAssetInfoKey_AssetId "AssetInfoKey_AssetId" // CA asset ID (WVUnsignedInt)
|
||||
#define kAssetInfoKey_KeyIndex "AssetInfoKey_KeyIndex" // CA key index (WVUnsignedInt)
|
||||
#define kAssetInfoKey_DistributionTimeRemaining "AssetInfoKey_DistributionTimeRemaining" // Distribution time remaining (WVUnsignedInt)
|
||||
#define kAssetInfoKey_PurchaseTimeRemaining "AssetInfoKey_PurchaseTimeRemaining" // Purchase time reaminng (WVUnsignedInt)
|
||||
#define kAssetInfoKey_LicenseTimeRemaining "AssetInfoKey_LicenseTimeRemaining" // License time remaining (WVUnsignedInt)
|
||||
#define kAssetInfoKey_LicenseExpiryTimeRemaining "AssetInfoKey_LicenseExpiryTimeRemaining" // Overall time remaining before license expires (WVUnsignedInt)
|
||||
#define kAssetInfoKey_TimeSinceFirstPlayback "AssetInfoKey_TimeSinceFirstPlayback" // Time since first playback (WVUnsignedInt)
|
||||
#define kAssetInfoKey_CAError "AssetInfoKey_CAError" // License retrieval error (WVUnsignedInt)
|
||||
#define kAssetInfoKey_MaxBitrate "AssetInfoKey_MaxBitrate" // Max bitrate (WVUnsignedInt)
|
||||
#define kAssetInfoKey_MinBitrate "AssetInfoKey_MinBitrate" // Min bitrate (WVUnsignedInt)
|
||||
|
||||
// Keys for error information containing dictionaries
|
||||
#define kErrorKey_WVStatus "ErrorKey_WVStatus" // WVStatus code (WVUnsignedInt)
|
||||
#define kErrorKey_AdditionalInfo "ErrorKey_AdditionalInfo" // Error additional information (WVString)
|
||||
|
||||
|
||||
// Keys for track information
|
||||
#define kTrackInfoKey_CypherVersion "TrackInfoKey_CypherVersion" // Cypher version (WVString)
|
||||
#define kTrackInfoKey_Id "TrackInfoKey_Id" // Track ID (WVUnsignedInt)
|
||||
#define kTrackInfoKey_Version "TrackInfoKey_Version" // Track version (WVUnsignedInt) INTERNAL
|
||||
#define kTrackInfoKey_BitRate "TrackInfoKey_BitRate" // Required bandwidth it bits/sec (WVUnsignedInt)
|
||||
#define kTrackInfoKey_Offset "TrackInfoKey_Offset" // Track byte offset (WVUnsignedLong) INTERNAL
|
||||
#define kTrackInfoKey_Size "TrackInfoKey_Size" // Track size (WVUnsignedLong) INTERNAL
|
||||
#define kTrackInfoKey_Duration "TrackInfoKey_Duration" // Track duration in us (WVUnsignedLong)
|
||||
#define kTrackInfoKey_AdaptationInterval "TrackInfoKey_AdaptationInterval" // Nominal adaptation interval, in seconds (WVFloat)
|
||||
#define kTrackInfoKey_TrickPlayRate "TrackInfoKey_TrickPlayRate" // Trick-play rate (WVSignedInt)
|
||||
#define kTrackInfoKey_Flags "TrackInfoKey_Flags" // Track flags (WVUnsignedInt)
|
||||
#define kTrackInfoKey_Source "TrackInfoKey_Source" // Source for media (WVString)
|
||||
#define kTrackInfoKey_TimingOffset "TrackInfoKey_TimingOffset" // Track timing adjustment in seconds (WVFloat)
|
||||
|
||||
// Video track information
|
||||
#define kTrackInfoKey_VideoFormat "TrackInfoKey_VideoFormat" // Type of video, valid values below (WVUnsignedInt)
|
||||
#define kTrackInfoKey_VideoProfile "TrackInfoKey_VideoProfile" // Video profile indicator (WVUnsignedInt)
|
||||
#define kTrackInfoKey_VideoLevel "TrackInfoKey_VideoLevel" // Video leve indicator (WVUnsignedInt)
|
||||
#define kTrackInfoKey_VideoWidth "TrackInfoKey_VideoWidth" // Video width, in pixels (WVUnsignedInt)
|
||||
#define kTrackInfoKey_VideoHeight "TrackInfoKey_VideoHeight" // Video height, in lines (WVUnsignedInt)
|
||||
#define kTrackInfoKey_VideoPixelWidth "TrackInfoKey_VideoPixelWidth" // Video pixel aspect ratio width (WVUnsignedInt)
|
||||
#define kTrackInfoKey_VideoPixelHeight "TrackInfoKey_VideoPixelHeight" // Video pixel aspect ratio height (WVUnsignedInt)
|
||||
#define kTrackInfoKey_VideoFrameRate "TrackInfoKey_VideoFrameRate" // Video frame rate (WVFloat)
|
||||
#define kTrackInfoKey_VideoBitRate "TrackInfoKey_VideoBitRate" // Video bit rate, bits/sec (WVUnsignedInt)
|
||||
#define kTrackInfoKey_VideoMpegStreamType "TrackInfoKey_VideoMpegStreamType" // Video MPEG ES stream type (WVUnsignedInt)
|
||||
#define kTrackInfoKey_VideoMpegStreamId "TrackInfoKey_VideoMpegStreamId" // Video MPEG PES stream ID (WVUnsignedInt)
|
||||
#define kTrackInfoKey_VideoMpegStreamPid "TrackInfoKey_VideoMpegStreamPid" // Video MPEG2-TS PID (WVUnsignedInt)
|
||||
#define kTrackInfoKey_AVCDecoderConfigurationRecord "TrackInfoKey_AVCDecoderConfigurationRecord" // h.264 AVCDecoderConfigurationRecord (WVDataBlob)
|
||||
|
||||
// Audio track information
|
||||
#define kTrackInfoKey_AudioFormat "TrackInfoKey_AudioFormat" // Type of audio, valid values below (WVUnsignedInt)
|
||||
#define kTrackInfoKey_AudioProfile "TrackInfoKey_AudioProfile" // Audio profile indicator (WVUnsignedInt)
|
||||
#define kTrackInfoKey_AudioNumChannels "TrackInfoKey_AudioNumChannels" // Number of audio channels (WVUnsignedInt)
|
||||
#define kTrackInfoKey_AudioSampleFrequency "TrackInfoKey_AudioSampleFrequency" // Audio sampling frequency, in hertz (WVUnsignedInt)
|
||||
#define kTrackInfoKey_AudioSampleSize "TrackInfoKey_AudioSampleSize" // Audio sample size, in bits (WVUnsignedInt)
|
||||
#define kTrackInfoKey_AudioBitRate "TrackInfoKey_AudioBitRate" // Audio bit rate (WVUnsignedInt)
|
||||
#define kTrackInfoKey_AudioMpegStreamType "TrackInfoKey_AudioMpegStreamType" // Audio MPEG ES stream type (WVUnsignedInt)
|
||||
#define kTrackInfoKey_AudioMpegStreamId "TrackInfoKey_AudioMpegStreamId" // Audio MPEG PES stream ID (WVUnsignedInt)
|
||||
#define kTrackInfoKey_AudioMpegStreamPid "TrackInfoKey_AudioMpegStreamPid" // Audio MPEG2-TS PID (WVUnsignedInt)
|
||||
#define kTrackInfoKey_AudioEsDescriptor "TrackInfoKey_AudioEsDescriptor" // Audio ES_Descriptor (WVDataBlob)
|
||||
#define kTrackInfoKey_AudioEC3SpecificData "TrackInfoKey_AudioEC3SpecificData" // E-AC3 audio contents of dec3 box (WVDataBlob)
|
||||
#define kTrackInfoKey_AudioIdentifier "TrackInfoKey_AudioIdentifier" // Audio track indentifier/language code (WVString)
|
||||
|
||||
// Subtitle track information
|
||||
#define kTrackInfoKey_SubtitleFormat "TrackInfoKey_SubtitleFormat" // Type of subtitle, valid values below (WVUnsignedInt)
|
||||
#define kTrackInfoKey_SubtitleIdentifier "TrackInfoKey_SubtitleIdentifier" // Subtitle track identifier/language code (WVString)
|
||||
|
||||
// Keys for chapter information
|
||||
#define kChapterInfoKey_SeqNum "ChapterInfoKey_SeqNum" // Chapter sequence number (WVUnsignedInt, 0 start)
|
||||
#define kChapterInfoKey_ChapterTimeIndex "ChapterInfoKey_StartTimeIndex" // Chapter start time index (WVUnsignedInt, milliseconds)
|
||||
#define kChapterInfoKey_Title "ChapterInfoKey_Title" // Chapter title (WVString)
|
||||
#define kChapterInfoKey_Thumbnail "ChapterInfoKey_Thumbnail" // Chapter thumbnail image (WVDataBlob, JPEG)
|
||||
|
||||
// Keys for copy control information
|
||||
#define kCopyControlInfoKey "CopyControlInfoKey" // CCI Information (WVUnsignedInt)
|
||||
#define kCopyControlInfoKey_EMI "CopyControlInfoKey_EMI" // EMI restrictions (WVUnsignedInt, below)
|
||||
#define kCopyControlInfoKey_APS "CopyControlInfoKey_APS" // APS restrictions (WVUnsignedInt, below)
|
||||
#define kCopyControlInfoKey_CIT "CopyControlInfoKey_CIT" // Constrain Image Trigger enabled (WVBoolean)
|
||||
#define kCopyControlInfoKey_HDCP "CopyControlInfoKey_HDCP" // HDCP enabled (WVBoolean)
|
||||
#define kCopyControlInfoKey_Heartbeats "CopyControlInfoKey_Heartbeats" // Heartbeats enabled (WVBoolean)
|
||||
|
||||
// Keys for DCP flags (please use enums and inlines in WVEmm.h to extract fields)
|
||||
#define kDCPKey_DCPFlags "DCPKey_DCPFlags" // DCP Flags (WVUnsignedInt)
|
||||
|
||||
// Key to indicate whether to check if the license needs to be refreshed
|
||||
#define kLicenseKey_CheckLicenseRefresh "LicenseKey_CheckLicenseRefresh" // License refresh flag (WVBoolean)
|
||||
|
||||
// Keys for stats query
|
||||
#define kStatsKey_VideoStreamingBufferSize "StatsKey_VideoStreamingBufferSize" // Size of adaptive video streaming buffer (WVUnsignedInt)
|
||||
#define kStatsKey_VideoStreamingBufferUsed "StatsKey_VideoStreamingBufferUsed" // Number of bytes in video streaming buffer (WVUnsignedInt)
|
||||
#define kStatsKey_VideoTimeBuffered "StatsKey_VideoTimeBuffered" // Duration of currently buffered video, in seconds (WVFloat)
|
||||
#define kStatsKey_AudioStreamingBufferSize "StatsKey_AudioStreamingBufferSize" // Size of separate audio streaming buffer (WVUnsignedInt)
|
||||
#define kStatsKey_AudioStreamingBufferUsed "StatsKey_AudioStreamingBufferUsed" // Number of bytes in separate audio streaming buffer (WVUnsignedInt)
|
||||
#define kStatsKey_AudioTimeBuffered "StatsKey_AudioTimeBuffered" // Duration of currently buffered separate audio, in seconds (WVFloat)
|
||||
#define kStatsKey_MeasuredBandwidth "StatsKey_MeasuredBandwidth" // Last measured bandwidth, in bits/sec (WVUnsignedInt)
|
||||
#define kStatsKey_VideoBitRate "StatsKey_VideoBitRate" // Current video bit rate in bits/sec (WVUnsignedInt)
|
||||
#define kStatsKey_AudioBitRate "StatsKey_AudioBitRate" // Current audio bit rate in bits/sec (WVUnsignedInt)
|
||||
#define kStatsKey_AudioIdentifier "StatsKey_AudioIdentifier" // Identifier of current audio track (WVString)
|
||||
|
||||
|
||||
// Constant values for kCredentialsKey_PlaybackMode
|
||||
#define kPlaybackModeValue_Streaming WVUnsignedInt(1) // Streaming playback
|
||||
#define kPlaybackModeValue_Offline WVUnsignedInt(2) // Playback from local file
|
||||
#define kPlaybackMode_OfflineAndStreaming WVUnsignedInt(3) // Streaming and local file playback
|
||||
|
||||
|
||||
// Constant values for kCopyControlInfoKey_EMI
|
||||
#define kCopyControlInfoValue_EMI_NoRestricions WVUnsignedInt(0)
|
||||
#define kCopyControlInfoValue_EMI_NoFurtherCopying WVUnsignedInt(1)
|
||||
#define kCopyControlInfoValue_EMI_OneGenerationCopyingPermitted WVUnsignedInt(2)
|
||||
#define kCopyControlInfoValue_EMI_NoCopy WVUnsignedInt(3)
|
||||
|
||||
|
||||
// Constant values for kCopyControlInfoKey_APS
|
||||
#define kCopyControlInfoValue_APS_NoRestricions WVUnsignedInt(0)
|
||||
#define kCopyControlInfoValue_APS_ACGOn WVUnsignedInt(1)
|
||||
#define kCopyControlInfoValue_APS_ACGOn2 WVUnsignedInt(2)
|
||||
#define kCopyControlInfoValue_APS_ACGOn4 WVUnsignedInt(3)
|
||||
|
||||
|
||||
// Constant values for kTrackInfoKey_VideoFormat
|
||||
#define kVideoFormatValue_H264 WVUnsignedInt(1)
|
||||
|
||||
|
||||
// Constant values for kTrackInfoKey_AudioFormat
|
||||
#define kAudioFormatValue_AAC WVUnsignedInt(1)
|
||||
#define kAudioFormatValue_EAC3 WVUnsignedInt(2)
|
||||
|
||||
// Constant values for kTrackInfoKey_SubtitleFormat
|
||||
#define kSubtitleFormatValue_TTML WVUnsignedInt(1)
|
||||
|
||||
#endif // __WVDICTIONARYKEYS_H__
|
||||
@@ -1,248 +0,0 @@
|
||||
/****************************************************************************************************
|
||||
* WVStatus.h
|
||||
*
|
||||
* (c) Copyright 2011-2012 Google, Inc.
|
||||
*
|
||||
* Widevine API status (return) codes
|
||||
***************************************************************************************************/
|
||||
|
||||
#ifndef __WVSTATUS_H__
|
||||
#define __WVSTATUS_H__
|
||||
|
||||
typedef enum WVStatus {
|
||||
WV_Status_Unknown = 0, // INTERNAL
|
||||
|
||||
// CA CGI
|
||||
WV_Status_CA_OK = 1,
|
||||
WV_Status_CA_AssetNotFound = 2,
|
||||
WV_Status_CA_AssetSaveFailed = 3,
|
||||
WV_Status_CA_AssetDeleteFailed = 4,
|
||||
WV_Status_CA_AssetAlreadyExist = 5,
|
||||
WV_Status_CA_InternalError = 6,
|
||||
WV_Status_CA_OperationNotAllowed = 7,
|
||||
WV_Status_CA_AssetBlocked = 8,
|
||||
WV_Status_CA_OutsideLicenseWindow = 9,
|
||||
WV_Status_CA_OutsideRegion = 10,
|
||||
WV_Status_CA_SignatureMissing = 11,
|
||||
WV_Status_CA_SignatureNotValid = 12,
|
||||
WV_Status_CA_ProviderUnknown = 13,
|
||||
WV_Status_CA_NetworkErr = 14,
|
||||
WV_Status_CA_EntitlementMessageErr = 15,
|
||||
WV_Status_CA_EntitlementDecodeFailed = 16,
|
||||
WV_Status_CA_ClientNetworkingErr = 17,
|
||||
WV_Status_CA_RequestAborted = 18,
|
||||
WV_Status_CA_ClientKeyMissing = 19,
|
||||
WV_Status_CA_RegServerNotResponding = 20,
|
||||
WV_Status_CA_RegServerDown = 21,
|
||||
WV_Status_CA_PortalMissing = 22,
|
||||
WV_Status_CA_PortalUnknown = 23,
|
||||
WV_Status_CA_AssetIdMissing = 24,
|
||||
WV_Status_CA_OwnerMissing = 25,
|
||||
WV_Status_CA_ProviderMissing = 26,
|
||||
WV_Status_CA_NameMissing = 27,
|
||||
WV_Status_CA_InvalidCCI = 28,
|
||||
WV_Status_CA_InvalidDCP = 29,
|
||||
WV_Status_CA_InvalidLicenseWindow = 30,
|
||||
WV_Status_CA_PolicyNotFound = 31,
|
||||
WV_Status_CA_PolicyRejected = 32,
|
||||
WV_Status_CA_PolicyServerNotResponding = 33,
|
||||
WV_Status_CA_ErrorProcessingClientToken = 34,
|
||||
WV_Status_CA_InvalidRegion = 35,
|
||||
WV_Status_CA_InvalidNonce = 36,
|
||||
WV_Status_CA_InvalidHWID = 37,
|
||||
WV_Status_CA_InvalidToken = 38,
|
||||
WV_Status_CA_InvalidAssetId = 39,
|
||||
WV_Status_CA_InvalidName = 40,
|
||||
WV_Status_CA_InvalidDiversity = 41,
|
||||
WV_Status_CA_InvalidKeyId = 42,
|
||||
WV_Status_CA_ModelNotSupported = 43,
|
||||
WV_Status_CA_InvalidKeyboxSystemID = 44,
|
||||
WV_Status_CA_NoDeviceLicenseAvailable = 45,
|
||||
WV_Status_CA_UnknownCode = 46,
|
||||
WV_Status_CA_InvalidAccessCriteria = 47,
|
||||
WV_Status_CA_RegionMissing = 48,
|
||||
WV_Status_CA_KeyVerificationFailed = 49,
|
||||
WV_Status_CA_STBKeyHashFailed = 50,
|
||||
WV_Status_CA_UnableToGetSharedKey = 51,
|
||||
WV_Status_CA_WrongSystemID = 52,
|
||||
WV_Status_CA_RevokedClientVersion = 53,
|
||||
WV_Status_CA_ClientVersionTampered = 54,
|
||||
WV_Status_CA_ClientVersionMissing = 55,
|
||||
WV_Status_CA_AssetProviderAlreadyExist = 56,
|
||||
WV_Status_CA_DiversityMissing = 57,
|
||||
WV_Status_CA_TokenMissing = 58,
|
||||
WV_Status_CA_ClientModelTampered = 59,
|
||||
WV_Status_CA_AssetKeyTooLarge = 60,
|
||||
WV_Status_CA_DecryptFailed = 61,
|
||||
WV_Status_CA_TooManyAssets = 62,
|
||||
WV_Status_CA_MakeNotSupported = 63,
|
||||
WV_Status_CA_PolicyAlreadyExist = 64,
|
||||
WV_Status_CA_InvalidXML = 65,
|
||||
WV_Status_CA_ProviderViolation = 66,
|
||||
WV_Status_CA_PortalVerificationFailed = 67,
|
||||
WV_Status_CA_PortalOverrideNotAllowed = 68,
|
||||
WV_Status_CA_PortalTimeNotSynced = 69,
|
||||
WV_Status_CA_ClientSignatureMissing = 70,
|
||||
WV_Status_CA_ClientSignatureNotValid = 71,
|
||||
WV_Status_CA_AssetNameTooLarge = 72,
|
||||
WV_Status_CA_UsageUrlMissing = 73,
|
||||
WV_Status_CA_AssetIdExceedsLimit = 74,
|
||||
WV_Status_CA_AssetIdInUsedRange = 75,
|
||||
WV_Status_CA_DeviceServerNotResponding = 76,
|
||||
WV_Status_CA_MakeMissing = 77,
|
||||
WV_Status_CA_ModelMissing = 78,
|
||||
WV_Status_CA_DeviceInfoAlreadyExist = 79,
|
||||
WV_Status_CA_DeviceInfoNotFound = 80,
|
||||
WV_Status_CA_InvalidAccess = 81,
|
||||
WV_Status_CA_AccessMissing = 82,
|
||||
WV_Status_CA_InvalidDate = 83,
|
||||
WV_Status_CA_PortalNotSupported = 84,
|
||||
WV_Status_CA_PortalDeniedByDevice = 85,
|
||||
WV_Status_CA_AddDeviceNotAllowed = 86,
|
||||
WV_Status_CA_PortalNotFound = 87,
|
||||
WV_Status_CA_PortalAlreadyExist = 88,
|
||||
WV_Status_CA_PortalServerNotResponding = 89,
|
||||
WV_Status_CA_PortalFlagsMissing = 90,
|
||||
WV_Status_CA_AssetDeleted = 91,
|
||||
WV_Status_CA_AssetUpdated = 92,
|
||||
WV_Status_CA_AssetUpdateFailed = 93,
|
||||
WV_Status_CA_IPNotAllowedByPolicy = 94,
|
||||
WV_Status_CA_AckUrlMissing = 95,
|
||||
WV_Status_CA_HeartbeatUrlMissing = 96,
|
||||
WV_Status_CA_SystemIDMissing = 97,
|
||||
WV_Status_CA_PlatformMissing = 98,
|
||||
WV_Status_CA_OwnerUnknown = 99,
|
||||
WV_Status_CA_InvalidBitrate = 100,
|
||||
WV_Status_CA_InvalidSystemID = 101,
|
||||
WV_Status_CA_DeviceKeyNotFound = 102,
|
||||
WV_Status_CA_DeviceKeyServerNotResponding = 103,
|
||||
WV_Status_CA_AssetKeyNotFound = 104,
|
||||
WV_Status_CA_MediaDigestSignatureMissing = 105,
|
||||
WV_Status_CA_MediaDigestSignatureNotValid = 106,
|
||||
|
||||
// Status OK (no error)
|
||||
WV_Status_OK = 200,
|
||||
|
||||
// HTTP Result codes
|
||||
WV_Status_Bad_Request = 400,
|
||||
WV_Status_Unauthorized = 401,
|
||||
WV_Status_Not_Found = 404,
|
||||
WV_Status_Method_Not_Allowed = 405,
|
||||
WV_Status_Request_Timeout = 408,
|
||||
WV_Status_Unsupported_Media_Type = 415,
|
||||
WV_Status_Requested_Range_Not_Satisfiable = 416,
|
||||
WV_Status_Invalid_Parameter = 451,
|
||||
WV_Status_Session_Not_Found = 454,
|
||||
WV_Status_Method_Not_Valid_In_This_State = 455,
|
||||
WV_Status_Invalid_Range = 457,
|
||||
WV_Status_Unsupported_Transport = 461,
|
||||
WV_Status_Destination_Unreachable = 462,
|
||||
WV_Status_Terminate_Requested = 463,
|
||||
WV_Status_Internal_Server_Error = 500,
|
||||
WV_Status_Not_Implemented = 501,
|
||||
WV_Status_Service_Unavailable = 503,
|
||||
WV_Status_Service_Response_Error = 504,
|
||||
|
||||
// Range 512 - 768 Reserved for customers. License-revoking codes
|
||||
WV_Status_Min_TP_Error = 512,
|
||||
WV_Status_Max_TP_Error = 768,
|
||||
|
||||
// Range 769 - 999 Reserved for customers. Non-license revoking codes
|
||||
WV_Status_Min_TP_NoRevoke_Error = 769,
|
||||
WV_Status_Max_TP_NoRevoke_Error = 999,
|
||||
|
||||
// WidevineMediaKit
|
||||
WV_Status_End_Of_Media = 1000,
|
||||
WV_Status_Invalid_Data_Format = 1001,
|
||||
WV_Status_Invalid_Data_Version = 1002,
|
||||
WV_Status_Parse_Error = 1003,
|
||||
WV_Status_Tamper_Detected = 1004,
|
||||
WV_Status_Truncated_Media = 1005,
|
||||
WV_Status_WVMK_Internal_Error = 1006,
|
||||
WV_Status_Entitlement_Error = 1007,
|
||||
WV_Status_Key_Error = 1008,
|
||||
WV_Status_Value_Out_Of_Range = 1009,
|
||||
WV_Status_System_Error = 1010,
|
||||
WV_Status_Invalid_Response = 1011,
|
||||
WV_Status_Unsupported_Transport_Type = 1012,
|
||||
WV_Status_FileSystem_Error = 1013,
|
||||
WV_Status_User_Cancel = 1014,
|
||||
WV_Status_InvalidState = 1015,
|
||||
WV_Status_InvalidPiggybackFile = 1016,
|
||||
WV_Status_Configuration_Error = 1017,
|
||||
WV_Status_Error_NoAdaptiveTracks = 1018,
|
||||
WV_Status_Invalid_Credentials = 1019,
|
||||
WV_Status_InitializationFailed = 1020,
|
||||
WV_Status_AlreadyInitialized = 1021,
|
||||
WV_Status_NotInitialized = 1022,
|
||||
WV_Status_NoLicenseManagerInstance = 1023,
|
||||
WV_Status_Invalid_Track = 1024,
|
||||
WV_Status_Invalid_Timestamp = 1025,
|
||||
WV_Status_Cannot_TrickPlay = 1026,
|
||||
WV_Status_NotYetSupported = 1027,
|
||||
WV_Status_Invalid_Key = 1028,
|
||||
WV_Status_Invalid_Manifest = 1029,
|
||||
WV_Status_Key_Mismatch = 1030,
|
||||
|
||||
WV_Status_Warning_Download_Stalled = 2000,
|
||||
WV_Status_Warning_Need_Key = 2001,
|
||||
WV_Status_Warning_Not_Available = 2002,
|
||||
WV_Status_Checking_Bandwidth = 2003,
|
||||
WV_Status_Error_Download_Stalled = 2004,
|
||||
WV_Status_Error_Need_Key = 2005,
|
||||
WV_Status_Error_Out_Of_Memory = 2006,
|
||||
WV_Status_Uninitialized = 2007,
|
||||
WV_Status_Internal_Error = 2008,
|
||||
WV_Status_Error_Invalid_Chapter = 2009,
|
||||
WV_Status_Heartbeat_Configuration_Error = 2010,
|
||||
WV_Status_Invalid_Keybox = 2011,
|
||||
WV_Status_Warning_CantVerifyIntegrity = 2012,
|
||||
WV_Status_Warning_ContinuityCounterError = 2014,
|
||||
WV_Status_Warning_Emm_Expired = 2015,
|
||||
|
||||
// PDL
|
||||
WV_Status_PDL_Invalid_State = 3000,
|
||||
WV_Status_PDL_Invalid_Path = 3001,
|
||||
WV_Status_PDL_Already_Exists = 3002,
|
||||
WV_Status_PDL_Invalid_Track = 3003,
|
||||
WV_Status_PDL_DownloadIncomplete = 3004,
|
||||
WV_Status_PDL_AlreadyFinalized = 3005,
|
||||
|
||||
// License Manager
|
||||
WV_Status_LicMgr_OutOfMemory = 4001,
|
||||
WV_Status_LicMgr_LicenseAbsent = 4002,
|
||||
WV_Status_LicMgr_LicenseExpired = 4003,
|
||||
WV_Status_LicMgr_LicenseCorrupted = 4004,
|
||||
WV_Status_LicMgr_LicenseOptionalFieldsMissing = 4005,
|
||||
WV_Status_LicMgr_OutsideLicenseWindow = 4006,
|
||||
WV_Status_LicMgr_OutsidePurchaseWindow = 4007,
|
||||
WV_Status_LicMgr_OutsideDistributionWindow = 4008,
|
||||
WV_Status_LicMgr_DataStoreCorrupted = 4009,
|
||||
WV_Status_LicMgr_DataStoreReadFailed = 4010,
|
||||
WV_Status_LicMgr_DataStoreWriteFailed = 4011,
|
||||
WV_Status_LicMgr_DataStoreFileDoesNotExist = 4012,
|
||||
WV_Status_LicMgr_ClockTamperDetected = 4013,
|
||||
WV_Status_LicMgr_EMMError = 4014,
|
||||
WV_Status_LicMgr_NoEMMsPresent = 4015,
|
||||
WV_Status_LicMgr_CACGIError = 4016,
|
||||
WV_Status_LicMgr_AssetNotRegistered = 4017,
|
||||
WV_Status_LicMgr_LicenseRevoked = 4018,
|
||||
WV_Status_LicMgr_CACGIStatusError = 4019,
|
||||
WV_Status_LicMgr_ObserversNotFound = 4020,
|
||||
WV_Status_LicMgr_PendingServerNotification = 4021,
|
||||
WV_Status_LicMgr_DuplicateAsset = 4022,
|
||||
WV_Status_LicMgr_PlaybackModeNotAllowed = 4023,
|
||||
WV_Status_LicMgr_LicenseRefreshRequired = 4023,
|
||||
|
||||
// Asset Registry API
|
||||
WV_Status_AR_AssetAlreadyRegistered = 4100,
|
||||
|
||||
// Media Transformer API
|
||||
WV_Status_Transformer_InvalidSession = 4200,
|
||||
WV_Status_Transformer_UnsupportedConfiguration = 4201
|
||||
|
||||
} WVStatus;
|
||||
|
||||
|
||||
|
||||
#endif // __WVSTATUS_H__
|
||||
@@ -1,17 +1,14 @@
|
||||
//
|
||||
// Declarations for Widevine Adaptive Streaming API
|
||||
//
|
||||
// Copyright 2011 Widevine Technologies, Inc., All Rights Reserved
|
||||
//
|
||||
/*
|
||||
* Copyright 2011 Widevine Technologies, Inc., All Rights Reserved
|
||||
*
|
||||
* Declarations for Widevine Adaptive Streaming API
|
||||
*/
|
||||
|
||||
#ifndef __WV_STREAM_CONTROL_API_H__
|
||||
#define __WV_STREAM_CONTROL_API_H__
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "WVStatus.h"
|
||||
#include "WVTypes.h"
|
||||
#include "WVControlSettings.h"
|
||||
|
||||
#if OS_WIN
|
||||
#ifdef CLIENTAPI_EXPORTS
|
||||
@@ -30,12 +27,69 @@ typedef enum WVLogging {
|
||||
WV_Logging_ParseOutput = 2,
|
||||
} WVLogging;
|
||||
|
||||
typedef enum WVStatus {
|
||||
WV_Status_OK = 200,
|
||||
WV_Status_Bad_Request = 400,
|
||||
WV_Status_Unauthorized = 401,
|
||||
WV_Status_Not_Found = 404,
|
||||
WV_Status_Method_Not_Allowed = 405,
|
||||
WV_Status_Request_Timeout = 408,
|
||||
WV_Status_Unsupported_Media_Type = 415,
|
||||
WV_Status_Requested_Range_Not_Satisfiable = 416,
|
||||
WV_Status_Invalid_Parameter = 451,
|
||||
WV_Status_Session_Not_Found = 454,
|
||||
WV_Status_Method_Not_Valid_In_This_State = 455,
|
||||
WV_Status_Invalid_Range = 457,
|
||||
WV_Status_Unsupported_Transport = 461,
|
||||
WV_Status_Destination_Unreachable = 462,
|
||||
WV_Status_Terminate_Requested = 463,
|
||||
WV_Status_Internal_Server_Error = 500,
|
||||
WV_Status_Not_Implemented = 501,
|
||||
WV_Status_Service_Unavailable = 503,
|
||||
WV_Status_Service_Response_Error = 504,
|
||||
WV_Status_Min_TP_Error = 512, // Error codes 512-768 are reserved for
|
||||
WV_Status_Max_TP_Error = 768, // Third Party apps (Cinema Now)
|
||||
WV_Status_End_Of_Media = 1000,
|
||||
WV_Status_Invalid_Data_Format = 1001,
|
||||
WV_Status_Invalid_Data_Version = 1002,
|
||||
WV_Status_Parse_Error = 1003,
|
||||
WV_Status_Tamper_Detected = 1004,
|
||||
WV_Status_Truncated_Media = 1005,
|
||||
WV_Status_WVMK_Internal_Error = 1006,
|
||||
WV_Status_Entitlement_Error = 1007,
|
||||
WV_Status_Key_Error = 1008,
|
||||
WV_Status_Value_Out_Of_Range = 1009,
|
||||
WV_Status_System_Error = 1010,
|
||||
WV_Status_Invalid_Response = 1011,
|
||||
WV_Status_Unsupported_Transport_Type = 1012,
|
||||
WV_Status_FileSystem_Error = 1013,
|
||||
WV_Status_User_Cancel = 1014,
|
||||
WV_Status_InvalidState = 1015,
|
||||
WV_Status_InvalidPiggybackFile = 1016,
|
||||
WV_Status_Configuration_Error= 1017,
|
||||
WV_Status_Warning_Download_Stalled = 2000,
|
||||
WV_Status_Warning_Need_Key = 2001,
|
||||
WV_Status_Warning_Not_Available = 2002,
|
||||
WV_Status_Checking_Bandwidth = 2003,
|
||||
WV_Status_Error_Download_Stalled = 2004,
|
||||
WV_Status_Error_Need_Key = 2005,
|
||||
WV_Status_Error_Out_Of_Memory = 2006,
|
||||
WV_Status_Uninitialized = 2007,
|
||||
WV_Status_Internal_Error = 2008,
|
||||
WV_Status_Error_Invalid_Chapter = 2009,
|
||||
WV_Status_Heartbeat_Configuration_Error = 2010,
|
||||
WV_Status_Invalid_Keybox = 2011,
|
||||
WV_Status_Error_NoAdaptiveTracks = 2012,
|
||||
WV_Status_Warning_ContinuityErrorCounter = 2014,
|
||||
} WVStatus;
|
||||
|
||||
|
||||
typedef enum WVOutputFormat {
|
||||
WV_OutputFormat_PS = 0, // Generic program stream
|
||||
WV_OutputFormat_DVD_Video = 1, // DVD-Video program stream
|
||||
WV_OutputFormat_TS = 2, // Transport Stream
|
||||
WV_OutputFormat_ES = 3, // Elementary Streams
|
||||
WV_OutputFormat_DVD_Video_No_EAC3_Framing = 4 // DVD-Video without Dolby Digital+ audio framing
|
||||
WV_OutputFormat_ES_TS = 4 // ES for PS streams, otherwise TS
|
||||
} WVOutputFormat;
|
||||
|
||||
|
||||
@@ -46,63 +100,50 @@ typedef enum WVEsSelector {
|
||||
} WVEsSelector;
|
||||
|
||||
|
||||
#define UNSPECIFIED_TRACK_ID WVUnsignedInt(0)
|
||||
struct WVCredentials {
|
||||
std::string deviceID; // unique player device ID from CinemaNow
|
||||
std::string streamID; // unique streamID from CinemaNow
|
||||
std::string clientIP; // IP address of client
|
||||
std::string drmServerURL; // URL for DRM server
|
||||
std::string userData; // Additional optional user data, TBD
|
||||
std::string portal; // Identifies the operator
|
||||
std::string storefront; // Identifies store run by operator
|
||||
std::string drmAckServerURL; // URL for server that receives
|
||||
// entitlement confirmations
|
||||
std::string heartbeatURL; // URL to receive client heartbeats
|
||||
unsigned int heartbeatPeriod;// Duration between consecutive heartbeats in
|
||||
// seconds. 0 indicates no heatbeats requested
|
||||
unsigned int cnDeviceType; // device type identifier defined by CinemaNow
|
||||
};
|
||||
|
||||
struct WVProxySettings {
|
||||
bool enable; // If true, proxy use is enable, otherwise disabled
|
||||
std::string ipAddr; // IP address of proxy server, e.g. "1.2.3.4" or host name
|
||||
unsigned short ipPort; // IP port number
|
||||
std::string userId; // User ID if authentication is needed, otherwise "" to disable authentication
|
||||
std::string password; // Password if userID is not ""
|
||||
};
|
||||
|
||||
|
||||
class WVSession;
|
||||
|
||||
//
|
||||
// Callbacks used for RTSP direct function call implementation and/or
|
||||
// direct function call push data model.
|
||||
// Also buffer allocation routines for using an external allocator
|
||||
//
|
||||
|
||||
#if defined(GOOGLETVLGL9_ES_TVP)
|
||||
typedef void (*WVDecryptCallback)(WVEsSelector esType, void* input, void* output, size_t length, int key, bool startCU, bool lastBuffer, unsigned long long dts, unsigned long long pts, bool au_start);
|
||||
#else
|
||||
typedef void (*WVDecryptCallback)(WVEsSelector esType, void* input, void* output, size_t length, int key, void *context);
|
||||
#endif
|
||||
|
||||
// Provide info on socket open/close operations for bandwidth attribution
|
||||
// status: {0=open, 1=close}
|
||||
typedef void (*WVSocketInfoCallback)(int fd, int status, void * context);
|
||||
|
||||
//
|
||||
// CALLBACK: WVDecryptCallback
|
||||
//
|
||||
// Gets called to decrypt individual crypto units
|
||||
//
|
||||
// Parameters:
|
||||
// [in] es_type - Type of elementary stream, indicating audio or video
|
||||
// [in] input - Pointer to encrypted crypto unit
|
||||
// [in] output - Pointer or handle to receive decrypted crypto unit
|
||||
// [in] length - Length of crypto unit
|
||||
// [in] key - ID of key to use for decryption
|
||||
// [in] dts - Decode timestamp, 90 KHz clock
|
||||
// [in] pts - Presentation timestamp, 90 KHz clock
|
||||
// [in] au_end - Indicates end of Access Unit (last CU in frame)
|
||||
// [in] context - Client context established from WV_Setup
|
||||
//
|
||||
// Returns:
|
||||
// - WV_Status_OK: Decryption succeeded
|
||||
// - WV_Status_Warning_Need_Key: Indicates key not yet available, will
|
||||
// be retried
|
||||
// - Error code indicating problem. Causes playback to halt.
|
||||
//
|
||||
typedef WVStatus (*WVDecryptCallback)(WVEsSelector es_type, void* input, void* output, size_t length,
|
||||
int key, unsigned long long dts, unsigned long long pts,
|
||||
bool au_end, void *context);
|
||||
|
||||
enum WVDecryptCallbackMode {
|
||||
WVDecryptCallbackMode_MultiCU = 0, // WVDecryptCallback called repeatedly until buffer exhausted
|
||||
WVDecryptCallbackMode_SingleCU = 1, // WVDecryptCallback called once
|
||||
WVDecryptCallbackMode_WholeAU = 2, // WVDecryptCallback called repeatedly until AU complete
|
||||
};
|
||||
|
||||
|
||||
class WVCallbacks {
|
||||
public:
|
||||
WVCallbacks() :
|
||||
pushData(NULL),
|
||||
response(NULL),
|
||||
allocBuffer(NULL),
|
||||
freeBuffer(NULL),
|
||||
getDeviceID(NULL),
|
||||
getKeyboxPath(NULL),
|
||||
decrypt(NULL),
|
||||
decryptMode(WVDecryptCallbackMode_MultiCU),
|
||||
socketInfo(NULL)
|
||||
{}
|
||||
typedef void (*WVSocketInfoCallback)(int fd, int status, void *context);
|
||||
|
||||
struct WVCallbacks {
|
||||
void (*pushData)(unsigned short port, void *buffer, size_t length);
|
||||
void (*response)(WVSession *session, const std::string &response);
|
||||
void *(*allocBuffer)(size_t);
|
||||
@@ -112,15 +153,12 @@ class WVCallbacks {
|
||||
int (*getDeviceID)(char *buffer, size_t size);
|
||||
|
||||
int (*getKeyboxPath)(char* path, size_t size);
|
||||
|
||||
WVDecryptCallback decrypt;
|
||||
WVDecryptCallbackMode decryptMode;
|
||||
|
||||
// publish info about descriptors used for streaming for accounting purposes
|
||||
WVSocketInfoCallback socketInfo;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// METHOD: WV_Initialize
|
||||
//
|
||||
@@ -400,16 +438,16 @@ WV_CheckBandwidth(const std::string &url, unsigned long *bandwidth, const WVProx
|
||||
//This form is deprecated and may be removed in a future release
|
||||
CLIENT_API WVStatus
|
||||
WV_Setup(WVSession *&session, const std::string &url,
|
||||
const std::string &transport, WVCredentials &credentials,
|
||||
WVOutputFormat outputFormat = WV_OutputFormat_PS,
|
||||
unsigned long bufferSize = 10 * 1024 * 1024, void *context = NULL);
|
||||
const std::string &transport, WVCredentials &credentials,
|
||||
WVOutputFormat outputFormat = WV_OutputFormat_PS,
|
||||
unsigned long bufferSize = 10 * 1024 * 1024, void *context = NULL);
|
||||
|
||||
// Setup using a proxy
|
||||
CLIENT_API WVStatus
|
||||
WV_Setup(WVSession *&session, const std::string &url,
|
||||
const std::string &transport, WVCredentials &credentials,
|
||||
WVProxySettings &proxy, WVOutputFormat outputFormat = WV_OutputFormat_PS,
|
||||
unsigned long bufferSize = 10 * 1024 * 1024, void *context = NULL);
|
||||
const std::string &transport, WVCredentials &credentials,
|
||||
WVProxySettings &proxy, WVOutputFormat outputFormat = WV_OutputFormat_PS,
|
||||
unsigned long bufferSize = 10 * 1024 * 1024, void *context = NULL);
|
||||
|
||||
//
|
||||
// An alternate form of WV_Setup that receives data from a file source instead of accessing
|
||||
@@ -429,7 +467,7 @@ public:
|
||||
|
||||
CLIENT_API WVStatus
|
||||
WV_Setup(WVSession *&session, WVFileSource *source, const std::string &transport,
|
||||
WVCredentials &credentials, WVOutputFormat outputFormat = WV_OutputFormat_PS,
|
||||
WVCredentials &credentials, WVOutputFormat outputFormat = WV_OutputFormat_PS,
|
||||
unsigned long bufferSize = 10 * 1024 * 1024, void *context = NULL);
|
||||
|
||||
//
|
||||
@@ -545,20 +583,12 @@ WV_Teardown(WVSession *&session);
|
||||
// version. This is needed since neither absolute time nor zero time
|
||||
// are appropriate for this case.
|
||||
//
|
||||
// [in] audioTrack - The ID of the audio track to be used. This value can be
|
||||
// from the audio track dictionaries obtained via WV_Info_GetAudioTracks.
|
||||
// This value is optional. If UNSPECIFIED_TRACK_ID is used, the default
|
||||
// audio track, which is the first encoded into the media package, or
|
||||
// the last selected audio track is used.
|
||||
//
|
||||
//
|
||||
// Returns:
|
||||
// WV_Status_OK on success, otherwise one of the WVStatus values
|
||||
// indicating the specific error.
|
||||
//
|
||||
CLIENT_API WVStatus
|
||||
WV_Play(WVSession *session, float scale_requested, float *scale_used,
|
||||
const std::string &range, WVUnsignedInt audioTrack = UNSPECIFIED_TRACK_ID);
|
||||
WV_Play(WVSession *session, float scale_requested, float *scale_used, const std::string &range);
|
||||
|
||||
//
|
||||
// METHOD: WV_Pause
|
||||
@@ -690,6 +720,7 @@ WV_GetData(WVSession *session, unsigned char *buffer, size_t request_size,
|
||||
// This method is used when the client chooses to receive elementary stream data directly via
|
||||
// function call using a pull data model. This method always returns data corresponding to
|
||||
// at most one single access unit.
|
||||
|
||||
//
|
||||
// Parameters:
|
||||
// [in] session - The session from which data is requested
|
||||
@@ -703,6 +734,8 @@ WV_GetData(WVSession *session, unsigned char *buffer, size_t request_size,
|
||||
//
|
||||
// [out] return_size - On return, set to the number of bytes written into the buffer
|
||||
//
|
||||
// [out] au_start - On return, indicates whether the data belongs to the next access unit.
|
||||
//
|
||||
// [out] dts - On return, set to MPEG-2 access unit decoding timestamp (DTS)
|
||||
//
|
||||
// [out] pts - On return, set to MPEG-2 access unit presentation timestamp (PTS)
|
||||
@@ -710,8 +743,6 @@ WV_GetData(WVSession *session, unsigned char *buffer, size_t request_size,
|
||||
// [out] sync_frame - On return, indicates whether the data belongs to a sync frame
|
||||
// (video key frame, or audio frame).
|
||||
//
|
||||
// [out] au_end - On return, indicates whether the data belongs to the end of the access unit.
|
||||
//
|
||||
// Returns:
|
||||
// WV_Status_OK on success, otherwise one of the WVStatus values
|
||||
// indicating the specific error.
|
||||
@@ -719,33 +750,7 @@ WV_GetData(WVSession *session, unsigned char *buffer, size_t request_size,
|
||||
CLIENT_API WVStatus
|
||||
WV_GetEsData(WVSession *session, WVEsSelector es_selector,
|
||||
unsigned char *buffer, size_t request_size, size_t& return_size,
|
||||
unsigned long long& dts, unsigned long long& pts, bool& sync_frame, bool& au_end);
|
||||
|
||||
|
||||
//
|
||||
// METHOD: WV_GetNextEsDataBufferSize
|
||||
//
|
||||
// This method returns the optimal size of the buffer size that should be used in the next
|
||||
// call to WV_GetEsData. Calculation is dependent on whether a decryption callback is used
|
||||
// and if so, the decrypt callback mode (WVDecryptCallbackMode), returning the total size of
|
||||
// remaining crypto units in the current access unit (no decrypt callback or
|
||||
// WVDecryptCallbackMode_MultiCU specified), the size of the next crypto unit
|
||||
// (decrypt callback and WVDecryptCallbackMode_SingleCU specified), or the size of the next
|
||||
// access unit (decrypt callback and WVDecryptCallbackMode_WholeAU specified)
|
||||
//
|
||||
// Parameters:
|
||||
// [in] session - The session from which data is requested
|
||||
//
|
||||
// [in] es_selector - Selector specifying the elementary stream targetted.
|
||||
//
|
||||
// [out] buffer_size - The size of the buffer
|
||||
//
|
||||
// Returns:
|
||||
// WV_Status_OK on success, otherwise one of the WVStatus values
|
||||
// indicating the specific error.
|
||||
//
|
||||
CLIENT_API WVStatus
|
||||
WV_GetNextEsDataBufferSize(WVSession* session, WVEsSelector es_selector, size_t &buffer_size);
|
||||
bool& au_start, unsigned long long& dts, unsigned long long& pts, bool& sync_frame);
|
||||
|
||||
|
||||
//
|
||||
@@ -1067,28 +1072,6 @@ CLIENT_API WVStatus
|
||||
WV_Info_TimeBuffered(WVSession *session, float *secondsBuffered);
|
||||
|
||||
|
||||
//
|
||||
// METHOD: WV_Info_GetStats
|
||||
//
|
||||
// This method is used to query current stats from the Widevine
|
||||
// adaptive client.
|
||||
//
|
||||
// Parameters:
|
||||
// [in] session - The session to query
|
||||
//
|
||||
// [in,out] stats - Dictionary containing placeholders for the
|
||||
// stats to be queried. On return the available
|
||||
// stats will be filled in.
|
||||
//
|
||||
// Returns:
|
||||
// WV_Status_OK on success, otherwise one of the WVStatus values
|
||||
// indicating the specific error.
|
||||
//
|
||||
|
||||
CLIENT_API WVStatus
|
||||
WV_Info_GetStats(WVSession *session, WVDictionary& stats);
|
||||
|
||||
|
||||
//
|
||||
// METHOD: WV_Info_GetAdaptiveBitrates
|
||||
//
|
||||
@@ -1319,7 +1302,7 @@ WV_SkipChapters(WVSession *session, std::string currentTime, long chapters);
|
||||
|
||||
|
||||
//
|
||||
// METHOD: WV_GoToChapter
|
||||
// METHOD: WV_SkipToChapter
|
||||
//
|
||||
// This method causes the stream to skip to a specified chapter.
|
||||
//
|
||||
@@ -1337,143 +1320,4 @@ WV_SkipChapters(WVSession *session, std::string currentTime, long chapters);
|
||||
CLIENT_API WVStatus
|
||||
WV_GoToChapter(WVSession *session, unsigned long chapterSeqNum);
|
||||
|
||||
|
||||
//
|
||||
// METHOD: WV_Info_GetVideoTracks
|
||||
//
|
||||
// This method populates a WVTypedValueArray containing a WVDictionary entry
|
||||
// for each adaptive video track in the media. These dicionaries contain all
|
||||
// the information available for the video, as well as the track ID.
|
||||
//
|
||||
// Parameters:
|
||||
// [in] session - The session to control
|
||||
//
|
||||
// [out] tracks - WVTypedValueArray which on return will contain an array
|
||||
// of video track info WVDictionary(s).
|
||||
////
|
||||
// Returns:
|
||||
// WV_Status_OK on success, otherwise one of the WVStatus values
|
||||
// indicating the specific error.
|
||||
//
|
||||
|
||||
CLIENT_API WVStatus
|
||||
WV_Info_GetVideoTracks(WVSession *session, WVTypedValueArray& tracks);
|
||||
|
||||
|
||||
//
|
||||
// METHOD: WV_Info_GetAudioTracks
|
||||
//
|
||||
// This method populates a WVTypedValueArray containing a WVDictionary entry
|
||||
// for each separate audio track in the media. These dicionaries contain all
|
||||
// the information available for the audio, as well as the track ID.
|
||||
//
|
||||
// Parameters:
|
||||
// [in] session - The session to control
|
||||
//
|
||||
// [out] tracks - WVTypedValueArray which on return will contain an array
|
||||
// of audio track info WVDictionary(s).
|
||||
////
|
||||
// Returns:
|
||||
// WV_Status_OK on success, otherwise one of the WVStatus values
|
||||
// indicating the specific error.
|
||||
//
|
||||
|
||||
CLIENT_API WVStatus
|
||||
WV_Info_GetAudioTracks(WVSession *session, WVTypedValueArray& tracks);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// METHOD: WV_Info_GetSubtitleTracks
|
||||
//
|
||||
// This method populates a WVTypedValueArray containing a WVDictionary entry
|
||||
// for each separate subtitle track in the media. These dicionaries contain all
|
||||
// the information available for subtitle.
|
||||
//
|
||||
// NOTE: Subtitle tracks cannot be selected. They are meant to be rendered by
|
||||
// the device media player.
|
||||
//
|
||||
// Parameters:
|
||||
// [in] session - The session to control
|
||||
//
|
||||
// [out] tracks - WVTypedValueArray which on return will contain an array
|
||||
// of subtile track info WVDictionary(s).
|
||||
////
|
||||
// Returns:
|
||||
// WV_Status_OK on success, otherwise one of the WVStatus values
|
||||
// indicating the specific error.
|
||||
//
|
||||
|
||||
|
||||
CLIENT_API WVStatus
|
||||
WV_Info_GetSubtitleTracks(WVSession *session, WVTypedValueArray& tracks);
|
||||
|
||||
|
||||
//
|
||||
// METHOD: WV_Info_GetCurrentVideoTrack
|
||||
//
|
||||
// This method populates a WVDicionary all the information available for the
|
||||
// current adaptive video track, as well as its track ID.
|
||||
//
|
||||
// Parameters:
|
||||
// [in] session - The session to control
|
||||
//
|
||||
// [out] track - WVDictionary which on return will contain the information
|
||||
// available for the current adaptive video track
|
||||
////
|
||||
// Returns:
|
||||
// WV_Status_OK on success, otherwise one of the WVStatus values
|
||||
// indicating the specific error.
|
||||
//
|
||||
|
||||
CLIENT_API WVStatus
|
||||
WV_Info_GetCurrentVideoTrack(WVSession *session, WVDictionary& track);
|
||||
|
||||
|
||||
//
|
||||
// METHOD: WV_Info_GetCurrentAudioTrack
|
||||
//
|
||||
// This method populates a WVDicionary all the information available for the
|
||||
// current separate audio track, as well as its track ID.
|
||||
//
|
||||
// Parameters:
|
||||
// [in] session - The session to control
|
||||
//
|
||||
// [out] track - WVDictionary which on return will contain the information
|
||||
// available for the current adaptive video track
|
||||
////
|
||||
// Returns:
|
||||
// WV_Status_OK on success, otherwise one of the WVStatus values
|
||||
// indicating the specific error. This function returns the status
|
||||
// WV_Status_Warning_Not_Available if separate audio is not available.
|
||||
//
|
||||
|
||||
CLIENT_API WVStatus
|
||||
WV_Info_GetCurrentAudioTrack(WVSession *session, WVDictionary& track);
|
||||
|
||||
|
||||
//
|
||||
// METHOD: WV_SelectTrack
|
||||
//
|
||||
// This method is used to explicitly select an adaptive video track or
|
||||
// separate audio track.
|
||||
//
|
||||
// Parameters:
|
||||
// [in] session - The session to control
|
||||
//
|
||||
// [out] trackId - The track ID for the track to be selected.
|
||||
// If an adaptive video track ID is specified, then a
|
||||
// video track change will be effected. Specifying
|
||||
// UNSPECIFIED_TRACK_ID will resume normal adaptive
|
||||
// video behavior.
|
||||
// If a separate audio track ID is specified, then
|
||||
// an audio track change will be effected.
|
||||
////
|
||||
// Returns:
|
||||
// WV_Status_OK on success, otherwise one of the WVStatus values
|
||||
// indicating the specific error.
|
||||
//
|
||||
CLIENT_API WVStatus WV_SelectTrack(WVSession* session, WVUnsignedInt trackId);
|
||||
|
||||
|
||||
#endif // __WV_STREAM_CONTROL_API_H__
|
||||
|
||||
@@ -1,248 +0,0 @@
|
||||
/****************************************************************************************************
|
||||
* WVTypes.h
|
||||
*
|
||||
* (c) Copyright 2011-2012 Google, Inc.
|
||||
*
|
||||
* Widevine API types
|
||||
***************************************************************************************************/
|
||||
|
||||
#ifndef __WVTYPES_H__
|
||||
#define __WVTYPES_H__
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <stdint.h>
|
||||
|
||||
// Unsigned and signed integer types (32 bits)
|
||||
typedef uint32_t WVUnsignedInt;
|
||||
typedef int32_t WVSignedInt;
|
||||
typedef uint64_t WVUnsignedLong;
|
||||
typedef int64_t WVSignedLong;
|
||||
typedef float WVFloat;
|
||||
typedef bool WVBoolean;
|
||||
|
||||
// String type
|
||||
typedef std::string WVString;
|
||||
|
||||
// Array of strings
|
||||
typedef std::vector<WVString> WVStringArray;
|
||||
typedef std::vector<uint8_t> WVDataBlob;
|
||||
|
||||
// Forward declarations
|
||||
class WVDictionary;
|
||||
class WVTypedValueRep;
|
||||
class WVTypedValueArray;
|
||||
|
||||
|
||||
// Classs to hold a typed value to be stored in a WVTypedValueArray or a WVDictionary
|
||||
class WVTypedValue
|
||||
{
|
||||
public:
|
||||
enum Type {
|
||||
Type_Null = 0,
|
||||
Type_UnsignedInt = 1,
|
||||
Type_SignedInt = 2,
|
||||
Type_UnsignedLong = 3,
|
||||
Type_SignedLong = 4,
|
||||
Type_Float = 5,
|
||||
Type_WVBoolean = 6,
|
||||
Type_String = 7,
|
||||
Type_Array = 8,
|
||||
Type_Dictionary = 9,
|
||||
Type_DataBlob = 10
|
||||
};
|
||||
|
||||
// Constructs Type_Null value
|
||||
WVTypedValue();
|
||||
|
||||
// Copy constructor and assignment operator
|
||||
WVTypedValue(WVTypedValue const& original);
|
||||
WVTypedValue const& operator=(WVTypedValue const& rhs);
|
||||
|
||||
// Constructors for various typed values
|
||||
WVTypedValue(WVUnsignedInt value);
|
||||
WVTypedValue(WVSignedInt value);
|
||||
WVTypedValue(WVUnsignedLong value);
|
||||
WVTypedValue(WVSignedLong value);
|
||||
WVTypedValue(WVFloat value);
|
||||
WVTypedValue(WVBoolean value);
|
||||
WVTypedValue(WVString const& value);
|
||||
WVTypedValue(WVTypedValueArray const& value);
|
||||
WVTypedValue(WVDictionary const& value);
|
||||
WVTypedValue(WVDataBlob const& value);
|
||||
|
||||
~WVTypedValue();
|
||||
|
||||
// Returns the type of the value held in the object
|
||||
Type GetType() const { return(mType); }
|
||||
|
||||
// Accessors to retrieve the value. Returns false if asked for a value of the wrong type
|
||||
WVBoolean GetValue(WVUnsignedInt& value) const;
|
||||
WVBoolean GetValue(WVSignedInt& value) const;
|
||||
WVBoolean GetValue(WVUnsignedLong& value) const;
|
||||
WVBoolean GetValue(WVSignedLong& value) const;
|
||||
WVBoolean GetValue(WVFloat& value) const;
|
||||
WVBoolean GetValue(WVBoolean& value) const;
|
||||
WVBoolean GetValue(WVString const*& value) const;
|
||||
WVBoolean GetValue(WVTypedValueArray const*& value) const;
|
||||
WVBoolean GetValue(WVDictionary const*& value) const;
|
||||
WVBoolean GetValue(WVDataBlob const*& value) const;
|
||||
|
||||
// Accessors to set the value. Can be used to change both the value and the type
|
||||
void SetUnsignedIntValue(WVUnsignedInt value);
|
||||
void SetSignedIntValue(WVSignedInt value);
|
||||
void SetUnsignedLongValue(WVUnsignedLong value);
|
||||
void SetSignedLongValue(WVSignedLong value);
|
||||
void SetFloatValue(WVFloat value);
|
||||
void SetBooleanValue(WVBoolean value);
|
||||
void SetStringValue(WVString const& value);
|
||||
void SetArrayValue(WVTypedValueArray const& value);
|
||||
void SetDictionaryValue(WVDictionary const& value);
|
||||
void SetDataBlobValue(WVDataBlob const& value);
|
||||
|
||||
// Serialize into WVDataBlob
|
||||
void Serialize(WVDataBlob& intoBlob) const;
|
||||
|
||||
// Deserialize from WVDataBlob. Returns bytes used, 0 on failure
|
||||
WVUnsignedInt Deserialize(WVDataBlob const& fromBlob, WVUnsignedInt fromIndex = 0);
|
||||
|
||||
// Dump value in human-readable format to toString
|
||||
void Dump(WVString const& prefix, WVString& toString) const;
|
||||
|
||||
private:
|
||||
void Reset();
|
||||
|
||||
union Representation {
|
||||
WVUnsignedInt uUnsignedIntValue;
|
||||
WVSignedInt uSignedIntValue;
|
||||
WVUnsignedLong uUnsignedLongValue;
|
||||
WVSignedLong uSignedLongValue;
|
||||
WVFloat uFloatValue;
|
||||
WVBoolean uBooleanValue;
|
||||
WVTypedValueRep* uOtherValue;
|
||||
};
|
||||
Type mType;
|
||||
Representation mValue;
|
||||
};
|
||||
|
||||
|
||||
// Class which holds an array of WVTypedValue. Types of values stored may vary
|
||||
class WVTypedValueArray
|
||||
{
|
||||
public:
|
||||
// Returns the number of entries in the array
|
||||
WVUnsignedInt Size() const { return mArray.size(); }
|
||||
bool Empty() const { return mArray.empty(); }
|
||||
|
||||
// Disposes of all entries in the array
|
||||
void Clear() { mArray.clear(); }
|
||||
|
||||
// Returns a pointer to an element in an array. NULL if the index is out of range
|
||||
WVTypedValue const* operator[](WVUnsignedInt index) const;
|
||||
|
||||
// Iterator type and boundary methods for typed value array
|
||||
typedef std::vector<WVTypedValue>::const_iterator Iterator;
|
||||
Iterator Begin() const { return(mArray.begin()); }
|
||||
Iterator End() const { return(mArray.end()); }
|
||||
|
||||
// Adds a typed value to the end of the array
|
||||
void Push(WVTypedValue const& entry) { mArray.push_back(entry); }
|
||||
|
||||
// Accessors for typed values stored in the array. Returns false if index is out of range,
|
||||
// or if trying to retrieve a value of the incorrect type.
|
||||
WVBoolean GetValue(WVUnsignedInt index, WVUnsignedInt& value) const;
|
||||
WVBoolean GetValue(WVUnsignedInt index, WVSignedInt& value) const;
|
||||
WVBoolean GetValue(WVUnsignedInt index, WVUnsignedLong& value) const;
|
||||
WVBoolean GetValue(WVUnsignedInt index, WVSignedLong& value) const;
|
||||
WVBoolean GetValue(WVUnsignedInt index, WVFloat& value) const;
|
||||
WVBoolean GetValue(WVUnsignedInt index, WVBoolean& value) const;
|
||||
WVBoolean GetValue(WVUnsignedInt index, WVString const*& value) const;
|
||||
WVBoolean GetValue(WVUnsignedInt index, WVTypedValueArray const*& value) const;
|
||||
WVBoolean GetValue(WVUnsignedInt index, WVDictionary const*& value) const;
|
||||
WVBoolean GetValue(WVUnsignedInt index, WVDataBlob const*& value) const;
|
||||
|
||||
// Serialize into WVDataBlob
|
||||
void Serialize(WVDataBlob& intoBlob) const;
|
||||
|
||||
// Deserialize from WVDataBlob. Returns bytes used, 0 on failure
|
||||
WVUnsignedInt Deserialize(WVDataBlob const& fromBlob, WVUnsignedInt fromIndex = 0);
|
||||
|
||||
// Dump values in human-readable format to toString
|
||||
void Dump(WVString const& prefix, WVString& toString) const;
|
||||
|
||||
private:
|
||||
std::vector<WVTypedValue> mArray;
|
||||
};
|
||||
|
||||
|
||||
// Object which holds named typed value pairs. Types of values stored may vary
|
||||
class WVDictionary
|
||||
{
|
||||
public:
|
||||
// Returns the number of entries in the dictionary
|
||||
WVUnsignedInt Size() const { return mMap.size(); }
|
||||
bool Empty() const { return mMap.empty(); }
|
||||
|
||||
// Disposes of all entries in the dictionary
|
||||
void Clear() { mMap.clear(); }
|
||||
|
||||
// Iterator type and bounary methods for dictionary.
|
||||
typedef std::map<WVString, WVTypedValue>::const_iterator Iterator;
|
||||
Iterator Begin() const { return(mMap.begin()); }
|
||||
Iterator End() const { return(mMap.end()); }
|
||||
|
||||
// Store a typed value for the specified key. Replaces any previous value stored for the key
|
||||
void SetEntry(WVString const& key, WVTypedValue const& entry = WVTypedValue()) { mMap[key] = entry; }
|
||||
|
||||
// Remove the typed value for the specified key. Fails silently if value is not present
|
||||
void RemoveEntry(WVString const& key);
|
||||
|
||||
// Copy an entry from another dictionary
|
||||
void CopyEntryFrom(WVString const& key, WVDictionary const& fromDict, bool removeIfNotFound = false);
|
||||
|
||||
// Merge two dictionaries
|
||||
void Merge(WVDictionary const& fromDict, bool replaceDuplicates);
|
||||
|
||||
// Returns a pointer to a stored value for a specified key. Returns NULL if value not present
|
||||
WVTypedValue const* GetEntry(WVString const& key) const;
|
||||
|
||||
// Accessor methods for typed values stored in the dictionary. Returns false if the value
|
||||
// is not present, or if trying to retrieve a value of the incorrect type
|
||||
WVBoolean GetValue(WVString const& key, WVUnsignedInt& value) const;
|
||||
WVBoolean GetValue(WVString const& key, WVSignedInt& value) const;
|
||||
WVBoolean GetValue(WVString const& key, WVUnsignedLong& value) const;
|
||||
WVBoolean GetValue(WVString const& key, WVSignedLong& value) const;
|
||||
WVBoolean GetValue(WVString const& key, WVFloat& value) const;
|
||||
WVBoolean GetValue(WVString const& key, WVBoolean& value) const;
|
||||
WVBoolean GetValue(WVString const& key, WVString const*& value) const;
|
||||
WVBoolean GetValue(WVString const& key, WVTypedValueArray const*& value) const;
|
||||
WVBoolean GetValue(WVString const& key, WVDictionary const*& value) const;
|
||||
WVBoolean GetValue(WVString const& key, WVDataBlob const*& value) const;
|
||||
|
||||
// Convenience accessors. Return default values if not found or wrong type specified
|
||||
WVUnsignedInt GetUnsignedIntValue(WVString const& key, WVUnsignedInt defaultValue = 0) const;
|
||||
WVSignedInt GetSignedIntValue(WVString const& key, WVSignedInt defaultValue = 0) const;
|
||||
WVUnsignedLong GetUnsignedLongValue(WVString const& key, WVUnsignedLong defaultValue = 0) const;
|
||||
WVSignedLong GetSignedLongValue(WVString const& key, WVSignedLong defaultValue = 0) const;
|
||||
WVFloat GetFloatValue(WVString const& key, WVFloat defaultValue = 0) const;
|
||||
WVBoolean GetBooleanValue(WVString const& key, WVBoolean defaultValue = 0) const;
|
||||
WVString GetStringValue(WVString const& key, WVString const& defaultValue = "") const;
|
||||
|
||||
// Serialize into WVDataBlob
|
||||
void Serialize(WVDataBlob& intoBlob) const;
|
||||
|
||||
// Deserialize from WVDataBlob. Returns bytes used, 0 on failure
|
||||
WVUnsignedInt Deserialize(WVDataBlob const& fromBlob, WVUnsignedInt fromIndex = 0);
|
||||
|
||||
// Merge dictionary into current one
|
||||
WVDictionary const& operator+=(WVDictionary const& rhs);
|
||||
|
||||
// Dumps values in human-readable format to toString
|
||||
void Dump(WVString const& prefix, WVString& toString) const;
|
||||
|
||||
private:
|
||||
std::map<WVString, WVTypedValue> mMap;
|
||||
};
|
||||
|
||||
#endif // __WVTYPES_H__
|
||||
Binary file not shown.
Binary file not shown.
@@ -19,7 +19,7 @@ LOCAL_C_INCLUDES += \
|
||||
frameworks/av/drm/libdrmframework/plugins/common/include
|
||||
|
||||
ifeq ($(TARGET_ARCH),x86)
|
||||
LOCAL_C_INCLUDES += system/core/include/arch/linux-x86
|
||||
LOCAL_C_INCLUDES += $(TOP)/system/core/include/arch/linux-x86
|
||||
endif
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
|
||||
@@ -3,7 +3,7 @@ ifneq ($(filter arm x86,$(TARGET_ARCH)),)
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
include vendor/widevine/proprietary/wvm/common.mk
|
||||
include $(TOP)/vendor/widevine/proprietary/wvm/common.mk
|
||||
|
||||
ifeq ($(BOARD_WIDEVINE_OEMCRYPTO_LEVEL),1)
|
||||
LOCAL_CFLAGS := -DREQUIRE_SECURE_BUFFERS
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#define AES_BLOCK_SIZE 16
|
||||
|
||||
|
||||
using namespace android;
|
||||
|
||||
static sp<DecryptHandle> sDecryptHandle;
|
||||
@@ -33,6 +32,7 @@ static void _cb1(char *data, unsigned long size)
|
||||
if (sDrmManagerClient != NULL) {
|
||||
sDrmManagerClient->initializeDecryptUnit(sDecryptHandle, 0, &buf);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int _cb2(char *in, char *out, int length, char *iv)
|
||||
@@ -141,6 +141,10 @@ void WVMExtractorImpl::Initialize()
|
||||
//ALOGD("WVMExtractorImpl::Initialize setting DecryptCallback\n");
|
||||
callbacks.decrypt = WVMMediaSource::DecryptCallback;
|
||||
}
|
||||
#else
|
||||
if (!mIsLiveStream && mClientContext->getCryptoPluginMode()) {
|
||||
callbacks.decrypt = WVMMediaSource::DecryptCallback;
|
||||
}
|
||||
#endif
|
||||
result = WV_Initialize(&callbacks);
|
||||
|
||||
@@ -351,8 +355,6 @@ status_t WVMExtractorImpl::readMetaData()
|
||||
mClientContext->setVideoSource(mVideoSource);
|
||||
mVideoSource->delegateClientContext(mClientContext);
|
||||
|
||||
mFileMetaData->setCString(kKeyMIMEType, "video/wvm");
|
||||
|
||||
mHaveMetaData = true;
|
||||
|
||||
mInfoListener->configureHeartbeat();
|
||||
@@ -361,6 +363,26 @@ status_t WVMExtractorImpl::readMetaData()
|
||||
// In crypto plugin mode, need to trigger the drm plugin to begin
|
||||
// license use on playback since the media player isn't involved.
|
||||
sDrmManagerClient->setPlaybackStatus(sDecryptHandle, Playback::START, 0);
|
||||
|
||||
#ifndef REQUIRE_SECURE_BUFFERS
|
||||
if (!mIsLiveStream) {
|
||||
// Get the content key for crypto plugin mode on L3 devices
|
||||
char keyBuffer[AES_BLOCK_SIZE];
|
||||
char nullBuffer[0];
|
||||
DrmBuffer nullDrmBuffer(nullBuffer, 0);
|
||||
DrmBuffer keyDrmBuffer(keyBuffer, sizeof(keyBuffer));
|
||||
DrmBuffer *keyDrmBufferPtr = &keyDrmBuffer;
|
||||
|
||||
status_t status = sDrmManagerClient->decrypt(sDecryptHandle, 0, &nullDrmBuffer,
|
||||
&keyDrmBufferPtr, &nullDrmBuffer);
|
||||
if (status != OK) {
|
||||
return status;
|
||||
}
|
||||
|
||||
mVideoSource->SetCryptoPluginKey(keyBuffer);
|
||||
mAudioSource->SetCryptoPluginKey(keyBuffer);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return OK;
|
||||
@@ -375,7 +397,7 @@ status_t WVMExtractorImpl::readESDSMetaData(sp<MetaData> audioMetaData)
|
||||
int limit = 500;
|
||||
do {
|
||||
size_t bytesRead;
|
||||
bool auEnd, sync;
|
||||
bool auStart, sync;
|
||||
unsigned long long dts, pts;
|
||||
unsigned char buf[1];
|
||||
size_t bufSize = 0;
|
||||
@@ -385,7 +407,7 @@ status_t WVMExtractorImpl::readESDSMetaData(sp<MetaData> audioMetaData)
|
||||
// pull some audio data. But we can't use it yet, so just request 0 bytes.
|
||||
//
|
||||
(void)WV_GetEsData(mSession, WV_EsSelector_Audio, buf, bufSize,
|
||||
bytesRead, dts, pts, sync, auEnd);
|
||||
bytesRead, auStart, dts, pts, sync);
|
||||
|
||||
result = WV_Info_GetCodecConfig(mSession, WV_CodecConfigType_ESDS, config, size);
|
||||
if (result != WV_Status_OK)
|
||||
@@ -467,11 +489,7 @@ sp<MetaData> WVMExtractorImpl::getTrackMetaData(size_t index, uint32_t flags)
|
||||
}
|
||||
|
||||
sp<MetaData> WVMExtractorImpl::getMetaData() {
|
||||
status_t err;
|
||||
if ((err = readMetaData()) != OK) {
|
||||
return new MetaData;
|
||||
}
|
||||
|
||||
mFileMetaData->setCString(kKeyMIMEType, "video/wvm");
|
||||
return mFileMetaData;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ WVMMediaSource::WVMMediaSource(WVSession *session, WVEsSelector esSelector,
|
||||
mNewSegment(false),
|
||||
mCryptoInitialized(false),
|
||||
mIsStalled(false),
|
||||
mStripADTS(false),
|
||||
mGroup(NULL),
|
||||
mKeyTime(0),
|
||||
mDts(0),
|
||||
@@ -53,6 +54,11 @@ WVMMediaSource::WVMMediaSource(WVSession *session, WVEsSelector esSelector,
|
||||
}
|
||||
}
|
||||
}
|
||||
mStripADTS = true;
|
||||
#else
|
||||
if (cryptoPluginMode) {
|
||||
mStripADTS = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -171,19 +177,21 @@ sp<MetaData> WVMMediaSource::getFormat()
|
||||
{
|
||||
Mutex::Autolock autoLock(mLock);
|
||||
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
if (!mIsLiveStream) {
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
if (mESSelector == WV_EsSelector_Video) {
|
||||
mTrackMetaData->setInt32(kKeyRequiresSecureBuffers, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Only support AAC on android for now, so assume the audio
|
||||
// track is AAC and notify the audio codec it has ADTS framing
|
||||
if (mESSelector == WV_EsSelector_Audio) {
|
||||
mTrackMetaData->setInt32(kKeyIsADTS, 1);
|
||||
if (mStripADTS) {
|
||||
// Only support AAC on android for now, so assume the audio
|
||||
// track is AAC and notify the audio codec it has ADTS framing
|
||||
if (mESSelector == WV_EsSelector_Audio) {
|
||||
mTrackMetaData->setInt32(kKeyIsADTS, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return mTrackMetaData;
|
||||
}
|
||||
@@ -260,13 +268,11 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
mDecryptContext.Initialize(mediaBuf);
|
||||
mEncryptedSizes.clear();
|
||||
#endif
|
||||
|
||||
size_t bytesRead;
|
||||
bool auEnd;
|
||||
bool auStart;
|
||||
size_t offset = 0;
|
||||
|
||||
bool syncFrame;
|
||||
@@ -281,7 +287,7 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
|
||||
size_t size = mediaBuf->size() - offset;
|
||||
|
||||
WVStatus result = WV_GetEsData(mSession, mESSelector, (uint8_t *)mediaBuf->data() + offset,
|
||||
size, bytesRead, mDts, mPts, syncFrame, auEnd);
|
||||
size, bytesRead, auStart, mDts, mPts, syncFrame);
|
||||
|
||||
if (result != WV_Status_OK &&
|
||||
result != WV_Status_Warning_Need_Key &&
|
||||
@@ -351,10 +357,8 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
|
||||
// drop frames up to next sync if requested
|
||||
mIsStalled = true;
|
||||
usleep(10000);
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
mDecryptContext.Initialize(mediaBuf);
|
||||
mEncryptedSizes.clear();
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -394,13 +398,15 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
|
||||
|
||||
mediaBuf->set_range(0, bytesRead + offset);
|
||||
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
if (!mIsLiveStream && mEncryptedSizes.size()) {
|
||||
mediaBuf->meta_data()->setData(kKeyEncryptedSizes, 0, &mEncryptedSizes[0],
|
||||
mEncryptedSizes.size() * sizeof(size_t));
|
||||
mediaBuf->meta_data()->setInt32(kKeyCryptoMode, CryptoPlugin::kMode_AES_WV);
|
||||
}
|
||||
|
||||
#ifndef REQUIRE_SECURE_BUFFERS
|
||||
mediaBuf->meta_data()->setData(kKeyCryptoKey, 0, mCryptoPluginKey, sizeof(mCryptoPluginKey));
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
// debug code - log packets to files
|
||||
@@ -432,11 +438,9 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
|
||||
return OK;
|
||||
}
|
||||
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
|
||||
WVStatus WVMMediaSource::DecryptCallback(WVEsSelector esType, void* input, void* output, size_t length,
|
||||
int key, unsigned long long dts, unsigned long long pts, bool au_end,
|
||||
void *obj)
|
||||
void WVMMediaSource::DecryptCallback(WVEsSelector esType, void* input, void* output,
|
||||
size_t length, int key, void *obj)
|
||||
{
|
||||
//ALOGD("DecryptCallback(type=%d, in=%p, out=%p, len=%d, key=%d\n",
|
||||
// (int)esType, input, output, length, key);
|
||||
@@ -444,7 +448,7 @@ WVStatus WVMMediaSource::DecryptCallback(WVEsSelector esType, void* input, void*
|
||||
ClientContext *clientContext = (ClientContext *)obj;
|
||||
if (!clientContext) {
|
||||
ALOGE("WVMMediaSource::DecryptCallback - no client context!");
|
||||
return WV_Status_Unknown;
|
||||
return;
|
||||
}
|
||||
|
||||
sp<WVMMediaSource> source;
|
||||
@@ -454,11 +458,7 @@ WVStatus WVMMediaSource::DecryptCallback(WVEsSelector esType, void* input, void*
|
||||
source = clientContext->getAudioSource();
|
||||
|
||||
DecryptContext &context = source->getDecryptContext();
|
||||
|
||||
OEMCrypto_UINT32 copied = length;
|
||||
OEMCryptoResult result;
|
||||
WVStatus status = WV_Status_OK;
|
||||
unsigned char *iv = NULL;
|
||||
uint32_t copied = length;
|
||||
|
||||
if (clientContext->getCryptoPluginMode()) {
|
||||
// just determine crypto unit boundaries
|
||||
@@ -467,7 +467,12 @@ WVStatus WVMMediaSource::DecryptCallback(WVEsSelector esType, void* input, void*
|
||||
}
|
||||
memcpy((uint8_t *)context.mMediaBuf->data() + context.mOffset, input, length);
|
||||
} else {
|
||||
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
// do decrypt
|
||||
OEMCryptoResult result;
|
||||
unsigned char *iv = NULL;
|
||||
|
||||
if (key)
|
||||
iv = context.mIV;
|
||||
|
||||
@@ -481,18 +486,13 @@ WVStatus WVMMediaSource::DecryptCallback(WVEsSelector esType, void* input, void*
|
||||
&copied);
|
||||
}
|
||||
|
||||
if (result == OEMCrypto_SUCCESS) {
|
||||
status = WV_Status_OK;
|
||||
} else {
|
||||
status = WV_Status_Unknown;
|
||||
if (result != OEMCrypto_SUCCESS) {
|
||||
ALOGD("OEMCrypto decrypt failure: %d", result);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
context.mOffset += copied;
|
||||
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
WVMMediaSource::~WVMMediaSource()
|
||||
|
||||
@@ -7,5 +7,5 @@ LOCAL_C_INCLUDES:= \
|
||||
vendor/widevine/proprietary/wvm/include
|
||||
|
||||
ifeq ($(TARGET_ARCH),x86)
|
||||
LOCAL_C_INCLUDES += system/core/include/arch/linux-x86
|
||||
LOCAL_C_INCLUDES += $(TOP)/system/core/include/arch/linux-x86
|
||||
endif
|
||||
|
||||
@@ -80,7 +80,7 @@ private:
|
||||
|
||||
status_t readMetaData();
|
||||
|
||||
const static size_t kStreamCacheSize = 16 * 1024 * 1024;
|
||||
const static size_t kStreamCacheSize = 10 * 1024 * 1024;
|
||||
|
||||
WVMExtractorImpl(const WVMExtractorImpl &);
|
||||
WVMExtractorImpl &operator=(const WVMExtractorImpl &);
|
||||
|
||||
@@ -47,7 +47,8 @@ public:
|
||||
|
||||
int64_t getTime() { return mKeyTime; }; // usec.
|
||||
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
static const int kCryptoBlockSize = 16;
|
||||
|
||||
class DecryptContext {
|
||||
public:
|
||||
void Initialize(MediaBuffer *mediaBuf) {
|
||||
@@ -57,17 +58,19 @@ public:
|
||||
}
|
||||
MediaBuffer *mMediaBuf;
|
||||
size_t mOffset;
|
||||
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, void *context);
|
||||
static void DecryptCallback(WVEsSelector esType, void* input, void* output, size_t length,
|
||||
int key, void *context);
|
||||
DecryptContext& getDecryptContext() { return mDecryptContext; }
|
||||
|
||||
void SetCryptoPluginKey(const char key[kCryptoBlockSize]) {
|
||||
memcpy(mCryptoPluginKey, key, sizeof(mCryptoPluginKey));
|
||||
}
|
||||
|
||||
private:
|
||||
DecryptContext mDecryptContext;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual ~WVMMediaSource();
|
||||
@@ -86,6 +89,7 @@ private:
|
||||
bool mNewSegment;
|
||||
bool mCryptoInitialized;
|
||||
bool mIsStalled;
|
||||
bool mStripADTS;
|
||||
|
||||
MediaBufferGroup *mGroup;
|
||||
|
||||
@@ -98,6 +102,7 @@ private:
|
||||
sp<ClientContext> mClientContext;
|
||||
|
||||
Vector<size_t> mEncryptedSizes;
|
||||
char mCryptoPluginKey[kCryptoBlockSize];
|
||||
|
||||
void allocBufferGroup();
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ LOCAL_C_INCLUDES+= \
|
||||
frameworks/av/media/libstagefright
|
||||
|
||||
ifeq ($(TARGET_ARCH),x86)
|
||||
LOCAL_C_INCLUDES += system/core/include/arch/linux-x86
|
||||
LOCAL_C_INCLUDES += $(TOP)/system/core/include/arch/linux-x86
|
||||
endif
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Widevine wvm static library. Sets up includes and defines the core libraries
|
||||
# required.
|
||||
#
|
||||
include vendor/widevine/proprietary/wvm/common.mk
|
||||
include $(TOP)/vendor/widevine/proprietary/wvm/common.mk
|
||||
|
||||
ifndef BOARD_WIDEVINE_OEMCRYPTO_LEVEL
|
||||
$(error BOARD_WIDEVINE_OEMCRYPTO_LEVEL not defined!)
|
||||
|
||||
Reference in New Issue
Block a user