Skip to content

Commit

Permalink
Adds support for recording from a Ceton OCUR recorder.
Browse files Browse the repository at this point in the history
  • Loading branch information
ldkronos authored and daniel-kristjansson committed Nov 30, 2011
1 parent 357e770 commit 4d6a4c4
Show file tree
Hide file tree
Showing 26 changed files with 2,172 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mythtv/bindings/perl/MythTV.pm
Expand Up @@ -114,7 +114,7 @@ package MythTV;
# schema version supported in the main code. We need to check that the schema
# version in the database is as expected by the bindings, which are expected
# to be kept in sync with the main code.
our $SCHEMA_VERSION = "1285";
our $SCHEMA_VERSION = "1287";

# NUMPROGRAMLINES is defined in mythtv/libs/libmythtv/programinfo.h and is
# the number of items in a ProgramInfo QStringList group used by
Expand Down
2 changes: 1 addition & 1 deletion mythtv/bindings/python/MythTV/static.py
Expand Up @@ -5,7 +5,7 @@
"""

OWN_VERSION = (0,25,-1,3)
SCHEMA_VERSION = 1285
SCHEMA_VERSION = 1287
NVSCHEMA_VERSION = 1007
MUSICSCHEMA_VERSION = 1018
PROTO_VERSION = '70'
Expand Down
5 changes: 5 additions & 0 deletions mythtv/configure
Expand Up @@ -111,6 +111,7 @@ Advanced options (experts only):
--disable-firewire disable support for FireWire cable boxes
--disable-iptv disable support for recording RTSP/UDP/RTP streams
--disable-hdhomerun disable support for HDHomeRun boxes
--disable-ceton disable support for Ceton cards
--disable-v4l2 disable Video4Linux support
--disable-ivtv disable ivtv support (PVR-x50) req. v4l2 support
--disable-hdpvr disable HD-PVR support
Expand Down Expand Up @@ -1344,6 +1345,7 @@ MYTHTV_CONFIG_LIST='
firewire
frontend
hdhomerun
ceton
hdpvr
iptv
ivtv
Expand Down Expand Up @@ -1773,6 +1775,7 @@ iptv_deps="backend"
ivtv_deps="backend v4l2"
hdpvr_deps="backend v4l2"
hdhomerun_deps="backend"
ceton_deps="backend"
mpegtsraw_demuxer_deps="merge_libavformat_mpegts_c"
mythtranscode_deps="backend frontend"
opengl_deps_any="agl_h GL_gl_h GLES2_gl2_h darwin windows x11"
Expand Down Expand Up @@ -1985,6 +1988,7 @@ enable ffmpeg_pthreads
enable firewire
enable frontend
enable hdhomerun
enable ceton
enable hdpvr
enable iptv
enable ivtv
Expand Down Expand Up @@ -4511,6 +4515,7 @@ if enabled backend; then
echo "DVB support ${dvb-no} [$dvb_path]"
echo "DVB-S2 support ${fe_can_2g_modulation-no}"
echo "HDHomeRun support ${hdhomerun-no}"
echo "Ceton support ${ceton-no}"
echo "IPTV support ${iptv-no}"
echo "ASI support ${asi-no}"
fi
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/mythversion.h
Expand Up @@ -51,7 +51,7 @@
* MythTV Python Bindings
* mythtv/bindings/python/MythTV/static.py
*/
#define MYTH_DATABASE_VERSION "1285"
#define MYTH_DATABASE_VERSION "1287"


MBASE_PUBLIC const char *GetMythSourceVersion();
Expand Down
24 changes: 24 additions & 0 deletions mythtv/libs/libmythtv/cardutil.cpp
Expand Up @@ -80,6 +80,12 @@ QString CardUtil::GetScanableCardTypes(void)
cardTypes += "'ASI'";
#endif

#ifdef USING_CETON
if (!cardTypes.isEmpty())
cardTypes += ",";
cardTypes += "'CETON'";
#endif // USING_CETON

if (cardTypes.isEmpty())
cardTypes = "'DUMMY'";

Expand Down Expand Up @@ -113,6 +119,16 @@ bool CardUtil::IsCableCardPresent(uint cardid,
#endif
return false;
}
else if (cardType == "CETON")
{
#ifdef USING_CETON
// TODO FIXME implement detection of Cablecard presence
LOG(VB_GENERAL, LOG_INFO, "Cardutil: TODO Ceton Is Cablecard Present?");
return true;
#else
return false;
#endif
}
else
return false;
}
Expand Down Expand Up @@ -354,6 +370,14 @@ QStringList CardUtil::ProbeVideoDevices(const QString &rawtype)
}
}
#endif // USING_HDHOMERUN
#ifdef USING_CETON
else if (rawtype.toUpper() == "CETON")
{
// TODO implement CETON probing.
LOG(VB_GENERAL, LOG_INFO, "CardUtil::ProbeVideoDevices: "
"TODO Probe Ceton devices");
}
#endif // USING_CETON
else
{
LOG(VB_GENERAL, LOG_ERR, QString("Raw Type: '%1' is not supported")
Expand Down
10 changes: 7 additions & 3 deletions mythtv/libs/libmythtv/cardutil.h
Expand Up @@ -65,6 +65,7 @@ class MTV_PUBLIC CardUtil
IMPORT = 14,
DEMO = 15,
ASI = 16,
CETON = 17,
};

static enum CARD_TYPES toCardType(const QString &name)
Expand Down Expand Up @@ -103,6 +104,8 @@ class MTV_PUBLIC CardUtil
return DEMO;
if ("ASI" == name)
return ASI;
if ("CETON" == name)
return CETON;
return ERROR_UNKNOWN;
}

Expand All @@ -112,7 +115,7 @@ class MTV_PUBLIC CardUtil
(rawtype != "DVB") && (rawtype != "FIREWIRE") &&
(rawtype != "HDHOMERUN") && (rawtype != "FREEBOX") &&
(rawtype != "IMPORT") && (rawtype != "DEMO") &&
(rawtype != "ASI");
(rawtype != "ASI") && (rawtype != "CETON");
}

static bool IsV4L(const QString &rawtype)
Expand Down Expand Up @@ -158,7 +161,7 @@ class MTV_PUBLIC CardUtil
{
return
(rawtype == "DVB") || (rawtype == "HDHOMERUN") ||
(rawtype == "ASI");
(rawtype == "ASI") || (rawtype == "CETON");
}

static bool IsTuningAnalog(const QString &rawtype)
Expand All @@ -178,7 +181,8 @@ class MTV_PUBLIC CardUtil
return
(rawtype == "FIREWIRE") || (rawtype == "HDHOMERUN") ||
(rawtype == "FREEBOX") || (rawtype == "ASI") ||
(rawtype == "IMPORT") || (rawtype == "DEMO");
(rawtype == "IMPORT") || (rawtype == "DEMO") ||
(rawtype == "CETON");
}

// Card creation and deletion
Expand Down
119 changes: 119 additions & 0 deletions mythtv/libs/libmythtv/cetonchannel.cpp
@@ -0,0 +1,119 @@
/** -*- Mode: c++ -*-
* CetonChannel
* Copyright (c) 2011 Ronald Frazier
* Copyright (c) 2006-2009 by Silicondust Engineering Ltd.
* Distributed as part of MythTV under GPL v2 and later.
*/

// MythTV includes
#include "cetonstreamhandler.h"
#include "cetonchannel.h"
#include "videosource.h"
#include "mythlogging.h"
#include "channelutil.h"
#include "mythdbcon.h"

#define LOC QString("CetonChan(%1): ").arg(GetDevice())

CetonChannel::CetonChannel(TVRec *parent, const QString &device) :
DTVChannel(parent), _device_id(device), _stream_handler(NULL)
{
}

CetonChannel::~CetonChannel(void)
{
Close();
}

bool CetonChannel::Open(void)
{
LOG(VB_CHANNEL, LOG_INFO, LOC + "Opening Ceton channel");

if (IsOpen())
return true;

_stream_handler = CetonStreamHandler::Get(_device_id);

tunerType = DTVTunerType::kTunerTypeATSC;
_tuner_types.push_back(tunerType);

if (!InitializeInputs())
{
Close();
return false;
}

return _stream_handler->IsConnected();
}

void CetonChannel::Close(void)
{
LOG(VB_CHANNEL, LOG_INFO, LOC + "Closing Ceton channel");

if (!IsOpen())
return; // this caller didn't have it open in the first place..

CetonStreamHandler::Return(_stream_handler);
}

bool CetonChannel::EnterPowerSavingMode(void)
{
if (IsOpen())
return _stream_handler->EnterPowerSavingMode();
else
return true;
}

bool CetonChannel::IsOpen(void) const
{
return _stream_handler;
}

/// This is used when the tuner type is kTunerTypeOCUR
bool CetonChannel::Tune(const QString &freqid, int /*finetune*/)
{
return _stream_handler->TuneVChannel(freqid);
}

static QString format_modulation(const DTVMultiplex &tuning)
{
if (DTVModulation::kModulationQAM256 == tuning.modulation)
return "qam256";
else if (DTVModulation::kModulationQAM64 == tuning.modulation)
return "qam64";
//note...ceton also supports NTSC-M, but not sure what to use that for
else if (DTVModulation::kModulation8VSB == tuning.modulation)
return "8vsb";

return "unknown";
}

bool CetonChannel::Tune(const DTVMultiplex &tuning, QString /*inputname*/)
{
QString modulation = format_modulation(tuning);

LOG(VB_CHANNEL, LOG_INFO, LOC + QString("Tuning to %1 %2")
.arg(tuning.frequency).arg(modulation));

if (_stream_handler->TuneFrequency(tuning.frequency, modulation))
{
SetSIStandard(tuning.sistandard);
return true;
}

return false;
}

bool CetonChannel::SetChannelByString(const QString &channum)
{
bool ok = DTVChannel::SetChannelByString(channum);

if (ok)
{
if (_stream_handler->IsCableCardInstalled())
currentProgramNum = _stream_handler->GetProgramNumber();
else
_stream_handler->TuneProgram(currentProgramNum);
}
return ok;
}
54 changes: 54 additions & 0 deletions mythtv/libs/libmythtv/cetonchannel.h
@@ -0,0 +1,54 @@
/** -*- Mode: c++ -*-
* CetonChannel
* Copyright (c) 2011 Ronald Frazier
* Copyright (c) 2006-2009 by Silicondust Engineering Ltd.
* Distributed as part of MythTV under GPL v2 and later.
*/

#ifndef CETONCHANNEL_H
#define CETONCHANNEL_H

// Qt headers
#include <QString>

// MythTV headers
#include "dtvchannel.h"

class CetonChannel;
class CetonStreamHandler;

class CetonChannel : public DTVChannel
{
friend class CetonSignalMonitor;
friend class CetonRecorder;

public:
CetonChannel(TVRec *parent, const QString &device);
~CetonChannel(void);

bool Open(void);
void Close(void);
bool EnterPowerSavingMode(void);

// Gets
bool IsOpen(void) const;
QString GetDevice(void) const { return _device_id; }
virtual vector<DTVTunerType> GetTunerTypes(void) const
{ return _tuner_types; }

// Sets
virtual bool SetChannelByString(const QString &channum);

// ATSC/DVB scanning/tuning stuff
bool Tune(const DTVMultiplex &tuning, QString inputname);

// Virtual tuning
bool Tune(const QString &freqid, int /*finetune*/);

private:
QString _device_id;
CetonStreamHandler *_stream_handler;
vector<DTVTunerType> _tuner_types;
};

#endif

0 comments on commit 4d6a4c4

Please sign in to comment.