OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_AUDIO_DECODER_SERVICE_H_ | 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_SERVICE_H_ |
6 #define MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_SERVICE_H_ | 6 #define MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_SERVICE_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "media/base/audio_decoder.h" | 11 #include "media/base/audio_decoder.h" |
12 #include "media/mojo/interfaces/audio_decoder.mojom.h" | 12 #include "media/mojo/interfaces/audio_decoder.mojom.h" |
13 #include "mojo/public/cpp/bindings/strong_binding.h" | 13 #include "mojo/public/cpp/bindings/strong_binding.h" |
14 #include "mojo/public/cpp/system/data_pipe.h" | 14 #include "mojo/public/cpp/system/data_pipe.h" |
15 | 15 |
16 namespace media { | 16 namespace media { |
17 | 17 |
| 18 class MojoCdmServiceContext; |
| 19 |
18 class MojoAudioDecoderService : public interfaces::AudioDecoder { | 20 class MojoAudioDecoderService : public interfaces::AudioDecoder { |
19 public: | 21 public: |
20 MojoAudioDecoderService( | 22 MojoAudioDecoderService( |
| 23 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context, |
21 scoped_ptr<media::AudioDecoder> decoder, | 24 scoped_ptr<media::AudioDecoder> decoder, |
22 mojo::InterfaceRequest<interfaces::AudioDecoder> request); | 25 mojo::InterfaceRequest<interfaces::AudioDecoder> request); |
23 | 26 |
24 ~MojoAudioDecoderService() final; | 27 ~MojoAudioDecoderService() final; |
25 | 28 |
26 // interfaces::AudioDecoder implementation | 29 // interfaces::AudioDecoder implementation |
27 void Initialize(interfaces::AudioDecoderClientPtr client, | 30 void Initialize(interfaces::AudioDecoderClientPtr client, |
28 interfaces::AudioDecoderConfigPtr config, | 31 interfaces::AudioDecoderConfigPtr config, |
29 int32_t cdm_id, | 32 int32_t cdm_id, |
30 const InitializeCallback& callback) final; | 33 const InitializeCallback& callback) final; |
(...skipping 23 matching lines...) Expand all Loading... |
54 scoped_refptr<DecoderBuffer> ReadDecoderBuffer( | 57 scoped_refptr<DecoderBuffer> ReadDecoderBuffer( |
55 interfaces::DecoderBufferPtr buffer); | 58 interfaces::DecoderBufferPtr buffer); |
56 | 59 |
57 // A binding represents the association between the service and the | 60 // A binding represents the association between the service and the |
58 // communication channel, i.e. the pipe. | 61 // communication channel, i.e. the pipe. |
59 mojo::StrongBinding<interfaces::AudioDecoder> binding_; | 62 mojo::StrongBinding<interfaces::AudioDecoder> binding_; |
60 | 63 |
61 // DataPipe for serializing the data section of DecoderBuffer. | 64 // DataPipe for serializing the data section of DecoderBuffer. |
62 mojo::ScopedDataPipeConsumerHandle consumer_handle_; | 65 mojo::ScopedDataPipeConsumerHandle consumer_handle_; |
63 | 66 |
| 67 // A helper object required to get CDM from CDM id. |
| 68 base::WeakPtr<MojoCdmServiceContext> mojo_cdm_service_context_; |
| 69 |
64 // The AudioDecoder that does actual decoding work. | 70 // The AudioDecoder that does actual decoding work. |
65 scoped_ptr<media::AudioDecoder> decoder_; | 71 scoped_ptr<media::AudioDecoder> decoder_; |
66 | 72 |
67 // The destination for the decoded buffers. | 73 // The destination for the decoded buffers. |
68 interfaces::AudioDecoderClientPtr client_; | 74 interfaces::AudioDecoderClientPtr client_; |
69 | 75 |
70 base::WeakPtr<MojoAudioDecoderService> weak_this_; | 76 base::WeakPtr<MojoAudioDecoderService> weak_this_; |
71 base::WeakPtrFactory<MojoAudioDecoderService> weak_factory_; | 77 base::WeakPtrFactory<MojoAudioDecoderService> weak_factory_; |
72 | 78 |
73 DISALLOW_COPY_AND_ASSIGN(MojoAudioDecoderService); | 79 DISALLOW_COPY_AND_ASSIGN(MojoAudioDecoderService); |
74 }; | 80 }; |
75 | 81 |
76 } // namespace media | 82 } // namespace media |
77 | 83 |
78 #endif // MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_SERVICE_H_ | 84 #endif // MEDIA_MOJO_SERVICES_MOJO_AUDIO_DECODER_SERVICE_H_ |
OLD | NEW |