vdr
1.7.31
Main Page
Namespaces
Classes
Files
File List
File Members
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
14
cTransfer::cTransfer
(
const
cChannel
*Channel)
15
:
cReceiver
(Channel,
TRANSFERPRIORITY
)
16
{
17
patPmtGenerator
.
SetChannel
(Channel);
18
}
19
20
cTransfer::~cTransfer
()
21
{
22
cReceiver::Detach
();
23
cPlayer::Detach
();
24
}
25
26
void
cTransfer::Activate
(
bool
On)
27
{
28
if
(On) {
29
PlayTs
(
patPmtGenerator
.
GetPat
(),
TS_SIZE
);
30
int
Index = 0;
31
while
(
uchar
*pmt =
patPmtGenerator
.
GetPmt
(Index))
32
PlayTs
(pmt,
TS_SIZE
);
33
}
34
else
35
cPlayer::Detach
();
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
;
48
cCondWait::SleepMs
(10);
49
}
50
esyslog
(
"ERROR: TS packet not accepted in Transfer Mode"
);
51
}
52
}
53
54
// --- cTransferControl ------------------------------------------------------
55
56
cDevice
*
cTransferControl::receiverDevice
= NULL;
57
58
cTransferControl::cTransferControl
(
cDevice
*ReceiverDevice,
const
cChannel
*Channel)
59
:
cControl
(transfer = new
cTransfer
(Channel), true)
60
{
61
ReceiverDevice->
AttachReceiver
(
transfer
);
62
receiverDevice
=
ReceiverDevice
;
63
}
64
65
cTransferControl::~cTransferControl
()
66
{
67
receiverDevice
= NULL;
68
delete
transfer
;
69
}
Generated by
1.8.1.2