当前位置: 首页>>代码示例>>C++>>正文


C++ Parcel::readNativeHandle方法代码示例

本文整理汇总了C++中Parcel::readNativeHandle方法的典型用法代码示例。如果您正苦于以下问题:C++ Parcel::readNativeHandle方法的具体用法?C++ Parcel::readNativeHandle怎么用?C++ Parcel::readNativeHandle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Parcel的用法示例。


在下文中一共展示了Parcel::readNativeHandle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OverlayRef

sp<OverlayRef> OverlayRef::readFromParcel(const Parcel& data) {
    sp<OverlayRef> result;
    sp<IOverlay> overlay = IOverlay::asInterface(data.readStrongBinder());
    if (overlay != NULL) {
        uint32_t w = data.readInt32();
        uint32_t h = data.readInt32();
        uint32_t f = data.readInt32();
        uint32_t ws = data.readInt32();
        uint32_t hs = data.readInt32();
        native_handle* handle = data.readNativeHandle();

        result = new OverlayRef();
        result->mOverlayHandle = handle;
        result->mOverlayChannel = overlay;
        result->mWidth = w;
        result->mHeight = h;
        result->mFormat = f;
        result->mWidthStride = ws;
        result->mHeightStride = hs;
    }
    return result;
}
开发者ID:yuanhy0055,项目名称:OyO,代码行数:22,代码来源:Overlay.cpp

示例2: onTransact

status_t BnCameraRecordingProxy::onTransact(
    uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
    switch(code) {
        case START_RECORDING: {
            ALOGV("START_RECORDING");
            CHECK_INTERFACE(ICameraRecordingProxy, data, reply);
            sp<ICameraRecordingProxyListener> listener =
                interface_cast<ICameraRecordingProxyListener>(data.readStrongBinder());
            reply->writeInt32(startRecording(listener));
            return NO_ERROR;
        } break;
        case STOP_RECORDING: {
            ALOGV("STOP_RECORDING");
            CHECK_INTERFACE(ICameraRecordingProxy, data, reply);
            stopRecording();
            return NO_ERROR;
        } break;
        case RELEASE_RECORDING_FRAME: {
            ALOGV("RELEASE_RECORDING_FRAME");
            CHECK_INTERFACE(ICameraRecordingProxy, data, reply);
            sp<IMemory> mem = interface_cast<IMemory>(data.readStrongBinder());
            releaseRecordingFrame(mem);
            return NO_ERROR;
        } break;
        case RELEASE_RECORDING_FRAME_HANDLE: {
            ALOGV("RELEASE_RECORDING_FRAME_HANDLE");
            CHECK_INTERFACE(ICameraRecordingProxy, data, reply);

            // releaseRecordingFrameHandle will be responsble to close the native handle.
            releaseRecordingFrameHandle(data.readNativeHandle());
            return NO_ERROR;
        } break;
        default:
            return BBinder::onTransact(code, data, reply, flags);
    }
}
开发者ID:android-source,项目名称:platform_frameworks_av,代码行数:37,代码来源:ICameraRecordingProxy.cpp

示例3: 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;
}
开发者ID:richardxu,项目名称:panda-a4,代码行数:37,代码来源:ImageBuffer.cpp

示例4: onTransact

status_t BnCameraRecordingProxyListener::onTransact(
    uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
    switch(code) {
        case DATA_CALLBACK_TIMESTAMP: {
            ALOGV("DATA_CALLBACK_TIMESTAMP");
            CHECK_INTERFACE(ICameraRecordingProxyListener, data, reply);
            nsecs_t timestamp = data.readInt64();
            int32_t msgType = data.readInt32();
            sp<IMemory> imageData = interface_cast<IMemory>(data.readStrongBinder());
            dataCallbackTimestamp(timestamp, msgType, imageData);
            return NO_ERROR;
        } break;
        case RECORDING_FRAME_HANDLE_CALLBACK_TIMESTAMP: {
            ALOGV("RECORDING_FRAME_HANDLE_CALLBACK_TIMESTAMP");
            CHECK_INTERFACE(ICameraRecordingProxyListener, data, reply);
            nsecs_t timestamp;
            status_t res = data.readInt64(&timestamp);
            if (res != OK) {
                ALOGE("%s: Failed to read timestamp: %s (%d)", __FUNCTION__, strerror(-res), res);
                return BAD_VALUE;
            }

            native_handle_t* handle = data.readNativeHandle();
            if (handle == nullptr) {
                ALOGE("%s: Received a null native handle", __FUNCTION__);
                return BAD_VALUE;
            }
            // The native handle will be freed in
            // BpCameraRecordingProxy::releaseRecordingFrameHandle.
            recordingFrameHandleCallbackTimestamp(timestamp, handle);
            return NO_ERROR;
        } break;
        case RECORDING_FRAME_HANDLE_CALLBACK_TIMESTAMP_BATCH: {
            ALOGV("RECORDING_FRAME_HANDLE_CALLBACK_TIMESTAMP_BATCH");
            CHECK_INTERFACE(ICameraRecordingProxyListener, data, reply);
            uint32_t n = 0;
            status_t res = data.readUint32(&n);
            if (res != OK) {
                ALOGE("%s: Failed to read batch size: %s (%d)", __FUNCTION__, strerror(-res), res);
                return BAD_VALUE;
            }
            std::vector<nsecs_t> timestamps;
            std::vector<native_handle_t*> handles;
            timestamps.reserve(n);
            handles.reserve(n);
            for (uint32_t i = 0; i < n; i++) {
                nsecs_t t;
                res = data.readInt64(&t);
                if (res != OK) {
                    ALOGE("%s: Failed to read timestamp[%d]: %s (%d)",
                            __FUNCTION__, i, strerror(-res), res);
                    return BAD_VALUE;
                }
                timestamps.push_back(t);
            }
            for (uint32_t i = 0; i < n; i++) {
                native_handle_t* handle = data.readNativeHandle();
                if (handle == nullptr) {
                    ALOGE("%s: Received a null native handle at handles[%d]",
                            __FUNCTION__, i);
                    return BAD_VALUE;
                }
                handles.push_back(handle);
            }
            // The native handle will be freed in
            // BpCameraRecordingProxy::releaseRecordingFrameHandleBatch.
            recordingFrameHandleCallbackTimestampBatch(timestamps, handles);
            return NO_ERROR;
        } break;
        default:
            return BBinder::onTransact(code, data, reply, flags);
    }
}
开发者ID:MIPS,项目名称:frameworks-av,代码行数:74,代码来源:ICameraRecordingProxyListener.cpp


注:本文中的Parcel::readNativeHandle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。