Add two creation flags to OMXCodec::Create()

o This allows to force to use software codecs or hardware codecs
o If request cannot be fullfilled, Create() returns NULL.

Change-Id: I02b56a9229abb56d49703fe80ac18571d33f3748
This commit is contained in:
James Dong
2010-10-22 17:28:15 -07:00
parent fc6d54ea07
commit 170a929648
2 changed files with 15 additions and 1 deletions

View File

@@ -39,6 +39,11 @@ struct OMXCodec : public MediaSource,
// The client wants to access the output buffer's video
// data for example for thumbnail extraction.
kClientNeedsFramebuffer = 4,
// Request for software or hardware codecs. If request
// can not be fullfilled, Create() returns NULL.
kSoftwareCodecsOnly = 8,
kHardwareCodecsOnly = 16,
};
static sp<MediaSource> Create(
const sp<IOMX> &omx,

View File

@@ -450,7 +450,16 @@ void OMXCodec::findMatchingCodecs(
continue;
}
matchingCodecs->push(String8(componentName));
// When requesting software-only codecs, only push software codecs
// When requesting hardware-only codecs, only push hardware codecs
// When there is request neither for software-only nor for
// hardware-only codecs, push all codecs
if (((flags & kSoftwareCodecsOnly) && IsSoftwareCodec(componentName)) ||
((flags & kHardwareCodecsOnly) && !IsSoftwareCodec(componentName)) ||
(!(flags & (kSoftwareCodecsOnly | kHardwareCodecsOnly)))) {
matchingCodecs->push(String8(componentName));
}
}
if (flags & kPreferSoftwareCodecs) {