Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Unified Diff: media/cdm/cdm_adapter.h

Issue 1888603002: Add CdmFileIOProvider interface for use by cdm_adapter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: callback Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/cdm/cdm_adapter.h
diff --git a/media/cdm/cdm_adapter.h b/media/cdm/cdm_adapter.h
index cb08f4a155d62ad63d7e75579be789c323f4e77d..392f5c3183e8eb6739b514c15a7bb27d7e6838f7 100644
--- a/media/cdm/cdm_adapter.h
+++ b/media/cdm/cdm_adapter.h
@@ -7,9 +7,11 @@
#include <stdint.h>
+#include <memory>
#include <string>
#include <vector>
+#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "base/macros.h"
@@ -32,8 +34,17 @@ namespace media {
class AudioFramesImpl;
class CdmAllocator;
+class CdmFileIO;
class CdmWrapper;
+// Called when the CDM needs a FileIO object from the host to do file IO
+// operations. Returns NULL if a FileIO object cannot be obtained. Once a
+// valid FileIO object is returned, |client| must be valid until
+// FileIO::Close() is called. The CDM can call this method multiple times
+// to operate on different files.
+using CdmFileIOProviderCB =
xhwang 2016/04/18 21:09:22 The naming is a bit odd since the callback does cr
jrummell 2016/04/19 23:59:29 Done.
+ base::Callback<std::unique_ptr<CdmFileIO>(cdm::FileIOClient* client)>;
+
class MEDIA_EXPORT CdmAdapter : public MediaKeys,
public CdmContext,
public Decryptor,
@@ -42,14 +53,16 @@ class MEDIA_EXPORT CdmAdapter : public MediaKeys,
public:
// Create the CDM using |cdm_path| and initialize it using |key_system| and
// |cdm_config|. |allocator| is to be used whenever the CDM needs memory
- // and to create VideoFrames. Callbacks will be used for events generated
- // by the CDM. |cdm_created_cb| will be called when the CDM is loaded and
- // initialized.
+ // and to create VideoFrames. |file_io_provider| is to be used whenever the
+ // CDM needs access to the file system. Callbacks will be used for events
+ // generated by the CDM. |cdm_created_cb| will be called when the CDM is
+ // loaded and initialized.
static void Create(
const std::string& key_system,
const base::FilePath& cdm_path,
const CdmConfig& cdm_config,
scoped_ptr<CdmAllocator> allocator,
+ const CdmFileIOProviderCB& file_io_provider_cb,
const SessionMessageCB& session_message_cb,
const SessionClosedCB& session_closed_cb,
const LegacySessionErrorCB& legacy_session_error_cb,
@@ -149,6 +162,7 @@ class MEDIA_EXPORT CdmAdapter : public MediaKeys,
CdmAdapter(const std::string& key_system,
const CdmConfig& cdm_config,
scoped_ptr<CdmAllocator> allocator,
+ const CdmFileIOProviderCB& file_io_provider_cb,
const SessionMessageCB& session_message_cb,
const SessionClosedCB& session_closed_cb,
const LegacySessionErrorCB& legacy_session_error_cb,
@@ -210,6 +224,7 @@ class MEDIA_EXPORT CdmAdapter : public MediaKeys,
ChannelLayout audio_channel_layout_;
scoped_ptr<CdmAllocator> allocator_;
+ CdmFileIOProviderCB file_io_provider_cb_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;

Powered by Google App Engine
This is Rietveld 408576698