aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2009-12-14 11:59:51 -0800
committerJames Dong <jdong@google.com>2009-12-14 12:07:33 -0800
commitf79964007dc0092755216ee94bbdc699537e2a74 (patch)
tree079453d335de3b9ece09477df4e40d8a51aed97d
parent472fe88597d3c7df17013a193391f0169ead7052 (diff)
downloadopencore-f79964007dc0092755216ee94bbdc699537e2a74.tar.gz
Use hw-based codec if a sw-based codec is not available but a hw-based codec is, when sw-based codec decoders are requested.
Thus, the request for sw-based codec becomes "preferred" request now, instead of "forced" ones.
-rw-r--r--codecs_v2/omx/omx_mastercore/src/pv_omxmastercore.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/codecs_v2/omx/omx_mastercore/src/pv_omxmastercore.cpp b/codecs_v2/omx/omx_mastercore/src/pv_omxmastercore.cpp
index b6360d2f3..20662ed8c 100644
--- a/codecs_v2/omx/omx_mastercore/src/pv_omxmastercore.cpp
+++ b/codecs_v2/omx/omx_mastercore/src/pv_omxmastercore.cpp
@@ -563,21 +563,32 @@ OSCL_EXPORT_REF OMX_ERRORTYPE OMX_APIENTRY OMX_MasterGetHandle(
return OMX_ErrorInsufficientResources;
}
+ OMX_S32 hwCodecFoundWhenSoftwareCodecIsRequested = -1;
for (ii = 0; ii < (data->iTotalNumOMXComponents); ii++)
{
// go through the list of supported components and find the component based on its name (identifier)
if (!oscl_strcmp((OMX_STRING)pOMXMasterRegistry[ii].CompName, cComponentName))
{
- // when we are not requesting a HW accelelrated codec, we must find a software
- // codec.
+ // when we are not requesting a HW accelelrated codec
+ // we prefer to find a software-based codec.
if (!bHWAccelerated) {
- if (!pOMXMasterRegistry[ii].bHWAccelerated) break;
+ if (!pOMXMasterRegistry[ii].bHWAccelerated)
+ {
+ break;
+ }
+ else if (hwCodecFoundWhenSoftwareCodecIsRequested == -1)
+ {
+ // Store the first hardware-based codec found
+ // In case we could not find any software-based codec, we will
+ // use this hareware-based codec
+ hwCodecFoundWhenSoftwareCodecIsRequested = ii;
+ }
} else {
break;
}
}
}
- if (ii == (data->iTotalNumOMXComponents))
+ if (ii == (data->iTotalNumOMXComponents) && hwCodecFoundWhenSoftwareCodecIsRequested == -1)
{
// could not find a component with the given name
OsclSingletonRegistry::registerInstanceAndUnlock(data, OSCL_SINGLETON_ID_OMXMASTERCORE, error);
@@ -589,6 +600,10 @@ OSCL_EXPORT_REF OMX_ERRORTYPE OMX_APIENTRY OMX_MasterGetHandle(
}
return OMX_ErrorComponentNotFound;
}
+ else if (hwCodecFoundWhenSoftwareCodecIsRequested != -1)
+ {
+ ii = hwCodecFoundWhenSoftwareCodecIsRequested;
+ }
// call the appropriate GetHandle for the component