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

Commit c46b2a7b authored by Andreas Huber's avatar Andreas Huber Committed by Android Git Automerger
Browse files

am 9b2f18df: am bc96c284: Merge "For thumbnail extraction make sure we...

am 9b2f18df: am bc96c284: Merge "For thumbnail extraction make sure we instantiate a decoder that allows access to the framebuffer. Implement the samsung workaround to support this by reconfiguring the decoder." into gingerbread

Merge commit '9b2f18df'

* commit '9b2f18df':
  For thumbnail extraction make sure we instantiate a decoder that allows access to the framebuffer. Implement the samsung workaround to support this by reconfiguring the decoder.
parents 3222df8d 9b2f18df
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -33,7 +33,11 @@ struct OMXCodec : public MediaSource,
                  public MediaBufferObserver {
                  public MediaBufferObserver {
    enum CreationFlags {
    enum CreationFlags {
        kPreferSoftwareCodecs    = 1,
        kPreferSoftwareCodecs    = 1,
        kIgnoreCodecSpecificData = 2
        kIgnoreCodecSpecificData = 2,

        // The client wants to access the output buffer's video
        // data for example for thumbnail extraction.
        kClientNeedsFramebuffer  = 4,
    };
    };
    static sp<MediaSource> Create(
    static sp<MediaSource> Create(
            const sp<IOMX> &omx,
            const sp<IOMX> &omx,
+45 −1
Original line number Original line Diff line number Diff line
@@ -510,12 +510,29 @@ sp<MediaSource> OMXCodec::Create(


        LOGV("Attempting to allocate OMX node '%s'", componentName);
        LOGV("Attempting to allocate OMX node '%s'", componentName);


        uint32_t quirks = getComponentQuirks(componentName, createEncoder);

        if (!createEncoder
                && (quirks & kOutputBuffersAreUnreadable)
                && (flags & kClientNeedsFramebuffer)) {
            if (strncmp(componentName, "OMX.SEC.", 8)) {
                // For OMX.SEC.* decoders we can enable a special mode that
                // gives the client access to the framebuffer contents.

                LOGW("Component '%s' does not give the client access to "
                     "the framebuffer contents. Skipping.",
                     componentName);

                continue;
            }
        }

        status_t err = omx->allocateNode(componentName, observer, &node);
        status_t err = omx->allocateNode(componentName, observer, &node);
        if (err == OK) {
        if (err == OK) {
            LOGV("Successfully allocated OMX node '%s'", componentName);
            LOGV("Successfully allocated OMX node '%s'", componentName);


            sp<OMXCodec> codec = new OMXCodec(
            sp<OMXCodec> codec = new OMXCodec(
                    omx, node, getComponentQuirks(componentName, createEncoder),
                    omx, node, quirks,
                    createEncoder, mime, componentName,
                    createEncoder, mime, componentName,
                    source);
                    source);


@@ -698,6 +715,33 @@ status_t OMXCodec::configureCodec(const sp<MetaData> &meta, uint32_t flags) {


    initOutputFormat(meta);
    initOutputFormat(meta);


    if ((flags & kClientNeedsFramebuffer)
            && !strncmp(mComponentName, "OMX.SEC.", 8)) {
        OMX_INDEXTYPE index;

        status_t err =
            mOMX->getExtensionIndex(
                    mNode,
                    "OMX.SEC.index.ThumbnailMode",
                    &index);

        if (err != OK) {
            return err;
        }

        OMX_BOOL enable = OMX_TRUE;
        err = mOMX->setConfig(mNode, index, &enable, sizeof(enable));

        if (err != OK) {
            CODEC_LOGE("setConfig('OMX.SEC.index.ThumbnailMode') "
                       "returned error 0x%08x", err);

            return err;
        }

        mQuirks &= ~kOutputBuffersAreUnreadable;
    }

    return OK;
    return OK;
}
}


+1 −1
Original line number Original line Diff line number Diff line
@@ -112,7 +112,7 @@ static VideoFrame *extractVideoFrameWithCodecFlags(
    sp<MediaSource> decoder =
    sp<MediaSource> decoder =
        OMXCodec::Create(
        OMXCodec::Create(
                client->interface(), source->getFormat(), false, source,
                client->interface(), source->getFormat(), false, source,
                NULL, flags);
                NULL, flags | OMXCodec::kClientNeedsFramebuffer);


    if (decoder.get() == NULL) {
    if (decoder.get() == NULL) {
        LOGV("unable to instantiate video decoder.");
        LOGV("unable to instantiate video decoder.");