Source release v2.1.3-2-789 + third_party libs

Change-Id: I8648756dab3fe1f53d6da18b83cd1294581d1abe
This commit is contained in:
Joey Parrish
2014-06-19 17:13:42 -07:00
parent 73445a920c
commit 84acd5a15e
32 changed files with 1340 additions and 1335 deletions

View File

@@ -21,6 +21,7 @@ class HostClock {
private:
static IClock* impl_;
};
} // namspace wvcdm
#endif // WVCDM_CDM_CDM_HOST_CLOCK_H_

View File

@@ -13,31 +13,37 @@ class IFileFactory;
class File::Impl {
public:
explicit Impl(cdm::Host* const host) : host_(host) {}
FILE* file_;
static void RegisterFileFactory(IFileFactory* factory) {
factory_ = factory;
}
static IFileFactory* factory_;
virtual bool Exists(const std::string& name);
virtual bool Open(const std::string& name);
virtual bool Close();
virtual bool Remove(const std::string& name);
virtual size_t Read(char* buffer, size_t bytes);
virtual size_t Write(const char* buffer, size_t bytes);
virtual size_t FileSize(const std::string& name);
virtual ssize_t Read(char* buffer, size_t bytes);
virtual ssize_t Write(const char* buffer, size_t bytes);
virtual ssize_t FileSize(const std::string& name);
private:
static IFileFactory* factory_;
friend class File;
cdm::Host* const host_;
std::string fname_;
};
class IFileFactory {
protected:
IFileFactory(){File::Impl::RegisterFileFactory(this);}
virtual ~IFileFactory(){}
IFileFactory() {
File::Impl::RegisterFileFactory(this);
}
virtual ~IFileFactory() {}
public:
virtual File::Impl* NewFileImpl () = 0;
virtual File::Impl* NewFileImpl() = 0;
};
} // namespace wvcdm

View File

