Upgrade of Widevine libraries from 4.5.0 to 6.0.0

Upload for Dave Parsons

6.0.0 Widevine libraries contain the features required
to support multiple audio tracks and subtitles.  This
is establishing the baseline for those features.

Change-Id: If12074bb2e4364c8107339e2f69453c40698e91f
related-to-bug: 5880566
This commit is contained in:
Jeff Tinker
2012-04-04 15:49:03 -07:00
parent e612ce59c4
commit 462dc030f8
14 changed files with 1004 additions and 119 deletions

View File

@@ -0,0 +1,41 @@
/****************************************************************************************************
* 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__

View File

@@ -0,0 +1,176 @@
/****************************************************************************************************
* 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__

View File

@@ -0,0 +1,248 @@
/****************************************************************************************************
* 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__

View File

@@ -1,14 +1,17 @@
/*
* Copyright 2011 Widevine Technologies, Inc., All Rights Reserved
*
* Declarations for Widevine Adaptive Streaming API
*/
//
// Declarations for Widevine Adaptive Streaming API
//
// Copyright 2011 Widevine Technologies, Inc., All Rights Reserved
//
#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
@@ -27,68 +30,12 @@ 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_ES = 3, // Elementary Streams
WV_OutputFormat_DVD_Video_No_EAC3_Framing = 4 // DVD-Video without Dolby Digital+ audio framing
} WVOutputFormat;
@@ -99,46 +46,61 @@ typedef enum WVEsSelector {
} WVEsSelector;
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 ""
};
#define UNSPECIFIED_TRACK_ID WVUnsignedInt(0)
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
//
typedef void (*WVDecryptCallback)(WVEsSelector esType, void* input, void* output, size_t length, int key);
// Provide info on socket open/close operations for bandwidth attribution
// status: {0=open, 1=close}
typedef void (*WVSocketInfoCallback)(int fd, int status, void *context);
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)
//
// 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);
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)
{}
struct WVCallbacks {
void (*pushData)(unsigned short port, void *buffer, size_t length);
void (*response)(WVSession *session, const std::string &response);
void *(*allocBuffer)(size_t);
@@ -148,12 +110,15 @@ struct 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
//
@@ -433,16 +398,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
@@ -578,12 +543,20 @@ 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);
WV_Play(WVSession *session, float scale_requested, float *scale_used,
const std::string &range, WVUnsignedInt audioTrack = UNSPECIFIED_TRACK_ID);
//
// METHOD: WV_Pause
@@ -715,7 +688,6 @@ 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
@@ -729,8 +701,6 @@ 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)
@@ -738,6 +708,8 @@ 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.
@@ -745,7 +717,33 @@ 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,
bool& au_start, unsigned long long& dts, unsigned long long& pts, bool& sync_frame);
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);
//
@@ -1067,6 +1065,28 @@ 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
//
@@ -1297,7 +1317,7 @@ WV_SkipChapters(WVSession *session, std::string currentTime, long chapters);
//
// METHOD: WV_SkipToChapter
// METHOD: WV_GoToChapter
//
// This method causes the stream to skip to a specified chapter.
//
@@ -1315,4 +1335,143 @@ 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__

View File

@@ -0,0 +1,248 @@
/****************************************************************************************************
* 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__

View File

@@ -132,14 +132,19 @@ void WVMExtractorImpl::Initialize()
#ifdef REQUIRE_SECURE_BUFFERS
if (!mIsLiveStream) {
WVCallbacks callbacks = {NULL, NULL, NULL, NULL, NULL, NULL, WVMMediaSource::DecryptCallback, SocketInfoCallback};
//ALOGD("WVMExtractorImpl::Initialize setting DecryptCallback\n");
WVCallbacks callbacks;
callbacks.decrypt = WVMMediaSource::DecryptCallback;
callbacks.socketInfo = SocketInfoCallback;
result = WV_Initialize(&callbacks);
} else {
WVCallbacks callbacks = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, SocketInfoCallback};
WVCallbacks callbacks;
callbacks.socketInfo = SocketInfoCallback;
result = WV_Initialize(&callbacks);
}
#else
WVCallbacks callbacks = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, SocketInfoCallback};
WVCallbacks callbacks;
callbacks.socketInfo = SocketInfoCallback;
result = WV_Initialize(&callbacks);
#endif
@@ -352,7 +357,7 @@ status_t WVMExtractorImpl::readESDSMetaData(sp<MetaData> audioMetaData)
int limit = 500;
do {
size_t bytesRead;
bool auStart, sync;
bool auEnd, sync;
unsigned long long dts, pts;
unsigned char buf[1];
size_t bufSize = 0;
@@ -362,7 +367,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, auStart, dts, pts, sync);
bytesRead, dts, pts, sync, auEnd);
result = WV_Info_GetCodecConfig(mSession, WV_CodecConfigType_ESDS, config, size);
if (result != WV_Status_OK)

View File

@@ -243,7 +243,7 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
#endif
size_t bytesRead;
bool auStart;
bool auEnd;
size_t offset = 0;
int64_t keyTime;
@@ -259,7 +259,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, auStart, mDts, mPts, syncFrame);
size, bytesRead, mDts, mPts, syncFrame, auEnd);
if (result != WV_Status_OK &&
result != WV_Status_Warning_Need_Key &&
@@ -397,14 +397,15 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
WVMMediaSource::DecryptContext WVMMediaSource::sDecryptContext[2] = {};
void WVMMediaSource::DecryptCallback(WVEsSelector esType, void* input, void* output,
size_t length, int key)
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)
{
//ALOGD("DecryptCallback(type=%d, in=%p, out=%p, len=%d, key=%d\n",
// (int)esType, input, output, length, key);
DecryptContext &context = sDecryptContext[esType];
OEMCrypto_UINT32 copied = length;
OEMCryptoResult result;
WVStatus status;
unsigned char *iv = NULL;
if (key)
@@ -420,11 +421,17 @@ void WVMMediaSource::DecryptCallback(WVEsSelector esType, void* input, void* out
&copied);
}
if (result != OEMCrypto_SUCCESS) {
if (result == OEMCrypto_SUCCESS) {
status = WV_Status_OK;
}
else {
status = WV_Status_Unknown;
ALOGD("OEMCrypto decrypt failure: %d", result);
}
context.mOffset += copied;
return status;
}
#endif

View File

@@ -53,8 +53,9 @@ public:
static const int kCryptoBlockSize = 16;
unsigned char mIV[kCryptoBlockSize];
};
static void DecryptCallback(WVEsSelector esType, void* input, void* output,
size_t length, int key);
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);
static DecryptContext sDecryptContext[2]; // audio vs. video
#endif