本文整理汇总了C++中Parcel::readFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ Parcel::readFloat方法的具体用法?C++ Parcel::readFloat怎么用?C++ Parcel::readFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parcel
的用法示例。
在下文中一共展示了Parcel::readFloat方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
status_t layer_state_t::read(const Parcel& input)
{
surface = input.readStrongBinder();
what = input.readUint32();
x = input.readFloat();
y = input.readFloat();
z = input.readUint32();
w = input.readUint32();
h = input.readUint32();
layerStack = input.readUint32();
alpha = input.readFloat();
flags = static_cast<uint8_t>(input.readUint32());
mask = static_cast<uint8_t>(input.readUint32());
const void* matrix_data = input.readInplace(sizeof(layer_state_t::matrix22_t));
if (matrix_data) {
matrix = *reinterpret_cast<layer_state_t::matrix22_t const *>(matrix_data);
} else {
return BAD_VALUE;
}
input.read(crop);
input.read(finalCrop);
handle = input.readStrongBinder();
frameNumber = input.readUint64();
overrideScalingMode = input.readInt32();
input.read(transparentRegion);
return NO_ERROR;
}
示例2: android_os_Parcel_readFloat
static jfloat android_os_Parcel_readFloat(JNIEnv* env, jclass clazz, jlong nativePtr)
{
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
if (parcel != NULL) {
return parcel->readFloat();
}
return 0;
}
示例3: invoke
status_t AAH_RXPlayer::invoke(const Parcel& request, Parcel *reply) {
if (!reply) {
return BAD_VALUE;
}
int32_t magic;
status_t err = request.readInt32(&magic);
if (err != OK) {
reply->writeInt32(err);
return OK;
}
if (magic != 0x12345) {
reply->writeInt32(BAD_VALUE);
return OK;
}
int32_t methodID;
err = request.readInt32(&methodID);
if (err != OK) {
reply->writeInt32(err);
return OK;
}
switch (methodID) {
// Get Volume
case INVOKE_GET_MASTER_VOLUME: {
if (audio_flinger_ != NULL) {
reply->writeInt32(OK);
reply->writeFloat(audio_flinger_->masterVolume());
} else {
reply->writeInt32(UNKNOWN_ERROR);
}
} break;
// Set Volume
case INVOKE_SET_MASTER_VOLUME: {
float targetVol = request.readFloat();
reply->writeInt32(audio_flinger_->setMasterVolume(targetVol));
} break;
default: return BAD_VALUE;
}
return OK;
}
示例4: onTransact
status_t BnMediaPlayer::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
switch(code) {
case DISCONNECT: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
disconnect();
return NO_ERROR;
} break;
case SET_VIDEO_SURFACE: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
sp<ISurface> surface = interface_cast<ISurface>(data.readStrongBinder());
reply->writeInt32(setVideoSurface(surface));
return NO_ERROR;
} break;
case PREPARE_ASYNC: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(prepareAsync());
return NO_ERROR;
} break;
case START: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(start());
return NO_ERROR;
} break;
case STOP: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(stop());
return NO_ERROR;
} break;
case IS_PLAYING: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
bool state;
status_t ret = isPlaying(&state);
reply->writeInt32(state);
reply->writeInt32(ret);
return NO_ERROR;
} break;
case PAUSE: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(pause());
return NO_ERROR;
} break;
case SEEK_TO: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(seekTo(data.readInt32()));
return NO_ERROR;
} break;
case GET_CURRENT_POSITION: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
int msec;
status_t ret = getCurrentPosition(&msec);
reply->writeInt32(msec);
reply->writeInt32(ret);
return NO_ERROR;
} break;
case GET_DURATION: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
int msec;
status_t ret = getDuration(&msec);
reply->writeInt32(msec);
reply->writeInt32(ret);
return NO_ERROR;
} break;
case RESET: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(reset());
return NO_ERROR;
} break;
case SET_AUDIO_STREAM_TYPE: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(setAudioStreamType(data.readInt32()));
return NO_ERROR;
} break;
case SET_LOOPING: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(setLooping(data.readInt32()));
return NO_ERROR;
} break;
case SET_VOLUME: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(setVolume(data.readFloat(), data.readFloat()));
return NO_ERROR;
} break;
case INVOKE: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
invoke(data, reply);
return NO_ERROR;
} break;
case SET_METADATA_FILTER: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(setMetadataFilter(data));
return NO_ERROR;
} break;
case SUSPEND: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(suspend());
return NO_ERROR;
} break;
case RESUME: {
//.........这里部分代码省略.........
示例5: onTransact
//.........这里部分代码省略.........
} break;
case PAUSE: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(pause());
return NO_ERROR;
} break;
case SEEK_TO: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(seekTo(data.readInt32()));
return NO_ERROR;
} break;
case GET_CURRENT_POSITION: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
int msec;
status_t ret = getCurrentPosition(&msec);
reply->writeInt32(msec);
reply->writeInt32(ret);
return NO_ERROR;
} break;
case GET_DURATION: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
int msec;
status_t ret = getDuration(&msec);
reply->writeInt32(msec);
reply->writeInt32(ret);
return NO_ERROR;
} break;
case RESET: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(reset());
return NO_ERROR;
} break;
case SET_AUDIO_STREAM_TYPE: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(setAudioStreamType(data.readInt32()));
return NO_ERROR;
} break;
case SET_LOOPING: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(setLooping(data.readInt32()));
return NO_ERROR;
} break;
case SET_VOLUME: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
float leftVolume = data.readFloat();
float rightVolume = data.readFloat();
reply->writeInt32(setVolume(leftVolume, rightVolume));
return NO_ERROR;
} break;
case INVOKE: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
status_t result = invoke(data, reply);
return result;
} break;
case SET_METADATA_FILTER: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(setMetadataFilter(data));
return NO_ERROR;
} break;
case GET_METADATA: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
bool update_only = static_cast<bool>(data.readInt32());
bool apply_filter = static_cast<bool>(data.readInt32());
const status_t retcode = getMetadata(update_only, apply_filter, reply);
reply->setDataPosition(0);
reply->writeInt32(retcode);
reply->setDataPosition(0);
return NO_ERROR;
} break;
case SET_AUX_EFFECT_SEND_LEVEL: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(setAuxEffectSendLevel(data.readFloat()));
return NO_ERROR;
} break;
case ATTACH_AUX_EFFECT: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
reply->writeInt32(attachAuxEffect(data.readInt32()));
return NO_ERROR;
} break;
case SET_PARAMETER: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
int key = data.readInt32();
Parcel request;
if (data.dataAvail() > 0) {
request.appendFrom(
const_cast<Parcel *>(&data), data.dataPosition(), data.dataAvail());
}
request.setDataPosition(0);
reply->writeInt32(setParameter(key, request));
return NO_ERROR;
} break;
case GET_PARAMETER: {
CHECK_INTERFACE(IMediaPlayer, data, reply);
return getParameter(data.readInt32(), reply);
} break;
default:
return BBinder::onTransact(code, data, reply, flags);
}
}
示例6: onTransact
status_t BnGraphicBufferProducer::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
switch(code) {
case REQUEST_BUFFER: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
int bufferIdx = data.readInt32();
sp<GraphicBuffer> buffer;
int result = requestBuffer(bufferIdx, &buffer);
reply->writeInt32(buffer != 0);
if (buffer != 0) {
reply->write(*buffer);
}
reply->writeInt32(result);
return NO_ERROR;
} break;
case SET_BUFFER_COUNT: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
int bufferCount = data.readInt32();
int result = setBufferCount(bufferCount);
reply->writeInt32(result);
return NO_ERROR;
} break;
case DEQUEUE_BUFFER: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
bool async = data.readInt32();
uint32_t w = data.readInt32();
uint32_t h = data.readInt32();
uint32_t format = data.readInt32();
uint32_t usage = data.readInt32();
int buf;
sp<Fence> fence;
int result = dequeueBuffer(&buf, &fence, async, w, h, format, usage);
reply->writeInt32(buf);
reply->writeInt32(fence != NULL);
if (fence != NULL) {
reply->write(*fence);
}
reply->writeInt32(result);
return NO_ERROR;
} break;
case QUEUE_BUFFER: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
int buf = data.readInt32();
QueueBufferInput input(data);
QueueBufferOutput* const output =
reinterpret_cast<QueueBufferOutput *>(
reply->writeInplace(sizeof(QueueBufferOutput)));
status_t result = queueBuffer(buf, input, output);
reply->writeInt32(result);
return NO_ERROR;
} break;
case CANCEL_BUFFER: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
int buf = data.readInt32();
sp<Fence> fence = new Fence();
data.read(*fence.get());
cancelBuffer(buf, fence);
return NO_ERROR;
} break;
case QUERY: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
int value;
int what = data.readInt32();
int res = query(what, &value);
reply->writeInt32(value);
reply->writeInt32(res);
return NO_ERROR;
} break;
case CONNECT: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
sp<IBinder> token = data.readStrongBinder();
int api = data.readInt32();
bool producerControlledByApp = data.readInt32();
QueueBufferOutput* const output =
reinterpret_cast<QueueBufferOutput *>(
reply->writeInplace(sizeof(QueueBufferOutput)));
status_t res = connect(token, api, producerControlledByApp, output);
reply->writeInt32(res);
return NO_ERROR;
} break;
case DISCONNECT: {
CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
int api = data.readInt32();
status_t res = disconnect(api);
reply->writeInt32(res);
return NO_ERROR;
} break;
case SET_CROP: {
Rect reg;
CHECK_INTERFACE(ISurfaceTexture, data, reply);
reg.left = data.readFloat();
reg.top = data.readFloat();
reg.right = data.readFloat();
reg.bottom = data.readFloat();
status_t result = setCrop(reg);
reply->writeInt32(result);
return NO_ERROR;
} break;
case SET_TRANSFORM: {
//.........这里部分代码省略.........
示例7: onTransact
status_t BnSurfaceTexture::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
switch(code) {
case REQUEST_BUFFER: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
int bufferIdx = data.readInt32();
sp<GraphicBuffer> buffer;
int result = requestBuffer(bufferIdx, &buffer);
reply->writeInt32(buffer != 0);
if (buffer != 0) {
reply->write(*buffer);
}
reply->writeInt32(result);
return NO_ERROR;
} break;
case SET_BUFFER_COUNT: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
int bufferCount = data.readInt32();
int result = setBufferCount(bufferCount);
reply->writeInt32(result);
return NO_ERROR;
} break;
case DEQUEUE_BUFFER: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
uint32_t w = data.readInt32();
uint32_t h = data.readInt32();
uint32_t format = data.readInt32();
uint32_t usage = data.readInt32();
int buf;
int result = dequeueBuffer(&buf, w, h, format, usage);
reply->writeInt32(buf);
reply->writeInt32(result);
return NO_ERROR;
} break;
case QUEUE_BUFFER: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
int buf = data.readInt32();
int64_t timestamp = data.readInt64();
uint32_t outWidth, outHeight, outTransform;
status_t result = queueBuffer(buf, timestamp,
&outWidth, &outHeight, &outTransform);
reply->writeInt32(outWidth);
reply->writeInt32(outHeight);
reply->writeInt32(outTransform);
reply->writeInt32(result);
return NO_ERROR;
} break;
case CANCEL_BUFFER: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
int buf = data.readInt32();
cancelBuffer(buf);
return NO_ERROR;
} break;
case SET_CROP: {
Rect reg;
CHECK_INTERFACE(ISurfaceTexture, data, reply);
reg.left = data.readFloat();
reg.top = data.readFloat();
reg.right = data.readFloat();
reg.bottom = data.readFloat();
status_t result = setCrop(reg);
reply->writeInt32(result);
return NO_ERROR;
} break;
case SET_TRANSFORM: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
uint32_t transform = data.readInt32();
status_t result = setTransform(transform);
reply->writeInt32(result);
return NO_ERROR;
} break;
case SET_SCALING_MODE: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
int mode = data.readInt32();
status_t result = setScalingMode(mode);
reply->writeInt32(result);
return NO_ERROR;
} break;
case QUERY: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
int value;
int what = data.readInt32();
int res = query(what, &value);
reply->writeInt32(value);
reply->writeInt32(res);
return NO_ERROR;
} break;
case SET_SYNCHRONOUS_MODE: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
bool enabled = data.readInt32();
status_t res = setSynchronousMode(enabled);
reply->writeInt32(res);
return NO_ERROR;
} break;
case CONNECT: {
CHECK_INTERFACE(ISurfaceTexture, data, reply);
int api = data.readInt32();
uint32_t outWidth, outHeight, outTransform;
status_t res = connect(api,
//.........这里部分代码省略.........