OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_BASE_RENDERER_FACTORY_SELECTOR_H_ |
| 6 #define MEDIA_BASE_RENDERER_FACTORY_SELECTOR_H_ |
| 7 |
| 8 #include "base/containers/flat_map.h" |
| 9 #include "media/base/renderer_factory.h" |
| 10 |
| 11 namespace media { |
| 12 |
| 13 // RendererFactorySelector owns RendererFactory instances used within WMPI. |
| 14 // Its purpose is to aggregate the signals and centralize the logic behind |
| 15 // choosing which RendererFactory should be used when creating a new Renderer. |
| 16 class MEDIA_EXPORT RendererFactorySelector { |
| 17 public: |
| 18 enum FactoryType { |
| 19 DEFAULT, // DefaultRendererFactory. |
| 20 MOJO, // MojoRendererFactory. |
| 21 MEDIA_PLAYER, // MediaPlayerRendererClientFactory. |
| 22 ADAPTIVE, // AdaptiveRendererFactory. |
| 23 UNKNOWN, |
| 24 }; |
| 25 |
| 26 RendererFactorySelector(); |
| 27 ~RendererFactorySelector(); |
| 28 |
| 29 // NOTE: There should be at most one factory per factory type. |
| 30 void AddFactory(FactoryType type, std::unique_ptr<RendererFactory> factory); |
| 31 |
| 32 // Sets the "default" factory to be returned in the absence explicit signals |
| 33 // indicating that another factory type should be selected instead. |
| 34 void SetBaseFactoryType(FactoryType type); |
| 35 |
| 36 // Note: This only returns the base factory type at the moment. |
| 37 RendererFactory* GetCurrentFactory(); |
| 38 |
| 39 private: |
| 40 FactoryType base_factory_type_ = FactoryType::UNKNOWN; |
| 41 base::flat_map<FactoryType, std::unique_ptr<RendererFactory>> factories_; |
| 42 DISALLOW_COPY_AND_ASSIGN(RendererFactorySelector); |
| 43 }; |
| 44 |
| 45 } // namespace media |
| 46 |
| 47 #endif // MEDIA_BASE_RENDERER_FACTORY_H_ |
OLD | NEW |