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