[mythtv-users] DVB-T tzap versus mythtv 0.19
Doug Scoular
dscoular at cisco.com
Sun Mar 12 10:39:56 UTC 2006
Hi Daniel et al,
Danielk wrote:
> Requiring usleep[s] is in a word asinine.
Agreed, although I think I put it a little more diplomatically :^)
In the IRC converstaion, Doug wrote:
> dscoular: Just doing a usleep doesn't seem particularly robust
I attempted to write an initial cut at a patch but since this is my
first C++ in 20+ years I could really use some tips.
> I would accept a patch that did the usleep[s] for
> some per card configurable period of time, so long as it defaults
> to off (you can autodetect the Nova-T and enable the hack for it.)
In order to create a new configurable setting the MythTV
settings schema would, presumably, have to evolve. I wasn't
sure how to do this... so the code simply determines if the
DVB frontend being used is "DibCom 3000P/M-C DVB-T"
and hardwires the timeout to the same value used by scan.c.
dvbsignalmonitor.cpp didn't have access to the DVBChannel
outwith the constructor (as far as I could glean) so I created
a new protected member called "channel" and added getter
and setter routines. The constructor now calls the new setter
SetDVBChannel(_channel) so that DVBSignalMonitor::UpdateValues()
can now use my GetDVBChannel() to obtain the frontend name
via channel->getFrontendName().
I'm not sure whether the constructor is the appropriate place to
set this... as this assumes that the constructor is called each time
we switch cards... this could be a very bad assumption.
Anyway, here's the output of svn diff:
Index: libs/libmythtv/dvbsignalmonitor.h
===================================================================
--- libs/libmythtv/dvbsignalmonitor.h (revision 9336)
+++ libs/libmythtv/dvbsignalmonitor.h (working copy)
@@ -48,6 +48,10 @@
int GetDVBCardNum(void) const;
bool SupportsTSMonitoring(void);
+
+ DVBChannel *GetDVBChannel(void) const { return(channel); };
+ void SetDVBChannel(DVBChannel *_channel) { channel = _channel; };
+
protected:
SignalMonitorValue signalToNoise;
SignalMonitorValue bitErrorRate;
@@ -58,6 +62,7 @@
pthread_t table_monitor_thread;
FilterMap filters; ///< PID filters for table monitoring
+ DVBChannel *channel;
};
#endif // DVBSIGNALMONITOR_H
Index: libs/libmythtv/dvbchannel.cpp
===================================================================
--- libs/libmythtv/dvbchannel.cpp (revision 9336)
+++ libs/libmythtv/dvbchannel.cpp (working copy)
@@ -633,6 +633,11 @@
"Setting Frontend tuning parameters failed.");
return false;
}
+
+ // Special case for Nova-T. Should use configurable timeout.
+ if (GetFrontendName() == "DiBcom 3000P/M-C DVB-T") {
+ usleep(2000000);
+ }
wait_for_backend(fd_frontend, 5 /* msec */);
prev_tuning.params = params;
Index: libs/libmythtv/dvbsignalmonitor.cpp
===================================================================
--- libs/libmythtv/dvbsignalmonitor.cpp (revision 9336)
+++ libs/libmythtv/dvbsignalmonitor.cpp (working copy)
@@ -83,6 +83,8 @@
QString msg = QString("DVBSignalMonitor(%1)::constructor(%2,%3): %4")
.arg(channel->GetDevice()).arg(capturecardnum);
+ SetDVBChannel(_channel);
+
#define DVB_IO(WHAT,WHERE,ERRMSG,FLAG) \
if (ioctl(_channel->GetFd(), WHAT, WHERE)) \
VERBOSE(VB_IMPORTANT, msg.arg(ERRMSG).arg(strerror(errno))); \
@@ -542,10 +544,16 @@
uint32_t ber = 0, ublocks = 0;
fe_status_t status;
bzero(&status, sizeof(status));
+ DVBChannel *channel = GetDVBChannel();
// Get info from card
int fd_frontend = channel->GetFd();
ioctl(fd_frontend, FE_READ_STATUS, &status);
+ // Special case for Nova-T. Should use configurable timeout.
+ if (channel->GetFrontendName() == "DiBcom 3000P/M-C DVB-T") {
+ usleep(2000000);
+ }
+
if (HasFlags(kDTVSigMon_WaitForSig))
ioctl(fd_frontend, FE_READ_SIGNAL_STRENGTH, &sig);
if (HasFlags(kDVBSigMon_WaitForSNR))
Please be kind, this is my first attempt at a patch and I really do
not expect
you to accept it since there is so much I do not yet have a clue about.
Also, should I really raise a trac ticket instead and attach this
protoplasmic
patch to the ticket ?
Cheers,
Doug
More information about the mythtv-users
mailing list