vdr
2.0.2
Main Page
Namespaces
Classes
Files
File List
File Members
player.c
Go to the documentation of this file.
1
/*
2
* player.c: The basic player interface
3
*
4
* See the main source file 'vdr.c' for copyright information and
5
* how to reach the author.
6
*
7
* $Id: player.c 2.2 2012/04/28 11:52:50 kls Exp $
8
*/
9
10
#include "
player.h
"
11
#include "
i18n.h
"
12
13
// --- cPlayer ---------------------------------------------------------------
14
15
cPlayer::cPlayer
(
ePlayMode
PlayMode)
16
{
17
device
= NULL;
18
playMode
= PlayMode;
19
}
20
21
cPlayer::~cPlayer
()
22
{
23
Detach
();
24
}
25
26
int
cPlayer::PlayPes
(
const
uchar
*Data,
int
Length,
bool
VideoOnly)
27
{
28
if
(
device
)
29
return
device
->
PlayPes
(Data, Length, VideoOnly);
30
esyslog
(
"ERROR: attempt to use cPlayer::PlayPes() without attaching to a cDevice!"
);
31
return
-1;
32
}
33
34
void
cPlayer::Detach
(
void
)
35
{
36
if
(
device
)
37
device
->
Detach
(
this
);
38
}
39
40
// --- cControl --------------------------------------------------------------
41
42
cControl
*
cControl::control
= NULL;
43
cMutex
cControl::mutex
;
44
45
cControl::cControl
(
cPlayer
*Player,
bool
Hidden)
46
{
47
attached
=
false
;
48
hidden
= Hidden;
49
player
= Player;
50
}
51
52
cControl::~cControl
()
53
{
54
if
(
this
==
control
)
55
control
= NULL;
56
}
57
58
cOsdObject
*
cControl::GetInfo
(
void
)
59
{
60
return
NULL;
61
}
62
63
const
cRecording
*
cControl::GetRecording
(
void
)
64
{
65
return
NULL;
66
}
67
68
cString
cControl::GetHeader
(
void
)
69
{
70
return
""
;
71
}
72
73
cControl
*
cControl::Control
(
bool
Hidden)
74
{
75
cMutexLock
MutexLock(&
mutex
);
76
return
(
control
&& (!
control
->
hidden
|| Hidden)) ?
control
: NULL;
77
}
78
79
void
cControl::Launch
(
cControl
*Control)
80
{
81
cMutexLock
MutexLock(&
mutex
);
82
cControl
*c =
control
;
// keeps control from pointing to uninitialized memory
83
control
=
Control
;
84
delete
c;
85
}
86
87
void
cControl::Attach
(
void
)
88
{
89
cMutexLock
MutexLock(&
mutex
);
90
if
(
control
&& !
control
->
attached
&&
control
->
player
&& !
control
->
player
->
IsAttached
()) {
91
if
(
cDevice::PrimaryDevice
()->
AttachPlayer
(
control
->
player
))
92
control
->
attached
=
true
;
93
else
{
94
Skins
.
Message
(
mtError
,
tr
(
"Channel locked (recording)!"
));
95
Shutdown
();
96
}
97
}
98
}
99
100
void
cControl::Shutdown
(
void
)
101
{
102
cMutexLock
MutexLock(&
mutex
);
103
cControl
*c =
control
;
// avoids recursions
104
control
= NULL;
105
delete
c;
106
}
107
Generated by
1.8.3.1