houxiao
2017-01-06 d4109b2cef809daba0f95f244029456613383f01
RtspFace/PL_Fork.h
@@ -3,8 +3,51 @@
#include "PipeLine.h"
// p1e1 p1e2<fork> p1e3 ... p1eN
//                 p2e1  p2e2... p2eN
class PL_Fork : public PipeLineElem
{
public:
   enum ForkBy
   {
      // do nothing
      FB_NONE,
      // time 1: p1e1 p1e2 [p1e3 ... p1eN]
      // time 2: p1e1 p1e2 [p2e1  p2e2... p2eN]
      FB_TURNS,
      // p1e1 p1e2 [p1e3 ... p1eN]|[p2e1  p2e2... p2eN]
      FB_RANDOM,
      // supported now!
      // p1e1 p1e2 TYPE1[p1e3 ... p1eN] TYPE2[p2e1  p2e2... p2eN]
      // Sync behavior depends on ForkSync
      FB_PM_TYPE,
      // supported now!
      FB_MB_TYPE,
      // FS_MAIN_PL_FIRST: p1e1 p1e2 [p1e3 p2e1] [p1e4 p2e2] ...
      // FS_MAIN_PL_LAST : p1e1 p1e2 [p2e1 p1e3] [p2e2 p1e4] ...
      FB_ALTERNATE
   };
   enum ForkSync
   {
      // do nothing
      FS_NONE,
      // supported now!
      FS_PARALLEL,
      // Result of main pl will be paid to branch pl
      FS_MAIN_PL_FIRST,
      // Result of branch pl will be paid to main pl
      FS_BRANCH_PL_FIRST
   };
public:
   PL_Fork();
   virtual ~PL_Fork();
@@ -15,10 +58,26 @@
   virtual bool pay(const PipeMaterial& pm);
   virtual bool gain(PipeMaterial& pm);
   
   void attach_pipe_line(PipeLine* pl);
private:
   void* internal;
   PipeLine* pl;
};
PipeLineElem* create_PL_Paint();
struct PL_Fork_Config
{
   PL_Fork::ForkBy forkBy;
   PL_Fork::ForkSync forkSync;
   int mainPLType;
   int branchPLType;
   PL_Fork_Config() :
      forkBy(PL_Fork::FB_NONE), forkSync(PL_Fork::FS_NONE), mainPLType(0), branchPLType(0)
   { }
};
PipeLineElem* create_PL_Fork();
#endif