diff options
author | Lajos Molnar <lajos@google.com> | 2014-07-27 21:21:32 -0700 |
---|---|---|
committer | Lajos Molnar <lajos@google.com> | 2014-07-30 23:09:46 -0700 |
commit | 89869f692c35d0ca914c7de4a1f5ff63c9920634 (patch) | |
tree | 8a5df7d07075e88b8323c93cf6e4ab6b21f6f55c /media/libstagefright | |
parent | b382340f33ac2dc26fe825ceb3ef98bac8af974c (diff) | |
download | frameworks_av-89869f692c35d0ca914c7de4a1f5ff63c9920634.zip frameworks_av-89869f692c35d0ca914c7de4a1f5ff63c9920634.tar.gz frameworks_av-89869f692c35d0ca914c7de4a1f5ff63c9920634.tar.bz2 |
stagefright: enable decoder color format selection
Bug: 10706245
Change-Id: I9a77631bfae0358be229b079228c1fcae0e77faf
Diffstat (limited to 'media/libstagefright')
-rw-r--r-- | media/libstagefright/ACodec.cpp | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index 3fb174d..5b6e59e 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -1267,13 +1267,7 @@ status_t ACodec::configureCodec( if (encoder) { err = setupVideoEncoder(mime, msg); } else { - int32_t width, height; - if (!msg->findInt32("width", &width) - || !msg->findInt32("height", &height)) { - err = INVALID_OPERATION; - } else { - err = setupVideoDecoder(mime, width, height); - } + err = setupVideoDecoder(mime, msg); } } else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_MPEG)) { int32_t numChannels, sampleRate; @@ -1883,7 +1877,13 @@ static status_t GetMimeTypeForVideoCoding( } status_t ACodec::setupVideoDecoder( - const char *mime, int32_t width, int32_t height) { + const char *mime, const sp<AMessage> &msg) { + int32_t width, height; + if (!msg->findInt32("width", &width) + || !msg->findInt32("height", &height)) { + return INVALID_OPERATION; + } + OMX_VIDEO_CODINGTYPE compressionFormat; status_t err = GetVideoCodingTypeFromMime(mime, &compressionFormat); @@ -1898,7 +1898,20 @@ status_t ACodec::setupVideoDecoder( return err; } - err = setSupportedOutputFormat(); + int32_t tmp; + if (msg->findInt32("color-format", &tmp)) { + OMX_COLOR_FORMATTYPE colorFormat = + static_cast<OMX_COLOR_FORMATTYPE>(tmp); + err = setVideoPortFormatType( + kPortIndexOutput, OMX_VIDEO_CodingUnused, colorFormat); + if (err != OK) { + ALOGW("[%s] does not support color format %d", + mComponentName.c_str(), colorFormat); + err = setSupportedOutputFormat(); + } + } else { + err = setSupportedOutputFormat(); + } if (err != OK) { return err; |