Skip to content

Commit

Permalink
Remove support from reading directly from ceton device.
Browse files Browse the repository at this point in the history
This is step 1 of many for making this a general purpose OCUR recorder.
  • Loading branch information
daniel-kristjansson committed Mar 13, 2012
1 parent eb339d7 commit b5019f5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 65 deletions.
49 changes: 6 additions & 43 deletions mythtv/libs/libmythtv/cetonstreamhandler.cpp
Expand Up @@ -124,7 +124,6 @@ CetonStreamHandler::CetonStreamHandler(const QString &device) :
QStringList tuner_parts = parts.at(1).split(".");
if (tuner_parts.size() == 2)
{
_using_rtp = (tuner_parts.at(0) == "RTP");
_card = tuner_parts.at(0).toUInt();
_tuner = tuner_parts.at(1).toUInt();
}
Expand All @@ -142,19 +141,6 @@ CetonStreamHandler::CetonStreamHandler(const QString &device) :
return;
}

if (!_using_rtp)
{
_device_path = QString("/dev/ceton/ctn91xx_mpeg%1_%2")
.arg(_card).arg(_tuner);

if (!QFile(_device_path).exists())
{
LOG(VB_RECORD, LOG_ERR, LOC +
QString("Tuner device unavailable"));
return;
}
}

_valid = true;

QString cardstatus = GetVar("cas", "CardStatus");
Expand Down Expand Up @@ -197,27 +183,11 @@ void CetonStreamHandler::run(void)
QFile file(_device_path);
CetonRTP rtp(_ip_address, _tuner);

if (_using_rtp)
if (!(rtp.Init() && rtp.StartStreaming()))
{
if (!(rtp.Init() && rtp.StartStreaming()))
{
LOG(VB_RECORD, LOG_ERR, LOC +
"Starting recording (RTP initialization failed). Aborting.");
_error = true;
}
}
else
{
if (!file.open(QIODevice::ReadOnly))
{
LOG(VB_RECORD, LOG_ERR, LOC +
"Starting recording (file open failed). Aborting.");
_error = true;
}

int flags = fcntl(file.handle(), F_GETFL, 0);
if (flags == -1) flags = 0;
fcntl(file.handle(), F_SETFL, flags | O_NONBLOCK);
LOG(VB_RECORD, LOG_ERR, LOC +
"Starting recording (RTP initialization failed). Aborting.");
_error = true;
}

if (_error)
Expand All @@ -240,11 +210,7 @@ void CetonStreamHandler::run(void)
int remainder = 0;
while (_running_desired && !_error)
{
int bytes_read;
if (_using_rtp)
bytes_read = rtp.Read(buffer, buffer_size);
else
bytes_read = file.read(buffer, buffer_size);
int bytes_read = rtp.Read(buffer, buffer_size);

if (bytes_read <= 0)
{
Expand Down Expand Up @@ -286,10 +252,7 @@ void CetonStreamHandler::run(void)
}
LOG(VB_RECORD, LOG_INFO, LOC + "RunTS(): " + "shutdown");

if (_using_rtp)
rtp.StopStreaming();
else
file.close();
rtp.StopStreaming();

delete[] buffer;

Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythtv/cetonstreamhandler.h
Expand Up @@ -64,7 +64,6 @@ class CetonStreamHandler : public StreamHandler

private:
QString _ip_address;
bool _using_rtp;
uint _card;
uint _tuner;
QString _device_path;
Expand Down
22 changes: 2 additions & 20 deletions mythtv/libs/libmythtv/videosource.cpp
Expand Up @@ -1983,16 +1983,7 @@ void CetonDeviceID::SetIP(const QString &ip)
if (QRegExp(regexp).exactMatch(ip + "."))
{
_ip = ip;
setValue(QString("%1-%2.%3").arg(_ip).arg(_card).arg(_tuner));
}
}

void CetonDeviceID::SetCard(const QString &card)
{
if (QRegExp("^(\\d|RTP)$").exactMatch(card))
{
_card = card;
setValue(QString("%1-%2.%3").arg(_ip).arg(_card).arg(_tuner));
setValue(QString("%1-RTP.%3").arg(_ip).arg(_tuner));
}
}

Expand All @@ -2001,7 +1992,7 @@ void CetonDeviceID::SetTuner(const QString &tuner)
if (QRegExp("^\\d$").exactMatch(tuner))
{
_tuner = tuner;
setValue(QString("%1-%2.%3").arg(_ip).arg(_card).arg(_tuner));
setValue(QString("%1-RTP.%2").arg(_ip).arg(_tuner));
}
}

Expand All @@ -2017,7 +2008,6 @@ void CetonDeviceID::UpdateValues(void)
if (newstyle.exactMatch(getValue()))
{
emit LoadedIP(newstyle.cap(1));
emit LoadedCard(newstyle.cap(2));
emit LoadedTuner(newstyle.cap(3));
}
}
Expand All @@ -2035,25 +2025,17 @@ CetonConfigurationGroup::CetonConfigurationGroup
ip = new CetonSetting(
"IP Address",
"IP Address of the Ceton device (192.168.200.1 by default)");
card = new CetonSetting(
"Card Number",
"Number of the installed Ceton card. Use 0 if only 1 Ceton card is "
"installed in your system. Use the value RTP if this is a Ceton "
"card installed in a remote system");
tuner = new CetonSetting(
"Tuner",
"Number of the tuner on the Ceton device (first tuner is number 0)");

addChild(ip);
addChild(card);
addChild(tuner);
addChild(deviceid);
addChild(desc);

connect(ip, SIGNAL(NewValue(const QString&)),
deviceid, SLOT( SetIP(const QString&)));
connect(card, SIGNAL(NewValue(const QString&)),
deviceid, SLOT( SetCard(const QString&)));
connect(tuner, SIGNAL(NewValue(const QString&)),
deviceid, SLOT( SetTuner(const QString&)));

Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythtv/videosource.h
Expand Up @@ -935,7 +935,6 @@ class CetonDeviceID : public LabelSetting, public CaptureCardDBStorage

public slots:
void SetIP(const QString&);
void SetCard(const QString&);
void SetTuner(const QString&);

private:
Expand Down

0 comments on commit b5019f5

Please sign in to comment.