SASC
DVBSoftCAM

filter.h

Go to the documentation of this file.
00001 /*
00002  * Softcam plugin to VDR (C++)
00003  *
00004  * This code is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This code is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
00018  */
00019 
00020 #ifndef ___FILTER_H
00021 #define ___FILTER_H
00022 
00023 #include <vdr/thread.h>
00024 #include "misc.h"
00025 
00026 class cDevice;
00027 class cPidFilter;
00028 
00029 // ----------------------------------------------------------------
00030 
00031 #define MAX_SECT_SIZE 4096
00032 
00033 class cAction : protected cThread {
00034 private:
00035   const char *devId;
00036   int unique, pri;
00037   cSimpleList<cPidFilter> filters;
00038 protected:
00039   cDevice *device;
00040   char *id;
00041   //
00042   virtual void Process(cPidFilter *filter, unsigned char *data, int len)=0;
00043   virtual void Action(void);
00044   virtual cPidFilter *CreateFilter(int Num, int IdleTime);
00045   //
00046   cPidFilter *NewFilter(int IdleTime);
00047   cPidFilter *IdleFilter(void);
00048   void DelFilter(cPidFilter *filter);
00049   void DelAllFilter(void);
00050   void Priority(int Pri);
00051 public:
00052   cAction(const char *Id, cDevice *Device, const char *DevId);
00053   virtual ~cAction();
00054   };
00055 
00056 // ----------------------------------------------------------------
00057 
00058 class cPidFilter : public cSimpleItem, private cMutex {
00059 friend class cAction;
00060 private:
00061   cDevice *device;
00062   unsigned int idleTime;
00063   cTimeMs lastTime;
00064   bool forceRun;
00065 protected:
00066   char *id;
00067   int fd;
00068   int pid;
00069 public:
00070   void *userData;
00071   //
00072   cPidFilter(const char *Id, int Num, cDevice *Device, unsigned int IdleTime);
00073   virtual ~cPidFilter();
00074   void Flush(void);
00075   virtual void Start(int Pid, int Section, int Mask);
00076   void Stop(void);
00077   void SetBuffSize(int BuffSize);
00078   void Wakeup(void);
00079   int SetIdleTime(unsigned int IdleTime);
00080   int Pid(void);
00081   bool Active(void) { return fd>=0; }
00082   };
00083 
00084 #endif //___FILTER_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines