本文整理汇总了C++中AttributeMap::getAsInt方法的典型用法代码示例。如果您正苦于以下问题:C++ AttributeMap::getAsInt方法的具体用法?C++ AttributeMap::getAsInt怎么用?C++ AttributeMap::getAsInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttributeMap
的用法示例。
在下文中一共展示了AttributeMap::getAsInt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createConsumerGLTextureExternal
Error Stream::createConsumerGLTextureExternal(const AttributeMap &attributes, gl::Context *context)
{
ASSERT(mState == EGL_STREAM_STATE_CREATED_KHR);
ASSERT(mConsumerType == ConsumerType::NoConsumer);
ASSERT(mProducerType == ProducerType::NoProducer);
ASSERT(context != nullptr);
const auto &glState = context->getState();
EGLenum bufferType = attributes.getAsInt(EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER);
if (bufferType == EGL_RGB_BUFFER)
{
mPlanes[0].texture = glState.getTargetTexture(gl::TextureType::External);
ASSERT(mPlanes[0].texture != nullptr);
mPlanes[0].texture->bindStream(this);
mConsumerType = ConsumerType::GLTextureRGB;
mPlaneCount = 1;
}
else
{
mPlaneCount = attributes.getAsInt(EGL_YUV_NUMBER_OF_PLANES_EXT, 2);
ASSERT(mPlaneCount <= 3);
for (EGLint i = 0; i < mPlaneCount; i++)
{
// Fetch all the textures
mPlanes[i].textureUnit = attributes.getAsInt(EGL_YUV_PLANE0_TEXTURE_UNIT_NV + i, -1);
if (mPlanes[i].textureUnit != EGL_NONE)
{
mPlanes[i].texture =
glState.getSamplerTexture(mPlanes[i].textureUnit, gl::TextureType::External);
ASSERT(mPlanes[i].texture != nullptr);
}
}
// Bind them to the stream
for (EGLint i = 0; i < mPlaneCount; i++)
{
if (mPlanes[i].textureUnit != EGL_NONE)
{
mPlanes[i].texture->bindStream(this);
}
}
mConsumerType = ConsumerType::GLTextureYUV;
}
mContext = context;
mState = EGL_STREAM_STATE_CONNECTING_KHR;
return NoError();
}
示例2: mDisplay
Stream::Stream(Display *display, const AttributeMap &attribs)
: mDisplay(display),
mProducerImplementation(nullptr),
mState(EGL_STREAM_STATE_CREATED_KHR),
mProducerFrame(0),
mConsumerFrame(0),
mConsumerLatency(attribs.getAsInt(EGL_CONSUMER_LATENCY_USEC_KHR, 0)),
mConsumerAcquireTimeout(attribs.getAsInt(EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR, 0)),
mPlaneCount(0),
mConsumerType(ConsumerType::NoConsumer),
mProducerType(ProducerType::NoProducer)
{
for (auto &plane : mPlanes)
{
plane.textureUnit = -1;
plane.texture = nullptr;
}
}