| 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_BASE_MEDIA_CLIENT_H_ | 5 #ifndef MEDIA_BASE_MEDIA_CLIENT_H_ |
| 6 #define MEDIA_BASE_MEDIA_CLIENT_H_ | 6 #define MEDIA_BASE_MEDIA_CLIENT_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "media/base/decode_capabilities.h" | 12 #include "media/base/decode_capabilities.h" |
| 12 #include "media/base/key_system_properties.h" | 13 #include "media/base/key_system_properties.h" |
| 13 #include "media/base/media_export.h" | 14 #include "media/base/media_export.h" |
| 14 #include "media/base/video_codecs.h" | 15 #include "media/base/video_codecs.h" |
| 15 #include "media/base/video_color_space.h" | 16 #include "media/base/video_color_space.h" |
| 16 #include "ui/gfx/color_space.h" | 17 #include "ui/gfx/color_space.h" |
| 17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 18 | 19 |
| 19 namespace media { | 20 namespace media { |
| 20 | 21 |
| 21 class MediaClient; | 22 class MediaClient; |
| 22 | 23 |
| 23 // Setter for the client. If a customized client is needed, it should be set | 24 // Setter for the client. If a customized client is needed, it should be set |
| 24 // early, before the client could possibly be used. | 25 // early, before the client could possibly be used. |
| 25 MEDIA_EXPORT void SetMediaClient(MediaClient* media_client); | 26 MEDIA_EXPORT void SetMediaClient(MediaClient* media_client); |
| 26 | 27 |
| 27 // Media's embedder API should only be used by media. | 28 // Media's embedder API should only be used by media. |
| 28 #if defined(MEDIA_IMPLEMENTATION) || defined(MEDIA_BLINK_IMPLEMENTATION) | 29 #if defined(MEDIA_IMPLEMENTATION) || defined(MEDIA_BLINK_IMPLEMENTATION) |
| 29 // Getter for the client. Returns NULL if no customized client is needed. | 30 // Getter for the client. Returns NULL if no customized client is needed. |
| 30 MEDIA_EXPORT MediaClient* GetMediaClient(); | 31 MEDIA_EXPORT MediaClient* GetMediaClient(); |
| 31 #endif | 32 #endif |
| 32 | 33 |
| 33 struct MEDIA_EXPORT KeySystemInfoForUMA { | |
| 34 KeySystemInfoForUMA(const std::string& key_system, | |
| 35 const std::string& key_system_name_for_uma); | |
| 36 ~KeySystemInfoForUMA(); | |
| 37 | |
| 38 // Concrete key system name; | |
| 39 std::string key_system; | |
| 40 | |
| 41 // Display name for UMA reporting. For example, the display name for | |
| 42 // "org.w3.clearkey" is "ClearKey". When providing this value, make sure to | |
| 43 // update tools/metrics/histograms/histograms.xml. | |
| 44 std::string key_system_name_for_uma; | |
| 45 }; | |
| 46 | |
| 47 // A client interface for embedders (e.g. content/renderer) to provide | 34 // A client interface for embedders (e.g. content/renderer) to provide |
| 48 // customized service. | 35 // customized key systems and decoders. |
| 49 class MEDIA_EXPORT MediaClient { | 36 class MEDIA_EXPORT MediaClient { |
| 50 public: | 37 public: |
| 51 MediaClient(); | 38 MediaClient(); |
| 52 virtual ~MediaClient(); | 39 virtual ~MediaClient(); |
| 53 | 40 |
| 54 // Provides UMA info for key systems that SHOULD be reported to UMA, no matter | 41 // Adds properties for supported key systems. |
| 55 // whether a key system is actually supported by this client or not. Only | 42 virtual void AddSupportedKeySystems( |
| 56 // called once per instance. | 43 std::vector<std::unique_ptr<KeySystemProperties>>* key_systems) = 0; |
| 57 virtual void AddKeySystemsInfoForUMA( | |
| 58 std::vector<KeySystemInfoForUMA>* key_systems_info_for_uma) = 0; | |
| 59 | 44 |
| 60 // Returns whether client key systems properties should be updated. | 45 // Returns whether client key systems properties should be updated. |
| 46 // TODO(chcunningham): Refactor this to a proper change "observer" API that is |
| 47 // less fragile (don't assume AddSupportedKeySystems has just one caller). |
| 61 virtual bool IsKeySystemsUpdateNeeded() = 0; | 48 virtual bool IsKeySystemsUpdateNeeded() = 0; |
| 62 | 49 |
| 63 // Adds properties for supported key systems. | |
| 64 virtual void AddSupportedKeySystems( | |
| 65 std::vector<std::unique_ptr<KeySystemProperties>>* | |
| 66 key_systems_properties) = 0; | |
| 67 | |
| 68 // Records a domain and registry of a url to a Rappor privacy-preserving | |
| 69 // metric. See: https://www.chromium.org/developers/design-documents/rappor | |
| 70 virtual void RecordRapporURL(const std::string& metric, const GURL& url) = 0; | |
| 71 | |
| 72 // Returns true if the given audio config is supported. | 50 // Returns true if the given audio config is supported. |
| 73 virtual bool IsSupportedAudioConfig(const AudioConfig& config) = 0; | 51 virtual bool IsSupportedAudioConfig(const AudioConfig& config) = 0; |
| 74 | 52 |
| 75 // Returns true if the given combination of video codec, profile and level is | 53 // Returns true if the given video config is supported. |
| 76 // supported. The |level| value is codec-specific. | |
| 77 virtual bool IsSupportedVideoConfig(const VideoConfig& config) = 0; | 54 virtual bool IsSupportedVideoConfig(const VideoConfig& config) = 0; |
| 78 }; | 55 }; |
| 79 | 56 |
| 80 } // namespace media | 57 } // namespace media |
| 81 | 58 |
| 82 #endif // MEDIA_BASE_MEDIA_CLIENT_H_ | 59 #endif // MEDIA_BASE_MEDIA_CLIENT_H_ |
| OLD | NEW |