dvbd / src / tuner.h @ 59be6a47
History | View | Annotate | Download (2.33 KB)
1 |
// -*- c++ -*-
|
---|---|
2 |
/*
|
3 |
Copyright 2003 John Knottenbelt
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License as published by
|
7 |
the Free Software Foundation; either version 2 of the License, or
|
8 |
(at your option) any later version.
|
9 |
|
10 |
This program is distributed in the hope that it will be useful,
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
GNU General Public License for more details.
|
14 |
|
15 |
You should have received a copy of the GNU General Public License
|
16 |
along with this program; if not, write to the Free Software
|
17 |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
|
18 |
*/
|
19 |
|
20 |
#if !defined __TUNER_H
|
21 |
#define __TUNER_H
|
22 |
|
23 |
#include "source.h" |
24 |
#include "select.h" |
25 |
#include "demuxer.h" |
26 |
|
27 |
#include <string> |
28 |
#include <map> |
29 |
|
30 |
class TuneParams; |
31 |
class Demuxer; |
32 |
class PSFilter; |
33 |
|
34 |
class Tuner : public Source, public Selectable { |
35 |
public:
|
36 |
Tuner( const std::string &frontendDevice );
|
37 |
virtual ~Tuner(); |
38 |
|
39 |
const TuneParams *getTuneParams() const { return tuneParams; }; |
40 |
void setTuneParams(const TuneParams *tuneParams); |
41 |
|
42 |
// Returns the corresponding demuxer device
|
43 |
// to the frontendDevice
|
44 |
std::string getDemuxerDevice() const { return demuxDevice; }; |
45 |
|
46 |
virtual void addSelectFDs(Select &) const; |
47 |
virtual bool isReady(const Select &) const; |
48 |
|
49 |
Source *getDemuxer(int pid, bool convertToPS, Demuxer::PESType pesType) const; |
50 |
|
51 |
int getMaxNumSubscribers() const { return 8; } |
52 |
virtual bool subscribe(Sink *s);
|
53 |
virtual void unsubscribe(Sink *s);
|
54 |
|
55 |
// Process the data from the dvr device
|
56 |
void process();
|
57 |
|
58 |
protected:
|
59 |
virtual Demuxer *makeNewDemuxer(int pid, Demuxer::PESType pesType) const; |
60 |
virtual bool openFrontend();
|
61 |
virtual void closeFrontend();
|
62 |
virtual bool openDvr();
|
63 |
virtual void closeDvr();
|
64 |
virtual bool tune();
|
65 |
|
66 |
private:
|
67 |
int numReaders;
|
68 |
int frontendFD, dvrFD;
|
69 |
const TuneParams *tuneParams;
|
70 |
std::string frontendDevice, demuxDevice, dvrDevice; |
71 |
|
72 |
// Keep a track of all the demuxers ever created.
|
73 |
// The Tuner owns the demuxers.
|
74 |
|
75 |
typedef std::map <int, Demuxer *> PIDMap; |
76 |
typedef std::map <const TuneParams *, PIDMap> DemuxerMap; |
77 |
typedef std::map <Demuxer *, PSFilter *> PSFilterMap;
|
78 |
|
79 |
mutable DemuxerMap demuxerMap; |
80 |
mutable PSFilterMap psfilterMap; |
81 |
|
82 |
}; |
83 |
|
84 |
#endif // __TUNER_H |