本文整理汇总了C++中FramePtr::Data方法的典型用法代码示例。如果您正苦于以下问题:C++ FramePtr::Data方法的具体用法?C++ FramePtr::Data怎么用?C++ FramePtr::Data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FramePtr
的用法示例。
在下文中一共展示了FramePtr::Data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderFrames
void RenderThread::RenderFrames(FrameListPtr sourceFrames, YUV_PLANE plane)
{
FrameImpl tempFrame;
for (int i = 0; i < sourceFrames->size(); i++)
{
FramePtr sourceFrameOrig = sourceFrames->at(i);
if (!sourceFrameOrig)
{
continue;
}
unsigned int viewID = sourceFrameOrig->Info(VIEW_ID).toUInt();
Frame* sourceFrame = sourceFrameOrig.data();
float scaleX = 1;
float scaleY = 1;
if (plane != PLANE_COLOR)
{
COLOR_FORMAT c = sourceFrameOrig->Format()->Color();
if (c == I420 || c == I422 || c == I444)
{
sourceFrame = &tempFrame;
FormatPtr format = sourceFrameOrig->Format();
sourceFrame->Format()->SetColor(Y800);
sourceFrame->Format()->SetWidth(format->PlaneWidth(plane));
sourceFrame->Format()->SetHeight(format->PlaneHeight(plane));
sourceFrame->Format()->SetStride(0, format->Stride(plane));
sourceFrame->Format()->PlaneSize(0);
sourceFrame->SetData(0, sourceFrameOrig->Data(plane));
scaleX = ((float)format->PlaneWidth(plane))/format->Width();
scaleY = ((float)format->PlaneHeight(plane))/format->Height();
}
}
int pos = -1;
for (int k = 0; k < m_RenderFrames.size(); k++)
{
FramePtr _frame = m_RenderFrames.at(k);
if (_frame && _frame->Info(VIEW_ID).toUInt() == viewID)
{
pos = k;
break;
}
}
if (pos == -1)
{
pos = m_RenderFrames.size();
m_RenderFrames.append(FramePtr());
}
FramePtr& renderFrame = m_RenderFrames[pos];
// Deallocate if resolution changed
if (renderFrame && (sourceFrame->Format()->Width() !=
renderFrame->Format()->Width() ||
sourceFrame->Format()->Height() !=
renderFrame->Format()->Height()))
{
m_Renderer->Deallocate(renderFrame);
renderFrame.clear();
}
// Allocate if needed
if (!renderFrame)
{
m_Renderer->Allocate(renderFrame, sourceFrame->Format());
}
renderFrame->SetInfo(VIEW_ID, viewID);
renderFrame->SetInfo(RENDER_SRC_SCALE_X, scaleX);
renderFrame->SetInfo(RENDER_SRC_SCALE_Y, scaleY);
// Render frame
if (m_Renderer->GetFrame(renderFrame) == OK)
{
if (sourceFrame->Format() == renderFrame->Format())
{
for (int i=0; i<4; i++)
{
size_t len = renderFrame->Format()->PlaneSize(i);
if (len > 0)
{
memcpy(renderFrame->Data(i), sourceFrame->Data(i), len);
}
}
}else
{
ColorConversion(*sourceFrame, *renderFrame);
}
m_Renderer->ReleaseFrame(renderFrame);
}
}
}