[mythtv] [patch] dvb on demand - beta/alpha or something
mian
mythtv at mian.net.au
Sun Feb 8 23:17:16 EST 2004
This patch was required for me to use both DVB and capture functions of my
card, the current myth code keeps the DVB card open all the time, even
when it's not in use, which prevents using the v4l analogue capture
functions for external sat receiver. By enabling the DVB on demand
option, the DVB card will be only be opened when it's required and then
closed again when it's free allowing the v4l analogue capture to be used
whenever the DVB function isn't. The option is added to capture card
setup, under advanced DVB settings - "Open DVB card on demand"
While it is working fine for me, I can obviously only test one setup -
mine, so it would be appreciated if someone else can test aswell.
As always I'll leave the automatic SQL upgrading for Ivans updates when
it's been tested so
ALTER TABLE capturecard ADD dvb_on_demand TINYINT NOT NULL DEFAULT 0
--
mian
-------------- next part --------------
--- work-orig/mythtv/libs/libmythtv/videosource.h 2004-02-04 16:13:57.000000000 +1030
+++ work/mythtv/libs/libmythtv/videosource.h 2004-02-04 16:21:23.000000000 +1030
@@ -457,6 +457,18 @@
};
};
+class DVBOnDemand: public CheckBoxSetting, public CCSetting {
+public:
+ DVBOnDemand(const CaptureCard& parent):
+ CCSetting(parent, "dvb_on_demand") {
+ setLabel(QObject::tr("Open DVB card on demand"));
+ setValue(true);
+ setHelpText(QObject::tr("This option makes the backend dvb-recorder only "
+ "open the card when it is actually in-use leaving "
+ "it free for other programs at other times."));
+ };
+};
+
class DVBPidBufferSize: public SpinBoxSetting, public CCSetting {
public:
DVBPidBufferSize(const CaptureCard& parent):
@@ -775,6 +787,7 @@
rec->addChild(new DVBSwFilter(parent));
rec->addChild(new DVBRecordTS(parent));
rec->addChild(new DVBNoSeqStart(parent));
+ rec->addChild(new DVBOnDemand(parent));
rec->addChild(new DVBPidBufferSize(parent));
rec->addChild(new DVBBufferSize(parent));
addChild(rec);
--- work-orig/mythtv/libs/libmythtv/tv_rec.h 2004-02-04 16:13:57.000000000 +1030
+++ work/mythtv/libs/libmythtv/tv_rec.h 2004-02-04 16:47:00.000000000 +1030
@@ -37,6 +37,7 @@
int wait_for_seqstart;
int dmx_buf_size;
int pkt_buf_size;
+ bool dvb_on_demand;
} dvb_options_t;
class TVRec
--- work-orig/mythtv/libs/libmythtv/tv_rec.cpp 2004-02-04 16:13:57.000000000 +1030
+++ work/mythtv/libs/libmythtv/tv_rec.cpp 2004-02-04 16:47:50.000000000 +1030
@@ -82,6 +82,7 @@
channel->SwitchToInput(inputname, startchannel);
channel->SetChannelOrdering(chanorder);
// don't close this channel, otherwise we cannot read data
+ if (dvb_options.dvb_on_demand) channel->Close();
#else
VERBOSE(VB_IMPORTANT, "ERROR: DVB Card configured, "
"but no DVB support compiled in!");
@@ -560,6 +561,7 @@
nvr->SetOptionsFromProfile(&profile, videodev, audiodev, vbidev, ispip);
+ nvr->SetOption("dvb_on_demand", dvb_options.dvb_on_demand);
nvr->SetOption("swfilter", dvb_options.swfilter);
nvr->SetOption("recordts", dvb_options.recordts);
nvr->SetOption("wait_for_seqstart", dvb_options.wait_for_seqstart);
@@ -1022,7 +1024,7 @@
"audioratelimit,defaultinput,cardtype,"
"dvb_swfilter, dvb_recordts,"
"dvb_wait_for_seqstart,dvb_dmx_buf_size,"
- "dvb_pkt_buf_size, skipbtaudio "
+ "dvb_pkt_buf_size, skipbtaudio, dvb_on_demand "
"FROM capturecard WHERE cardid = %1;")
.arg(cardnum);
@@ -1064,8 +1066,8 @@
dvb_opts.wait_for_seqstart = query.value(8).toInt();
dvb_opts.dmx_buf_size = query.value(9).toInt();
dvb_opts.pkt_buf_size = query.value(10).toInt();
-
skip_bt = query.value(11).toInt();
+ dvb_opts.dvb_on_demand = query.value(12).toInt();
}
thequery = QString("SELECT if(startchan!='', startchan, '3') "
--- work-orig/mythtv/libs/libmythtv/dvbrecorder.h 2004-02-04 16:13:57.000000000 +1030
+++ work/mythtv/libs/libmythtv/dvbrecorder.h 2004-02-04 16:31:30.000000000 +1030
@@ -104,6 +104,7 @@
QMap<long long, long long> positionMap;
long long prev_gop_save_pos;
+ bool dvb_on_demand;
bool isopen;
int cardnum;
bool swfilter;
--- work-orig/mythtv/libs/libmythtv/dvbrecorder.cpp 2004-02-04 16:13:57.000000000 +1030
+++ work/mythtv/libs/libmythtv/dvbrecorder.cpp 2004-02-04 17:02:50.000000000 +1030
@@ -65,6 +65,7 @@
was_paused = true;
channel_changed = true;
dvbchannel = advbchannel;
+ dvb_on_demand = false;
paused = false;
mainpaused = false;
@@ -135,6 +136,10 @@
if (expire_data_days < 1)
expire_data_days = 1;
}
+ else if (name == "dvb_on_demand")
+ {
+ dvb_on_demand = value;
+ }
else
RecorderBase::SetOption(name, value);
}
@@ -173,6 +178,11 @@
if (isopen)
return true;
+ if (dvb_on_demand && dvbchannel->Open())
+ {
+ dvbchannel->SetChannelByString(dvbchannel->GetCurrentName());
+ }
+
fd_dvr = open(dvbdevice(DVB_DEV_DVR,cardnum), O_RDONLY | O_NONBLOCK);
if(fd_dvr < 0)
{
@@ -196,11 +206,16 @@
if (!isopen)
return;
+ VERBOSE(VB_ALL, "Closing DVB recorder");
+
CloseFilters();
if (fd_dvr > 0)
close(fd_dvr);
+ if (dvb_on_demand && dvbchannel)
+ dvbchannel->Close();
+
isopen = false;
}
--- work-orig/mythtv/libs/libmythtv/dvbchannel.h 2004-02-04 16:13:57.000000000 +1030
+++ work/mythtv/libs/libmythtv/dvbchannel.h 2004-02-04 16:55:45.000000000 +1030
@@ -32,7 +32,7 @@
~DVBChannel();
bool Open();
- void Close() {};
+ void Close();
fe_type_t GetCardType() { return info.type; };
--- work-orig/mythtv/libs/libmythtv/dvbchannel.cpp 2004-02-04 16:13:57.000000000 +1030
+++ work/mythtv/libs/libmythtv/dvbchannel.cpp 2004-02-04 17:02:22.000000000 +1030
@@ -78,8 +78,16 @@
if (dvbcam)
delete dvbcam;
- if (isOpen && (fd_frontend > 0))
- close(fd_frontend);
+ Close();
+}
+
+void DVBChannel::Close()
+{
+ VERBOSE(VB_ALL, "Closing DVB channel");
+
+ close(fd_frontend);
+ fd_frontend = 0;
+ curchannelname = "";
}
bool DVBChannel::Open()
More information about the mythtv-dev
mailing list