summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorRachad <rachad@google.com>2015-01-10 02:00:10 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-01-10 02:00:10 +0000
commit7e85361e364bf8f80ab43dd5feb0f584e481019e (patch)
treefbc76909e02d1aab4f53f2ec76063c0ce92fbdd0 /media
parente6453027baf4c79e95b31aa602b18621e3118423 (diff)
parent26c73acb73b5af94cb27e5d285d1708d25eb6892 (diff)
downloadframeworks_av-7e85361e364bf8f80ab43dd5feb0f584e481019e.zip
frameworks_av-7e85361e364bf8f80ab43dd5feb0f584e481019e.tar.gz
frameworks_av-7e85361e364bf8f80ab43dd5feb0f584e481019e.tar.bz2
am 26c73acb: am 0b460ad7: Merge "ACodec: Added support for E-AC3 decoders" into lmp-mr1-dev
* commit '26c73acb73b5af94cb27e5d285d1708d25eb6892': ACodec: Added support for E-AC3 decoders
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/ACodec.cpp67
-rw-r--r--media/libstagefright/MediaDefs.cpp1
2 files changed, 68 insertions, 0 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 5999489..fa31c44 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -1105,6 +1105,8 @@ status_t ACodec::setComponentRole(
"video_decoder.mpeg2", "video_encoder.mpeg2" },
{ MEDIA_MIMETYPE_AUDIO_AC3,
"audio_decoder.ac3", "audio_encoder.ac3" },
+ { MEDIA_MIMETYPE_AUDIO_EAC3,
+ "audio_decoder.eac3", "audio_encoder.eac3" },
};
static const size_t kNumMimeToRole =
@@ -1539,6 +1541,15 @@ status_t ACodec::configureCodec(
} else {
err = setupAC3Codec(encoder, numChannels, sampleRate);
}
+ } else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_EAC3)) {
+ int32_t numChannels;
+ int32_t sampleRate;
+ if (!msg->findInt32("channel-count", &numChannels)
+ || !msg->findInt32("sample-rate", &sampleRate)) {
+ err = INVALID_OPERATION;
+ } else {
+ err = setupEAC3Codec(encoder, numChannels, sampleRate);
+ }
}
if (err != OK) {
@@ -1824,6 +1835,44 @@ status_t ACodec::setupAC3Codec(
sizeof(def));
}
+status_t ACodec::setupEAC3Codec(
+ bool encoder, int32_t numChannels, int32_t sampleRate) {
+ status_t err = setupRawAudioFormat(
+ encoder ? kPortIndexInput : kPortIndexOutput, sampleRate, numChannels);
+
+ if (err != OK) {
+ return err;
+ }
+
+ if (encoder) {
+ ALOGW("EAC3 encoding is not supported.");
+ return INVALID_OPERATION;
+ }
+
+ OMX_AUDIO_PARAM_ANDROID_EAC3TYPE def;
+ InitOMXParams(&def);
+ def.nPortIndex = kPortIndexInput;
+
+ err = mOMX->getParameter(
+ mNode,
+ (OMX_INDEXTYPE)OMX_IndexParamAudioAndroidEac3,
+ &def,
+ sizeof(def));
+
+ if (err != OK) {
+ return err;
+ }
+
+ def.nChannels = numChannels;
+ def.nSampleRate = sampleRate;
+
+ return mOMX->setParameter(
+ mNode,
+ (OMX_INDEXTYPE)OMX_IndexParamAudioAndroidEac3,
+ &def,
+ sizeof(def));
+}
+
static OMX_AUDIO_AMRBANDMODETYPE pickModeFromBitRate(
bool isAMRWB, int32_t bps) {
if (isAMRWB) {
@@ -3498,6 +3547,24 @@ status_t ACodec::getPortFormat(OMX_U32 portIndex, sp<AMessage> &notify) {
break;
}
+ case OMX_AUDIO_CodingAndroidEAC3:
+ {
+ OMX_AUDIO_PARAM_ANDROID_EAC3TYPE params;
+ InitOMXParams(&params);
+ params.nPortIndex = portIndex;
+
+ CHECK_EQ((status_t)OK, mOMX->getParameter(
+ mNode,
+ (OMX_INDEXTYPE)OMX_IndexParamAudioAndroidEac3,
+ &params,
+ sizeof(params)));
+
+ notify->setString("mime", MEDIA_MIMETYPE_AUDIO_EAC3);
+ notify->setInt32("channel-count", params.nChannels);
+ notify->setInt32("sample-rate", params.nSampleRate);
+ break;
+ }
+
case OMX_AUDIO_CodingAndroidOPUS:
{
OMX_AUDIO_PARAM_ANDROID_OPUSTYPE params;
diff --git a/media/libstagefright/MediaDefs.cpp b/media/libstagefright/MediaDefs.cpp
index d48dd84..c5a6939 100644
--- a/media/libstagefright/MediaDefs.cpp
+++ b/media/libstagefright/MediaDefs.cpp
@@ -45,6 +45,7 @@ const char *MEDIA_MIMETYPE_AUDIO_FLAC = "audio/flac";
const char *MEDIA_MIMETYPE_AUDIO_AAC_ADTS = "audio/aac-adts";
const char *MEDIA_MIMETYPE_AUDIO_MSGSM = "audio/gsm";
const char *MEDIA_MIMETYPE_AUDIO_AC3 = "audio/ac3";
+const char *MEDIA_MIMETYPE_AUDIO_EAC3 = "audio/eac3";
const char *MEDIA_MIMETYPE_CONTAINER_MPEG4 = "video/mp4";
const char *MEDIA_MIMETYPE_CONTAINER_WAV = "audio/x-wav";