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

Commit d5350764 authored by Andreas Huber's avatar Andreas Huber Committed by Android (Google) Code Review
Browse files

Merge "Squashed commit of the following:"

parents 27113f86 e3c01832
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ namespace android {

class Parcel;
class ISurface;
class Surface;

class IMediaPlayer: public IInterface
{
@@ -33,7 +34,8 @@ public:

    virtual void            disconnect() = 0;

    virtual status_t        setVideoSurface(const sp<ISurface>& surface) = 0;
    virtual status_t        setVideoISurface(const sp<ISurface>& surface) = 0;
    virtual status_t        setVideoSurface(const sp<Surface>& surface) = 0;
    virtual status_t        prepareAsync() = 0;
    virtual status_t        start() = 0;
    virtual status_t        stop() = 0;
+3 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ namespace android {

class Parcel;
class ISurface;
class Surface;

template<typename T> class SortedVector;

@@ -104,7 +105,8 @@ public:
            const KeyedVector<String8, String8> *headers = NULL) = 0;

    virtual status_t    setDataSource(int fd, int64_t offset, int64_t length) = 0;
    virtual status_t    setVideoSurface(const sp<ISurface>& surface) = 0;
    virtual status_t    setVideoISurface(const sp<ISurface>& surface) = 0;
    virtual status_t    setVideoSurface(const sp<Surface>& surface) = 0;
    virtual status_t    prepare() = 0;
    virtual status_t    prepareAsync() = 0;
    virtual status_t    start() = 0;
+2 −1
Original line number Diff line number Diff line
@@ -43,7 +43,8 @@ public:
            const char *url, const KeyedVector<String8, String8> *headers);

    virtual status_t    setDataSource(int fd, int64_t offset, int64_t length);
    virtual status_t    setVideoSurface(const sp<ISurface>& surface);
    virtual status_t    setVideoISurface(const sp<ISurface>& surface);
    virtual status_t    setVideoSurface(const sp<Surface>& surface);
    virtual status_t    prepare();
    virtual status_t    prepareAsync();
    virtual status_t    start();
+1 −0
Original line number Diff line number Diff line
@@ -178,6 +178,7 @@ private:
    // MediaPlayer needs access to ISurface for display
    friend class MediaPlayer;
    friend class IOMX;
    friend class SoftwareRenderer;
    // this is just to be able to write some unit tests
    friend class Test;

+19 −2
Original line number Diff line number Diff line
@@ -22,12 +22,14 @@

#include <media/IMediaPlayer.h>
#include <surfaceflinger/ISurface.h>
#include <surfaceflinger/Surface.h>

namespace android {

enum {
    DISCONNECT = IBinder::FIRST_CALL_TRANSACTION,
    SET_VIDEO_SURFACE,
    SET_VIDEO_ISURFACE,
    PREPARE_ASYNC,
    START,
    STOP,
@@ -65,11 +67,20 @@ public:
        remote()->transact(DISCONNECT, data, &reply);
    }

    status_t setVideoSurface(const sp<ISurface>& surface)
    status_t setVideoISurface(const sp<ISurface>& surface)
    {
        Parcel data, reply;
        data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor());
        data.writeStrongBinder(surface->asBinder());
        remote()->transact(SET_VIDEO_ISURFACE, data, &reply);
        return reply.readInt32();
    }

    status_t setVideoSurface(const sp<Surface>& surface)
    {
        Parcel data, reply;
        data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor());
        Surface::writeToParcel(surface, &data);
        remote()->transact(SET_VIDEO_SURFACE, data, &reply);
        return reply.readInt32();
    }
@@ -256,9 +267,15 @@ status_t BnMediaPlayer::onTransact(
            disconnect();
            return NO_ERROR;
        } break;
        case SET_VIDEO_SURFACE: {
        case SET_VIDEO_ISURFACE: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            sp<ISurface> surface = interface_cast<ISurface>(data.readStrongBinder());
            reply->writeInt32(setVideoISurface(surface));
            return NO_ERROR;
        } break;
        case SET_VIDEO_SURFACE: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            sp<Surface> surface = Surface::readFromParcel(data);
            reply->writeInt32(setVideoSurface(surface));
            return NO_ERROR;
        } break;
Loading