houxiao
2017-08-17 0250edfd9c4d453f25a2f9827698ccf87ff5afff
RtspFace/PL_Paint.cpp
@@ -5,7 +5,6 @@
#include <string.h> // for memcpy
#include <opencv2/core/mat.hpp>
#include <opencv2/imgproc.hpp>
#ifdef ENABLE_WTEXT
#include "CvUtil/CvxText.h"
#endif
@@ -31,6 +30,12 @@
    delete (CvxText*)cvxText;
   cvxText = nullptr;
#endif
}
void PLPLContext::clear()
{
   cmds.clear();
   params.clear();
}
struct PL_Paint_Internal
@@ -186,7 +191,7 @@
bool plplDraw_Rect_RGB565(PLPLContext* plplCtx, MB_Frame* paintMb, int& paramOffset)
{
    int LTX = plplCtx->params[paramOffset + 0].val_i;
   int LTX = plplCtx->params[paramOffset + 0].val_i;
    int LTY = plplCtx->params[paramOffset + 1].val_i;
    int RBX = plplCtx->params[paramOffset + 2].val_i;
    int RBY = plplCtx->params[paramOffset + 3].val_i;
@@ -237,7 +242,7 @@
bool plplDraw_Text_RGB565(PLPLContext* plplCtx, MB_Frame* paintMb, int& paramOffset)
{
    int LTX = plplCtx->params[paramOffset + 0].val_i;
   int LTX = plplCtx->params[paramOffset + 0].val_i;
    int LTY = plplCtx->params[paramOffset + 1].val_i;
    const char* TXT = plplCtx->params[paramOffset + 2].val_s;
    paramOffset += 3;
@@ -309,7 +314,7 @@
#endif
}
bool plplExecutor_YUV(PL_Paint_Internal *in)
bool plpl_executor(PL_Paint_Internal *in)
{
   MB_Frame* paintMb = &(in->lastMbfBuffOrigin);
   int ret = true;
@@ -427,7 +432,7 @@
   in->lastMbfBuffOrigin.height = frame->height;
   in->lastMbfBuffOrigin.pts = frame->pts;
   in->payError = !plplExecutor_YUV(in);
   in->payError = !plpl_executor(in);
   return false;
}
@@ -436,29 +441,12 @@
{
   PL_Paint_Internal* in = (PL_Paint_Internal*)internal;
   in->payError = true;
    if (pm.type != PipeMaterial::PMT_FRAME)
    {
        LOG_ERROR << "Only support PMT_FRAME" << LOG_ENDL;
        return false;
    }
    if (pm.buffer == nullptr)
        return false;
    MB_Frame* frame = (MB_Frame*)pm.buffer;
    switch(frame->type)
    {
        case MB_Frame::MBFT_YUV420:
        case MB_Frame::MBFT_NV12:
        case MB_Frame::MBFT_RGB565:
            pm.breake(PipeMaterial::PMT_FRAME, MB_Frame::MBFT_RGB565, PL_Paint::pay_breaker_MBFT, in);
            return !(in->payError);
        default:
            LOG_ERROR << "Only support MBFT_YUV420 / MBFT_NV12 / MBFT_RGB565" << LOG_ENDL;
            in->payError = true;
            break;
    }
   if (in->payError)
      pm.breake(PipeMaterial::PMT_FRAME, MB_Frame::MBFT_YUV420, PL_Paint::pay_breaker_MBFT, in);
   if (in->payError)
      pm.breake(PipeMaterial::PMT_FRAME, MB_Frame::MBFT_NV12, PL_Paint::pay_breaker_MBFT, in);
   if (in->payError)
      pm.breake(PipeMaterial::PMT_FRAME, MB_Frame::MBFT_RGB565, PL_Paint::pay_breaker_MBFT, in);
   return !(in->payError);
}