| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- #include "AvPlayer/playerdemowindow.h"
- #include "mainwindow.h"
- #include "thememanager.h"
- #include "themesettingswidget.h"
- #include <QApplication>
- #include <QAudioDeviceInfo>
- #include <QAudioOutput>
- #include <QDebug>
- #include <QVBoxLayout>
- #include <qendian.h>
- #include <qmath.h>
- #include <QFile>
- #include <QTextStream>
- #include <QDateTime>
- #include <QMutex>
- QFile g_logFile;
- QTextStream* g_logStream = nullptr;
- QMutex g_logMutex;
- void myMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
- {
- QMutexLocker locker(&g_logMutex);
- if (!g_logStream) return;
- QString typeStr;
- switch (type) {
- case QtDebugMsg: typeStr = "DEBUG"; break;
- case QtWarningMsg: typeStr = "WARN "; break;
- case QtCriticalMsg: typeStr = "ERROR"; break;
- case QtFatalMsg: typeStr = "FATAL"; break;
- }
- QString logMsg = QString("%1 [%2] %3 (%4:%5)\n")
- .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz"))
- .arg(typeStr)
- .arg(msg)
- .arg(QString(context.file ? context.file : ""))
- .arg(context.line);
- (*g_logStream) << logMsg;
- g_logStream->flush();
- if (type == QtFatalMsg)
- abort();
- }
- #include "AvPlayer2/mainwindowa.h"
- int main(int argc, char* argv[])
- {
- // 打开日志文件(覆盖模式)
- g_logFile.setFileName("log.txt");
- g_logFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate);
- g_logStream = new QTextStream(&g_logFile);
- // 安装日志处理器
- //qInstallMessageHandler(myMessageHandler);
- // std::freopen(nullptr, "w", stdout);
- setvbuf(stdout, nullptr, _IONBF, 0);
- QApplication a(argc, argv);
- ThemeManager::instance().setThemeMode(ThemeManager::Light);
- /*
- docker run -itd --name zlmediakit --restart=always
- -p 1935:1935 -p 8080:80 -p 8443:443
- -p 8554:554 -p 10000:10000
- -p 10000:10000/udp -p 8000:8000/udp
- -p 9000:9000/udp
- -v /data/zlmediakit/media/bin:/opt/media/bin
- -v /data/zlmediakit/media/conf:/opt/media/conf
- zlmediakit/zlmediakit:master
- */
- MainWindow w;
- w.show();
- // ThemeSettingsWidget ThemeSettingsWidget;
- // ThemeSettingsWidget.show();
- // PlayerWindow w;
- // w.resize(960, 540);
- // w.show();
- // MainWindowA aa;
- // aa.show();
- // // 这里填你的流地址
- // // w.startPlay("http://vd3.bdstatic.com/mda-jennyc5ci1ugrxzi/mda-jennyc5ci1ugrxzi.mp4");
- // w.open("C:/Users/zhuizhu/Videos/1.mp4");
- // // w.startPlay("rtmp://127.0.0.1:1936/stream/V1");
- int ret = a.exec();
- delete g_logStream;
- g_logFile.close();
- return ret;
- }
|