mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-21 14:03:11 -07:00
Port to Windows
This commit is contained in:
parent
43ddf619ed
commit
5faa801331
52 changed files with 616 additions and 143 deletions
|
@ -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)
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
class QLabel;
|
||||
|
||||
class ServerIconWidget;
|
||||
class DisplayServer;
|
||||
struct DisplayServer;
|
||||
|
||||
class ServerItemWidget : public QFrame
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 ®ist_
|
|||
{
|
||||
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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,8 +89,6 @@ send_packet:
|
|||
emit FramesAvailable();
|
||||
}
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
AVFrame *VideoDecoder::PullFrame()
|
||||
{
|
||||
QMutexLocker locker(&mutex);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue