Add mp2 container and codec support
AOSP doesn't support audio mp2 file, so mp2 audio file
with file extension .mp2 cannot be identified as an audio.
1. Add mp2 extension to mp3extractor.cpp and cannot use
mp2extractor as demuxer for mp2 file
2. Add MEDIA_MIMETYPE_AUDIO_MPEG_LAYER_II to Acodec.cpp when
configure omx component params; then audio channel and
samplerate can be configured correctly when init omx component
Bug: 123730913
Test: play mp2 file
Change-Id: I42d7cbc578f801df13f249ff41442f1ebf0e5180
diff --git a/media/extractors/mp3/MP3Extractor.cpp b/media/extractors/mp3/MP3Extractor.cpp
index 61838f6..a838ae6 100644
--- a/media/extractors/mp3/MP3Extractor.cpp
+++ b/media/extractors/mp3/MP3Extractor.cpp
@@ -708,6 +708,7 @@
}
static const char *extensions[] = {
+ "mp2",
"mp3",
"mpeg",
"mpg",
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index a1a2660..6d2329f 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -2092,7 +2092,8 @@
if (usingSwRenderer) {
outputFormat->setInt32("using-sw-renderer", 1);
}
- } else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_MPEG)) {
+ } else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_MPEG) ||
+ !strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_MPEG_LAYER_II)) {
int32_t numChannels, sampleRate;
if (!msg->findInt32("channel-count", &numChannels)
|| !msg->findInt32("sample-rate", &sampleRate)) {