本文整理汇总了C++中LayerAndroid::findById方法的典型用法代码示例。如果您正苦于以下问题:C++ LayerAndroid::findById方法的具体用法?C++ LayerAndroid::findById怎么用?C++ LayerAndroid::findById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayerAndroid
的用法示例。
在下文中一共展示了LayerAndroid::findById方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendSurfaceTexture
// This is called on the UI thread only.
// The video layers are composited on the webkit thread and then copied over
// to the UI thread with the same ID. For rendering, we are only using the
// video layers on the UI thread. Therefore, on the UI thread, we have to use
// the videoLayerId from Java side to find the exact video layer in the tree
// to set the surface texture.
// Every time a play call into Java side, the videoLayerId will be sent and
// saved in Java side. Then every time setBaseLayer call, the saved
// videoLayerId will be passed to this function to find the Video Layer.
// Return value: true when the video layer is found.
static bool SendSurfaceTexture(JNIEnv* env, jobject obj, jobject surfTex,
int baseLayer, int videoLayerId,
int textureName, int playerState) {
if (!surfTex)
return false;
sp<SurfaceTexture> texture = android::SurfaceTexture_getSurfaceTexture(env, surfTex);
if (!texture.get())
return false;
BaseLayerAndroid* layerImpl = reinterpret_cast<BaseLayerAndroid*>(baseLayer);
if (!layerImpl)
return false;
if (!layerImpl->countChildren())
return false;
LayerAndroid* compositedRoot = static_cast<LayerAndroid*>(layerImpl->getChild(0));
if (!compositedRoot)
return false;
VideoLayerAndroid* videoLayer =
static_cast<VideoLayerAndroid*>(compositedRoot->findById(videoLayerId));
if (!videoLayer)
return false;
// Set the SurfaceTexture to the layer we found
videoLayer->setSurfaceTexture(texture, textureName, static_cast<PlayerState>(playerState));
return true;
}