- Log file and minor changes.

- PD Video uses noaudio option to avoid blocking the device
This commit is contained in:
Santi Noreña 2013-02-20 16:55:00 +01:00
parent d7d9559e9f
commit c2af0c91ab
12 changed files with 194 additions and 180 deletions

View file

@ -1,37 +1,37 @@
#N canvas 352 90 904 417 10;
#N canvas 391 105 477 527 audio_player 0;
#X msg 22 107 open \$1;
#X msg 203 167 start;
#X msg 242 168 stop;
#X obj 119 214 oggread~;
#X msg 274 168 resume;
#N canvas 350 98 904 417 10;
#N canvas 389 113 497 527 audio_player 0;
#X msg 22 33 open \$1;
#X msg 203 93 start;
#X msg 242 94 stop;
#X obj 119 140 oggread~;
#X msg 274 94 resume;
#X obj 22 9 inlet;
#X obj 219 105 / 25;
#X obj 219 125 int;
#X obj 219 31 / 25;
#X obj 219 51 int;
#X obj 219 10 r \$0-c5;
#X obj 100 265 *~ 0;
#X obj 157 265 *~ 0;
#X obj 276 209 dbtorms;
#X obj 219 209 dbtorms;
#X obj 150 493 dac~;
#X obj 363 140 r \$0-c1;
#X obj 212 300 r \$0-c2;
#X text 361 123 Volumen;
#X text 224 284 Pan;
#X obj 212 340 * 0.00392157;
#X obj 219 145 select 0 1 2;
#X msg 119 175 seek \$1;
#X obj 119 110 r \$0-c8;
#X obj 363 176 * 0.0015308;
#X obj 119 141 * 0.01;
#X obj 200 267 s \$0-position;
#X obj 117 383 expr 1-$f1;
#X obj 210 432 line~;
#X msg 210 411 \$1 1;
#X obj 117 424 line~;
#X msg 117 403 \$1 1;
#X obj 194 452 *~;
#X obj 101 449 *~;
#X obj 100 191 *~ 0;
#X obj 157 191 *~ 0;
#X obj 276 135 dbtorms;
#X obj 219 135 dbtorms;
#X obj 150 419 dac~;
#X obj 363 66 r \$0-c1;
#X obj 212 226 r \$0-c2;
#X text 361 49 Volumen;
#X text 224 210 Pan;
#X obj 212 266 * 0.00392157;
#X obj 219 71 select 0 1 2;
#X msg 119 101 seek \$1;
#X obj 119 36 r \$0-c8;
#X obj 363 102 * 0.0015308;
#X obj 119 67 * 0.01;
#X obj 200 193 s \$0-position;
#X obj 117 309 expr 1-$f1;
#X obj 210 358 line~;
#X msg 210 337 \$1 1;
#X obj 117 350 line~;
#X msg 117 329 \$1 1;
#X obj 194 378 *~;
#X obj 101 375 *~;
#X connect 0 0 3 0;
#X connect 1 0 3 0;
#X connect 2 0 3 0;
@ -99,7 +99,7 @@
#X obj 708 -67 s \$0-c14;
#X obj 763 -67 s \$0-c15;
#X obj 825 -67 s \$0-c16;
#N canvas 122 209 412 197 selector 0;
#N canvas 678 268 412 197 selector 0;
#X obj 193 -66 outlet;
#X text 99 -210 folder;
#X obj 95 -193 r \$0-c3;
@ -137,8 +137,6 @@
#X text 184 -336 c1 Vol c2 pan c3 folder c4 file c5 playback c6 Control
c7 Volumen fino 8 Entry point Coarse 9 Entry point fine;
#X obj 5 -199 outlet;
#X floatatom 66 -167 5 0 0 0 - - -;
#X symbolatom 189 -176 80 0 0 0 - - -;
#X connect 1 0 40 0;
#X connect 2 0 25 0;
#X connect 3 0 26 0;
@ -158,10 +156,8 @@ c7 Volumen fino 8 Entry point Coarse 9 Entry point fine;
#X connect 17 0 33 0;
#X connect 32 0 0 0;
#X connect 32 0 42 0;
#X connect 32 0 44 0;
#X connect 33 0 34 0;
#X connect 34 0 9 0;
#X connect 34 0 43 0;
#X connect 34 1 10 0;
#X connect 34 2 11 0;
#X connect 34 3 12 0;

