- New CITP/MSEx menu. Init protocol and make thumbs options

This commit is contained in:
Santi Noreña 2013-02-12 15:07:08 +01:00
parent ef52ae20d8
commit 2d1bbe0e37
12 changed files with 674 additions and 727 deletions

View file

@ -29,20 +29,15 @@ THE SOFTWARE.
#include "citp-lib.h"
#include "CITPDefines.h"
#include "PacketCreator.h"
//#include "MediaServer.h"
#include <QTimer>
#include <QtDebug>
#include <QNetworkInterface>
#ifdef Q_OS_WIN
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
PeerInformationSocket::PeerInformationSocket(QObject *parent)
: QUdpSocket(parent),
@ -105,8 +100,7 @@ bool PeerInformationSocket::init(const QString &name, const QString &state, quin
// transmitPLoc();
// XXX - don't connect this more than once..
connect(this, SIGNAL(readyRead()),
this, SLOT(handleReadReady()));
// connect(this, SIGNAL(readyRead()),this, SLOT(handleReadReady()));
if (m_timer)
{
@ -124,7 +118,7 @@ void PeerInformationSocket::transmitPLoc()
writeDatagram((const char*)m_packetBuffer, m_packetBufferLen, addr, CITP_PINF_MULTICAST_PORT);
}
}
/*
void PeerInformationSocket::handleReadReady()
{
while (hasPendingDatagrams())
@ -152,7 +146,7 @@ void PeerInformationSocket::processPacket(const QHostAddress &address, const QBy
qDebug() << "No CITP";
return;
}
/*
if (packet->CITPPINFHeader.CITPHeader.VersionMajor != 0x01)
{
qDebug() << "Invalid VersionMajor value:" << packet->CITPPINFHeader.CITPHeader.VersionMajor;
@ -164,7 +158,7 @@ void PeerInformationSocket::processPacket(const QHostAddress &address, const QBy
qDebug() << "Invalid VersionMinor value:" << packet->CITPPINFHeader.CITPHeader.VersionMinor;
return;
}
*/
if (packet->CITPPINFHeader.CITPHeader.ContentType != COOKIE_PINF)
{
qDebug() << "NO PINF";
@ -180,3 +174,4 @@ void PeerInformationSocket::processPacket(const QHostAddress &address, const QBy
// PLoc data
// quint16 listeningPort = packet->ListeningTCPPort;
}
*/

View file

@ -33,7 +33,6 @@ THE SOFTWARE.
#include <QUdpSocket>
class QTimer;
//class MediaServer;
struct PeerDescripton;
@ -49,7 +48,7 @@ public:
private slots:
void transmitPLoc();
void handleReadReady();
// void handleReadReady();
private:
QString m_name;
@ -58,7 +57,7 @@ private:
unsigned char *m_packetBuffer;
int m_packetBufferLen;
void processPacket(const QHostAddress &sender, const QByteArray &packet);
// void processPacket(const QHostAddress &sender, const QByteArray &packet);
signals:

View file

@ -140,10 +140,11 @@ libreMediaServer::libreMediaServer(QWidget *parent)
connect(ui.actionOpen_conf, SIGNAL(triggered()), this, SLOT(openFile()));
connect(ui.actionSave_conf, SIGNAL(triggered()), this, SLOT(saveFile()));
connect(ui.actionChange_Media_Path, SIGNAL(triggered()), this, SLOT(ChangeMediaPath()));
connect(ui.actionInitMSEX, SIGNAL(triggered()), this, SLOT(InitMSEX()));
connect(ui.actionInitMSEX, SIGNAL(triggered()), this, SLOT(initMSEX()));
connect(ui.actionMake_Thumbs, SIGNAL(triggered()), this, SLOT(makeThumbs()));
// Load the configuration
open_start();
// Connect MSEx
// Connect MSEx Timer
connect(m_msex,SIGNAL(frameRequest()), this, SLOT(sendFrame()));
}
@ -346,7 +347,8 @@ void libreMediaServer::open(QFile *file)
qDebug()<<(desc);
file->close();
delete buffer;
// delete fileconf; // Comment due to Seg Fault
// delete file;
// delete fileconf; // Comment due to Seg Fault
}
void libreMediaServer::save(QFile *file)
@ -430,12 +432,6 @@ void libreMediaServer::olastart()
// connect(ola, SIGNAL(finished(int)), this, SLOT(olastart()));
}
/*
* User Interface Stuff
*/
///////////////////////////////////////////////////////////////////
// Menu CITP/MSEx
///////////////////////////////////////////////////////////////////
@ -471,14 +467,14 @@ void libreMediaServer::initMSEX()
ipadd = ipadd + i;
m_msex->startCitp(ipadd);
}
//void setIPAdd();
// Generates the thumbs to transmit by CITP/MSEx
void libreMediaServer::makeThumbs()
{
QProcess *script = new QProcess ();
QStringList arguments;
arguments << m_pathmedia;
script->execute("./scripts/make_thumbs.sh", arguments);
script->execute("../scripts/make_thumbs.sh", arguments);
}
///////////////////////////////////////////////////////////////////
@ -870,10 +866,10 @@ void libreMediaServer::stdout() {
{
ui.textEdit->appendPlainText("Can not read DMX data.");
}
if (out.indexOf("watchdog",0) != -1)
/* if (out.indexOf("watchdog",0) != -1)
{
ui.textEdit->appendPlainText("PD video watchdog detected.");
}
}*/
int j = out.indexOf("togui: ",0);
if ((j >= 0) && (out.size() > (j+7)))
{
@ -931,7 +927,7 @@ void libreMediaServer::stdout() {
}
}
}
// Restart the Pure Data process if crash. Connected wit signal finished of QProcess
// Restart the Pure Data process if crash. Connected with signal finished of QProcess
void libreMediaServer::pdrestart()
{
@ -941,7 +937,7 @@ void libreMediaServer::pdrestart()
}
save_finish();
qDebug()<<"Restarting PD";
ui.textEdit->appendPlainText("PD Restarting...");
ui.textEdit->appendPlainText("PD Video Restarting.");
disconnect(m_pd_video, SIGNAL(finished(int)), this, SLOT(pdrestart()));
pdstart();
}
@ -1048,7 +1044,7 @@ void libreMediaServer::newconexion()
{
// Iniciamos el socket
m_pd_write_video->connectToHost(QHostAddress::LocalHost, PDPORTW);
m_pd_write_video->waitForConnected(300000);
m_pd_write_video->waitForConnected(3000);
if (!(m_pd_write_video->isOpen())){
qErrnoWarning("newconexion:pd write socket not open!:");
return;

View file

@ -7,8 +7,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>773</width>
<height>626</height>
<width>745</width>
<height>636</height>
</rect>
</property>
<property name="windowTitle">
@ -76,7 +76,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>300</y>
<y>290</y>
<width>55</width>
<height>27</height>
</rect>
@ -91,8 +91,8 @@
<widget class="QSpinBox" name="ipAddress2">
<property name="geometry">
<rect>
<x>510</x>
<y>340</y>
<x>570</x>
<y>170</y>
<width>31</width>
<height>27</height>
</rect>
@ -107,8 +107,8 @@
<widget class="QSpinBox" name="ipAddress4">
<property name="geometry">
<rect>
<x>590</x>
<y>340</y>
<x>650</x>
<y>170</y>
<width>31</width>
<height>27</height>
</rect>
@ -126,8 +126,8 @@
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>30</x>
<y>330</y>
<x>20</x>
<y>320</y>
<width>101</width>
<height>17</height>
</rect>
@ -153,7 +153,7 @@
<property name="geometry">
<rect>
<x>20</x>
<y>270</y>
<y>260</y>
<width>87</width>
<height>23</height>
</rect>
@ -230,8 +230,8 @@
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>20</x>
<y>380</y>
<x>10</x>
<y>370</y>
<width>121</width>
<height>20</height>
</rect>
@ -244,7 +244,7 @@
<property name="geometry">
<rect>
<x>20</x>
<y>240</y>
<y>230</y>
<width>101</width>
<height>23</height>
</rect>
@ -296,7 +296,7 @@
<property name="geometry">
<rect>
<x>70</x>
<y>350</y>
<y>340</y>
<width>55</width>
<height>27</height>
</rect>
@ -322,7 +322,7 @@
<property name="geometry">
<rect>
<x>20</x>
<y>210</y>
<y>200</y>
<width>55</width>
<height>27</height>
</rect>
@ -345,7 +345,7 @@
<property name="geometry">
<rect>
<x>70</x>
<y>300</y>
<y>290</y>
<width>55</width>
<height>27</height>
</rect>
@ -358,7 +358,7 @@
<property name="geometry">
<rect>
<x>20</x>
<y>190</y>
<y>180</y>
<width>91</width>
<height>20</height>
</rect>
@ -380,24 +380,24 @@
<string>Layer 5</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="CITPaddress_label">
<property name="geometry">
<rect>
<x>500</x>
<y>370</y>
<width>81</width>
<x>480</x>
<y>150</y>
<width>241</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>IP Address</string>
<string>IP address interface for CITP/MSEx</string>
</property>
</widget>
<widget class="QSpinBox" name="ipAddress3">
<property name="geometry">
<rect>
<x>550</x>
<y>340</y>
<x>610</x>
<y>170</y>
<width>31</width>
<height>27</height>
</rect>
@ -426,7 +426,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>350</y>
<y>340</y>
<width>55</width>
<height>27</height>
</rect>
@ -438,8 +438,8 @@
<widget class="QSpinBox" name="ipAddress1">
<property name="geometry">
<rect>
<x>470</x>
<y>340</y>
<x>530</x>
<y>170</y>
<width>31</width>
<height>27</height>
</rect>
@ -678,7 +678,7 @@
<zorder>video</zorder>
<zorder>winsizey</zorder>
<zorder>label</zorder>
<zorder>label_4</zorder>
<zorder>CITPaddress_label</zorder>
<zorder>ipAddress3</zorder>
<zorder>winpositionx</zorder>
<zorder>ipAddress1</zorder>
@ -1093,13 +1093,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>751</width>
<width>721</width>
<height>121</height>
</rect>
</property>
<property name="plainText">
<string>LibreMediaServer 0.01-2
<string>LibreMediaServer 0.02-1
(C) 2012-2013 Santiago Noreña libremediaserver@gmail.com
GPL 3 license. See LICENSE.txt and credits.txt for details
This program comes with ABSOLUTELY NO WARRANTY</string>
</property>
</widget>
@ -1110,7 +1111,7 @@ This program comes with ABSOLUTELY NO WARRANTY</string>
<rect>
<x>0</x>
<y>0</y>
<width>773</width>
<width>745</width>
<height>29</height>
</rect>
</property>
@ -1155,7 +1156,7 @@ This program comes with ABSOLUTELY NO WARRANTY</string>
</action>
<action name="actionInitMSEX">
<property name="checkable">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="text">
<string>Init</string>