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

Commit 35213f14 authored by Andreas Huber's avatar Andreas Huber
Browse files

Initial checkin of support for acting as a wifi display source

Change-Id: I08f17efa0c7d007e17408feb7d4fbef0a19f531a
parent f8b8f6f8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -50,6 +50,8 @@ public:
    virtual sp<IOMX>            getOMX() = 0;
    virtual sp<ICrypto>         makeCrypto() = 0;

    virtual status_t enableRemoteDisplay(bool enable) = 0;

    // codecs and audio devices usage tracking for the battery app
    enum BatteryDataBits {
        // tracking audio codec
+11 −0
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@
#include <media/stagefright/SkipCutBuffer.h>
#include <OMX_Audio.h>

#define TRACK_BUFFER_TIMING     0

namespace android {

struct ABuffer;
@@ -127,6 +129,15 @@ private:
        sp<GraphicBuffer> mGraphicBuffer;
    };

#if TRACK_BUFFER_TIMING
    struct BufferStats {
        int64_t mEmptyBufferTimeUs;
        int64_t mFillBufferDoneTimeUs;
    };

    KeyedVector<int64_t, BufferStats> mBufferStats;
#endif

    sp<AMessage> mNotify;

    sp<UninitializedState> mUninitializedState;
+15 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ enum {
    CREATE_METADATA_RETRIEVER,
    GET_OMX,
    MAKE_CRYPTO,
    ENABLE_REMOTE_DISPLAY,
    ADD_BATTERY_DATA,
    PULL_BATTERY_DATA
};
@@ -120,6 +121,14 @@ public:
        return interface_cast<ICrypto>(reply.readStrongBinder());
    }

    virtual status_t enableRemoteDisplay(bool enable) {
        Parcel data, reply;
        data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor());
        data.writeInt32(enable);
        remote()->transact(ENABLE_REMOTE_DISPLAY, data, &reply);
        return reply.readInt32();
    }

    virtual void addBatteryData(uint32_t params) {
        Parcel data, reply;
        data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor());
@@ -206,6 +215,12 @@ status_t BnMediaPlayerService::onTransact(
            reply->writeStrongBinder(crypto->asBinder());
            return NO_ERROR;
        } break;
        case ENABLE_REMOTE_DISPLAY: {
            CHECK_INTERFACE(IMediaPlayerService, data, reply);
            bool enable = data.readInt32();
            reply->writeInt32(enableRemoteDisplay(enable));
            return NO_ERROR;
        } break;
        case ADD_BATTERY_DATA: {
            CHECK_INTERFACE(IMediaPlayerService, data, reply);
            uint32_t params = data.readInt32();
+33 −31
Original line number Diff line number Diff line
@@ -9,30 +9,32 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES:=               \
    ActivityManager.cpp         \
    Crypto.cpp                  \
    MediaRecorderClient.cpp     \
    MediaPlayerFactory.cpp      \
    MediaPlayerService.cpp      \
    MediaRecorderClient.cpp     \
    MetadataRetrieverClient.cpp \
    TestPlayerStub.cpp          \
    MidiMetadataRetriever.cpp   \
    MidiFile.cpp                \
    MidiMetadataRetriever.cpp   \
    RemoteDisplay.cpp           \
    StagefrightPlayer.cpp       \
    StagefrightRecorder.cpp
    StagefrightRecorder.cpp     \
    TestPlayerStub.cpp          \

LOCAL_SHARED_LIBRARIES :=       \
	libcutils             			\
	libutils              			\
    libbinder                   \
	libvorbisidec         			\
	libsonivox            			\
    libcamera_client            \
    libcutils                   \
    libdl                       \
    libgui                      \
    libmedia                    \
    libmedia_native             \
	libcamera_client      			\
    libsonivox                  \
    libstagefright              \
	libstagefright_omx    			\
    libstagefright_foundation   \
	libgui                          \
	libdl
    libstagefright_omx          \
    libstagefright_wfd          \
    libutils                    \
    libvorbisidec               \

LOCAL_STATIC_LIBRARIES :=       \
    libstagefright_nuplayer     \
@@ -42,6 +44,7 @@ LOCAL_C_INCLUDES := \
    $(call include-path-for, graphics corecg)                       \
    $(TOP)/frameworks/av/media/libstagefright/include               \
    $(TOP)/frameworks/av/media/libstagefright/rtsp                  \
    $(TOP)/frameworks/av/media/libstagefright/wifi-display          \
    $(TOP)/frameworks/native/include/media/openmax                  \
    $(TOP)/external/tremolo/Tremolo                                 \

@@ -50,4 +53,3 @@ LOCAL_MODULE:= libmediaplayerservice
include $(BUILD_SHARED_LIBRARY)

include $(call all-makefiles-under,$(LOCAL_PATH))
+23 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@
#include <OMX.h>

#include "Crypto.h"
#include "RemoteDisplay.h"

namespace {
using android::media::Metadata;
@@ -278,6 +279,28 @@ sp<ICrypto> MediaPlayerService::makeCrypto() {
    return new Crypto;
}

status_t MediaPlayerService::enableRemoteDisplay(bool enable) {
    Mutex::Autolock autoLock(mLock);

    if (enable && mRemoteDisplay == NULL) {
        mRemoteDisplay = new RemoteDisplay;

        status_t err = mRemoteDisplay->start();

        if (err != OK) {
            mRemoteDisplay.clear();
            return err;
        }

        return OK;
    } else if (!enable && mRemoteDisplay != NULL) {
        mRemoteDisplay->stop();
        mRemoteDisplay.clear();
    }

    return OK;
}

status_t MediaPlayerService::AudioCache::dump(int fd, const Vector<String16>& args) const
{
    const size_t SIZE = 256;
Loading