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

Commit 3baff731 authored by Andreas Huber's avatar Andreas Huber
Browse files

resolved conflicts for merge of 31dc911a to gingerbread-plus-aosp

Change-Id: I2f51b2120b3c552566d91a7dc498a5e8b130205f
parents 4974d5ea 85d9b422
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -115,7 +115,8 @@ public:
            const char *componentName,
            OMX_COLOR_FORMATTYPE colorFormat,
            size_t encodedWidth, size_t encodedHeight,
            size_t displayWidth, size_t displayHeight) = 0;
            size_t displayWidth, size_t displayHeight,
            int32_t rotationDegrees) = 0;

    // Note: These methods are _not_ virtual, it exists as a wrapper around
    // the virtual "createRenderer" method above facilitating extraction
@@ -125,14 +126,16 @@ public:
            const char *componentName,
            OMX_COLOR_FORMATTYPE colorFormat,
            size_t encodedWidth, size_t encodedHeight,
            size_t displayWidth, size_t displayHeight);
            size_t displayWidth, size_t displayHeight,
            int32_t rotationDegrees);

    sp<IOMXRenderer> createRendererFromJavaSurface(
            JNIEnv *env, jobject javaSurface,
            const char *componentName,
            OMX_COLOR_FORMATTYPE colorFormat,
            size_t encodedWidth, size_t encodedHeight,
            size_t displayWidth, size_t displayHeight);
            size_t displayWidth, size_t displayHeight,
            int32_t rotationDegrees);
};

