OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_MOJO_SERVICES_MOJO_DECRYPTOR_SERVICE_H_ | 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_DECRYPTOR_SERVICE_H_ |
6 #define MEDIA_MOJO_SERVICES_MOJO_DECRYPTOR_SERVICE_H_ | 6 #define MEDIA_MOJO_SERVICES_MOJO_DECRYPTOR_SERVICE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <unordered_map> | 11 #include <unordered_map> |
12 | 12 |
13 #include "base/callback.h" | |
14 #include "base/macros.h" | 13 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
16 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
17 #include "media/base/decryptor.h" | 16 #include "media/base/decryptor.h" |
18 #include "media/mojo/interfaces/decryptor.mojom.h" | 17 #include "media/mojo/interfaces/decryptor.mojom.h" |
19 #include "mojo/public/cpp/bindings/binding.h" | 18 #include "mojo/public/cpp/bindings/binding.h" |
| 19 #include "mojo/public/cpp/bindings/callback.h" |
20 #include "mojo/public/cpp/system/data_pipe.h" | 20 #include "mojo/public/cpp/system/data_pipe.h" |
21 | 21 |
22 namespace media { | 22 namespace media { |
23 | 23 |
24 class DecoderBuffer; | 24 class DecoderBuffer; |
25 class MediaKeys; | 25 class MediaKeys; |
26 | 26 |
27 // A mojom::Decryptor implementation. This object is owned by the creator, | 27 // A mojom::Decryptor implementation. This object is owned by the creator, |
28 // and uses a weak binding across the mojo interface. | 28 // and uses a weak binding across the mojo interface. |
29 class MojoDecryptorService : public mojom::Decryptor { | 29 class MojoDecryptorService : public mojom::Decryptor { |
30 public: | 30 public: |
31 // Constructs a MojoDecryptorService and binds it to the |request|. Keeps a | 31 // Constructs a MojoDecryptorService and binds it to the |request|. Keeps a |
32 // copy of |cdm| to prevent it from being deleted as long as it is needed. | 32 // copy of |cdm| to prevent it from being deleted as long as it is needed. |
33 // |error_handler| will be called if a connection error occurs. | 33 // |error_handler| will be called if a connection error occurs. |
34 MojoDecryptorService(const scoped_refptr<MediaKeys>& cdm, | 34 MojoDecryptorService(const scoped_refptr<MediaKeys>& cdm, |
35 mojo::InterfaceRequest<mojom::Decryptor> request, | 35 mojo::InterfaceRequest<mojom::Decryptor> request, |
36 const base::Closure& error_handler); | 36 const mojo::Closure& error_handler); |
37 | 37 |
38 ~MojoDecryptorService() final; | 38 ~MojoDecryptorService() final; |
39 | 39 |
40 // mojom::Decryptor implementation. | 40 // mojom::Decryptor implementation. |
41 void Initialize(mojo::ScopedDataPipeConsumerHandle receive_pipe, | 41 void Initialize(mojo::ScopedDataPipeConsumerHandle receive_pipe, |
42 mojo::ScopedDataPipeProducerHandle transmit_pipe) final; | 42 mojo::ScopedDataPipeProducerHandle transmit_pipe) final; |
43 void Decrypt(mojom::DemuxerStream::Type stream_type, | 43 void Decrypt(mojom::DemuxerStream::Type stream_type, |
44 mojom::DecoderBufferPtr encrypted, | 44 mojom::DecoderBufferPtr encrypted, |
45 const DecryptCallback& callback) final; | 45 const DecryptCallback& callback) final; |
46 void CancelDecrypt(mojom::DemuxerStream::Type stream_type) final; | 46 void CancelDecrypt(mojom::DemuxerStream::Type stream_type) final; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 base::WeakPtr<MojoDecryptorService> weak_this_; | 107 base::WeakPtr<MojoDecryptorService> weak_this_; |
108 base::WeakPtrFactory<MojoDecryptorService> weak_factory_; | 108 base::WeakPtrFactory<MojoDecryptorService> weak_factory_; |
109 | 109 |
110 DISALLOW_COPY_AND_ASSIGN(MojoDecryptorService); | 110 DISALLOW_COPY_AND_ASSIGN(MojoDecryptorService); |
111 }; | 111 }; |
112 | 112 |
113 } // namespace media | 113 } // namespace media |
114 | 114 |
115 #endif // MEDIA_MOJO_SERVICES_MOJO_DECRYPTOR_SERVICE_H_ | 115 #endif // MEDIA_MOJO_SERVICES_MOJO_DECRYPTOR_SERVICE_H_ |
OLD | NEW |