Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(976)

Side by Side Diff: media/base/android/media_codec_util.cc

Issue 2466463005: Support (E)AC3 passthrough
Patch Set: Improve CastMediaClient::IsSupportedPassthroughAudio() Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 13 matching lines...) Expand all
24 using base::android::JavaIntArrayToIntVector; 24 using base::android::JavaIntArrayToIntVector;
25 using base::android::ScopedJavaLocalRef; 25 using base::android::ScopedJavaLocalRef;
26 26
27 namespace media { 27 namespace media {
28 28
29 namespace { 29 namespace {
30 30
31 const char kMp4aMimeType[] = "audio/mp4a-latm"; 31 const char kMp4aMimeType[] = "audio/mp4a-latm";
32 const char kOpusMimeType[] = "audio/opus"; 32 const char kOpusMimeType[] = "audio/opus";
33 const char kVorbisMimeType[] = "audio/vorbis"; 33 const char kVorbisMimeType[] = "audio/vorbis";
34 const char kAc3MimeType[] = "audio/ac3";
35 const char kEac3MimeType[] = "audio/eac3";
34 const char kAvcMimeType[] = "video/avc"; 36 const char kAvcMimeType[] = "video/avc";
35 const char kHevcMimeType[] = "video/hevc"; 37 const char kHevcMimeType[] = "video/hevc";
36 const char kVp8MimeType[] = "video/x-vnd.on2.vp8"; 38 const char kVp8MimeType[] = "video/x-vnd.on2.vp8";
37 const char kVp9MimeType[] = "video/x-vnd.on2.vp9"; 39 const char kVp9MimeType[] = "video/x-vnd.on2.vp9";
38 40
39 } // namespace 41 } // namespace
40 42
41 static std::string CodecTypeToAndroidMimeType(const std::string& codec) { 43 static std::string CodecTypeToAndroidMimeType(const std::string& codec) {
42 // TODO(xhwang): Shall we handle more detailed strings like "mp4a.40.2"? 44 // TODO(xhwang): Shall we handle more detailed strings like "mp4a.40.2"?
43 if (codec == "avc1") 45 if (codec == "avc1")
44 return kAvcMimeType; 46 return kAvcMimeType;
45 if (codec == "hvc1") 47 if (codec == "hvc1")
46 return kHevcMimeType; 48 return kHevcMimeType;
47 if (codec == "mp4a") 49 if (codec == "mp4a")
48 return kMp4aMimeType; 50 return kMp4aMimeType;
49 if (codec == "vp8" || codec == "vp8.0") 51 if (codec == "vp8" || codec == "vp8.0")
50 return kVp8MimeType; 52 return kVp8MimeType;
51 if (codec == "vp9" || codec == "vp9.0") 53 if (codec == "vp9" || codec == "vp9.0")
52 return kVp9MimeType; 54 return kVp9MimeType;
53 if (codec == "vorbis") 55 if (codec == "vorbis")
54 return kVorbisMimeType; 56 return kVorbisMimeType;
55 if (codec == "opus") 57 if (codec == "opus")
56 return kOpusMimeType; 58 return kOpusMimeType;
59 if (codec == "ac3")
60 return kAc3MimeType;
61 if (codec == "eac3")
62 return kEac3MimeType;
63
57 DLOG(WARNING) << "Cannot convert codec to Android MIME type: " << codec; 64 DLOG(WARNING) << "Cannot convert codec to Android MIME type: " << codec;
58 return std::string(); 65 return std::string();
59 } 66 }
60 67
61 static bool IsSupportedAndroidMimeType(const std::string& mime_type) { 68 static bool IsSupportedAndroidMimeType(const std::string& mime_type) {
62 std::vector<std::string> supported{ 69 std::vector<std::string> supported{
63 kMp4aMimeType, kOpusMimeType, kVorbisMimeType, kAvcMimeType, 70 kMp4aMimeType, kOpusMimeType, kVorbisMimeType, kAvcMimeType,
64 kHevcMimeType, kVp8MimeType, kVp9MimeType}; 71 kHevcMimeType, kVp8MimeType, kVp9MimeType};
65 return std::find(supported.begin(), supported.end(), mime_type) != 72 return std::find(supported.begin(), supported.end(), mime_type) !=
66 supported.end(); 73 supported.end();
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 (sdk_int == 18 && ("OMX.SEC.avc.dec" == codec_name || 265 (sdk_int == 18 && ("OMX.SEC.avc.dec" == codec_name ||
259 "OMX.SEC.avc.dec.secure" == codec_name)) || 266 "OMX.SEC.avc.dec.secure" == codec_name)) ||
260 (sdk_int == 19 && 267 (sdk_int == 19 &&
261 base::StartsWith(base::android::BuildInfo::GetInstance()->model(), 268 base::StartsWith(base::android::BuildInfo::GetInstance()->model(),
262 "SM-G800", base::CompareCase::INSENSITIVE_ASCII) && 269 "SM-G800", base::CompareCase::INSENSITIVE_ASCII) &&
263 ("OMX.Exynos.avc.dec" == codec_name || 270 ("OMX.Exynos.avc.dec" == codec_name ||
264 "OMX.Exynos.avc.dec.secure" == codec_name)); 271 "OMX.Exynos.avc.dec.secure" == codec_name));
265 } 272 }
266 273
267 } // namespace media 274 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698