OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/android/media_codec_bridge.h" | 5 #include "media/base/android/media_codec_bridge.h" |
6 | 6 |
7 #include <jni.h> | 7 #include <jni.h> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/android/build_info.h" | 10 #include "base/android/build_info.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 return std::string(); | 42 return std::string(); |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 static const std::string VideoCodecToAndroidMimeType(const VideoCodec& codec) { | 46 static const std::string VideoCodecToAndroidMimeType(const VideoCodec& codec) { |
47 switch (codec) { | 47 switch (codec) { |
48 case kCodecH264: | 48 case kCodecH264: |
49 return "video/avc"; | 49 return "video/avc"; |
50 case kCodecVP8: | 50 case kCodecVP8: |
51 return "video/x-vnd.on2.vp8"; | 51 return "video/x-vnd.on2.vp8"; |
| 52 case kCodecVP9: |
| 53 return "video/x-vnd.on2.vp9"; |
52 default: | 54 default: |
53 return std::string(); | 55 return std::string(); |
54 } | 56 } |
55 } | 57 } |
56 | 58 |
57 static const std::string CodecTypeToAndroidMimeType(const std::string& codec) { | 59 static const std::string CodecTypeToAndroidMimeType(const std::string& codec) { |
58 // TODO(xhwang): Shall we handle more detailed strings like "mp4a.40.2"? | 60 // TODO(xhwang): Shall we handle more detailed strings like "mp4a.40.2"? |
59 if (codec == "avc1") | 61 if (codec == "avc1") |
60 return "video/avc"; | 62 return "video/avc"; |
61 if (codec == "mp4a") | 63 if (codec == "mp4a") |
62 return "audio/mp4a-latm"; | 64 return "audio/mp4a-latm"; |
63 if (codec == "vp8" || codec == "vp8.0") | 65 if (codec == "vp8" || codec == "vp8.0") |
64 return "video/x-vnd.on2.vp8"; | 66 return "video/x-vnd.on2.vp8"; |
| 67 if (codec == "vp9" || codec == "vp9.0") |
| 68 return "video/x-vnd.on2.vp9"; |
65 if (codec == "vorbis") | 69 if (codec == "vorbis") |
66 return "audio/vorbis"; | 70 return "audio/vorbis"; |
67 return std::string(); | 71 return std::string(); |
68 } | 72 } |
69 | 73 |
70 // TODO(qinmin): using a map to help all the conversions in this class. | 74 // TODO(qinmin): using a map to help all the conversions in this class. |
71 static const std::string AndroidMimeTypeToCodecType(const std::string& mime) { | 75 static const std::string AndroidMimeTypeToCodecType(const std::string& mime) { |
72 if (mime == "video/mp4v-es") | 76 if (mime == "video/mp4v-es") |
73 return "mp4v"; | 77 return "mp4v"; |
74 if (mime == "video/avc") | 78 if (mime == "video/avc") |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 bool VideoCodecBridge::IsKnownUnaccelerated(const VideoCodec& codec) { | 541 bool VideoCodecBridge::IsKnownUnaccelerated(const VideoCodec& codec) { |
538 return MediaCodecBridge::IsKnownUnaccelerated( | 542 return MediaCodecBridge::IsKnownUnaccelerated( |
539 VideoCodecToAndroidMimeType(codec)); | 543 VideoCodecToAndroidMimeType(codec)); |
540 } | 544 } |
541 | 545 |
542 bool MediaCodecBridge::RegisterMediaCodecBridge(JNIEnv* env) { | 546 bool MediaCodecBridge::RegisterMediaCodecBridge(JNIEnv* env) { |
543 return RegisterNativesImpl(env); | 547 return RegisterNativesImpl(env); |
544 } | 548 } |
545 | 549 |
546 } // namespace media | 550 } // namespace media |
OLD | NEW |