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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 return "audio/mp4a-latm"; | 46 return "audio/mp4a-latm"; |
47 default: | 47 default: |
48 return std::string(); | 48 return std::string(); |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 static const std::string VideoCodecToAndroidMimeType(const VideoCodec& codec) { | 52 static const std::string VideoCodecToAndroidMimeType(const VideoCodec& codec) { |
53 switch (codec) { | 53 switch (codec) { |
54 case kCodecH264: | 54 case kCodecH264: |
55 return "video/avc"; | 55 return "video/avc"; |
| 56 case kCodecHEVC: |
| 57 return "video/hevc"; |
56 case kCodecVP8: | 58 case kCodecVP8: |
57 return "video/x-vnd.on2.vp8"; | 59 return "video/x-vnd.on2.vp8"; |
58 case kCodecVP9: | 60 case kCodecVP9: |
59 return "video/x-vnd.on2.vp9"; | 61 return "video/x-vnd.on2.vp9"; |
60 default: | 62 default: |
61 return std::string(); | 63 return std::string(); |
62 } | 64 } |
63 } | 65 } |
64 | 66 |
65 static const std::string CodecTypeToAndroidMimeType(const std::string& codec) { | 67 static const std::string CodecTypeToAndroidMimeType(const std::string& codec) { |
66 // TODO(xhwang): Shall we handle more detailed strings like "mp4a.40.2"? | 68 // TODO(xhwang): Shall we handle more detailed strings like "mp4a.40.2"? |
67 if (codec == "avc1") | 69 if (codec == "avc1") |
68 return "video/avc"; | 70 return "video/avc"; |
| 71 if (codec == "hvc1") |
| 72 return "video/hevc"; |
69 if (codec == "mp4a") | 73 if (codec == "mp4a") |
70 return "audio/mp4a-latm"; | 74 return "audio/mp4a-latm"; |
71 if (codec == "vp8" || codec == "vp8.0") | 75 if (codec == "vp8" || codec == "vp8.0") |
72 return "video/x-vnd.on2.vp8"; | 76 return "video/x-vnd.on2.vp8"; |
73 if (codec == "vp9" || codec == "vp9.0") | 77 if (codec == "vp9" || codec == "vp9.0") |
74 return "video/x-vnd.on2.vp9"; | 78 return "video/x-vnd.on2.vp9"; |
75 if (codec == "vorbis") | 79 if (codec == "vorbis") |
76 return "audio/vorbis"; | 80 return "audio/vorbis"; |
77 if (codec == "opus") | 81 if (codec == "opus") |
78 return "audio/opus"; | 82 return "audio/opus"; |
79 return std::string(); | 83 return std::string(); |
80 } | 84 } |
81 | 85 |
82 // TODO(qinmin): using a map to help all the conversions in this class. | 86 // TODO(qinmin): using a map to help all the conversions in this class. |
83 static const std::string AndroidMimeTypeToCodecType(const std::string& mime) { | 87 static const std::string AndroidMimeTypeToCodecType(const std::string& mime) { |
84 if (mime == "video/mp4v-es") | 88 if (mime == "video/mp4v-es") |
85 return "mp4v"; | 89 return "mp4v"; |
86 if (mime == "video/avc") | 90 if (mime == "video/avc") |
87 return "avc1"; | 91 return "avc1"; |
| 92 if (mime == "video/hevc") |
| 93 return "hvc1"; |
88 if (mime == "video/x-vnd.on2.vp8") | 94 if (mime == "video/x-vnd.on2.vp8") |
89 return "vp8"; | 95 return "vp8"; |
90 if (mime == "video/x-vnd.on2.vp9") | 96 if (mime == "video/x-vnd.on2.vp9") |
91 return "vp9"; | 97 return "vp9"; |
92 if (mime == "audio/mp4a-latm") | 98 if (mime == "audio/mp4a-latm") |
93 return "mp4a"; | 99 return "mp4a"; |
94 if (mime == "audio/mpeg") | 100 if (mime == "audio/mpeg") |
95 return "mp3"; | 101 return "mp3"; |
96 if (mime == "audio/vorbis") | 102 if (mime == "audio/vorbis") |
97 return "vorbis"; | 103 return "vorbis"; |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 JNIEnv* env = AttachCurrentThread(); | 859 JNIEnv* env = AttachCurrentThread(); |
854 return Java_MediaCodecBridge_isAdaptivePlaybackSupported( | 860 return Java_MediaCodecBridge_isAdaptivePlaybackSupported( |
855 env, media_codec(), width, height); | 861 env, media_codec(), width, height); |
856 } | 862 } |
857 | 863 |
858 bool MediaCodecBridge::RegisterMediaCodecBridge(JNIEnv* env) { | 864 bool MediaCodecBridge::RegisterMediaCodecBridge(JNIEnv* env) { |
859 return RegisterNativesImpl(env); | 865 return RegisterNativesImpl(env); |
860 } | 866 } |
861 | 867 |
862 } // namespace media | 868 } // namespace media |
OLD | NEW |