summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author James Dong <jdong@google.com> 2010-10-22 17:28:15 -0700
committer James Dong <jdong@google.com> 2010-10-25 18:21:55 -0700
commit170a929648b9f5c6efbf6dcbec4f1bc73593cbde (patch)
tree59a0780c0c0ac6dbbdb1cf0ce03be8d6dc40c33b
parentfc6d54ea074aa1f6a177b031e6b2814368ac7583 (diff)
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
-rw-r--r--include/media/stagefright/OMXCodec.h5
-rw-r--r--media/libstagefright/OMXCodec.cpp11
2 files changed, 15 insertions, 1 deletions
diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h
index 6fef2e706130..0f4fbfb1d195 100644
--- a/include/media/stagefright/OMXCodec.h
+++ b/include/media/stagefright/OMXCodec.h
@@ -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,
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 2520f46f50b4..0d8abe2f0c5f 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -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) {