OLD | NEW |
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_MOJO_SERVICES_MOJO_MEDIA_CLIENT_H_ | 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_MEDIA_CLIENT_H_ |
6 #define MEDIA_MOJO_SERVICES_MOJO_MEDIA_CLIENT_H_ | 6 #define MEDIA_MOJO_SERVICES_MOJO_MEDIA_CLIENT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "media/base/audio_decoder.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "media/base/audio_renderer_sink.h" | |
12 #include "media/base/cdm_factory.h" | |
13 #include "media/base/media_log.h" | |
14 #include "media/base/renderer_factory.h" | |
15 #include "media/base/video_renderer_sink.h" | |
16 | 11 |
17 namespace base { | 12 namespace base { |
18 class SingleThreadTaskRunner; | 13 class SingleThreadTaskRunner; |
19 } | 14 } |
20 | 15 |
21 namespace shell { | 16 namespace shell { |
22 namespace mojom { | 17 namespace mojom { |
23 class InterfaceProvider; | 18 class InterfaceProvider; |
24 } | 19 } |
25 } | 20 } |
26 | 21 |
27 namespace media { | 22 namespace media { |
28 | 23 |
| 24 class AudioDecoder; |
| 25 class AudioRendererSink; |
| 26 class CdmFactory; |
| 27 class MediaLog; |
| 28 class RendererFactory; |
| 29 class VideoDecoder; |
| 30 class VideoRendererSink; |
| 31 |
29 class MojoMediaClient { | 32 class MojoMediaClient { |
30 public: | 33 public: |
31 virtual ~MojoMediaClient(); | 34 virtual ~MojoMediaClient(); |
32 | 35 |
33 // Called exactly once before any other method. | 36 // Called exactly once before any other method. |
34 virtual void Initialize(); | 37 virtual void Initialize(); |
| 38 |
35 // Called before the host application is scheduled to quit. | 39 // Called before the host application is scheduled to quit. |
36 // The application message loop is still valid at this point, so all clean | 40 // The application message loop is still valid at this point, so all clean |
37 // up tasks requiring the message loop must be completed before returning. | 41 // up tasks requiring the message loop must be completed before returning. |
38 virtual void WillQuit(); | 42 virtual void WillQuit(); |
39 | 43 |
40 virtual std::unique_ptr<AudioDecoder> CreateAudioDecoder( | 44 virtual std::unique_ptr<AudioDecoder> CreateAudioDecoder( |
41 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 45 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
42 | 46 |
| 47 virtual std::unique_ptr<VideoDecoder> CreateVideoDecoder( |
| 48 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 49 |
43 // TODO(xhwang): Consider creating Renderer and CDM directly in the client | 50 // TODO(xhwang): Consider creating Renderer and CDM directly in the client |
44 // instead of creating factories. See http://crbug.com/586211 | 51 // instead of creating factories. See http://crbug.com/586211 |
45 | 52 |
46 // Returns the RendererFactory to be used by MojoRendererService. | 53 // Returns the RendererFactory to be used by MojoRendererService. |
47 virtual std::unique_ptr<RendererFactory> CreateRendererFactory( | 54 virtual std::unique_ptr<RendererFactory> CreateRendererFactory( |
48 const scoped_refptr<MediaLog>& media_log); | 55 const scoped_refptr<MediaLog>& media_log); |
49 | 56 |
50 // The output sink used for rendering audio or video respectively. They will | 57 // The output sink used for rendering audio or video respectively. They will |
51 // be used in the CreateRenderer() call on the RendererFactory returned by | 58 // be used in the CreateRenderer() call on the RendererFactory returned by |
52 // CreateRendererFactory(). May be null if the RendererFactory doesn't need an | 59 // CreateRendererFactory(). May be null if the RendererFactory doesn't need an |
53 // audio or video sink. If not null, the sink must be owned by the client. | 60 // audio or video sink. If not null, the sink must be owned by the client. |
54 virtual AudioRendererSink* CreateAudioRendererSink(); | 61 virtual AudioRendererSink* CreateAudioRendererSink(); |
55 virtual VideoRendererSink* CreateVideoRendererSink( | 62 virtual VideoRendererSink* CreateVideoRendererSink( |
56 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 63 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
57 | 64 |
58 // Returns the CdmFactory to be used by MojoCdmService. | 65 // Returns the CdmFactory to be used by MojoCdmService. |
59 virtual std::unique_ptr<CdmFactory> CreateCdmFactory( | 66 virtual std::unique_ptr<CdmFactory> CreateCdmFactory( |
60 shell::mojom::InterfaceProvider* interface_provider); | 67 shell::mojom::InterfaceProvider* interface_provider); |
61 | 68 |
62 protected: | 69 protected: |
63 MojoMediaClient(); | 70 MojoMediaClient(); |
64 }; | 71 }; |
65 | 72 |
66 } // namespace media | 73 } // namespace media |
67 | 74 |
68 #endif // MEDIA_MOJO_SERVICES_MOJO_MEDIA_CLIENT_H_ | 75 #endif // MEDIA_MOJO_SERVICES_MOJO_MEDIA_CLIENT_H_ |
OLD | NEW |