View file

@ -1 +0,0 @@
libMagick++-6.Q16.so.1.0.0

View file

@ -1 +0,0 @@
libMagick++-6.Q16.so.1.0.0

Binary file not shown.

View file

@ -1 +0,0 @@
/usr/local/lib/libMagick++-6.Q16.so.1.0.0

Binary file not shown.

Binary file not shown.

View file

@ -1,20 +0,0 @@
#!/bin/bash
# make_thumbs v0.0.2
# Script que genera thumbnails de todas las películas en el directorio Media
# Copyright Santi Noreña 2012-2013
# GPL License
cd $0 ||{
echo "Can not change to directory." $0
exit $E_XCD;
}
for folder in $(find -maxdepth 1 -type d); do
rm $folder/thumbs/*
mkdir $folder/thumbs
done
for file in $(find . -maxdepth 2 -mindepth 2 -type f ); do
avconv -i $file -f image2 -frames:v 1 -s 64x46 -vcodec mjpeg $file.jpg
done
for folder in $(find -maxdepth 1 -type d); do
mv $folder/*.jpg $folder/thumbs
done
exit 0

View file

@ -1,6 +1,6 @@
/*
Pure Media Server - A Media Server Sotfware for stage and performing
v0.01-2
v0.03-1
Copyright (C) 2012-2013 Santi Noreña libremediaserver@gmail.com
This program is free software: you can redistribute it and/or modify
@ -30,6 +30,8 @@
#include <QFileInfo>
#include <QFileDialog>
#include <QLocalServer>
#include <QFile>
#include <QTextStream>
// Esto habrá que cambiarlo para poder utilizar varias instancias
#define PDPORTW 9195
@ -104,25 +106,31 @@ bool audioCheck;
///////////////////////////////////////////////////////////////////
libreMediaServer::libreMediaServer(QWidget *parent)
: QMainWindow(parent)
: QMainWindow(parent),
m_startvideo(0),
m_startaudio(0),
m_pd_video(NULL),
m_pd_audio(NULL),
m_pd_write_video(NULL),
m_pd_write_audio(NULL),
m_pd_read_audio(NULL),
m_tcpsocket_audio(NULL)
{
qDebug() << "******************************************************************************************************";
qDebug() << QDate::currentDate() << QTime::currentTime();
// Iniciamos el User Interface
ui.setupUi(this);
// Iniciamos los punteros NULL
m_pd_write_video = NULL;
m_pd_video = NULL;
m_tcpsocket_audio = NULL;
m_pd_read_audio = NULL;
m_pd_write_audio = NULL;
m_pd_audio = NULL;
// Unix Local Sockets
QFile socket(SOCKET);
if (socket.exists())
{
socket.remove();
}
m_server_vid = new QLocalServer(this);
Q_CHECK_PTR(m_server_vid);
if (!m_server_vid->listen(SOCKET))
{
qErrnoWarning("Can not listen on unix local server");
qErrnoWarning("Init: Can not listen on unix local server");
}
connect(m_server_vid, SIGNAL(newConnection()),this, SLOT(newPeer()));
// Start preview Timer
@ -160,10 +168,6 @@ libreMediaServer::~libreMediaServer()
m_pd_write_video->abort();
delete m_pd_write_video;
}
// if (m_read_vid->isOpen()) {
// m_read_vid->close();;
// delete m_read_vid;
// }
if (m_server_vid->isListening()) {
m_server_vid->close();
delete m_server_vid;
@ -172,13 +176,21 @@ libreMediaServer::~libreMediaServer()
{
disconnect(m_pd_video, SIGNAL(finished(int)), this, SLOT(pdrestart()));
m_pd_video->terminate();
if (m_pd_video->waitForFinished(30000))
{
delete m_pd_video;
}
}
m_ola->close();
delete m_ola;
if (m_pd_audio != NULL)
{
disconnect(m_pd_audio, SIGNAL(finished(int)), this, SLOT( pdrestart_audio()));
m_pd_audio->terminate();
if (m_pd_audio->waitForFinished(30000))
{
delete m_pd_audio;
}
}
if (m_pd_write_audio != NULL)
{
@ -190,6 +202,10 @@ libreMediaServer::~libreMediaServer()
m_pd_read_audio->close();
delete m_pd_read_audio;
}
socket.remove();
qDebug() << "PD Video starts: " << m_startvideo << " PD Audio starts: " << m_startaudio;
qDebug() << "Date: " << QDate::currentDate() << "Time: "<< QTime::currentTime();
qDebug() << "******************************************************************************************************";
return;
}
@ -836,17 +852,19 @@ void libreMediaServer::pdstart()
{
return;
}
qDebug()<<"Starting PD Video:" << ++m_startvideo;
// Creamos los sockets para la conexión a Pure Data
m_pd_write_video = new QTcpSocket(this);
Q_CHECK_PTR(m_pd_write_video);
connect(m_pd_write_video, SIGNAL(connected()),this, SLOT(newconexion()));
// Arrancamos el proceso Pure Data
m_pd_video->start("./pd -lib Gem -d 0 -stderr -nogui -nostdpath lms-video.pd");
m_pd_video->start("./pd -noaudio -lib Gem -stderr -nostdpath -path ./externals/ lms-video.pd");
if (m_pd_video->waitForStarted(3000)){
ui.textEdit->appendPlainText("Video Engine started.");
}
else
{
qFatal("PD Video can not start") ;
ui.textEdit->appendPlainText("Video Engine can not start!");
return;
}
@ -856,78 +874,6 @@ void libreMediaServer::pdstart()
connect(m_pd_video, SIGNAL(finished(int)), this, SLOT(pdrestart()));
}
// Sacamos la salida de Pure Data en la terminal
void libreMediaServer::stdout() {
QByteArray out = m_pd_video->readAllStandardError();
if (out.size() < 7) {return;}
out.chop(1);
qDebug() << out;
if (out.indexOf("ola2pd: Can not read DMX!",0) != -1)
{
ui.textEdit->appendPlainText("Can not read DMX data.");
}
/* 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)))
{
int i = m_pathmedia.size() + 16;
out.remove(0,j);
switch (out.at(7)) {
case '0':
qDebug()<<"Loadbang Video";
ui.textEdit->appendPlainText("LoadBang Video received.");
newconexion();
break;
case '1':
out.remove(0, i);
out.prepend("Layer 1 playing:");
ui.textEdit->appendPlainText(out);
break;
case '2':
out.remove(0, i);
out.prepend("Layer 2 playing:");
ui.textEdit->appendPlainText(out);
break;
case '3':
out.remove(0,i);
out.prepend("Layer 3 playing:");
ui.textEdit->appendPlainText(out);
break;
case '4':
out.remove(0,i);
out.prepend("Layer 4 playing:");
ui.textEdit->appendPlainText(out);
break;
case '5':
out.remove(0,i);
out.prepend("Layer 5 playing:");
ui.textEdit->appendPlainText(out);
break;
case '6':
out.remove(0,i);
out.prepend("Layer 6 playing:");
ui.textEdit->appendPlainText(out);
break;
case '7':
out.remove(0,i);
out.prepend("Layer 7 playing:");
ui.textEdit->appendPlainText(out);
break;
case '8':
out.remove(0,i);
out.prepend("Layer 8 playing:");
ui.textEdit->appendPlainText(out);
break;
default:
qDebug()<<"stdout:Invalid cooki received"<<out;
break;
}
}
}
// Restart the Pure Data process if crash. Connected with signal finished of QProcess
void libreMediaServer::pdrestart()
@ -937,10 +883,10 @@ void libreMediaServer::pdrestart()
return;
}
save_finish();
qDebug()<<"Restarting PD";
ui.textEdit->appendPlainText("PD Video Restarting.");
disconnect(m_pd_video, SIGNAL(finished(int)), this, SLOT(pdrestart()));
pdstart();
}
// New conexion on TCP Server
@ -1418,6 +1364,7 @@ void libreMediaServer::pdstart_audio()
{
return;
}
qDebug()<<"Starting PD Audio:" << ++m_startaudio;
// Creamos los sockets para la conexión a Pure Data
m_pd_write_audio = new QTcpSocket(this);
Q_CHECK_PTR(m_pd_write_audio);
@ -1434,7 +1381,7 @@ void libreMediaServer::pdstart_audio()
qDebug()<<"error listening tcpServer";
}
// Arrancamos el proceso Pure Data
m_pd_audio->start("./pd -channels 2 -audiodev 1 -stderr -nostdpath -nogui lms-audio.pd");
m_pd_audio->start("./pd -alsa -channels 2 -audiodev 1 -stderr -nostdpath -path ./externals/ lms-audio.pd");
if (m_pd_audio->waitForStarted(3000)){
ui.textEdit->appendPlainText("PD Audio started.");
}
@ -1447,27 +1394,12 @@ void libreMediaServer::pdstart_audio()
connect(m_pd_audio, SIGNAL(readyReadStandardError()), this, SLOT(stdout_audio()));
}
// Sacamos la salida de Pure Data en la terminal
void libreMediaServer::stdout_audio() {
QString out = m_pd_audio->readAllStandardError();
out.chop(1);
if (!out.isEmpty())
{
qDebug() << out;
// ui.textEdit->appendPlainText(out);
}
}
// Restart the Pure Data process if crash. Connected wit signal finished of QProcess
void libreMediaServer::pdrestart_audio()
{
save_finish();
qDebug()<<"Restarting PD audio";
ui.textEdit->appendPlainText("PD audio Restarting...");
int state = m_pd_audio->state();
if (state != 0)
if (m_pd_audio->state())
{
return;
}
@ -1488,7 +1420,6 @@ void libreMediaServer::pdrestart_audio()
}
// New conexion on TCP Server
void libreMediaServer::newPeer_audio()
{
m_tcpsocket_audio = m_pd_read_audio->nextPendingConnection();
@ -1497,7 +1428,6 @@ void libreMediaServer::newPeer_audio()
}
// New message in a TCP socket stablished connection
void libreMediaServer::newmessage_audio()
{
if (m_tcpsocket_audio == NULL)
@ -1581,7 +1511,6 @@ void libreMediaServer::newconexion_audio()
}
// Sends packets to Pure Data audio
bool libreMediaServer::sendPacket_audio(const char *buffer, int bufferLen)
{
if (m_pd_write_audio == NULL) {
@ -1599,7 +1528,6 @@ bool libreMediaServer::sendPacket_audio(const char *buffer, int bufferLen)
}
// Function error sending packets to PD audio
void libreMediaServer::errorsending_audio() {
if (ui.audio->checkState())
{
@ -1612,6 +1540,7 @@ void libreMediaServer::errorsending_audio() {
// Previews
//
///////////////////////////////////////////////////////////////////
// GUI
void libreMediaServer::previewMaster()
{
@ -1675,3 +1604,91 @@ void libreMediaServer::sendFrame()
}
m_msex->n_timer->start();
}
///////////////////////////////////////////////////////////////////
//
// Terminal and Log
//
///////////////////////////////////////////////////////////////////
// Sacamos la salida de Pure Data Audio en la terminal
void libreMediaServer::stdout_audio() {
QString out = m_pd_audio->readAllStandardError();
out.chop(1);
if (!out.isEmpty())
{
qDebug() << "PD Audio: " << out;
}
}
// Sacamos la salida de Pure Data Video en la terminal
void libreMediaServer::stdout() {
QByteArray out = m_pd_video->readAllStandardError();
if (out.size() < 7) {return;}
out.chop(1);
qDebug() << "PD Video: " << out;
if (out.indexOf("ola2pd: Can not read DMX!",0) != -1)
{
ui.textEdit->appendPlainText("Can not read DMX data.");
}
/* 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)))
{
int i = m_pathmedia.size() + 16;
out.remove(0,j);
switch (out.at(7)) {
case '0':
qDebug()<<"Loadbang Video";
ui.textEdit->appendPlainText("LoadBang Video received.");
newconexion();
break;
case '1':
out.remove(0, i);
out.prepend("Layer 1 playing:");
ui.textEdit->appendPlainText(out);
break;
case '2':
out.remove(0, i);
out.prepend("Layer 2 playing:");
ui.textEdit->appendPlainText(out);
break;
case '3':
out.remove(0,i);
out.prepend("Layer 3 playing:");
ui.textEdit->appendPlainText(out);
break;
case '4':
out.remove(0,i);
out.prepend("Layer 4 playing:");
ui.textEdit->appendPlainText(out);
break;
case '5':
out.remove(0,i);
out.prepend("Layer 5 playing:");
ui.textEdit->appendPlainText(out);
break;
case '6':
out.remove(0,i);
out.prepend("Layer 6 playing:");
ui.textEdit->appendPlainText(out);
break;
case '7':
out.remove(0,i);
out.prepend("Layer 7 playing:");
ui.textEdit->appendPlainText(out);
break;
case '8':
out.remove(0,i);
out.prepend("Layer 8 playing:");
ui.textEdit->appendPlainText(out);
break;
default:
qDebug()<<"stdout:Invalid cookie received"<<out;
break;
}
}
}

View file

@ -50,18 +50,16 @@ protected:
// Video Sockets
QTcpSocket *m_pd_write_video;
// Unix Local Sockets
// QLocalSocket *m_write_vid;
// Video Unix Local Sockets
QLocalServer *m_server_vid;
QLocalSocket *m_read_vid;
// Audio TCP Sockets
QTcpSocket *m_pd_write_audio;
QTcpServer *m_pd_read_audio;
QTcpSocket *m_tcpsocket_audio;
QTimer *m_preview;
// void contextMenuEvent(QContextMenuEvent *event);
QTimer *m_preview; // Timer for the preview screen
int m_startvideo; // Counter starts video engine. Debugging purpose
int m_startaudio; // Counter starts audio engine. Debugging purpose
private:

View file

@ -1098,7 +1098,7 @@
</rect>
</property>
<property name="plainText">
<string>LibreMediaServer 0.02-1
<string>LibreMediaServer 0.03-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>
@ -1112,7 +1112,7 @@ This program comes with ABSOLUTELY NO WARRANTY</string>
<x>0</x>
<y>0</y>
<width>745</width>
<height>29</height>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">

View file

@ -19,10 +19,36 @@
#include <QApplication>
#include "libremediaserver.h"
void MessageHandler(QtMsgType type, const char *msg)
{
QString txt;
switch (type) {
case QtDebugMsg:
txt = QString("Debug: %1").arg(msg);
break;
case QtWarningMsg:
txt = QString("Warning: %1").arg(msg);
break;
case QtCriticalMsg:
txt = QString("Critical: %1").arg(msg);
break;
case QtFatalMsg:
txt = QString("Fatal: %1").arg(msg);
abort();
}
QFile outFile("log.txt");
outFile.open(QIODevice::WriteOnly | QIODevice::Append);
QTextStream ts(&outFile);
ts << txt << endl;
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
qInstallMsgHandler(MessageHandler);
libreMediaServer libreMediaServer;
libreMediaServer.show();
return app.exec();
}