本文整理汇总了C++中sp::connect方法的典型用法代码示例。如果您正苦于以下问题:C++ sp::connect方法的具体用法?C++ sp::connect怎么用?C++ sp::connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sp
的用法示例。
在下文中一共展示了sp::connect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SfUtProc
JNIEXPORT int JNICALL Java_com_mediatek_ut_SurfaceFlingerTest_connect(JNIEnv *_env, jobject /*_this*/,
jobject native_window, jboolean useDefaultSize, jint w, jint h, jboolean updateScreen, jint api, jint format, jint colorIndex) {
if (utProc == NULL)
utProc = new SfUtProc();
sp<ANativeWindow> window;
utProc->mId++;
LOGD("connect, native_window=%p, useDefaultSize=%d, w=%d, h=%d, updateScreen=%d, api=%d, format=%x, colorIndex=%d",
native_window, useDefaultSize, w, h, updateScreen, api, format, colorIndex);
if (native_window == NULL) {
LOGW("native_window is null");
//not_valid_surface:
// jniThrowException(_env, "java/lang/IllegalArgumentException",
// "[SFT_jni] Make sure the SurfaceView or associated SurfaceHolder has a valid Surface");
return -1;
}
// window = android_view_Surface_getNativeWindow(_env, native_window);
window = ANativeWindow_fromSurface(_env, native_window);
if (window == NULL) {
LOGW("getNative window is null");
// goto not_valid_surface;
return -1;
}
utProc->connect(utProc->mId, window, useDefaultSize, w, h, updateScreen, api, format, colorIndex);
return utProc->mId;
}
示例2: LOGV
// construct a camera client from an existing camera remote
sp<Camera> Camera::create(const sp<ICamera>& camera)
{
LOGV("create");
if (camera == 0) {
LOGE("camera remote is a NULL pointer");
return 0;
}
sp<Camera> c = new Camera();
if (camera->connect(c) == NO_ERROR) {
c->mStatus = NO_ERROR;
c->mCamera = camera;
camera->asBinder()->linkToDeath(c);
}
return c;
}
示例3: AfterConnect
AfterConnect() {
cs = getCameraService();
cc = new MCameraClient();
c = cs->connect(cc);
ASSERT(c != 0);
}
示例4: listener
status_t Camera3StreamSplitter::addOutputLocked(const sp<Surface>& outputQueue) {
ATRACE_CALL();
if (outputQueue == nullptr) {
SP_LOGE("addOutput: outputQueue must not be NULL");
return BAD_VALUE;
}
sp<IGraphicBufferProducer> gbp = outputQueue->getIGraphicBufferProducer();
// Connect to the buffer producer
sp<OutputListener> listener(new OutputListener(this, gbp));
IInterface::asBinder(gbp)->linkToDeath(listener);
status_t res = outputQueue->connect(NATIVE_WINDOW_API_CAMERA, listener);
if (res != NO_ERROR) {
SP_LOGE("addOutput: failed to connect (%d)", res);
return res;
}
// Query consumer side buffer count, and update overall buffer count
int maxConsumerBuffers = 0;
res = static_cast<ANativeWindow*>(outputQueue.get())->query(
outputQueue.get(),
NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &maxConsumerBuffers);
if (res != OK) {
SP_LOGE("%s: Unable to query consumer undequeued buffer count"
" for surface", __FUNCTION__);
return res;
}
SP_LOGV("%s: Consumer wants %d buffers, Producer wants %zu", __FUNCTION__,
maxConsumerBuffers, mMaxHalBuffers);
size_t totalBufferCount = maxConsumerBuffers + mMaxHalBuffers;
res = native_window_set_buffer_count(outputQueue.get(),
totalBufferCount);
if (res != OK) {
SP_LOGE("%s: Unable to set buffer count for surface %p",
__FUNCTION__, outputQueue.get());
return res;
}
// Set dequeueBuffer/attachBuffer timeout if the consumer is not hw composer or hw texture.
// We need skip these cases as timeout will disable the non-blocking (async) mode.
uint64_t usage = 0;
res = native_window_get_consumer_usage(static_cast<ANativeWindow*>(outputQueue.get()), &usage);
if (!(usage & (GRALLOC_USAGE_HW_COMPOSER | GRALLOC_USAGE_HW_TEXTURE))) {
outputQueue->setDequeueTimeout(kDequeueBufferTimeout);
}
res = gbp->allowAllocation(false);
if (res != OK) {
SP_LOGE("%s: Failed to turn off allocation for outputQueue", __FUNCTION__);
return res;
}
// Add new entry into mOutputs
mOutputs.push_back(gbp);
mNotifiers[gbp] = listener;
mOutputSlots[gbp] = std::make_unique<OutputSlots>(totalBufferCount);
mMaxConsumerBuffers += maxConsumerBuffers;
return NO_ERROR;
}