diff options
author | sandersd@chromium.org <sandersd@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-14 16:01:37 +0000 |
---|---|---|
committer | sandersd@chromium.org <sandersd@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-14 16:02:26 +0000 |
commit | c22e381492db207a6fb850ec02cb004c4604b54b (patch) | |
tree | 929381fa4092a0ffbd1500c91b4fd08c874de1ed /media | |
parent | 78d9c1906afd44cc32bc7a5d9ac31ae93b6dc2b3 (diff) | |
download | chromium_src-c22e381492db207a6fb850ec02cb004c4604b54b.zip chromium_src-c22e381492db207a6fb850ec02cb004c4604b54b.tar.gz chromium_src-c22e381492db207a6fb850ec02cb004c4604b54b.tar.bz2 |
Convert between |init_data_type| and content type.
This allows both to be used while Blink and the tests are transitioned.
BUG=385874
Review URL: https://codereview.chromium.org/472493003
Cr-Commit-Position: refs/heads/master@{#289605}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289605 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/cdm/ppapi/cdm_wrapper.h | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/media/cdm/ppapi/cdm_wrapper.h b/media/cdm/ppapi/cdm_wrapper.h index b27be42..afd7ab8 100644 --- a/media/cdm/ppapi/cdm_wrapper.h +++ b/media/cdm/ppapi/cdm_wrapper.h @@ -127,6 +127,12 @@ class CdmWrapper { virtual void ConvertInputBuffer(const cdm::InputBuffer& v2, cdm::InputBuffer_1* v1) = 0; + // Prior to CDM_6, |init_data_type| was a content type. This helper convererts + // an |init_data_type| to a content type. + // TODO(sandersd): Remove once Host_4 and Host_5 interfaces are removed. + virtual const char* ConvertInitDataTypeToContentType( + const char* init_data_type) const = 0; + protected: CdmWrapper() {} @@ -339,6 +345,15 @@ class CdmWrapperImpl : public CdmWrapper { v1->timestamp = v2.timestamp; } + virtual const char* ConvertInitDataTypeToContentType( + const char* init_data_type) const { + if (!strcmp(init_data_type, "cenc")) + return "video/mp4"; + if (!strcmp(init_data_type, "webm")) + return "video/webm"; + return init_data_type; + } + private: CdmWrapperImpl(CdmInterface* cdm) : cdm_(cdm), next_session_id_(100) { PP_DCHECK(cdm_); @@ -361,7 +376,8 @@ class CdmWrapperImpl : public CdmWrapper { // create a new session_id to pass to the CDM. For update and release, we need // to look up |web_session_id| and convert it into the existing |session_id|. // Since the callbacks don't come through this interface, cdm_adapter needs to -// create the mapping (and delete it on release). +// create the mapping (and delete it on release). Finally, for create, we need +// to translate |init_data_type| to a MIME type. // TODO(jrummell): Remove these once Host_4 interface is removed. template <> @@ -375,7 +391,7 @@ void CdmWrapperImpl<cdm::ContentDecryptionModule_4>::CreateSession( uint32_t session_id = CreateSessionId(); RegisterPromise(session_id, promise_id); cdm_->CreateSession(session_id, - init_data_type, + ConvertInitDataTypeToContentType(init_data_type), init_data_type_size, init_data, init_data_size); @@ -472,6 +488,22 @@ CdmWrapperImpl<cdm::ContentDecryptionModule_4>::DecryptAndDecodeSamples( // TODO(jrummell): Remove these once Host_5 interface is removed. template <> +void CdmWrapperImpl<cdm::ContentDecryptionModule_5>::CreateSession( + uint32_t promise_id, + const char* init_data_type, + uint32_t init_data_type_size, + const uint8_t* init_data, + uint32_t init_data_size, + cdm::SessionType session_type) { + cdm_->CreateSession(promise_id, + ConvertInitDataTypeToContentType(init_data_type), + init_data_type_size, + init_data, + init_data_size, + session_type); +} + +template <> void CdmWrapperImpl<cdm::ContentDecryptionModule_5>::LoadSession( uint32_t promise_id, const char* web_session_id, |