struct omx_message {
+8 −0
Original line number Diff line number Diff line
@@ -32,6 +32,14 @@ extern android::VideoRenderer *createRenderer(
        size_t displayWidth, size_t displayHeight,
        size_t decodedWidth, size_t decodedHeight);

extern android::VideoRenderer *createRendererWithRotation(
        const android::sp<android::ISurface> &surface,
        const char *componentName,
        OMX_COLOR_FORMATTYPE colorFormat,
        size_t displayWidth, size_t displayHeight,
        size_t decodedWidth, size_t decodedHeight,
        int32_t rotationDegrees);

extern android::OMXPluginBase *createOMXPlugin();

#endif  // HARDWARE_API_H_
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ enum {
    kKeyMIMEType          = 'mime',  // cstring
    kKeyWidth             = 'widt',  // int32_t
    kKeyHeight            = 'heig',  // int32_t
    kKeyRotation          = 'rotA',  // int32_t (angle in degrees)
    kKeyIFramesInterval   = 'ifiv',  // int32_t
    kKeyStride            = 'strd',  // int32_t
    kKeySliceHeight       = 'slht',  // int32_t
+14 −6
Original line number Diff line number Diff line
@@ -38,11 +38,13 @@ sp<IOMXRenderer> IOMX::createRenderer(
        const char *componentName,
        OMX_COLOR_FORMATTYPE colorFormat,
        size_t encodedWidth, size_t encodedHeight,
        size_t displayWidth, size_t displayHeight) {
        size_t displayWidth, size_t displayHeight,
        int32_t rotationDegrees) {
    return createRenderer(
            surface->getISurface(),
            componentName, colorFormat, encodedWidth, encodedHeight,
            displayWidth, displayHeight);
            displayWidth, displayHeight,
            rotationDegrees);
}

sp<IOMXRenderer> IOMX::createRendererFromJavaSurface(
@@ -50,7 +52,8 @@ sp<IOMXRenderer> IOMX::createRendererFromJavaSurface(
        const char *componentName,
        OMX_COLOR_FORMATTYPE colorFormat,
        size_t encodedWidth, size_t encodedHeight,
        size_t displayWidth, size_t displayHeight) {
        size_t displayWidth, size_t displayHeight,
        int32_t rotationDegrees) {
    jclass surfaceClass = env->FindClass("android/view/Surface");
    if (surfaceClass == NULL) {
        LOGE("Can't find android/view/Surface");
@@ -67,7 +70,8 @@ sp<IOMXRenderer> IOMX::createRendererFromJavaSurface(

    return createRenderer(
            surface, componentName, colorFormat, encodedWidth,
            encodedHeight, displayWidth, displayHeight);
            encodedHeight, displayWidth, displayHeight,
            rotationDegrees);
}

class BpOMX : public BpInterface<IOMX> {
@@ -349,7 +353,8 @@ public:
            const char *componentName,
            OMX_COLOR_FORMATTYPE colorFormat,
            size_t encodedWidth, size_t encodedHeight,
            size_t displayWidth, size_t displayHeight) {
            size_t displayWidth, size_t displayHeight,
            int32_t rotationDegrees) {
        Parcel data, reply;
        data.writeInterfaceToken(IOMX::getInterfaceDescriptor());

@@ -360,6 +365,7 @@ public:
        data.writeInt32(encodedHeight);
        data.writeInt32(displayWidth);
        data.writeInt32(displayHeight);
        data.writeInt32(rotationDegrees);

        remote()->transact(CREATE_RENDERER, data, &reply);

@@ -682,11 +688,13 @@ status_t BnOMX::onTransact(
            size_t encodedHeight = (size_t)data.readInt32();
            size_t displayWidth = (size_t)data.readInt32();
            size_t displayHeight = (size_t)data.readInt32();
            int32_t rotationDegrees = data.readInt32();

            sp<IOMXRenderer> renderer =
                createRenderer(isurface, componentName, colorFormat,
                               encodedWidth, encodedHeight,
                               displayWidth, displayHeight);
                               displayWidth, displayHeight,
                               rotationDegrees);

            reply->writeStrongBinder(renderer->asBinder());

+71 −17
Original line number Diff line number Diff line
@@ -103,12 +103,14 @@ struct AwesomeLocalRenderer : public AwesomeRenderer {
            OMX_COLOR_FORMATTYPE colorFormat,
            const sp<ISurface> &surface,
            size_t displayWidth, size_t displayHeight,
            size_t decodedWidth, size_t decodedHeight)
            size_t decodedWidth, size_t decodedHeight,
            int32_t rotationDegrees)
        : mTarget(NULL),
          mLibHandle(NULL) {
            init(previewOnly, componentName,
                 colorFormat, surface, displayWidth,
                 displayHeight, decodedWidth, decodedHeight);
                 displayHeight, decodedWidth, decodedHeight,
                 rotationDegrees);
    }

    virtual void render(MediaBuffer *buffer) {
@@ -141,7 +143,8 @@ private:
            OMX_COLOR_FORMATTYPE colorFormat,
            const sp<ISurface> &surface,
            size_t displayWidth, size_t displayHeight,
            size_t decodedWidth, size_t decodedHeight);
            size_t decodedWidth, size_t decodedHeight,
            int32_t rotationDegrees);

