diff options
author | Dave Burke <daveburke@google.com> | 2011-08-30 14:39:17 +0100 |
---|---|---|
committer | Dave Burke <daveburke@google.com> | 2011-09-02 11:26:59 +0100 |
commit | d681bbb1767bed09415e050ba78975df214bcd68 (patch) | |
tree | 2030c617c61bbf7b6cd8c6bafab601a99b1ac83d /media/libmedia/IMediaPlayerService.cpp | |
parent | d942202ee0c92608c648735c3ad0f1bab4312420 (diff) | |
download | frameworks_av-d681bbb1767bed09415e050ba78975df214bcd68.zip frameworks_av-d681bbb1767bed09415e050ba78975df214bcd68.tar.gz frameworks_av-d681bbb1767bed09415e050ba78975df214bcd68.tar.bz2 |
Require INTERNET permission for network-based content.
Bug #1870981
Change-Id: Ia3ad166390c4d60cea19c3783895b078a2c4c15f
Diffstat (limited to 'media/libmedia/IMediaPlayerService.cpp')
-rw-r--r-- | media/libmedia/IMediaPlayerService.cpp | 104 |
1 files changed, 5 insertions, 99 deletions
diff --git a/media/libmedia/IMediaPlayerService.cpp b/media/libmedia/IMediaPlayerService.cpp index 17a0362..8e4dd04 100644 --- a/media/libmedia/IMediaPlayerService.cpp +++ b/media/libmedia/IMediaPlayerService.cpp @@ -30,9 +30,7 @@ namespace android { enum { - CREATE_URL = IBinder::FIRST_CALL_TRANSACTION, - CREATE_FD, - CREATE_STREAM, + CREATE = IBinder::FIRST_CALL_TRANSACTION, DECODE_URL, DECODE_FD, CREATE_MEDIA_RECORDER, @@ -60,28 +58,14 @@ public: } virtual sp<IMediaPlayer> create( - pid_t pid, const sp<IMediaPlayerClient>& client, - const char* url, const KeyedVector<String8, String8> *headers, int audioSessionId) { + pid_t pid, const sp<IMediaPlayerClient>& client, int audioSessionId) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); data.writeInt32(pid); data.writeStrongBinder(client->asBinder()); - data.writeCString(url); - - if (headers == NULL) { - data.writeInt32(0); - } else { - // serialize the headers - data.writeInt32(headers->size()); - for (size_t i = 0; i < headers->size(); ++i) { - data.writeString8(headers->keyAt(i)); - data.writeString8(headers->valueAt(i)); - } - } data.writeInt32(audioSessionId); - remote()->transact(CREATE_URL, data, &reply); - + remote()->transact(CREATE, data, &reply); return interface_cast<IMediaPlayer>(reply.readStrongBinder()); } @@ -94,38 +78,6 @@ public: return interface_cast<IMediaRecorder>(reply.readStrongBinder()); } - virtual sp<IMediaPlayer> create(pid_t pid, const sp<IMediaPlayerClient>& client, int fd, - int64_t offset, int64_t length, int audioSessionId) - { - Parcel data, reply; - data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); - data.writeInt32(pid); - data.writeStrongBinder(client->asBinder()); - data.writeFileDescriptor(fd); - data.writeInt64(offset); - data.writeInt64(length); - data.writeInt32(audioSessionId); - - remote()->transact(CREATE_FD, data, &reply); - - return interface_cast<IMediaPlayer>(reply.readStrongBinder());; - } - - virtual sp<IMediaPlayer> create( - pid_t pid, const sp<IMediaPlayerClient> &client, - const sp<IStreamSource> &source, int audioSessionId) { - Parcel data, reply; - data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); - data.writeInt32(static_cast<int32_t>(pid)); - data.writeStrongBinder(client->asBinder()); - data.writeStrongBinder(source->asBinder()); - data.writeInt32(static_cast<int32_t>(audioSessionId)); - - remote()->transact(CREATE_STREAM, data, &reply); - - return interface_cast<IMediaPlayer>(reply.readStrongBinder());; - } - virtual sp<IMemory> decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, int* pFormat) { Parcel data, reply; @@ -181,62 +133,16 @@ status_t BnMediaPlayerService::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch(code) { - case CREATE_URL: { + case CREATE: { CHECK_INTERFACE(IMediaPlayerService, data, reply); pid_t pid = data.readInt32(); sp<IMediaPlayerClient> client = interface_cast<IMediaPlayerClient>(data.readStrongBinder()); - const char* url = data.readCString(); - - KeyedVector<String8, String8> headers; - int32_t numHeaders = data.readInt32(); - for (int i = 0; i < numHeaders; ++i) { - String8 key = data.readString8(); - String8 value = data.readString8(); - headers.add(key, value); - } - int audioSessionId = data.readInt32(); - - sp<IMediaPlayer> player = create( - pid, client, url, numHeaders > 0 ? &headers : NULL, audioSessionId); - - reply->writeStrongBinder(player->asBinder()); - return NO_ERROR; - } break; - case CREATE_FD: { - CHECK_INTERFACE(IMediaPlayerService, data, reply); - pid_t pid = data.readInt32(); - sp<IMediaPlayerClient> client = interface_cast<IMediaPlayerClient>(data.readStrongBinder()); - int fd = dup(data.readFileDescriptor()); - int64_t offset = data.readInt64(); - int64_t length = data.readInt64(); int audioSessionId = data.readInt32(); - - sp<IMediaPlayer> player = create(pid, client, fd, offset, length, audioSessionId); + sp<IMediaPlayer> player = create(pid, client, audioSessionId); reply->writeStrongBinder(player->asBinder()); return NO_ERROR; } break; - case CREATE_STREAM: - { - CHECK_INTERFACE(IMediaPlayerService, data, reply); - - pid_t pid = static_cast<pid_t>(data.readInt32()); - - sp<IMediaPlayerClient> client = - interface_cast<IMediaPlayerClient>(data.readStrongBinder()); - - sp<IStreamSource> source = - interface_cast<IStreamSource>(data.readStrongBinder()); - - int audioSessionId = static_cast<int>(data.readInt32()); - - sp<IMediaPlayer> player = - create(pid, client, source, audioSessionId); - - reply->writeStrongBinder(player->asBinder()); - return OK; - break; - } case DECODE_URL: { CHECK_INTERFACE(IMediaPlayerService, data, reply); const char* url = data.readCString(); |