1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/media/omx/mediaresourcemanager/IMediaResourceManagerClient.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,62 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim:set ts=2 sw=2 sts=2 et cindent: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.8 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +//#define LOG_NDEBUG 0 1.11 +#define LOG_TAG "IMediaResourceManagerClient" 1.12 +#include <utils/Log.h> 1.13 + 1.14 +#include <stdint.h> 1.15 +#include <sys/types.h> 1.16 + 1.17 +#include <binder/Parcel.h> 1.18 + 1.19 +#include "IMediaResourceManagerClient.h" 1.20 + 1.21 +namespace android { 1.22 + 1.23 +enum { 1.24 + STATUS_CHANGED = IBinder::FIRST_CALL_TRANSACTION 1.25 +}; 1.26 + 1.27 +class BpMediaResourceManagerClient : public BpInterface<IMediaResourceManagerClient> 1.28 +{ 1.29 +public: 1.30 + BpMediaResourceManagerClient(const sp<IBinder>& impl) 1.31 + : BpInterface<IMediaResourceManagerClient>(impl) 1.32 + { 1.33 + } 1.34 + 1.35 + void statusChanged(int event) 1.36 + { 1.37 + Parcel data, reply; 1.38 + data.writeInterfaceToken(IMediaResourceManagerClient::getInterfaceDescriptor()); 1.39 + data.writeInt32(event); 1.40 + remote()->transact(STATUS_CHANGED, data, &reply, IBinder::FLAG_ONEWAY); 1.41 + } 1.42 +}; 1.43 + 1.44 +IMPLEMENT_META_INTERFACE(MediaResourceManagerClient, "android.media.IMediaResourceManagerClient"); 1.45 + 1.46 +// ---------------------------------------------------------------------- 1.47 + 1.48 +status_t BnMediaResourceManagerClient::onTransact( 1.49 + uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) 1.50 +{ 1.51 + switch(code) { 1.52 + case STATUS_CHANGED: { 1.53 + CHECK_INTERFACE(IMediaResourceManagerClient, data, reply); 1.54 + int event = data.readInt32(); 1.55 + statusChanged(event); 1.56 + return NO_ERROR; 1.57 + } break; 1.58 + default: 1.59 + return BBinder::onTransact(code, data, reply, flags); 1.60 + } 1.61 +} 1.62 + 1.63 +// ---------------------------------------------------------------------------- 1.64 + 1.65 +}; // namespace android