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

Commit 07436fc0 authored by Jason Simmons's avatar Jason Simmons Committed by Mike Lockwood
Browse files

Configure the A@H TX media player with one string

Music2 would prefer a configuration interface that takes a single
blob of data passed in from the RPC client and then passes it
opaquely to the media player.  This eliminates the need for Music2
to rev their application if we add more configuration options to
the TX player.

Change-Id: Ia2daea3ff2502f91f8a5a82b898752c435279a0f
parent 3c56184d
Loading
Loading
Loading
Loading
+28 −8
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
#define LOG_TAG "LibAAH_RTP"
#include <utils/Log.h>

#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <netdb.h>
#include <netinet/ip.h>

@@ -698,20 +700,38 @@ status_t AAH_TXPlayer::invoke(const Parcel& request, Parcel *reply) {
    }

    switch (methodID) {
        case kInvokeSetAAHDstIPPort: {
        case kInvokeSetAAHDstIPPort:
        case kInvokeSetAAHConfigBlob: {
            if (mEndpointValid) {
                return INVALID_OPERATION;
            }

            String16 addr = request.readString16();
            String8 addr;
            uint16_t port;

            if (methodID == kInvokeSetAAHDstIPPort) {
                addr = String8(request.readString16());

                int32_t port32;
                err = request.readInt32(&port32);
                if (err != android::OK) {
                    return err;
                }
                port = static_cast<uint16_t>(port32);
            } else {
                String8 blob(request.readString16());

                char addr_buf[101];
                if (sscanf(blob.string(), "V1:%100s %" SCNu16,
                           addr_buf, &port) != 2) {
                    return BAD_VALUE;
                }
                if (addr.setTo(addr_buf) != OK) {
                    return NO_MEMORY;
                }
            }

            struct hostent* ent = gethostbyname(String8(addr).string());
            struct hostent* ent = gethostbyname(addr.string());
            if (ent == NULL) {
                return ERROR_UNKNOWN_HOST;
            }
@@ -722,7 +742,7 @@ status_t AAH_TXPlayer::invoke(const Parcel& request, Parcel *reply) {
            Mutex::Autolock lock(mEndpointLock);
            mEndpoint = AAH_TXSender::Endpoint(
                        reinterpret_cast<struct in_addr*>(ent->h_addr)->s_addr,
                        static_cast<uint16_t>(port32));
                        port);
            mEndpointValid = true;
            return OK;
        };
+4 −0
Original line number Diff line number Diff line
@@ -67,6 +67,10 @@ class AAH_TXPlayer : public MediaPlayerHWInterface {
    enum {
        // set the IP address and port of the A@H receiver
        kInvokeSetAAHDstIPPort = 1,

        // set the destination IP address and port (and perhaps any additional
        // parameters added in the future) packaged in one string
        kInvokeSetAAHConfigBlob,
    };

    static const int64_t kAAHRetryKeepAroundTimeNs;