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

Side by Side Diff: media/blink/encrypted_media_player_support.h

Issue 1133033003: Eliminate MediaPlayer & MediaPlayerClient abstractions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added new path for createMediaPlayer Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ 5 #ifndef MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_
6 #define MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ 6 #define MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "media/base/cdm_context.h" 14 #include "media/base/cdm_context.h"
15 #include "media/base/cdm_factory.h" 15 #include "media/base/cdm_factory.h"
16 #include "media/base/demuxer.h" 16 #include "media/base/demuxer.h"
17 #include "media/base/eme_constants.h" 17 #include "media/base/eme_constants.h"
18 #include "media/cdm/proxy_decryptor.h" 18 #include "media/cdm/proxy_decryptor.h"
19 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" 19 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h"
20 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" 20 #include "third_party/WebKit/public/platform/WebMediaPlayer.h"
21 21
22 namespace blink { 22 namespace blink {
23 class WebContentDecryptionModule; 23 class WebContentDecryptionModule;
24 class WebLocalFrame; 24 class WebLocalFrame;
25 class WebMediaPlayerClient; 25 class WebMediaPlayerClient;
26 class WebMediaPlayerEncryptedMediaClient;
26 class WebString; 27 class WebString;
27 } 28 }
28 29
29 namespace media { 30 namespace media {
30 31
31 class MediaPermission; 32 class MediaPermission;
32 class WebContentDecryptionModuleImpl; 33 class WebContentDecryptionModuleImpl;
33 34
34 // Provides support to prefixed EME implementation. 35 // Provides support to prefixed EME implementation.
35 // Do NOT add unprefixed EME functionality to this class! 36 // Do NOT add unprefixed EME functionality to this class!
36 // TODO(xhwang): When deprecating prefixed EME support, drop this whole file. 37 // TODO(xhwang): When deprecating prefixed EME support, drop this whole file.
37 class EncryptedMediaPlayerSupport 38 class EncryptedMediaPlayerSupport
38 : public base::SupportsWeakPtr<EncryptedMediaPlayerSupport> { 39 : public base::SupportsWeakPtr<EncryptedMediaPlayerSupport> {
39 public: 40 public:
40 using CdmContextReadyCB = ProxyDecryptor::CdmContextReadyCB; 41 using CdmContextReadyCB = ProxyDecryptor::CdmContextReadyCB;
41 42
42 // |cdm_context_ready_cb| is called when the CDM instance creation completes. 43 // |cdm_context_ready_cb| is called when the CDM instance creation completes.
43 EncryptedMediaPlayerSupport(CdmFactory* cdm_factory, 44 EncryptedMediaPlayerSupport(
44 blink::WebMediaPlayerClient* client, 45 CdmFactory* cdm_factory,
45 MediaPermission* media_permission, 46 blink::WebMediaPlayerClient* client,
46 const CdmContextReadyCB& cdm_context_ready_cb); 47 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
48 MediaPermission* media_permission,
49 const CdmContextReadyCB& cdm_context_ready_cb);
47 ~EncryptedMediaPlayerSupport(); 50 ~EncryptedMediaPlayerSupport();
48 51
49 blink::WebMediaPlayer::MediaKeyException GenerateKeyRequest( 52 blink::WebMediaPlayer::MediaKeyException GenerateKeyRequest(
50 blink::WebLocalFrame* frame, 53 blink::WebLocalFrame* frame,
51 const blink::WebString& key_system, 54 const blink::WebString& key_system,
52 const unsigned char* init_data, 55 const unsigned char* init_data,
53 unsigned init_data_length); 56 unsigned init_data_length);
54 57
55 blink::WebMediaPlayer::MediaKeyException AddKey( 58 blink::WebMediaPlayer::MediaKeyException AddKey(
56 const blink::WebString& key_system, 59 const blink::WebString& key_system,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 void OnKeyError(const std::string& session_id, 94 void OnKeyError(const std::string& session_id,
92 MediaKeys::KeyError error_code, 95 MediaKeys::KeyError error_code,
93 uint32 system_code); 96 uint32 system_code);
94 void OnKeyMessage(const std::string& session_id, 97 void OnKeyMessage(const std::string& session_id,
95 const std::vector<uint8>& message, 98 const std::vector<uint8>& message,
96 const GURL& destination_url); 99 const GURL& destination_url);
97 100
98 CdmFactory* cdm_factory_; 101 CdmFactory* cdm_factory_;
99 102
100 blink::WebMediaPlayerClient* client_; 103 blink::WebMediaPlayerClient* client_;
104 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client_;
101 105
102 MediaPermission* media_permission_; 106 MediaPermission* media_permission_;
103 107
104 // The currently selected key system. Empty string means that no key system 108 // The currently selected key system. Empty string means that no key system
105 // has been selected. 109 // has been selected.
106 std::string current_key_system_; 110 std::string current_key_system_;
107 111
108 // We assume all streams are from the same container, thus have the same 112 // We assume all streams are from the same container, thus have the same
109 // init data type. 113 // init data type.
110 EmeInitDataType init_data_type_; 114 EmeInitDataType init_data_type_;
111 115
112 CdmContextReadyCB cdm_context_ready_cb_; 116 CdmContextReadyCB cdm_context_ready_cb_;
113 117
114 // Manages decryption keys and decrypts encrypted frames. 118 // Manages decryption keys and decrypts encrypted frames.
115 scoped_ptr<ProxyDecryptor> proxy_decryptor_; 119 scoped_ptr<ProxyDecryptor> proxy_decryptor_;
116 120
117 DISALLOW_COPY_AND_ASSIGN(EncryptedMediaPlayerSupport); 121 DISALLOW_COPY_AND_ASSIGN(EncryptedMediaPlayerSupport);
118 }; 122 };
119 123
120 } // namespace media 124 } // namespace media
121 125
122 #endif // MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ 126 #endif // MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698