Statistics
| Branch: | Tag: | Revision:

dvbd / tuneparams.h @ bfdb7446

History | View | Annotate | Download (2.13 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 __TUNEPARAMS_H
21
#define __TUNEPARAMS_H
22

    
23
#include <string>
24

    
25
// Abstract base class for the Tuning Parameters
26
class TuneParams {
27
protected:
28
  TuneParams(const std::string &name, int apid, int vpid)
29
    : name(name), apid(apid), vpid(vpid)
30
  {
31
  }
32

    
33
  virtual ~TuneParams();
34

    
35
public:
36

    
37
  std::string getName() const { return name; };
38

    
39
  // Is the TuneParams the same as another
40
  // apart from the channel name and the PIDs?
41
  // (ie. same freq, modulation, fec codes etc).
42
  virtual bool sameAsExceptPIDs(const TuneParams &other) const = 0;
43

    
44
  // Given the frontendFD, tune the params in.
45
  virtual bool tune(int frontendFD) const = 0;
46

    
47
  // Get the PIDS
48
  int getAudioPID() const { return apid; };
49
  int getVideoPID() const { return vpid; };
50

    
51
  int getNumPIDs() const { return (apid != 0) + (vpid != 0); };
52

    
53
protected:
54
  std::string name;
55
  int apid, vpid;
56
};
57

    
58
class DVBTTuneParams : public TuneParams {
59
private:
60
  DVBTTuneParams(const std::string &name, int apid, int vpid);
61
  virtual ~DVBTTuneParams();
62
public:
63

    
64
  // Parses a line from ~/.tzap/channels.conf
65
  // Throws an execption if not well formed.
66
  static DVBTTuneParams *createFromTZAP(const std::string &line);
67

    
68
  virtual bool sameAsExceptPIDs(const TuneParams &other) const;
69
  virtual bool tune(int frontendFD) const;
70

    
71
private:
72
  /* Frequency etc */
73
  unsigned long freq;
74
  int qam, inv, fec1, fec2, hier, bandw, mode, guard;
75
};
76

    
77

    
78
#endif // __TUNEPARAMS_H