Ich habe das Problem, dass QProcess kein Output bekommt und habe die Vermutung, dass dies an dem eigentlichen Programm rtmpdump 2.2d windows liegt.
Hier jedoch erst einmal mein Code:
Code: Alles auswählen
#include "ptest.h"
#include <QProcess>
#include <QByteArray>
#include <QHBoxLayout>
#include <QPushButton>
#include <QDir>
#include <QCoreApplication>
PTest::PTest(QWidget *parent) :
QWidget(parent)
{
process = new QProcess;
edit = new QPlainTextEdit;
edit->setReadOnly(true);
edit->appendPlainText("Start download");
QString c = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/rtmpdump.exe");
process->start(c,
QStringList()
<< "-o"
<< "movie.flv"
<< "--host"
<< "vod.daserste.de"
<< "--port"
<< "1935"
<< "--protocol"
<< "rtmp"
<< "--stop"
<< "10"
<< "--playpath"
<< "mp4:videoportal/mediathek/Tatort/c_120000/129195/format133590.f4v"
<< "--swfUrl"
<< "http://www.ardmediathek.de/ard/static/swf/Aardvark.swf"
<< "--swfsize"
<< "90694"
<< "--swfhash"
<< "66b5e55cbf5e3dcf3866cffd412d5582c001ecbf407846aa23549a97e5b07689"
<< "--tcUrl"
<< "rtmp://vod.daserste.de/ardfs"
<< "--pageUrl"
<< "http://www.ardmediathek.de/ard/servlet/content/2600?inPopup=true"
<< "--app"
<< "ardfs"
<< "--flashVer"
<< "WIN 10,0,42,34"
<< "--verbose"
);
QPushButton *quit = new QPushButton("Stop download");
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(quit);
layout->addWidget(edit);
setLayout(layout);
connect(quit,SIGNAL(clicked()),this,SLOT(Quit()));
connect(process,SIGNAL(readyReadStandardOutput()),this,SLOT(Output()));
connect(process,SIGNAL(finished(int)),this,SLOT(Finish(int)));
}
void PTest::Quit() {
process->close();
edit->appendPlainText("Download stopped!");
}
void PTest::Output() {
static QByteArray output;
output = process->readAllStandardOutput();
edit->appendPlainText(output);
}
void PTest::Finish(int i) {
edit->appendPlainText(QVariant(i).toString());
}
Code: Alles auswählen
void RTMP_LogPrintf(const char *format, ...)
{
char str[MAX_PRINT_LEN]="";
int len;
va_list args;
va_start(args, format);
len = vsnprintf(str, MAX_PRINT_LEN-1, format, args);
va_end(args);
if ( RTMP_debuglevel==RTMP_LOGCRIT )
return;
if ( !fmsg ) fmsg = stderr;
if (neednl) {
putc('\n', fmsg);
neednl = 0;
}
if (len > MAX_PRINT_LEN-1)
len = MAX_PRINT_LEN-1;
fprintf(fmsg, "%s", str);
if (str[len-1] == '\n')
fflush(fmsg);
}