本文整理汇总了C++中android::sp::get方法的典型用法代码示例。如果您正苦于以下问题:C++ sp::get方法的具体用法?C++ sp::get怎么用?C++ sp::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android::sp
的用法示例。
在下文中一共展示了sp::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
sp<PipelineModelBase::HalImageStreamBufferPoolT>
PipelineModelBase::
addHalStreamBufferPoolLocked(
android::sp<IImageStreamInfo> pStreamInfo
)
{
if ( pStreamInfo == 0 ) {
MY_LOGE("NULL IImageStreamInfo");
return NULL;
}
//
String8 const name = String8::format("%s:%s", getName(), pStreamInfo->getStreamName());
//
IImageStreamInfo::BufPlanes_t const& bufPlanes = pStreamInfo->getBufPlanes();
size_t bufStridesInBytes[3] = {0};
size_t bufBoundaryInBytes[3]= {0};
for (size_t i = 0; i < bufPlanes.size(); i++) {
bufStridesInBytes[i] = bufPlanes[i].rowStrideInBytes;
}
IImageBufferAllocator::ImgParam const imgParam(
pStreamInfo->getImgFormat(),
pStreamInfo->getImgSize(),
bufStridesInBytes, bufBoundaryInBytes,
bufPlanes.size()
);
sp<HalImageStreamBufferPoolT>
pPool = new HalImageStreamBufferPoolT(
name.string(),
HalImageStreamBufferAllocatorT(pStreamInfo.get(), imgParam)
);
if ( pPool == 0 ) {
MY_LOGE("Fail to new a image pool:%s", name.string());
return NULL;
}
//
MERROR err = pPool->initPool(getName(), pStreamInfo->getMaxBufNum(), pStreamInfo->getMinInitBufNum());
if ( OK != err ) {
MY_LOGE("%s: initPool err:%d(%s)", name.string(), err, ::strerror(-err));
return NULL;
}
if ( OK != pPool->commitPool(getName()) ) {
MY_LOGE("%s: commitPool err:%d(%s)", name.string(), err, ::strerror(-err));
return NULL;
}
//
mHalImageStreamBufferPoolMap.add(pStreamInfo->getStreamId(), pPool);
return pPool;
}
示例2: ALOGD
android::sp<android::IBinder> get_service_manager()
{
static android::sp<android::IBinder> binder;
if (binder.get() != NULL) {
return binder;
}
ALOGD("elastos servicemanager try getting...\n");
android::sp<android::IServiceManager> sm = android::defaultServiceManager();
do {
binder = sm->getService(android::String16(ELASTOS_SERVICEMGR_NAME));
if (binder != 0) {
break;
}
usleep(500000);
} while (true);
ALOGD("elastos servicemanager getted.\n");
return binder;
}
示例3: _l
MERROR
PipelineModelBase::
acquireHalStreamBuffer(
android::sp<IImageStreamInfo> const pStreamInfo,
android::sp<HalImageStreamBuffer>& rpStreamBuffer
) const
{
RWLock::AutoRLock _l(mRWLock);
//
StreamId_T const streamId = pStreamInfo->getStreamId();
sp<HalImageStreamBufferPoolT> pPool = mHalImageStreamBufferPoolMap.valueFor(streamId);
MY_LOGE_IF(pPool == 0, "NULL HalImageStreamBufferPool - stream:%#"PRIxPTR"(%s)", streamId, pStreamInfo->getStreamName());
MERROR err = pPool == 0 ? UNKNOWN_ERROR : pPool->acquireFromPool(__FUNCTION__, rpStreamBuffer, ::s2ns(10));
MY_LOGA_IF(
OK!=err || rpStreamBuffer==0,
"[acquireFromPool] err:%d(%s) pStreamBuffer:%p stream:%#"PRIxPTR"(%s)",
err, ::strerror(-err), rpStreamBuffer.get(), streamId, pStreamInfo->getStreamName()
);
return err;
}
示例4: Setup
virtual void Setup(Compositor* aCompositor, size_t aStep) {
mBuf = nullptr;
int w = 256;
int h = 256;
int32_t format = android::PIXEL_FORMAT_RGBA_8888;;
mGralloc = new android::GraphicBuffer(w, h,
format,
android::GraphicBuffer::USAGE_SW_READ_OFTEN |
android::GraphicBuffer::USAGE_SW_WRITE_OFTEN |
android::GraphicBuffer::USAGE_HW_TEXTURE);
mTexture = new mozilla::layers::GrallocTextureSourceOGL((CompositorOGL*)aCompositor, mGralloc.get(), SurfaceFormat::B8G8R8A8);
}
示例5:
MyWifiClient *MyWifiClient::instance() {
static android::sp<MyWifiClient> _s_wifiClient = 0;
if (!_s_wifiClient.get())
_s_wifiClient = new MyWifiClient;
return _s_wifiClient.get();
}