xingzilong
2017-08-18 9e5babf9db52e64bdae60137be7696e56241fca6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef _PL_QUEUE_H_
#define _PL_QUEUE_H_
 
#include "PipeLine.h"
#include "MaterialBuffer.h"
 
typedef bool (*plq_cache_pm_func_t)(const PipeMaterial& inPm, PipeMaterial& outPm, std::vector<MB_Frame>& outMbf, uint8_t* cacheData, size_t& cacheMaxSize);
 
struct PL_Queue_Config
{
    size_t maxBlockCount;
    size_t maxBlockSize;
    bool cacheEmptyBlock;//#todo not implement
    
    bool syncQueueFull;
    bool syncQueueEmpty;
    bool queueFullDropFrontBlock;
    bool copyData; //#todo not implement (copy ptr)
    bool dropBlockOnlyNextPayOK;
 
    plq_cache_pm_func_t cacheFrameListFunc;
    
    PL_Queue_Config() : 
        maxBlockCount(32), maxBlockSize(1920*1080*2), cacheEmptyBlock(false),
        syncQueueFull(true), syncQueueEmpty(true), queueFullDropFrontBlock(false), copyData(true), dropBlockOnlyNextPayOK(true),
        cacheFrameListFunc(nullptr)
    {
    }
};
 
class PL_Queue : public PipeLineElem
{
public:
    PL_Queue();
    virtual ~PL_Queue();
 
    virtual bool init(void* args);
    virtual void finit();
 
    virtual bool pay(const PipeMaterial& pm);
    virtual bool gain(PipeMaterial& pm);
    
private:
    static void pm_deleter_qb(PipeMaterial* pm, bool lastRet);
 
    void* internal;
};
 
PipeLineElem* create_PL_Queue();
 
#endif