本文整理汇总了C++中Parcel::readInt32方法的典型用法代码示例。如果您正苦于以下问题:C++ Parcel::readInt32方法的具体用法?C++ Parcel::readInt32怎么用?C++ Parcel::readInt32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parcel
的用法示例。
在下文中一共展示了Parcel::readInt32方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onTransact
status_t BnWfdVideoService::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
switch(code) {
case WFDVIDEOSERVICE_SET_SOURCE: {
CHECK_INTERFACE(IWfdVideoService, data, reply);
int32_t source = data.readInt32();
setSource(source);
} break;
case WFDVIDEOSERVICE_GET_CURSOURCE: {
CHECK_INTERFACE(IWfdVideoService, data, reply);
int32_t source = getCurSource();
reply->writeInt32(source);
} break;
case WFDVIDEOSERVICE_START: {
CHECK_INTERFACE(IWfdVideoService, data, reply);
start();
} break;
case WFDVIDEOSERVICE_STOP: {
CHECK_INTERFACE(IWfdVideoService, data, reply);
stop();
} break;
case WFDVIDEOSERVICE_WRITE: {
CHECK_INTERFACE(IWfdVideoService, data, reply);
uint32_t srcColorFormat = data.readInt32();
uint32_t srcWidth = data.readInt32();
uint32_t srcHeight = data.readInt32();
uint32_t srcCropX = data.readInt32();
uint32_t srcCropY = data.readInt32();
uint32_t srcCropW = data.readInt32();
uint32_t srcCropH = data.readInt32();
uint32_t srcYAddr = data.readInt32();
uint32_t srcCbAddr = data.readInt32();
uint32_t srcCrAddr = data.readInt32();
uint32_t rotate = data.readInt32();
int64_t timestamp = data.readInt64();
write(
srcColorFormat,
srcWidth,
srcHeight,
srcCropX,
srcCropY,
srcCropW,
srcCropH,
srcYAddr,
srcCbAddr,
srcCrAddr,
rotate,
timestamp);
} break;
case WFDVIDEOSERVICE_READ: {
CHECK_INTERFACE(IWfdVideoService, data, reply);
uint32_t dstColorFormat;
uint32_t dstWidth;
uint32_t dstHeight;
uint32_t dstStride;
uint32_t dstYAddr;
uint32_t dstCbAddr;
uint32_t dstCrAddr;
uint32_t dstBufIndex;
int64_t timestamp;
int32_t ret = read(
&dstColorFormat,
&dstWidth,
&dstHeight,
&dstStride,
&dstYAddr,
&dstCbAddr,
&dstCrAddr,
&dstBufIndex,
×tamp);
reply->writeInt32(dstColorFormat);
reply->writeInt32(dstWidth);
reply->writeInt32(dstHeight);
reply->writeInt32(dstStride);
reply->writeInt32(dstYAddr);
reply->writeInt32(dstCbAddr);
reply->writeInt32(dstCrAddr);
reply->writeInt32(dstBufIndex);
reply->writeInt64(timestamp);
reply->writeInt32(ret);
} break;
case WFDVIDEOSERVICE_RELEASEBUFFER: {
CHECK_INTERFACE(IWfdVideoService, data, reply);
uint32_t bufIndex = data.readInt32();
releaseBuffer(bufIndex);
} break;
default:
return BBinder::onTransact(code, data, reply, flags);
}
return NO_ERROR;
}
示例2: onTransact
status_t BnSurface::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
switch(code) {
case REQUEST_BUFFER: {
CHECK_INTERFACE(ISurface, data, reply);
int bufferIdx = data.readInt32();
uint32_t w = data.readInt32();
uint32_t h = data.readInt32();
uint32_t format = data.readInt32();
uint32_t usage = data.readInt32();
sp<GraphicBuffer> buffer(requestBuffer(bufferIdx, w, h, format, usage));
if (buffer == NULL)
return BAD_VALUE;
return reply->write(*buffer);
}
case SET_BUFFER_COUNT: {
CHECK_INTERFACE(ISurface, data, reply);
int bufferCount = data.readInt32();
status_t err = setBufferCount(bufferCount);
reply->writeInt32(err);
return NO_ERROR;
}
case REGISTER_BUFFERS: {
CHECK_INTERFACE(ISurface, data, reply);
BufferHeap buffer;
buffer.w = data.readInt32();
buffer.h = data.readInt32();
buffer.hor_stride = data.readInt32();
buffer.ver_stride= data.readInt32();
buffer.format = data.readInt32();
buffer.transform = data.readInt32();
buffer.flags = data.readInt32();
buffer.heap = interface_cast<IMemoryHeap>(data.readStrongBinder());
status_t err = registerBuffers(buffer);
reply->writeInt32(err);
return NO_ERROR;
} break;
case UNREGISTER_BUFFERS: {
CHECK_INTERFACE(ISurface, data, reply);
unregisterBuffers();
return NO_ERROR;
} break;
case POST_BUFFER: {
CHECK_INTERFACE(ISurface, data, reply);
ssize_t offset = data.readInt32();
postBuffer(offset);
return NO_ERROR;
} break;
case CREATE_OVERLAY: {
CHECK_INTERFACE(ISurface, data, reply);
int w = data.readInt32();
int h = data.readInt32();
int f = data.readInt32();
int orientation = data.readInt32();
sp<OverlayRef> o = createOverlay(w, h, f, orientation);
return OverlayRef::writeToParcel(reply, o);
} break;
default:
return BBinder::onTransact(code, data, reply, flags);
}
}
示例3: onTransact
status_t BnMediaRecorder::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
switch(code) {
case RELEASE: {
LOGV("RELEASE");
CHECK_INTERFACE(IMediaRecorder, data, reply);
reply->writeInt32(release());
return NO_ERROR;
} break;
case INIT: {
LOGV("INIT");
CHECK_INTERFACE(IMediaRecorder, data, reply);
reply->writeInt32(init());
return NO_ERROR;
} break;
case CLOSE: {
LOGV("CLOSE");
CHECK_INTERFACE(IMediaRecorder, data, reply);
reply->writeInt32(close());
return NO_ERROR;
} break;
case RESET: {
LOGV("RESET");
CHECK_INTERFACE(IMediaRecorder, data, reply);
reply->writeInt32(reset());
return NO_ERROR;
} break;
case PAUSE: {
LOGV("PAUSE");
CHECK_INTERFACE(IMediaRecorder, data, reply);
reply->writeInt32(pause());
return NO_ERROR;
} break;
case STOP: {
LOGV("STOP");
CHECK_INTERFACE(IMediaRecorder, data, reply);
reply->writeInt32(stop());
return NO_ERROR;
} break;
case START: {
LOGV("START");
CHECK_INTERFACE(IMediaRecorder, data, reply);
reply->writeInt32(start());
return NO_ERROR;
} break;
case PREPARE: {
LOGV("PREPARE");
CHECK_INTERFACE(IMediaRecorder, data, reply);
reply->writeInt32(prepare());
return NO_ERROR;
} break;
case GET_MAX_AMPLITUDE: {
LOGV("GET_MAX_AMPLITUDE");
CHECK_INTERFACE(IMediaRecorder, data, reply);
int max = 0;
status_t ret = getMaxAmplitude(&max);
reply->writeInt32(max);
reply->writeInt32(ret);
return NO_ERROR;
} break;
case SET_VIDEO_SOURCE: {
LOGV("SET_VIDEO_SOURCE");
CHECK_INTERFACE(IMediaRecorder, data, reply);
int vs = data.readInt32();
reply->writeInt32(setVideoSource(vs));
return NO_ERROR;
} break;
case SET_AUDIO_SOURCE: {
LOGV("SET_AUDIO_SOURCE");
CHECK_INTERFACE(IMediaRecorder, data, reply);
int as = data.readInt32();
reply->writeInt32(setAudioSource(as));
return NO_ERROR;
} break;
case SET_OUTPUT_FORMAT: {
LOGV("SET_OUTPUT_FORMAT");
CHECK_INTERFACE(IMediaRecorder, data, reply);
int of = data.readInt32();
reply->writeInt32(setOutputFormat(of));
return NO_ERROR;
} break;
case SET_VIDEO_ENCODER: {
LOGV("SET_VIDEO_ENCODER");
CHECK_INTERFACE(IMediaRecorder, data, reply);
int ve = data.readInt32();
reply->writeInt32(setVideoEncoder(ve));
return NO_ERROR;
} break;
case SET_AUDIO_ENCODER: {
LOGV("SET_AUDIO_ENCODER");
CHECK_INTERFACE(IMediaRecorder, data, reply);
int ae = data.readInt32();
reply->writeInt32(setAudioEncoder(ae));
return NO_ERROR;
} break;
case SET_OUTPUT_FILE_PATH: {
LOGV("SET_OUTPUT_FILE_PATH");
CHECK_INTERFACE(IMediaRecorder, data, reply);
//.........这里部分代码省略.........
示例4: onTransact
status_t BnMediaMetadataRetriever::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
switch (code) {
case DISCONNECT: {
CHECK_INTERFACE(IMediaMetadataRetriever, data, reply);
disconnect();
return NO_ERROR;
} break;
case SET_DATA_SOURCE_URL: {
CHECK_INTERFACE(IMediaMetadataRetriever, data, reply);
const char* srcUrl = 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);
}
reply->writeInt32(
setDataSource(srcUrl, numHeaders > 0 ? &headers : NULL));
return NO_ERROR;
} break;
case SET_DATA_SOURCE_FD: {
CHECK_INTERFACE(IMediaMetadataRetriever, data, reply);
int fd = dup(data.readFileDescriptor());
int64_t offset = data.readInt64();
int64_t length = data.readInt64();
reply->writeInt32(setDataSource(fd, offset, length));
return NO_ERROR;
} break;
case GET_FRAME_AT_TIME: {
CHECK_INTERFACE(IMediaMetadataRetriever, data, reply);
int64_t timeUs = data.readInt64();
int option = data.readInt32();
#ifndef DISABLE_GROUP_SCHEDULE_HACK
setSchedPolicy(data);
#endif
sp<IMemory> bitmap = getFrameAtTime(timeUs, option);
if (bitmap != 0) { // Don't send NULL across the binder interface
reply->writeInt32(NO_ERROR);
reply->writeStrongBinder(bitmap->asBinder());
} else {
reply->writeInt32(UNKNOWN_ERROR);
}
#ifndef DISABLE_GROUP_SCHEDULE_HACK
restoreSchedPolicy();
#endif
return NO_ERROR;
} break;
case EXTRACT_ALBUM_ART: {
CHECK_INTERFACE(IMediaMetadataRetriever, data, reply);
#ifndef DISABLE_GROUP_SCHEDULE_HACK
setSchedPolicy(data);
#endif
sp<IMemory> albumArt = extractAlbumArt();
if (albumArt != 0) { // Don't send NULL across the binder interface
reply->writeInt32(NO_ERROR);
reply->writeStrongBinder(albumArt->asBinder());
} else {
reply->writeInt32(UNKNOWN_ERROR);
}
#ifndef DISABLE_GROUP_SCHEDULE_HACK
restoreSchedPolicy();
#endif
return NO_ERROR;
} break;
case EXTRACT_METADATA: {
CHECK_INTERFACE(IMediaMetadataRetriever, data, reply);
#ifndef DISABLE_GROUP_SCHEDULE_HACK
setSchedPolicy(data);
#endif
int keyCode = data.readInt32();
const char* value = extractMetadata(keyCode);
if (value != NULL) { // Don't send NULL across the binder interface
reply->writeInt32(NO_ERROR);
reply->writeCString(value);
} else {
reply->writeInt32(UNKNOWN_ERROR);
}
#ifndef DISABLE_GROUP_SCHEDULE_HACK
restoreSchedPolicy();
#endif
return NO_ERROR;
} break;
default:
return BBinder::onTransact(code, data, reply, flags);
}
}
示例5: setSchedPolicy
static void setSchedPolicy(const Parcel& data)
{
SchedPolicy policy = (SchedPolicy) data.readInt32();
set_sched_policy(gettid(), policy);
}
示例6: CheckStartTimeMs
void CheckStartTimeMs(const Parcel& parcel, int32_t timeMs) {
int32_t intval;
parcel.setDataPosition(8);
parcel.readInt32(&intval);
EXPECT_EQ(timeMs, intval);
}
示例7: onTransact
status_t BnAudioPolicyService::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
switch (code) {
case SET_DEVICE_CONNECTION_STATE: {
CHECK_INTERFACE(IAudioPolicyService, data, reply);
audio_devices_t device =
static_cast <audio_devices_t>(data.readInt32());
audio_policy_dev_state_t state =
static_cast <audio_policy_dev_state_t>(data.readInt32());
const char *device_address = data.readCString();
reply->writeInt32(static_cast<uint32_t> (setDeviceConnectionState(device,
state,
device_address)));
return NO_ERROR;
} break;
case GET_DEVICE_CONNECTION_STATE: {
CHECK_INTERFACE(IAudioPolicyService, data, reply);
audio_devices_t device =
static_cast<audio_devices_t> (data.readInt32());
const char *device_address = data.readCString();
reply->writeInt32(static_cast<uint32_t> (getDeviceConnectionState(device,
device_address)));
return NO_ERROR;
} break;
case SET_PHONE_STATE: {
CHECK_INTERFACE(IAudioPolicyService, data, reply);
reply->writeInt32(static_cast <uint32_t>(setPhoneState(
(audio_mode_t) data.readInt32())));
return NO_ERROR;
} break;
case SET_FORCE_USE: {
CHECK_INTERFACE(IAudioPolicyService, data, reply);
audio_policy_force_use_t usage = static_cast <audio_policy_force_use_t>(
data.readInt32());
audio_policy_forced_cfg_t config =
static_cast <audio_policy_forced_cfg_t>(data.readInt32());
reply->writeInt32(static_cast <uint32_t>(setForceUse(usage, config)));
return NO_ERROR;
} break;
case GET_FORCE_USE: {
CHECK_INTERFACE(IAudioPolicyService, data, reply);
audio_policy_force_use_t usage = static_cast <audio_policy_force_use_t>(
data.readInt32());
reply->writeInt32(static_cast <uint32_t>(getForceUse(usage)));
return NO_ERROR;
} break;
case GET_OUTPUT: {
CHECK_INTERFACE(IAudioPolicyService, data, reply);
audio_stream_type_t stream =
static_cast <audio_stream_type_t>(data.readInt32());
uint32_t samplingRate = data.readInt32();
audio_format_t format = (audio_format_t) data.readInt32();
audio_channel_mask_t channelMask = data.readInt32();
audio_output_flags_t flags =
static_cast <audio_output_flags_t>(data.readInt32());
audio_io_handle_t output = getOutput(stream,
samplingRate,
format,
channelMask,
flags);
reply->writeInt32(static_cast <int>(output));
return NO_ERROR;
} break;
case START_OUTPUT: {
CHECK_INTERFACE(IAudioPolicyService, data, reply);
audio_io_handle_t output = static_cast <audio_io_handle_t>(data.readInt32());
uint32_t stream = data.readInt32();
int session = data.readInt32();
reply->writeInt32(static_cast <uint32_t>(startOutput(output,
(audio_stream_type_t)stream,
session)));
return NO_ERROR;
} break;
case STOP_OUTPUT: {
CHECK_INTERFACE(IAudioPolicyService, data, reply);
audio_io_handle_t output = static_cast <audio_io_handle_t>(data.readInt32());
uint32_t stream = data.readInt32();
int session = data.readInt32();
reply->writeInt32(static_cast <uint32_t>(stopOutput(output,
(audio_stream_type_t)stream,
session)));
return NO_ERROR;
} break;
case RELEASE_OUTPUT: {
CHECK_INTERFACE(IAudioPolicyService, data, reply);
audio_io_handle_t output = static_cast <audio_io_handle_t>(data.readInt32());
releaseOutput(output);
return NO_ERROR;
} break;
//.........这里部分代码省略.........
示例8: onTransact
status_t BnSurfaceComposer::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
switch(code) {
case CREATE_CONNECTION: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
sp<IBinder> b = createConnection()->asBinder();
reply->writeStrongBinder(b);
} break;
case CREATE_CLIENT_CONNECTION: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
sp<IBinder> b = createClientConnection()->asBinder();
reply->writeStrongBinder(b);
} break;
case OPEN_GLOBAL_TRANSACTION: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
openGlobalTransaction();
} break;
case CLOSE_GLOBAL_TRANSACTION: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
closeGlobalTransaction();
} break;
case SET_ORIENTATION: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
DisplayID dpy = data.readInt32();
int orientation = data.readInt32();
uint32_t flags = data.readInt32();
reply->writeInt32( setOrientation(dpy, orientation, flags) );
} break;
case FREEZE_DISPLAY: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
DisplayID dpy = data.readInt32();
uint32_t flags = data.readInt32();
reply->writeInt32( freezeDisplay(dpy, flags) );
} break;
case UNFREEZE_DISPLAY: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
DisplayID dpy = data.readInt32();
uint32_t flags = data.readInt32();
reply->writeInt32( unfreezeDisplay(dpy, flags) );
} break;
case BOOT_FINISHED: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
bootFinished();
} break;
case SIGNAL: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
signal();
} break;
case GET_CBLK: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
sp<IBinder> b = getCblk()->asBinder();
reply->writeStrongBinder(b);
} break;
case CAPTURE_SCREEN: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
DisplayID dpy = data.readInt32();
uint32_t reqWidth = data.readInt32();
uint32_t reqHeight = data.readInt32();
sp<IMemoryHeap> heap;
uint32_t w, h;
PixelFormat f;
status_t res = captureScreen(dpy, &heap, &w, &h, &f,
reqWidth, reqHeight);
reply->writeStrongBinder(heap->asBinder());
reply->writeInt32(w);
reply->writeInt32(h);
reply->writeInt32(f);
reply->writeInt32(res);
} break;
case TURN_ELECTRON_BEAM_OFF: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
int32_t mode = data.readInt32();
status_t res = turnElectronBeamOff(mode);
reply->writeInt32(res);
} break;
case TURN_ELECTRON_BEAM_ON: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
int32_t mode = data.readInt32();
status_t res = turnElectronBeamOn(mode);
reply->writeInt32(res);
} break;
default:
return BBinder::onTransact(code, data, reply, flags);
}
return NO_ERROR;
}
示例9: ImageBuffer
sp<ImageBuffer> ImageBuffer::readFromParcel(const Parcel& data)
{
ARX_PRINT(ARX_ZONE_API, "%s\n", __FUNCTION__);
sp<ImageBuffer> imBuf = new ImageBuffer();
imBuf->mRemote = true;
imBuf->mIndex = data.readInt32();
DVP_Image_t *pImage = &imBuf->mImage;
pImage->planes = data.readInt32();
pImage->width = data.readInt32();
pImage->height = data.readInt32();
pImage->bufWidth = data.readInt32();
pImage->bufHeight = data.readInt32();
pImage->x_start = data.readInt32();
pImage->y_start = data.readInt32();
pImage->x_stride = data.readInt32();
pImage->y_stride = data.readInt32();
pImage->color = data.readInt32();
pImage->numBytes = data.readInt32();
pImage->memType = data.readInt32();
if (pImage->memType == DVP_MTYPE_GRALLOC_2DTILED ||
pImage->memType == DVP_MTYPE_DISPLAY_2DTILED) {
pImage->reserved = data.readNativeHandle();
imBuf->mUsingTexture = data.readInt32();
} else {
for (uint32_t i = 0; i < pImage->planes; i++) {
if (pImage->memType == DVP_MTYPE_MPUCACHED_VIRTUAL_SHARED) {
imBuf->mSharedFds[i] = data.readInt32();
} else {
imBuf->mSharedFds[i] = dup(data.readFileDescriptor());
}
}
}
return imBuf;
}
示例10: onTransact
status_t BnAndroidShm::onTransact( uint32_t code,
const Parcel &data,
Parcel *reply,
uint32_t flags)
{
switch(code) {
case HW_SENDCOMMAND:{
CHECK_INTERFACE(IAndroidShm, data, reply);
const char *str;
str = data.readCString();
reply->writeInt32(sendCommand(str));
return NO_ERROR;
}break;
case HW_GETBUFFER:{
CHECK_INTERFACE(IAndroidShm, data, reply);
int32_t index;
data.readInt32(&index);
sp<IMemoryHeap> Data = getBuffer(index);
if(Data != NULL){
reply->writeStrongBinder(Data->asBinder());
}
return NO_ERROR;
}break;
case HW_ALLOC_SHM:{
CHECK_INTERFACE(IAndroidShm, data, reply);
int32_t size;
data.readInt32(&size);
reply->writeInt32(allocShm(size));
return NO_ERROR;
}break;
case HW_REMOVE_SHM:{
CHECK_INTERFACE(IAndroidShm, data, reply);
int32_t index;
data.readInt32(&index);
reply->writeInt32(removeShm(index));
return NO_ERROR;
}break;
case HW_IS_ALLOCATED:{
CHECK_INTERFACE(IAndroidShm, data, reply);
int32_t index;
data.readInt32(&index);
reply->writeInt32(isAllocated(index));
return NO_ERROR;
}break;
case HW_SET_REGISTRY_INDEX:{
CHECK_INTERFACE(IAndroidShm, data, reply);
int32_t index;
data.readInt32(&index);
reply->writeInt32(setRegistryIndex(index));
return NO_ERROR;
}break;
case HW_GET_REGISTRY_INDEX:{
CHECK_INTERFACE(IAndroidShm, data, reply);
reply->writeInt32(getRegistryIndex());
return NO_ERROR;
}break;
case HW_INIT_SEMAPHORE:{
CHECK_INTERFACE(IAndroidShm, data, reply);
const char *name;
name = data.readCString();
sp<IMemoryHeap> Data = InitSemaphore(name);
if(Data != NULL){
reply->writeStrongBinder(Data->asBinder());
}
return NO_ERROR;
}break;
default:
return BBinder::onTransact(code, data, reply, flags);
}
}