| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/mime_util.h" | 5 #include "media/base/mime_util.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | |
| 8 #include "media/base/mime_util_internal.h" | 7 #include "media/base/mime_util_internal.h" |
| 9 | 8 |
| 10 namespace media { | 9 namespace media { |
| 11 | 10 |
| 12 // This variable is Leaky because it is accessed from WorkerPool threads. | 11 // This variable is Leaky because it is accessed from WorkerPool threads. |
| 13 static base::LazyInstance<internal::MimeUtil>::Leaky g_media_mime_util = | 12 static internal::MimeUtil* GetMimeUtil() { |
| 14 LAZY_INSTANCE_INITIALIZER; | 13 static internal::MimeUtil* mime_util = new internal::MimeUtil(); |
| 14 return mime_util; |
| 15 } |
| 15 | 16 |
| 16 bool IsSupportedMediaMimeType(const std::string& mime_type) { | 17 bool IsSupportedMediaMimeType(const std::string& mime_type) { |
| 17 return g_media_mime_util.Pointer()->IsSupportedMediaMimeType(mime_type); | 18 return GetMimeUtil()->IsSupportedMediaMimeType(mime_type); |
| 18 } | 19 } |
| 19 | 20 |
| 20 SupportsType IsSupportedMediaFormat(const std::string& mime_type, | 21 SupportsType IsSupportedMediaFormat(const std::string& mime_type, |
| 21 const std::vector<std::string>& codecs) { | 22 const std::vector<std::string>& codecs) { |
| 22 return g_media_mime_util.Pointer()->IsSupportedMediaFormat(mime_type, codecs, | 23 return GetMimeUtil()->IsSupportedMediaFormat(mime_type, codecs, false); |
| 23 false); | |
| 24 } | 24 } |
| 25 | 25 |
| 26 SupportsType IsSupportedEncryptedMediaFormat( | 26 SupportsType IsSupportedEncryptedMediaFormat( |
| 27 const std::string& mime_type, | 27 const std::string& mime_type, |
| 28 const std::vector<std::string>& codecs) { | 28 const std::vector<std::string>& codecs) { |
| 29 return g_media_mime_util.Pointer()->IsSupportedMediaFormat(mime_type, codecs, | 29 return GetMimeUtil()->IsSupportedMediaFormat(mime_type, codecs, true); |
| 30 true); | |
| 31 } | 30 } |
| 32 | 31 |
| 33 void ParseCodecString(const std::string& codecs, | 32 void ParseCodecString(const std::string& codecs, |
| 34 std::vector<std::string>* codecs_out, | 33 std::vector<std::string>* codecs_out, |
| 35 bool strip) { | 34 bool strip) { |
| 36 g_media_mime_util.Pointer()->ParseCodecString(codecs, codecs_out, strip); | 35 GetMimeUtil()->ParseCodecString(codecs, codecs_out, strip); |
| 37 } | 36 } |
| 38 | 37 |
| 39 void RemoveProprietaryMediaTypesAndCodecsForTests() { | 38 void RemoveProprietaryMediaTypesAndCodecsForTests() { |
| 40 g_media_mime_util.Pointer()->RemoveProprietaryMediaTypesAndCodecs(); | 39 GetMimeUtil()->RemoveProprietaryMediaTypesAndCodecs(); |
| 41 } | 40 } |
| 42 | 41 |
| 43 } // namespace media | 42 } // namespace media |
| OLD | NEW |