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

Unified Diff: chromecast/media/cdm/browser_cdm_cast.h

Issue 741823004: Chromecast: extensions to the BrowserCdm interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | chromecast/media/cdm/browser_cdm_cast.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/media/cdm/browser_cdm_cast.h
diff --git a/chromecast/media/cdm/browser_cdm_cast.h b/chromecast/media/cdm/browser_cdm_cast.h
new file mode 100644
index 0000000000000000000000000000000000000000..0ce138785b77ebb4c2edd7737e7a4f0d5b4dab24
--- /dev/null
+++ b/chromecast/media/cdm/browser_cdm_cast.h
@@ -0,0 +1,60 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_
+#define CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_
+
+#include <stdint.h>
+
+#include <map>
+#include <string>
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "media/base/browser_cdm.h"
+
+namespace chromecast {
+namespace media {
+class DecryptContext;
+
+// BrowserCdmCast is an extension of BrowserCdm that provides common
+// functionality across CDM implementations.
+// All these additional functions are synchronous so:
+// - either both the CDM and the media pipeline must be running on the same
+// thread,
+// - or BrowserCdmCast implementations must use some locks.
+//
+class BrowserCdmCast : public ::media::BrowserCdm {
+ public:
+ BrowserCdmCast();
+ virtual ~BrowserCdmCast() override;
+
+ // PlayerTracker implementation.
+ int RegisterPlayer(const base::Closure& new_key_cb,
+ const base::Closure& cdm_unset_cb) override;
+ void UnregisterPlayer(int registration_id) override;
+
+ // Returns the decryption context needed to decrypt frames encrypted with
+ // |key_id|.
+ // Returns null if |key_id| is not available.
+ virtual scoped_refptr<DecryptContext> GetDecryptContext(
+ const std::string& key_id) const = 0;
+
+ protected:
+ // Notifies all listeners a new key was added on the next message loop cycle.
+ void NotifyKeyAdded() const;
+
+ private:
+ uint32_t next_registration_id_;
+ std::map<uint32_t, base::Closure> new_key_callbacks_;
+ std::map<uint32_t, base::Closure> cdm_unset_callbacks_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserCdmCast);
+};
+
+} // namespace media
+} // namespace chromecast
+
+#endif // CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_
« no previous file with comments | « no previous file | chromecast/media/cdm/browser_cdm_cast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698