[vdr] detach receiver?

Patrick Fischer patrick_fischer at gmx.de
Thu Nov 24 19:27:40 CET 2005


after hours of testing, I don't understand the methods of the receiver.

Maybe I'm totally wrong.

I need:
-a method to receive the PES of a given VPID of a Channel
-the method should be closed if the VPID of the Channel can't be reached 
any more

In my opinion this is a receiver!
But this receiver will NEVER be detached unless vdr will shutdown.
Independent from the Prio. I have tried -10 .... 90
unfortunately it will receive data is an other channel has the same VPID


I have written a simple receiver:

class cPTSReceiver : public cReceiver, cThread {
protected:
  virtual void Activate(bool On);
  virtual void Receive(uchar *Data, int Length);
  virtual void Action(void); 
public:
  cPTSReceiver(cChannel* channel);
  bool isAttached();
private:
  char channelname[30];
  bool isrunning;
  };

//---------cPTSReceiver-----------//
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());
    channelAttachedTo = channel;
}


void cPTSReceiver::Activate(bool On)
{   
    // start your own thread for processing the received data
    isrunning = On;
    if (isrunning){
        dsyslog("attach receiver to %s",channelname);
    }
    else
        dsyslog("detach receiver from %s!",channelname);//will never reached
}

bool cPTSReceiver::isAttached(){
    return isrunning;   
}

void cPTSReceiver::Receive(uchar *Data, int Length)
{...do something...}


At the moment I use a total crazy way. I give the receiver the device 
and the channel. Each time the receiver will Receive()data, I test if 
the Channel of my receiver and the channel of the device are on the same 
TSID and NID. If not, the user has changed the channel. But this way is 
very ugly.
Klaus sad that the vdr will detach the receiver if the Prio is lower the -1.
My Receiver didn't detach at anytime!
Please help me 8-)

Patrick



More information about the vdr mailing list