summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-09-09 13:55:48 -0400
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-09-09 13:55:48 -0400
commit4e60d7e60b29c42c6745dd23ff90dced8834fa7c (patch)
treea95bca3226c5ced8ac9fbfe905b103433922f6a9
parent100f08613392c225b8dff3f1e1d586f981884e29 (diff)
parentee606e66b0c1bc3527ecaffbbe95486d2ff5009e (diff)
downloadframeworks_base-4e60d7e60b29c42c6745dd23ff90dced8834fa7c.zip
frameworks_base-4e60d7e60b29c42c6745dd23ff90dced8834fa7c.tar.gz
frameworks_base-4e60d7e60b29c42c6745dd23ff90dced8834fa7c.tar.bz2
Merge change 24179 into eclair
* changes: Support encoding amr-wb content in stagefright.
-rw-r--r--cmds/stagefright/record.cpp4
-rw-r--r--include/media/stagefright/OMXCodec.h1
-rw-r--r--media/libstagefright/OMXCodec.cpp37
3 files changed, 40 insertions, 2 deletions
diff --git a/cmds/stagefright/record.cpp b/cmds/stagefright/record.cpp
index 81a1c0a..4751580 100644
--- a/cmds/stagefright/record.cpp
+++ b/cmds/stagefright/record.cpp
@@ -228,7 +228,7 @@ int main(int argc, char **argv) {
#endif
sp<MetaData> encMeta = new MetaData;
- encMeta->setCString(kKeyMIMEType, 1 ? "audio/3gpp" : "audio/mp4a-latm");
+ encMeta->setCString(kKeyMIMEType, 1 ? "audio/amr-wb" : "audio/mp4a-latm");
encMeta->setInt32(kKeySampleRate, kSampleRate);
encMeta->setInt32(kKeyChannelCount, kNumChannels);
encMeta->setInt32(kKeyMaxInputSize, 8192);
@@ -248,7 +248,7 @@ int main(int argc, char **argv) {
buffer->release();
buffer = NULL;
- if (++n == 10000) {
+ if (++n == 100) {
break;
}
}
diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h
index ac45481..7f99553 100644
--- a/include/media/stagefright/OMXCodec.h
+++ b/include/media/stagefright/OMXCodec.h
@@ -138,6 +138,7 @@ private:
void setComponentRole();
void setAMRFormat();
+ void setAMRWBFormat();
void setAACFormat(int32_t numChannels, int32_t sampleRate);
status_t setVideoPortFormatType(
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index d01d6af..3cba142 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -49,6 +49,7 @@ static const CodecInfo kDecoderInfo[] = {
{ "audio/mpeg", "OMX.PV.mp3dec" },
{ "audio/3gpp", "OMX.TI.AMR.decode" },
{ "audio/3gpp", "OMX.PV.amrdec" },
+ { "audio/amr-wb", "OMX.TI.WBAMR.decode" },
{ "audio/mp4a-latm", "OMX.TI.AAC.decode" },
{ "audio/mp4a-latm", "OMX.PV.aacdec" },
{ "video/mp4v-es", "OMX.qcom.video.decoder.mpeg4" },
@@ -65,6 +66,7 @@ static const CodecInfo kDecoderInfo[] = {
static const CodecInfo kEncoderInfo[] = {
{ "audio/3gpp", "OMX.TI.AMR.encode" },
{ "audio/3gpp", "OMX.PV.amrencnb" },
+ { "audio/amr-wb", "OMX.TI.WBAMR.encode" },
{ "audio/mp4a-latm", "OMX.TI.AAC.encode" },
{ "audio/mp4a-latm", "OMX.PV.aacenc" },
{ "video/mp4v-es", "OMX.qcom.video.encoder.mpeg4" },
@@ -317,6 +319,9 @@ sp<OMXCodec> OMXCodec::Create(
if (!strcasecmp("audio/3gpp", mime)) {
codec->setAMRFormat();
}
+ if (!strcasecmp("audio/amr-wb", mime)) {
+ codec->setAMRWBFormat();
+ }
if (!strcasecmp("audio/mp4a-latm", mime)) {
int32_t numChannels, sampleRate;
CHECK(meta->findInt32(kKeyChannelCount, &numChannels));
@@ -673,6 +678,7 @@ void OMXCodec::setComponentRole() {
static const MimeToRole kMimeToRole[] = {
{ "audio/mpeg", "audio_decoder.mp3", "audio_encoder.mp3" },
{ "audio/3gpp", "audio_decoder.amrnb", "audio_encoder.amrnb" },
+ { "audio/amr-wb", "audio_decoder.amrwb", "audio_encoder.amrwb" },
{ "audio/mp4a-latm", "audio_decoder.aac", "audio_encoder.aac" },
{ "video/avc", "video_decoder.avc", "video_encoder.avc" },
{ "video/mp4v-es", "video_decoder.mpeg4", "video_encoder.mpeg4" },
@@ -1548,6 +1554,37 @@ void OMXCodec::setAMRFormat() {
}
}
+void OMXCodec::setAMRWBFormat() {
+ if (!mIsEncoder) {
+ OMX_AUDIO_PARAM_AMRTYPE def;
+ InitOMXParams(&def);
+ def.nPortIndex = kPortIndexInput;
+
+ status_t err =
+ mOMX->get_parameter(mNode, OMX_IndexParamAudioAmr, &def, sizeof(def));
+
+ CHECK_EQ(err, OK);
+
+ def.eAMRFrameFormat = OMX_AUDIO_AMRFrameFormatFSF;
+ def.eAMRBandMode = OMX_AUDIO_AMRBandModeWB0;
+
+ err = mOMX->set_parameter(mNode, OMX_IndexParamAudioAmr, &def, sizeof(def));
+ CHECK_EQ(err, OK);
+ }
+
+ ////////////////////////
+
+ if (mIsEncoder) {
+ sp<MetaData> format = mSource->getFormat();
+ int32_t sampleRate;
+ int32_t numChannels;
+ CHECK(format->findInt32(kKeySampleRate, &sampleRate));
+ CHECK(format->findInt32(kKeyChannelCount, &numChannels));
+
+ setRawAudioFormat(kPortIndexInput, sampleRate, numChannels);
+ }
+}
+
void OMXCodec::setAACFormat(int32_t numChannels, int32_t sampleRate) {
if (mIsEncoder) {
setRawAudioFormat(kPortIndexInput, sampleRate, numChannels);