    AwesomeLocalRenderer(const AwesomeLocalRenderer &);
    AwesomeLocalRenderer &operator=(const AwesomeLocalRenderer &);;
@@ -153,7 +156,8 @@ void AwesomeLocalRenderer::init(
        OMX_COLOR_FORMATTYPE colorFormat,
        const sp<ISurface> &surface,
        size_t displayWidth, size_t displayHeight,
        size_t decodedWidth, size_t decodedHeight) {
        size_t decodedWidth, size_t decodedHeight,
        int32_t rotationDegrees) {
    if (!previewOnly) {
        // We will stick to the vanilla software-color-converting renderer
        // for "previewOnly" mode, to avoid unneccessarily switching overlays
@@ -162,6 +166,14 @@ void AwesomeLocalRenderer::init(
        mLibHandle = dlopen("libstagefrighthw.so", RTLD_NOW);

        if (mLibHandle) {
            typedef VideoRenderer *(*CreateRendererWithRotationFunc)(
                    const sp<ISurface> &surface,
                    const char *componentName,
                    OMX_COLOR_FORMATTYPE colorFormat,
                    size_t displayWidth, size_t displayHeight,
                    size_t decodedWidth, size_t decodedHeight,
                    int32_t rotationDegrees);

            typedef VideoRenderer *(*CreateRendererFunc)(
                    const sp<ISurface> &surface,
                    const char *componentName,
@@ -169,6 +181,24 @@ void AwesomeLocalRenderer::init(
                    size_t displayWidth, size_t displayHeight,
                    size_t decodedWidth, size_t decodedHeight);

            CreateRendererWithRotationFunc funcWithRotation =
                (CreateRendererWithRotationFunc)dlsym(
                        mLibHandle,
                        "_Z26createRendererWithRotationRKN7android2spINS_8"
                        "ISurfaceEEEPKc20OMX_COLOR_FORMATTYPEjjjji");

            if (funcWithRotation) {
                mTarget =
                    (*funcWithRotation)(
                            surface, componentName, colorFormat,
                            displayWidth, displayHeight,
                            decodedWidth, decodedHeight,
                            rotationDegrees);
            } else {
                if (rotationDegrees != 0) {
                    LOGW("renderer does not support rotation.");
                }

                CreateRendererFunc func =
                    (CreateRendererFunc)dlsym(
                            mLibHandle,
@@ -183,11 +213,12 @@ void AwesomeLocalRenderer::init(
                }
            }
        }
    }

    if (mTarget == NULL) {
        mTarget = new SoftwareRenderer(
                colorFormat, surface, displayWidth, displayHeight,
                decodedWidth, decodedHeight);
                decodedWidth, decodedHeight, rotationDegrees);
    }
}

@@ -806,6 +837,12 @@ void AwesomePlayer::initRenderer_l() {
        CHECK(meta->findInt32(kKeyWidth, &decodedWidth));
        CHECK(meta->findInt32(kKeyHeight, &decodedHeight));

        int32_t rotationDegrees;
        if (!mVideoTrack->getFormat()->findInt32(
                    kKeyRotation, &rotationDegrees)) {
            rotationDegrees = 0;
        }

        mVideoRenderer.clear();

        // Must ensure that mVideoRenderer's destructor is actually executed
@@ -821,7 +858,8 @@ void AwesomePlayer::initRenderer_l() {
                        mISurface, component,
                        (OMX_COLOR_FORMATTYPE)format,
                        decodedWidth, decodedHeight,
                        mVideoWidth, mVideoHeight));
                        mVideoWidth, mVideoHeight,
                        rotationDegrees));
        } else {
            // Other decoders are instantiated locally and as a consequence
            // allocate their buffers in local address space.
@@ -831,7 +869,7 @@ void AwesomePlayer::initRenderer_l() {
                (OMX_COLOR_FORMATTYPE)format,
                mISurface,
                mVideoWidth, mVideoHeight,
                decodedWidth, decodedHeight);
                decodedWidth, decodedHeight, rotationDegrees);
        }
    }
}
@@ -1671,7 +1709,22 @@ void AwesomePlayer::finishAsyncPrepare_l() {
        if (mVideoWidth < 0 || mVideoHeight < 0) {
            notifyListener_l(MEDIA_SET_VIDEO_SIZE, 0, 0);
        } else {
            notifyListener_l(MEDIA_SET_VIDEO_SIZE, mVideoWidth, mVideoHeight);
            int32_t rotationDegrees;
            if (!mVideoTrack->getFormat()->findInt32(
                        kKeyRotation, &rotationDegrees)) {
                rotationDegrees = 0;
            }

#if 1
            if (rotationDegrees == 90 || rotationDegrees == 270) {
                notifyListener_l(
                        MEDIA_SET_VIDEO_SIZE, mVideoHeight, mVideoWidth);
            } else
#endif
            {
                notifyListener_l(
                        MEDIA_SET_VIDEO_SIZE, mVideoWidth, mVideoHeight);
            }
        }

        notifyListener_l(MEDIA_PREPARED);
@@ -1803,7 +1856,8 @@ status_t AwesomePlayer::resume() {
                    state->mVideoWidth,
                    state->mVideoHeight,
                    state->mDecodedWidth,
                    state->mDecodedHeight);
                    state->mDecodedHeight,
                    0);

        mVideoRendererIsPreview = true;

Loading