From e366f52b1520f13306d5fef1c3c8a2b2c653d935 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Tue, 28 Jun 2011 10:51:41 -0700 Subject: Multiple changes to ACodec/codec tools: Make sure sf2 does not coalesce input buffers, generalize ACodec's codec instantiation based on OMXCodec's list of eligible component names. Some changes/additions to the "sf2" commandline tool Make surface options consistent with stagefright tool, i.e. use '-S' instead of '-s' New option '-R' renders surface-allocated buffers. Also fixes a longstanding bug introduced when generalizing from surfaces to native windows that never used surface-allocated buffers in sf2 even when the option was specified. Change-Id: I59fd533f0f6ef0337ebe2806ddc81a46878eb3ae --- media/libstagefright/ACodec.cpp | 63 +++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 22 deletions(-) (limited to 'media') diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index d628301..513eda8 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -401,11 +402,22 @@ status_t ACodec::allocateBuffersOnPort(OMX_U32 portIndex) { CHECK(mem.get() != NULL); IOMX::buffer_id buffer; -#if 0 - err = mOMX->allocateBufferWithBackup(mNode, portIndex, mem, &buffer); -#else - err = mOMX->useBuffer(mNode, portIndex, mem, &buffer); -#endif + + if (!strcasecmp( + mComponentName.c_str(), "OMX.TI.DUCATI1.VIDEO.DECODER")) { + if (portIndex == kPortIndexInput && i == 0) { + // Only log this warning once per allocation round. + + LOGW("OMX.TI.DUCATI1.VIDEO.DECODER requires the use of " + "OMX_AllocateBuffer instead of the preferred " + "OMX_UseBuffer. Vendor must fix this."); + } + + err = mOMX->allocateBufferWithBackup( + mNode, portIndex, mem, &buffer); + } else { + err = mOMX->useBuffer(mNode, portIndex, mem, &buffer); + } if (err != OK) { return err; @@ -891,6 +903,7 @@ status_t ACodec::setSupportedOutputFormat() { CHECK(format.eColorFormat == OMX_COLOR_FormatYUV420Planar || format.eColorFormat == OMX_COLOR_FormatYUV420SemiPlanar || format.eColorFormat == OMX_COLOR_FormatCbYCrY + || format.eColorFormat == OMX_TI_COLOR_FormatYUV420PackedSemiPlanar || format.eColorFormat == OMX_QCOM_COLOR_FormatYVU420SemiPlanar); return mOMX->setParameter( @@ -1639,27 +1652,33 @@ void ACodec::UninitializedState::onSetup( AString mime; CHECK(msg->findString("mime", &mime)); + Vector matchingCodecs; + OMXCodec::findMatchingCodecs( + mime.c_str(), + false, // createEncoder + NULL, // matchComponentName + 0, // flags + &matchingCodecs); + + sp observer = new CodecObserver; + IOMX::node_id node = NULL; + AString componentName; - if (!strcasecmp(mime.c_str(), MEDIA_MIMETYPE_VIDEO_AVC)) { - componentName = "OMX.Nvidia.h264.decode"; - } else if (!strcasecmp(mime.c_str(), MEDIA_MIMETYPE_AUDIO_AAC)) { - componentName = "OMX.google.aac.decoder"; - } else if (!strcasecmp(mime.c_str(), MEDIA_MIMETYPE_AUDIO_MPEG)) { - componentName = "OMX.Nvidia.mp3.decoder"; - } else if (!strcasecmp(mime.c_str(), MEDIA_MIMETYPE_VIDEO_MPEG2)) { - componentName = "OMX.Nvidia.mpeg2v.decode"; - } else if (!strcasecmp(mime.c_str(), MEDIA_MIMETYPE_VIDEO_MPEG4)) { - componentName = "OMX.google.mpeg4.decoder"; - } else { - TRESPASS(); - } + for (size_t matchIndex = 0; matchIndex < matchingCodecs.size(); + ++matchIndex) { + componentName = matchingCodecs.itemAt(matchIndex).string(); - sp observer = new CodecObserver; + status_t err = omx->allocateNode(componentName.c_str(), observer, &node); - IOMX::node_id node; - CHECK_EQ(omx->allocateNode(componentName.c_str(), observer, &node), - (status_t)OK); + if (err == OK) { + break; + } + + node = NULL; + } + + CHECK(node != NULL); sp notify = new AMessage(kWhatOMXMessage, mCodec->id()); observer->setNotificationMessage(notify); -- cgit v1.1