Statistics
| Branch: | Tag: | Revision:

dvbd / src / recordconnection.cpp @ 904d298f

History | View | Annotate | Download (1.77 KB)

1 fc92ba5f jak
/*
2
  Copyright 2003 John Knottenbelt
3
  
4
  This program is free software; you can redistribute it and/or modify
5
  it under the terms of the GNU General Public License as published by
6
  the Free Software Foundation; either version 2 of the License, or
7
  (at your option) any later version.
8
 
9
  This program is distributed in the hope that it will be useful,
10
  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
  GNU General Public License for more details.
13
 
14
  You should have received a copy of the GNU General Public License
15
  along with this program; if not, write to the Free Software
16
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
17
*/
18
19
#include "config.h"
20
#include "recordconnection.h"
21
#include "debug.h"
22
#include <iostream>
23
24
RecordConnection::RecordConnection(const Recording &rec, TunerManager *tm, int dataFD)
25
  : Connection(tm, dataFD), rec(rec)
26
{
27
}
28
29
bool RecordConnection::tune() {
30
  return Connection::tune(rec.getType(), rec.getChannel(), 
31
                          rec.getConvertToPS(), rec.getPriority());
32
}
33
34
void RecordConnection::addSelectFDs(Select &s) const
35
{
36
  Connection::addSelectFDs(s);
37
38
  if (getStopTime() != 0)
39
    s.addAlarm(std::max(0L, getStopTime() - getCurrentTime()), 0);
40
}
41
42
std::string RecordConnection::getType() const
43
{
44
  return "RecordConnection";
45
}
46
47
std::ostream& RecordConnection::printOn(std::ostream &o) const
48
{
49
  return Connection::printOn(o) << " " << rec;
50
}
51
52
bool RecordConnection::processReady(const Select &s)
53
{
54
  if (getStopTime() != 0 && getCurrentTime() > getStopTime()) {
55
    if (debugLevel > 0) {
56
      std::cerr << "Stop time reached (stopTime = " << getStopTime() 
57
                << ", now = " << getCurrentTime() << ")\n";
58
    }
59
    return false;
60
  }
61
62
  return Connection::processReady(s);
63
}