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

Commit f4148b55 authored by Andreas Huber's avatar Andreas Huber
Browse files

Expose a variation of the createRenderer API that works on a plain Surface.

parent 408b8e10
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ class IMemory;
class IOMXObserver;
class IOMXRenderer;
class ISurface;
class Surface;

class IOMX : public IInterface {
public:
@@ -87,6 +88,16 @@ public:
            OMX_COLOR_FORMATTYPE colorFormat,
            size_t encodedWidth, size_t encodedHeight,
            size_t displayWidth, size_t displayHeight) = 0;

    // Note: This method is _not_ virtual, it exists as a wrapper around
    // the virtual "createRenderer" method above facilitating extraction
    // of the ISurface from a regular Surface.
    sp<IOMXRenderer> createRenderer(
            const sp<Surface> &surface,
            const char *componentName,
            OMX_COLOR_FORMATTYPE colorFormat,
            size_t encodedWidth, size_t encodedHeight,
            size_t displayWidth, size_t displayHeight);
};

struct omx_message {
+13 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
#include <binder/Parcel.h>
#include <media/IOMX.h>
#include <ui/ISurface.h>
#include <ui/Surface.h>

namespace android {

@@ -29,6 +30,18 @@ enum {
    RENDERER_RENDER,
};

sp<IOMXRenderer> IOMX::createRenderer(
        const sp<Surface> &surface,
        const char *componentName,
        OMX_COLOR_FORMATTYPE colorFormat,
        size_t encodedWidth, size_t encodedHeight,
        size_t displayWidth, size_t displayHeight) {
    return createRenderer(
            surface->getISurface(),
            componentName, colorFormat, encodedWidth, encodedHeight,
            displayWidth, displayHeight);
}

static void *readVoidStar(const Parcel *parcel) {
    // FIX if sizeof(void *) != sizeof(int32)
    return (void *)parcel->readInt32();
+15 −9
Original line number Diff line number Diff line
@@ -646,15 +646,21 @@ void MediaPlayerImpl::populateISurface() {
    success = success && meta->findInt32(kKeyHeight, &decodedHeight);
    assert(success);

    const sp<ISurface> &isurface =
        mSurface.get() != NULL ? mSurface->getISurface() : mISurface;

    if (mSurface.get() != NULL) {
        mVideoRenderer =
            mClient.interface()->createRenderer(
                isurface, component,
                    mSurface, component,
                    (OMX_COLOR_FORMATTYPE)format,
                    decodedWidth, decodedHeight,
                    mVideoWidth, mVideoHeight);
    } else {
        mVideoRenderer =
            mClient.interface()->createRenderer(
                    mISurface, component,
                    (OMX_COLOR_FORMATTYPE)format,
                    decodedWidth, decodedHeight,
                    mVideoWidth, mVideoHeight);
    }
}

void MediaPlayerImpl::depopulateISurface() {