Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d332a72e authored by James Dong's avatar James Dong
Browse files

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
parent 1104688c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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,
+10 −1
Original line number Diff line number Diff line
@@ -450,8 +450,17 @@ void OMXCodec::findMatchingCodecs(
            continue;
        }

        // 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) {
        matchingCodecs->sort(CompareSoftwareCodecsFirst);