vdr  1.7.31
transfer.c
Go to the documentation of this file.
1 /*
2  * transfer.c: Transfer mode
3  *
4  * See the main source file 'vdr.c' for copyright information and
5  * how to reach the author.
6  *
7  * $Id: transfer.c 2.6 2012/02/29 14:16:23 kls Exp $
8  */
9 
10 #include "transfer.h"
11 
12 // --- cTransfer -------------------------------------------------------------
13 
15 :cReceiver(Channel, TRANSFERPRIORITY)
16 {
17  patPmtGenerator.SetChannel(Channel);
18 }
19 
21 {
24 }
25 
26 void cTransfer::Activate(bool On)
27 {
28  if (On) {
30  int Index = 0;
31  while (uchar *pmt = patPmtGenerator.GetPmt(Index))
32  PlayTs(pmt, TS_SIZE);
33  }
34  else
36 }
37 
38 void cTransfer::Receive(uchar *Data, int Length)
39 {
40  if (cPlayer::IsAttached()) {
41  // Transfer Mode means "live tv", so there's no point in doing any additional
42  // buffering here. The TS packets *must* get through here! However, every
43  // now and then there may be conditions where the packet just can't be
44  // handled when offered the first time, so that's why we try several times:
45  for (int i = 0; i < 100; i++) {
46  if (PlayTs(Data, Length) > 0)
47  return;
49  }
50  esyslog("ERROR: TS packet not accepted in Transfer Mode");
51  }
52 }
53 
54 // --- cTransferControl ------------------------------------------------------
55 
57 
58 cTransferControl::cTransferControl(cDevice *ReceiverDevice, const cChannel *Channel)
59 :cControl(transfer = new cTransfer(Channel), true)
60 {
61  ReceiverDevice->AttachReceiver(transfer);
63 }
64 
66 {
67  receiverDevice = NULL;
68  delete transfer;
69 }