summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/OMXCodec.cpp
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2012-09-07 17:27:50 -0700
committerJames Dong <jdong@google.com>2012-09-10 16:37:26 -0700
commit2020801209f7f0f82ddd7635daf2c371b46ea6d6 (patch)
tree85b31efc5aed0defe61c7786061cf82e81cedc80 /media/libstagefright/OMXCodec.cpp
parent3e2e7a945cf0239b2f021294fc9786958f389ef9 (diff)
downloadframeworks_av-2020801209f7f0f82ddd7635daf2c371b46ea6d6.zip
frameworks_av-2020801209f7f0f82ddd7635daf2c371b46ea6d6.tar.gz
frameworks_av-2020801209f7f0f82ddd7635daf2c371b46ea6d6.tar.bz2
Allow OMXCodec to specify an output color format for OMX decoder component
The output color format is specified via the meta argument in OMXCodec::Create() o related-to-bug: 7122195 Change-Id: Id3247686b893af25cc190685201e53ad34b0399c
Diffstat (limited to 'media/libstagefright/OMXCodec.cpp')
-rwxr-xr-xmedia/libstagefright/OMXCodec.cpp34
1 files changed, 28 insertions, 6 deletions
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index d0e306c..233a733 100755
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -546,12 +546,8 @@ status_t OMXCodec::configureCodec(const sp<MetaData> &meta) {
if (mIsEncoder) {
setVideoInputFormat(mMIME, meta);
} else {
- int32_t width, height;
- bool success = meta->findInt32(kKeyWidth, &width);
- success = success && meta->findInt32(kKeyHeight, &height);
- CHECK(success);
status_t err = setVideoOutputFormat(
- mMIME, width, height);
+ mMIME, meta);
if (err != OK) {
return err;
@@ -1172,7 +1168,13 @@ status_t OMXCodec::setupAVCEncoderParameters(const sp<MetaData>& meta) {
}
status_t OMXCodec::setVideoOutputFormat(
- const char *mime, OMX_U32 width, OMX_U32 height) {
+ const char *mime, const sp<MetaData>& meta) {
+
+ int32_t width, height;
+ bool success = meta->findInt32(kKeyWidth, &width);
+ success = success && meta->findInt32(kKeyHeight, &height);
+ CHECK(success);
+
CODEC_LOGV("setVideoOutputFormat width=%ld, height=%ld", width, height);
OMX_VIDEO_CODINGTYPE compressionFormat = OMX_VIDEO_CodingUnused;
@@ -1218,6 +1220,26 @@ status_t OMXCodec::setVideoOutputFormat(
|| format.eColorFormat == OMX_QCOM_COLOR_FormatYVU420SemiPlanar
|| format.eColorFormat == OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka);
+ int32_t colorFormat;
+ if (meta->findInt32(kKeyColorFormat, &colorFormat)
+ && colorFormat != OMX_COLOR_FormatUnused
+ && colorFormat != format.eColorFormat) {
+
+ while (OMX_ErrorNoMore != err) {
+ format.nIndex++;
+ err = mOMX->getParameter(
+ mNode, OMX_IndexParamVideoPortFormat,
+ &format, sizeof(format));
+ if (format.eColorFormat == colorFormat) {
+ break;
+ }
+ }
+ if (format.eColorFormat != colorFormat) {
+ CODEC_LOGE("Color format %d is not supported", colorFormat);
+ return ERROR_UNSUPPORTED;
+ }
+ }
+
err = mOMX->setParameter(
mNode, OMX_IndexParamVideoPortFormat,
&format, sizeof(format));