OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "media/base/media.h" | 5 #include "media/base/media.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #if defined(OS_ANDROID) | 50 #if defined(OS_ANDROID) |
51 void enable_platform_decoder_support() { | 51 void enable_platform_decoder_support() { |
52 has_platform_decoder_support_ = true; | 52 has_platform_decoder_support_ = true; |
53 } | 53 } |
54 | 54 |
55 bool has_platform_decoder_support() const { | 55 bool has_platform_decoder_support() const { |
56 return has_platform_decoder_support_; | 56 return has_platform_decoder_support_; |
57 } | 57 } |
58 #endif // defined(OS_ANDROID) | 58 #endif // defined(OS_ANDROID) |
59 | 59 |
| 60 void enable_new_vp9_codec_string_support() { |
| 61 has_new_vp9_codec_string_support_ = true; |
| 62 } |
| 63 |
| 64 bool has_new_vp9_codec_string_support() { |
| 65 return has_new_vp9_codec_string_support_; |
| 66 } |
| 67 |
60 private: | 68 private: |
61 ~MediaInitializer() = delete; | 69 ~MediaInitializer() = delete; |
62 | 70 |
63 #if defined(OS_ANDROID) | 71 #if defined(OS_ANDROID) |
64 bool has_platform_decoder_support_ = false; | 72 bool has_platform_decoder_support_ = false; |
65 #endif // defined(OS_ANDROID) | 73 #endif // defined(OS_ANDROID) |
66 | 74 |
| 75 bool has_new_vp9_codec_string_support_ = false; |
| 76 |
67 DISALLOW_COPY_AND_ASSIGN(MediaInitializer); | 77 DISALLOW_COPY_AND_ASSIGN(MediaInitializer); |
68 }; | 78 }; |
69 | 79 |
70 static MediaInitializer* GetMediaInstance() { | 80 static MediaInitializer* GetMediaInstance() { |
71 static MediaInitializer* instance = new MediaInitializer(); | 81 static MediaInitializer* instance = new MediaInitializer(); |
72 return instance; | 82 return instance; |
73 } | 83 } |
74 | 84 |
75 void InitializeMediaLibrary() { | 85 void InitializeMediaLibrary() { |
76 GetMediaInstance(); | 86 GetMediaInstance(); |
77 } | 87 } |
78 | 88 |
79 #if defined(OS_ANDROID) | 89 #if defined(OS_ANDROID) |
80 void EnablePlatformDecoderSupport() { | 90 void EnablePlatformDecoderSupport() { |
81 GetMediaInstance()->enable_platform_decoder_support(); | 91 GetMediaInstance()->enable_platform_decoder_support(); |
82 } | 92 } |
83 | 93 |
84 bool HasPlatformDecoderSupport() { | 94 bool HasPlatformDecoderSupport() { |
85 return GetMediaInstance()->has_platform_decoder_support(); | 95 return GetMediaInstance()->has_platform_decoder_support(); |
86 } | 96 } |
87 | 97 |
88 bool PlatformHasOpusSupport() { | 98 bool PlatformHasOpusSupport() { |
89 return base::android::BuildInfo::GetInstance()->sdk_int() >= 21; | 99 return base::android::BuildInfo::GetInstance()->sdk_int() >= 21; |
90 } | 100 } |
91 #endif // defined(OS_ANDROID) | 101 #endif // defined(OS_ANDROID) |
92 | 102 |
| 103 void EnableNewVp9CodecStringSupport() { |
| 104 GetMediaInstance()->enable_new_vp9_codec_string_support(); |
| 105 } |
| 106 |
| 107 bool HasNewVp9CodecStringSupport() { |
| 108 return GetMediaInstance()->has_new_vp9_codec_string_support(); |
| 109 } |
| 110 |
93 } // namespace media | 111 } // namespace media |
OLD | NEW |