| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/android/media_codec_util.h" | 5 #include "media/base/android/media_codec_util.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "base/android/build_info.h" | 11 #include "base/android/build_info.h" |
| 12 #include "base/android/jni_android.h" | 12 #include "base/android/jni_android.h" |
| 13 #include "base/android/jni_array.h" | 13 #include "base/android/jni_array.h" |
| 14 #include "base/android/jni_string.h" | 14 #include "base/android/jni_string.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 17 #include "jni/MediaCodecUtil_jni.h" | 17 #include "jni/MediaCodecUtil_jni.h" |
| 18 #include "url/gurl.h" |
| 18 | 19 |
| 19 using base::android::AttachCurrentThread; | 20 using base::android::AttachCurrentThread; |
| 20 using base::android::ConvertJavaStringToUTF8; | 21 using base::android::ConvertJavaStringToUTF8; |
| 21 using base::android::ConvertUTF8ToJavaString; | 22 using base::android::ConvertUTF8ToJavaString; |
| 22 using base::android::JavaIntArrayToIntVector; | 23 using base::android::JavaIntArrayToIntVector; |
| 23 using base::android::ScopedJavaLocalRef; | 24 using base::android::ScopedJavaLocalRef; |
| 24 | 25 |
| 25 namespace media { | 26 namespace media { |
| 26 | 27 |
| 27 // static | 28 // static |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 base::CompareCase::SENSITIVE) || | 213 base::CompareCase::SENSITIVE) || |
| 213 base::StartsWith(codec_name, "OMX.MTK.", | 214 base::StartsWith(codec_name, "OMX.MTK.", |
| 214 base::CompareCase::SENSITIVE) || | 215 base::CompareCase::SENSITIVE) || |
| 215 base::StartsWith(codec_name, "OMX.Exynos.", | 216 base::StartsWith(codec_name, "OMX.Exynos.", |
| 216 base::CompareCase::SENSITIVE)); | 217 base::CompareCase::SENSITIVE)); |
| 217 } | 218 } |
| 218 return true; | 219 return true; |
| 219 } | 220 } |
| 220 | 221 |
| 221 // static | 222 // static |
| 223 bool MediaCodecUtil::IsHLSPath(const GURL& url) { |
| 224 if (!url.SchemeIsHTTPOrHTTPS() && !url.SchemeIsFile()) |
| 225 return false; |
| 226 |
| 227 std::string path = url.path(); |
| 228 return base::EndsWith(path, ".m3u8", base::CompareCase::INSENSITIVE_ASCII); |
| 229 } |
| 230 |
| 231 // static |
| 232 bool MediaCodecUtil::IsHLSURL(const GURL& url) { |
| 233 if (!url.SchemeIsHTTPOrHTTPS() && !url.SchemeIsFile()) |
| 234 return false; |
| 235 |
| 236 std::string spec = url.spec(); |
| 237 if (base::EndsWith(spec, ".m3u8", base::CompareCase::INSENSITIVE_ASCII)) |
| 238 return true; |
| 239 |
| 240 return (spec.find("m3u8") != std::string::npos); |
| 241 } |
| 242 |
| 243 // static |
| 222 bool MediaCodecUtil::RegisterMediaCodecUtil(JNIEnv* env) { | 244 bool MediaCodecUtil::RegisterMediaCodecUtil(JNIEnv* env) { |
| 223 return RegisterNativesImpl(env); | 245 return RegisterNativesImpl(env); |
| 224 } | 246 } |
| 225 | 247 |
| 226 } // namespace media | 248 } // namespace media |
| OLD | NEW |