houxiao
2016-12-22 fe007cee79c88a084bef01333f86f5da5f3c143f
add padd pl emements


git-svn-id: http://192.168.1.226/svn/proxy@29 454eff88-639b-444f-9e54-f578c98de674
4个文件已添加
2个文件已修改
230 ■■■■■ 已修改文件
RtspFace/PL_AVFrameBGRA.cpp 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RtspFace/PL_SensetimeFaceDetect.cpp 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RtspFace/PL_SensetimeFaceDetect.h 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RtspFace/PL_StaticJpegSource.cpp 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RtspFace/PL_StaticJpegSource.h 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RtspFace/main.cpp 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
RtspFace/PL_AVFrameBGRA.cpp
@@ -14,13 +14,12 @@
    uint8_t buffer[1920*1080*4];
    size_t buffSize;
    size_t buffSizeMax;
    AVFormatContext* pAVFormatContext;//#todo delete
    bool payError;
    
    PL_AVFrameBGRA_Internal() : 
        buffSize(0), buffSizeMax(sizeof(buffer)), 
        pAVFormatContext(nullptr), payError(true)
        payError(true)
    {
    }
    
@@ -55,8 +54,6 @@
    PL_AVFrameBGRA_Internal* in = (PL_AVFrameBGRA_Internal*)internal;
    in->reset();
    in->pAVFormatContext = avformat_alloc_context();
    return true;
}
RtspFace/PL_SensetimeFaceDetect.cpp
New file
@@ -0,0 +1,81 @@
#include "PL_SensetimeFaceDetect.h"
struct PL_SensetimeFaceDetect_Internal
{
    uint8_t buffer[1920*1080*4];
    size_t buffSize;
    size_t buffSizeMax;
    bool payError;
    PL_SensetimeFaceDetect_Internal() :
        buffSize(0), buffSizeMax(sizeof(buffer)),
        payError(true)
    {
    }
    ~PL_SensetimeFaceDetect_Internal()
    {
    }
    void reset()
    {
        buffSize = 0;
        payError = true;
    }
};
PipeLineElem* create_PL_SensetimeFaceDetect()
{
    return new PL_SensetimeFaceDetect;
}
PL_SensetimeFaceDetect::PL_SensetimeFaceDetect() : internal(new PL_SensetimeFaceDetect_Internal)
{
}
PL_SensetimeFaceDetect::~PL_SensetimeFaceDetect()
{
    delete (PL_SensetimeFaceDetect_Internal*)internal;
    internal= nullptr;
}
bool PL_SensetimeFaceDetect::init(void* args)
{
    PL_SensetimeFaceDetect_Internal* in = (PL_SensetimeFaceDetect_Internal*)internal;
    in->reset();
    return true;
}
void PL_SensetimeFaceDetect::finit()
{
    PL_SensetimeFaceDetect_Internal* in = (PL_SensetimeFaceDetect_Internal*)internal;
}
bool PL_SensetimeFaceDetect::pay(const PipeMaterial& pm)
{
    PL_SensetimeFaceDetect_Internal* in = (PL_SensetimeFaceDetect_Internal*)internal;
    //in->buffer readly
    //static size_t f=0;
    //char fname[50];
    //sprintf(fname, "%u.bgra", ++f);
    //FILE * pFile = fopen (fname,"wb");
    //fwrite (in->buffer , sizeof(char), in->buffSize, pFile);
    //fclose(pFile);
    return true;
}
bool PL_SensetimeFaceDetect::gain(PipeMaterial& pm)
{
    PL_SensetimeFaceDetect_Internal* in = (PL_SensetimeFaceDetect_Internal*)internal;
    pm.buffer = in->buffer;
    pm.buffSize = in->buffSize;
    pm.former = this;
    return true;
}
RtspFace/PL_SensetimeFaceDetect.h
New file
@@ -0,0 +1,24 @@
#ifndef _PL_PL_SENSETIMEFACEDETECT_H_
#define _PL_PL_SENSETIMEFACEDETECT_H_
#include "PipeLine.h"
class PL_SensetimeFaceDetect : public PipeLineElem
{
public:
    PL_SensetimeFaceDetect();
    virtual ~PL_SensetimeFaceDetect();
    virtual bool init(void* args);
    virtual void finit();
    virtual bool pay(const PipeMaterial& pm);
    virtual bool gain(PipeMaterial& pm);
private:
    void* internal;
};
PipeLineElem* create_PL_SensetimeFaceDetect();
#endif
RtspFace/PL_StaticJpegSource.cpp
New file
@@ -0,0 +1,86 @@
#include "PL_StaticJpegSource.h"
extern "C"
{
    #include <libyuv.h>
}
struct PL_StaticJpegSource_Internal
{
    uint8_t buffer[1920*1080*4];
    size_t buffSize;
    size_t buffSizeMax;
    bool payError;
    PL_StaticJpegSource_Internal() :
        buffSize(0), buffSizeMax(sizeof(buffer)),
        payError(true)
    {
    }
    ~PL_StaticJpegSource_Internal()
    {
    }
    void reset()
    {
        buffSize = 0;
        payError = true;
    }
};
PipeLineElem* create_PL_StaticJpegSource()
{
    return new PL_StaticJpegSource;
}
PL_StaticJpegSource::PL_StaticJpegSource() : internal(new PL_StaticJpegSource_Internal)
{
}
PL_StaticJpegSource::~PL_StaticJpegSource()
{
    delete (PL_StaticJpegSource_Internal*)internal;
    internal= nullptr;
}
bool PL_StaticJpegSource::init(void* args)
{
    PL_StaticJpegSource_Internal* in = (PL_StaticJpegSource_Internal*)internal;
    in->reset();
    return true;
}
void PL_StaticJpegSource::finit()
{
    PL_StaticJpegSource_Internal* in = (PL_StaticJpegSource_Internal*)internal;
}
bool PL_StaticJpegSource::pay(const PipeMaterial& pm)
{
    PL_StaticJpegSource_Internal* in = (PL_StaticJpegSource_Internal*)internal;
    //in->buffer readly
    //static size_t f=0;
    //char fname[50];
    //sprintf(fname, "%u.bgra", ++f);
    //FILE * pFile = fopen (fname,"wb");
    //fwrite (in->buffer , sizeof(char), in->buffSize, pFile);
    //fclose(pFile);
    return true;
}
bool PL_StaticJpegSource::gain(PipeMaterial& pm)
{
    PL_StaticJpegSource_Internal* in = (PL_StaticJpegSource_Internal*)internal;
    pm.buffer = in->buffer;
    pm.buffSize = in->buffSize;
    pm.former = this;
    return true;
}
RtspFace/PL_StaticJpegSource.h
New file
@@ -0,0 +1,24 @@
#ifndef _PL_PL_StaticJpegSource_H_
#define _PL_PL_StaticJpegSource_H_
#include "PipeLine.h"
class PL_StaticJpegSource : public PipeLineElem
{
public:
    PL_StaticJpegSource();
    virtual ~PL_StaticJpegSource();
    virtual bool init(void* args);
    virtual void finit();
    virtual bool pay(const PipeMaterial& pm);
    virtual bool gain(PipeMaterial& pm);
private:
    void* internal;
};
PipeLineElem* create_PL_StaticJpegSource();
#endif
RtspFace/main.cpp
@@ -1,7 +1,7 @@
#include "PipeLine.h"
#include "PL_RTSPClient.h"
#include "PL_H264Decoder.h"
#include "PL_AVFrameBGRA.h"
#include "PL_AVFrameYUV420.h"
#include <iostream>
using namespace std;
@@ -12,7 +12,7 @@
    
    pipeLine.register_elem_creator("PL_RTSPClient", create_PL_RTSPClient);
    pipeLine.register_elem_creator("PL_H264Decoder", create_PL_H264Decoder);
    pipeLine.register_elem_creator("PL_AVFrameBGRA", create_PL_AVFrameBGRA);
    pipeLine.register_elem_creator("PL_AVFrameYUV420", create_PL_AVFrameYUV420);
    
    PL_RTSPClient* rtspClient = (PL_RTSPClient*)pipeLine.push_elem("PL_RTSPClient");
    RTSPConfig rtspConfig;
@@ -28,8 +28,8 @@
    PL_H264Decoder* h264Decoder = (PL_H264Decoder*)pipeLine.push_elem("PL_H264Decoder");
    h264Decoder->init(nullptr);
    
    PL_AVFrameBGRA* avFrameBGRA = (PL_AVFrameBGRA*)pipeLine.push_elem("PL_AVFrameBGRA");
    avFrameBGRA->init(nullptr);
    PL_AVFrameYUV420* avFrameYUV420 = (PL_AVFrameYUV420*)pipeLine.push_elem("PL_AVFrameYUV420");
    avFrameYUV420->init(nullptr);
    
    while(true)
    {