#include #include #include #include #include static const char *VERSION = "0.0.1"; static const char *DESCRIPTION = "Enter description for 'receivertest' plugin"; //static const char *MAINMENUENTRY = "Receivertest"; #define PRIORECEIVER -1 class cPTSReceiver; class cPluginReceivertest : public cPlugin { private: cPTSReceiver *myreceiver; public: cPluginReceivertest(void); virtual ~cPluginReceivertest(); virtual const char *Version(void) { return VERSION; } virtual const char *Description(void) { return DESCRIPTION; } virtual bool Start(void); virtual void Stop(void); }; class cPTSReceiver : public cReceiver, cThread { protected: virtual void Receive(uchar *Data, int Length); public: cPTSReceiver(cChannel* channel); virtual ~cPTSReceiver(); void Action(); void cPTSReceiver::Activate(bool On); private: char channelname[30]; }; //------The Receiver----------- cPTSReceiver::cPTSReceiver(cChannel* channel):cReceiver(0,PRIORECEIVER, channel->Vpid()) { dsyslog("created a new receiver for %s with prio %d",channel->Name(),PRIORECEIVER); strcpy(channelname,channel->Name()); } cPTSReceiver::~cPTSReceiver(){ Detach(); dsyslog("destroy Receiver for Channel %s",channelname); } void cPTSReceiver::Action(void) {} void cPTSReceiver::Activate(bool On) { if (On) dsyslog("Attach receiver to %s",channelname); else dsyslog("Detach receiver from %s",channelname); } void cPTSReceiver::Receive(uchar *Data, int Length) { dsyslog("receiving data from channelname=%s \n",channelname); } //------The Plugin----------- cPluginReceivertest::cPluginReceivertest(void) {} cPluginReceivertest::~cPluginReceivertest() {} bool cPluginReceivertest::Start(void) { int channelnumber = 5; cChannel *chan = Channels.GetByNumber(channelnumber); // cDevice *mydevice = cDevice::PrimaryDevice();//dont work if I use the Xine-Plugin cDevice *mydevice = cDevice::GetDevice(0); cDevice::PrimaryDevice()->SwitchChannel(chan,true); dsyslog("should add PTSReceiver to Channel %d on Device %d with Vpid %d",channelnumber,mydevice->DeviceNumber(),chan->Vpid()); myreceiver = new cPTSReceiver(chan); mydevice->AttachReceiver(myreceiver); return true; } void cPluginReceivertest::Stop(void){ delete myreceiver; } VDRPLUGINCREATOR(cPluginReceivertest); // Don't touch this!