Port to Windows

This commit is contained in:
Florian Märkl 2019-08-18 19:47:27 +02:00
commit 5faa801331
No known key found for this signature in database
GPG key ID: 125BC8A5A6A1E857
52 changed files with 616 additions and 143 deletions

View file

@ -13,6 +13,10 @@ if(CHIAKI_GUI_ENABLE_SDL_GAMECONTROLLER)
find_package(SDL2 MODULE REQUIRED)
endif()
if(WIN32)
add_definitions(-DWIN32_LEAN_AND_MEAN)
endif()
find_package(FFMPEG REQUIRED COMPONENTS avcodec avutil)
set(RESOURCE_FILES "")
@ -21,7 +25,7 @@ if(APPLE)
list(APPEND RESOURCE_FILES "chiaki.icns")
endif()
add_executable(chiaki
add_executable(chiaki WIN32
${RESOURCE_FILES}
include/exception.h
src/main.cpp
@ -93,4 +97,4 @@ install(TARGETS chiaki
RUNTIME DESTINATION bin
BUNDLE DESTINATION bin)
install(FILES chiaki.desktop DESTINATION share/applications)
install(FILES chiaki.png DESTINATION share/icons/hicolor/512x512)
install(FILES chiaki.png DESTINATION share/icons/hicolor/512x512)

View file

@ -18,11 +18,11 @@
#ifndef CHIAKI_AVOPENGLWIDGET_H
#define CHIAKI_AVOPENGLWIDGET_H
#include <chiaki/log.h>
#include <QOpenGLWidget>
#include <QMutex>
#include <chiaki/log.h>
extern "C"
{
#include <libavcodec/avcodec.h>

View file

@ -18,13 +18,13 @@
#ifndef CHIAKI_DISCOVERYMANAGER_H
#define CHIAKI_DISCOVERYMANAGER_H
#include <chiaki/discoveryservice.h>
#include "host.h"
#include <QObject>
#include <QList>
#include <chiaki/discoveryservice.h>
struct DiscoveryHost
{
ChiakiDiscoveryHostState state;

View file

@ -25,11 +25,11 @@
class Exception : public std::exception
{
private:
QString msg;
QByteArray msg;
public:
explicit Exception(const QString &msg) : msg(msg) {}
const char *what() const noexcept override { return msg.toLocal8Bit().constData(); }
explicit Exception(const QString &msg) : msg(msg.toLocal8Bit()) {}
const char *what() const noexcept override { return msg.constData(); }
};
#endif // CHIAKI_EXCEPTION_H

View file

@ -18,11 +18,11 @@
#ifndef CHIAKI_HOST_H
#define CHIAKI_HOST_H
#include <chiaki/regist.h>
#include <QMetaType>
#include <QString>
#include <chiaki/regist.h>
class QSettings;
class HostMAC

View file

@ -18,10 +18,10 @@
#ifndef CHIAKI_REGISTDIALOG_H
#define CHIAKI_REGISTDIALOG_H
#include "host.h"
#include <chiaki/regist.h>
#include "host.h"
#include <QDialog>
class Settings;

View file

@ -23,7 +23,7 @@
class QLabel;
class ServerIconWidget;
class DisplayServer;
struct DisplayServer;
class ServerItemWidget : public QFrame
{

View file

@ -18,10 +18,10 @@
#ifndef CHIAKI_SETTINGS_H
#define CHIAKI_SETTINGS_H
#include "host.h"
#include <chiaki/session.h>
#include "host.h"
#include <QSettings>
class Settings : public QObject

View file

@ -18,6 +18,8 @@
#ifndef CHIAKI_STREAMSESSION_H
#define CHIAKI_STREAMSESSION_H
#include <chiaki/session.h>
#include "videodecoder.h"
#include "exception.h"
#include "sessionlog.h"
@ -26,8 +28,6 @@
#include <QObject>
#include <QImage>
#include <chiaki/session.h>
#if CHIAKI_GUI_ENABLE_QT_GAMEPAD
class QGamepad;
#endif

View file

@ -18,10 +18,10 @@
#ifndef CHIAKI_VIDEODECODER_H
#define CHIAKI_VIDEODECODER_H
#include "exception.h"
#include <chiaki/log.h>
#include "exception.h"
#include <QMutex>
#include <QObject>

View file

@ -1,5 +1,5 @@
<RCC>
<qresource prefix="icons">
<qresource prefix="/icons">
<file>settings-20px.svg</file>
<file>add-24px.svg</file>
<file>discover-24px.svg</file>

View file

@ -19,7 +19,15 @@
#include <exception.h>
#include <cstring>
#ifdef _WIN32
#include <winsock2.h>
#else
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#endif
#define PING_MS 500
#define HOSTS_MAX 16
@ -101,8 +109,8 @@ void DiscoveryManager::SendWakeup(const QString &host, const QByteArray &regist_
{
if(ai->ai_family != AF_INET)
continue;
if(ai->ai_protocol != IPPROTO_UDP)
continue;
//if(ai->ai_protocol != IPPROTO_UDP)
// continue;
if(ai->ai_addrlen > sizeof(addr))
continue;
std::memcpy(&addr, ai->ai_addr, ai->ai_addrlen);

View file

@ -1,4 +1,8 @@
// ugly workaround because Windows does weird things and ENOTIME
int real_main(int argc, char *argv[]);
int main(int argc, char *argv[]) { return real_main(argc, argv); }
#include <streamwindow.h>
#include <videodecoder.h>
#include <mainwindow.h>
@ -43,7 +47,7 @@ static const QMap<QString, CLICommand> cli_commands = {
int RunStream(QApplication &app, const StreamSessionConnectInfo &connect_info);
int RunMain(QApplication &app, Settings *settings);
int main(int argc, char *argv[])
int real_main(int argc, char *argv[])
{
qRegisterMetaType<DiscoveryHost>();
qRegisterMetaType<RegisteredHost>();
@ -67,6 +71,8 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
Q_INIT_RESOURCE(resources);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
Settings settings;

View file

@ -327,4 +327,4 @@ void MainWindow::UpdateServerWidgets()
for(size_t i=0; i<server_item_widgets.count(); i++)
server_item_widgets[i]->Update(display_servers[i]);
}
}

View file

@ -89,8 +89,6 @@ send_packet:
emit FramesAvailable();
}
#include <unistd.h>
AVFrame *VideoDecoder::PullFrame()
{
QMutexLocker locker(&mutex);