@@ -269,6 +269,9 @@ class ContentDecryptionModule_1 {
const uint8_t* key, int key_size,
const uint8_t* key_id, int key_id_size) = 0;
// Tests whether |key_id| is known to any current session.
virtual bool IsKeyValid(const uint8_t* key_id, int key_id_size) = 0;
// Cancels any pending key request made to the CDM for |session_id|.
//
// Returns kSuccess if all pending key requests for |session_id| were
@@ -293,80 +296,6 @@ class ContentDecryptionModule_1 {
virtual Status Decrypt(const InputBuffer& encrypted_buffer,
DecryptedBlock* decrypted_buffer) = 0;
// Initializes the CDM audio decoder with |audio_decoder_config|.
// This function is only needed if DecryptAndDecodeSamples() or
// DecryptDecodeAndRenderSamples() is used. It must be called before either
// of these routines is called.
//
// Returns kSuccess if the |audio_decoder_config| is supported and the CDM
// audio decoder is successfully initialized.
// Returns kSessionError if |audio_decoder_config| is not supported. The CDM
// may still be able to do Decrypt().
//
virtual Status InitializeAudioDecoder(
const AudioDecoderConfig& audio_decoder_config) = 0;
// Initializes the CDM video decoder with |video_decoder_config|.
// This function is only needed if DecryptAndDecodeFrame() or
// DecryptDecodeAndRenderFrame() is used. It must be called before either
// of these routines is called.
//
// Returns kSuccess if the |video_decoder_config| is supported and the CDM
// video decoder is successfully initialized.
// Returns kSessionError if |video_decoder_config| is not supported. The CDM
// may still be able to do Decrypt().
//
virtual Status InitializeVideoDecoder(
const VideoDecoderConfig& video_decoder_config) = 0;
// De-initializes the CDM decoder and sets it to an uninitialized state. The
// caller can initialize the decoder again after this call to re-initialize
// it. This can be used to reconfigure the decoder if the configuration
// changes.
virtual void DeinitializeDecoder(StreamType decoder_type) = 0;
// Resets the CDM decoder to an initialized clean state. All internal buffers
// MUST be flushed.
virtual void ResetDecoder(StreamType decoder_type) = 0;
// Decrypts the |encrypted_buffer| and decodes the decrypted buffer into a
// |video_frame|. Upon end-of-stream, the caller should call this function
// repeatedly with empty |encrypted_buffer| (|data| == NULL) until only empty
// |video_frame| (|format| == kEmptyVideoFrame) is produced.
//
// Returns kSuccess if decryption and decoding both succeeded, in which case
// the callee will have filled the |video_frame| and passed the ownership of
// |frame_buffer| in |video_frame| to the caller.
// Returns kNoKey if the CDM did not have the necessary decryption key
// to decrypt.
// Returns kNeedMoreData if more data was needed by the decoder to generate
// a decoded frame (e.g. during initialization and end-of-stream).
// Returns kDecryptError if any decryption error happened.
// Returns kDecodeError if any decoding error happened.
// If the return value is not kSuccess, |video_frame| should be ignored by
// the caller.
virtual Status DecryptAndDecodeFrame(const InputBuffer& encrypted_buffer,
VideoFrame* video_frame) = 0;
// Decrypts the |encrypted_buffer| and decodes the decrypted buffer into
// |audio_frames|. Upon end-of-stream, the caller should call this function
// repeatedly with empty |encrypted_buffer| (|data| == NULL) until only empty
// |audio_frames| is produced.
//
// Returns kSuccess if decryption and decoding both succeeded, in which case
// the callee will have filled |audio_frames| and passed the ownership of
// |data| in |audio_frames| to the caller.
// Returns kNoKey if the CDM did not have the necessary decryption key
// to decrypt.
// Returns kNeedMoreData if more data was needed by the decoder to generate
// audio samples (e.g. during initialization and end-of-stream).
// Returns kDecryptError if any decryption error happened.
// Returns kDecodeError if any decoding error happened.
// If the return value is not kSuccess, |audio_frames| should be ignored by
// the caller.
virtual Status DecryptAndDecodeSamples(const InputBuffer& encrypted_buffer,
AudioFrames* audio_frames) = 0;
// Decrypts the |encrypted_buffer|, decodes the decrypted buffer into a
// video frame, and passes the frame to the rendering FW/HW. No data
// is returned.
@@ -471,28 +400,18 @@ class Host_1 {
MediaKeyError error_code,
uint32_t system_code) = 0;
// Get private data from the host. This function is limited to internal use.
typedef const void* (*GetPrivateInterface)(const char* interface_name);
virtual void GetPrivateData(int32_t* instance,
GetPrivateInterface* get_interface) = 0;
// Version 1.3:
// These virtual member functions extend the cdm::Host interface to allow
// the CDM to query the host for various information.
//Version 1.3
// These Virtual member functions extend the cdm::Host interface to allow
// the sharing for platform specific information, between the cdm::Host and
// the CDM.
// Asks the host to persist a name-value pair.
virtual void SetPlatformString(const std::string& name,
const std::string& value) = 0;
virtual int GetPlatformString(const std::string& name,
std::string* value) = 0;
virtual int SetPlatformString(const std::string& name,
const std::string& value) = 0;
virtual int PersistPlatformString(const std::string& name,
const std::string& value) = 0;
virtual int GetPlatformByteArray(const std::string& name,
std::vector<uint8_t>* value) = 0;
virtual int SetPlatformByteArray(const std::string& name,
const std::vector<uint8_t>& value) = 0;
virtual int PersistPlatformByteArray(const std::string& name,
const std::vector<uint8_t>& value) = 0;
// Retrieves a value by name. If there is no such value, the Host should
// set value to an empty string.
virtual void GetPlatformString(const std::string& name,
std::string* value) = 0;
protected:
Host_1() {}

View File

@@ -1,3 +1,3 @@
// Widevine CDM Kit Version
#define WV_CDM_VERSION "v2.1.2-0-773"
#define WV_CDM_VERSION "v2.1.3-2-789"

View File

@@ -28,7 +28,7 @@ class WVClientPropertySet : public wvcdm::CdmClientPropertySet {
security_level_ = securityLevel;
}
virtual std::string security_level() const {
virtual const std::string& security_level() const {
return security_level_;
}
@@ -40,11 +40,11 @@ class WVClientPropertySet : public wvcdm::CdmClientPropertySet {
return use_privacy_mode_;
}
void set_service_certificate(const std::vector<uint8_t>& serviceCertificate) {
void set_service_certificate(const std::string& serviceCertificate) {
service_certificate_ = serviceCertificate;
}
virtual std::vector<uint8_t> service_certificate() const {
virtual const std::string& service_certificate() const {
return service_certificate_;
}
@@ -67,24 +67,23 @@ class WVClientPropertySet : public wvcdm::CdmClientPropertySet {
return; // This is unused by common cdm but we need a
// definition for the pure virtual methods.
}
private:
CORE_DISALLOW_COPY_AND_ASSIGN(WVClientPropertySet);
std::string security_level_;
bool use_privacy_mode_;
std::vector<uint8_t> service_certificate_;
std::string service_certificate_;
};
class WvContentDecryptionModule : public cdm::ContentDecryptionModule,
public IFileFactory,
public IClock {
File::Impl* NewFileImpl() { return new File::Impl(host_); }
public:
explicit WvContentDecryptionModule(cdm::Host* host)
: host_(host), host_event_listener_(host, &cdm_engine_) {
HostClock::SetClockInterface(this);
}
explicit WvContentDecryptionModule(cdm::Host* host);
virtual ~WvContentDecryptionModule();
// cdm::ContentDecryptionModule implementation.
virtual cdm::Status GenerateKeyRequest(const char* type, int type_size,
const uint8_t* init_data,
@@ -94,6 +93,8 @@ class WvContentDecryptionModule : public cdm::ContentDecryptionModule,
const uint8_t* key, int key_size,
const uint8_t* key_id, int key_id_size) OVERRIDE;
virtual bool IsKeyValid(const uint8_t* key_id, int key_id_size) OVERRIDE;
virtual cdm::Status CancelKeyRequest(const char* session_id,
int session_id_size) OVERRIDE;
@@ -102,24 +103,6 @@ class WvContentDecryptionModule : public cdm::ContentDecryptionModule,
virtual cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer,
cdm::DecryptedBlock* decrypted_buffer) OVERRIDE;
virtual cdm::Status InitializeAudioDecoder(
const cdm::AudioDecoderConfig& audio_decoder_config) OVERRIDE;
virtual cdm::Status InitializeVideoDecoder(
const cdm::VideoDecoderConfig& video_decoder_config) OVERRIDE;
virtual void DeinitializeDecoder(cdm::StreamType decoder_type) OVERRIDE;
virtual void ResetDecoder(cdm::StreamType decoder_type) OVERRIDE;
virtual cdm::Status DecryptAndDecodeFrame(
const cdm::InputBuffer& encrypted_buffer,
cdm::VideoFrame* video_frame) OVERRIDE;
virtual cdm::Status DecryptAndDecodeSamples(
const cdm::InputBuffer& encrypted_buffer,
cdm::AudioFrames* audio_frames) OVERRIDE;
virtual cdm::Status DecryptDecodeAndRenderFrame(
const cdm::InputBuffer& encrypted_buffer) OVERRIDE;
@@ -128,29 +111,30 @@ class WvContentDecryptionModule : public cdm::ContentDecryptionModule,
virtual void Destroy() OVERRIDE;
// Provisioning related methods
virtual cdm::Status GetProvisioningRequest(
std::string* request, std::string* default_url);
std::string* request, std::string* default_url) OVERRIDE;
virtual cdm::Status HandleProvisioningResponse(
std::string& response);
void EnablePolicyTimer();
void DisablePolicyTimer();
void OnTimerEvent();
std::string& response) OVERRIDE;
private:
virtual int64_t GetCurrentTimeInSeconds() {
return host_->GetCurrentWallTimeInSeconds();
}
void EnablePolicyTimer();
void DisablePolicyTimer();
virtual File::Impl* NewFileImpl() OVERRIDE;
virtual int64_t GetCurrentTimeInSeconds() OVERRIDE;
cdm::Status DoSubsampleDecrypt(CdmDecryptionParameters& parameters,
std::vector<uint8_t>& iv,
const cdm::InputBuffer& encrypted_buffer,
cdm::DecryptedBlock* decrypted_block);
CdmEngine cdm_engine_;
cdm::Host* const host_;
HostEventListener host_event_listener_;
WVClientPropertySet property_set_;
bool timer_enabled_;
CORE_DISALLOW_COPY_AND_ASSIGN(WvContentDecryptionModule);
};