[mythtv] [PATCH] Three small patches
Mikael Magnusson
mikaelmagnusson at tjohoo.se
Sun Sep 14 16:28:10 EDT 2003
On Sun, Sep 14, 2003 at 03:05:28PM +0200, Mikael Magnusson wrote:
> Hi,
>
> I have made three small patches that I'd like to contribute.
>
> 1. Mythbackend communications
> With the patch Mythtv exits if the backend closes the connection while
> watching live TV, instead of locking. It also makes it possible to
> recover from some backend failures. Mythtv will try to reconnect to the
> backend if there are no remote file transmissions in progress, for
> example live TV.
>
> 2. External Channel Change
> Added channel number argument to the call of the external channel change
> program. This is useful in Europe.
>
> 3. Mythplugin
> When debugging it's nice to know why loading of a plugin fails. Added
> dynamic library error string (dlerror).
>
>
> Mikael Magnusson
>
Sorry, I forgot to attach them.
Mikael
-------------- next part --------------
Index: libs/libmyth/mythcontext.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythcontext.cpp,v
retrieving revision 1.82
diff -u -r1.82 mythcontext.cpp
--- libs/libmyth/mythcontext.cpp 27 Aug 2003 15:41:49 -0000 1.82
+++ libs/libmyth/mythcontext.cpp 13 Sep 2003 21:59:21 -0000
@@ -8,6 +8,7 @@
#include <qsqldatabase.h>
#include <qurl.h>
#include <qnetwork.h>
+#include <qsocketdevice.h>
#include "mythcontext.h"
#include "oldsettings.h"
@@ -149,6 +150,9 @@
ReadStringList(serverSock, strlist);
connect(serverSock, SIGNAL(readyRead()), this, SLOT(readSocket()));
+ connect(serverSock, SIGNAL(error(int)), this, SLOT(errorSocket(int)));
+ connect(serverSock, SIGNAL(connectionClosed()),
+ this, SLOT(closedSocket()));
return true;
}
@@ -979,6 +983,20 @@
}
serverSockLock.unlock();
+}
+
+void MythContext::closedSocket()
+{
+ serverSock->close();
+ delete serverSock;
+ serverSock = NULL;
+
+ cerr << "Connection closed by backend server\n";
+}
+
+void MythContext::errorSocket(int errval)
+{
+ cerr << "Socket error: " << errval << endl;
}
void MythContext::addListener(QObject *obj)
Index: libs/libmyth/mythcontext.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythcontext.h,v
retrieving revision 1.96
diff -u -r1.96 mythcontext.h
--- libs/libmyth/mythcontext.h 8 Sep 2003 21:38:33 -0000 1.96
+++ libs/libmyth/mythcontext.h 13 Sep 2003 21:59:22 -0000
@@ -151,6 +151,9 @@
const QString &pluginversion);
private slots:
void readSocket();
+ void errorSocket(int errval);
+ void closedSocket();
+
private:
void SetPalette(QWidget *widget);
Index: libs/libmyth/remotefile.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/remotefile.cpp,v
retrieving revision 1.18
diff -u -r1.18 remotefile.cpp
--- libs/libmyth/remotefile.cpp 9 Aug 2003 22:21:15 -0000 1.18
+++ libs/libmyth/remotefile.cpp 13 Sep 2003 21:59:24 -0000
@@ -12,6 +12,7 @@
#include "mythcontext.h"
RemoteFile::RemoteFile(const QString &url, bool needevents, int lrecordernum)
+ : QObject()
{
type = 0;
path = url;
@@ -130,6 +131,10 @@
}
}
+ connect(sock, SIGNAL(error(int)), this, SLOT(errorSocket(int)));
+ connect(sock, SIGNAL(connectionClosed()),
+ this, SLOT(closedSocket()));
+
return sock;
}
@@ -280,3 +285,24 @@
return true;
}
+
+void RemoteFile::closedSocket()
+{
+ sock->close();
+ delete sock;
+ sock = NULL;
+
+ controlSock->close();
+ delete controlSock;
+ controlSock = NULL;
+
+ cerr << "Connection closed by backend server path:" <<
+ path << endl;
+ cerr << "exiting\n";
+ exit(1);
+}
+
+void RemoteFile::errorSocket(int errval)
+{
+ cerr << "Socket error " << errval << " path:" << path << endl;
+}
Index: libs/libmyth/remotefile.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/remotefile.h,v
retrieving revision 1.7
diff -u -r1.7 remotefile.h
--- libs/libmyth/remotefile.h 14 May 2003 19:06:15 -0000 1.7
+++ libs/libmyth/remotefile.h 13 Sep 2003 21:59:24 -0000
@@ -3,12 +3,14 @@
#include <qstring.h>
#include <qmutex.h>
+#include <qobject.h>
class MythContext;
class QSocket;
-class RemoteFile
+class RemoteFile : public QObject
{
+ Q_OBJECT
public:
RemoteFile(const QString &url, bool needevents = false,
int recordernum = -1);
@@ -49,6 +51,10 @@
QMutex lock;
long long filesize;
+
+ private slots:
+ void errorSocket(int errval);
+ void closedSocket();
};
#endif
-------------- next part --------------
Index: libs/libmythtv/channel.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/channel.cpp,v
retrieving revision 1.55
diff -u -r1.55 channel.cpp
--- libs/libmythtv/channel.cpp 27 Aug 2003 15:41:50 -0000 1.55
+++ libs/libmythtv/channel.cpp 13 Sep 2003 20:08:26 -0000
@@ -331,7 +331,7 @@
if (!TuneTo(freqid, finetune))
return false;
}
- else if (!ChangeExternalChannel(freqid))
+ else if (!ChangeExternalChannel(freqid, chan))
return false;
curchannelname = chan;
Index: libs/libmythtv/channelbase.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/channelbase.cpp,v
retrieving revision 1.6
diff -u -r1.6 channelbase.cpp
--- libs/libmythtv/channelbase.cpp 12 Sep 2003 16:49:53 -0000 1.6
+++ libs/libmythtv/channelbase.cpp 13 Sep 2003 20:08:27 -0000
@@ -120,13 +120,16 @@
cerr << "Couldn't find input: " << inputname << " on card\n";
}
-bool ChannelBase::ChangeExternalChannel(const QString &channum)
+bool ChannelBase::ChangeExternalChannel(const QString &freqid,
+ const QString &channum)
{
if (externalChanger[currentcapchannel].isEmpty())
return false;
- QString command = QString("%1 %2 &").arg(externalChanger[currentcapchannel])
- .arg(channum);
+ QString command =
+ QString("%1 %2 %3 &").arg(externalChanger[currentcapchannel])
+ .arg(freqid)
+ .arg(channum);
VERBOSE(VB_CHANNEL, QString("External channel change: %1").arg(command));
pid_t child = fork();
Index: libs/libmythtv/channelbase.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/channelbase.h,v
retrieving revision 1.3
diff -u -r1.3 channelbase.h
--- libs/libmythtv/channelbase.h 7 Aug 2003 17:37:41 -0000 1.3
+++ libs/libmythtv/channelbase.h 13 Sep 2003 20:08:27 -0000
@@ -73,7 +73,8 @@
QString channelorder;
- bool ChangeExternalChannel(const QString &newchan);
+ bool ChangeExternalChannel(const QString &newfreqid,
+ const QString &newchan);
};
#endif
-------------- next part --------------
Index: libs/libmyth/mythplugin.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythplugin.cpp,v
retrieving revision 1.5
diff -u -r1.5 mythplugin.cpp
--- libs/libmyth/mythplugin.cpp 29 Jul 2003 03:03:05 -0000 1.5
+++ libs/libmyth/mythplugin.cpp 13 Sep 2003 20:08:24 -0000
@@ -1,5 +1,6 @@
#include "mythplugin.h"
#include "qdict.h"
+#include <dlfcn.h>
#include <iostream>
#include "mythcontext.h"
@@ -68,6 +69,9 @@
{
m_dict.remove(newname);
cerr << "Unable to initialize plugin '" << plugname << "'." << endl;
+
+ cerr << dlerror() << endl;
+
return false;
}
More information about the mythtv-dev
mailing list