fix windows compile

This commit is contained in:
孙羽
2026-05-27 21:34:09 +08:00
parent 6b94ceea14
commit 116a4b8368
8 changed files with 48 additions and 44 deletions
+17 -20
View File
@@ -21,6 +21,23 @@
#include "ffmpegdecoder.h"
namespace olive {
static VideoParams::Interlacing FFmpegFieldOrderToOlive(AVFieldOrder fo)
{
switch (fo) {
case AV_FIELD_TT:
return VideoParams::kInterlacedTopFirst;
case AV_FIELD_BB:
return VideoParams::kInterlacedBottomFirst;
case AV_FIELD_PROGRESSIVE:
default:
return VideoParams::kInterlaceNone;
}
}
}
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
@@ -349,18 +366,6 @@ TexturePtr FFmpegDecoder::RetrieveVideoInternal(const RetrieveVideoParams &p)
return nullptr;
}
// Diagnostic: check if decoded frame is all black
bool all_black = true;
if (f->data[0]) {
int check_rows = std::min(f->height, 8);
int check_bytes = check_rows * f->linesize[0];
for (int i = 0; i < check_bytes; ++i) {
if (f->data[0][i] != 0) {
all_black = false;
break;
}
}
}
// Finally, perform any GPU processing required
TexturePtr texture = ProcessFrameIntoTexture(f, p, original);
@@ -454,14 +459,6 @@ FootageDescription FFmpegDecoder::Probe(const QString &filename,
avstream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO ||
avstream->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE)) {
if (avstream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
AVPixelFormat compatible_pix_fmt = AV_PIX_FMT_NONE;
bool image_is_still = false;
rational pixel_aspect_ratio;
rational frame_rate;
VideoParams::Interlacing interlacing =
VideoParams::kInterlaceNone;
{
// Read at least two frames to get more information about this video stream
AVPacket *pkt = av_packet_alloc();
-14
View File
@@ -43,20 +43,6 @@ extern "C" {
namespace olive
{
// 头文件里先备好枚举映射
static VideoParams::Interlacing FFmpegFieldOrderToOlive(AVFieldOrder fo)
{
switch (fo) {
case AV_FIELD_TT: // 隔行,顶场在前
return VideoParams::kInterlacedTopFirst;
case AV_FIELD_BB: // 隔行,底场在前
return VideoParams::kInterlacedBottomFirst;
case AV_FIELD_PROGRESSIVE:
default:
return VideoParams::kInterlaceNone;
}
}
/**
* @brief A Decoder derivative that wraps FFmpeg functions as on Olive decoder
*/
+9
View File
@@ -21,6 +21,11 @@
#include "ffmpegencoder.h"
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
extern "C" {
#include <libavfilter/buffersink.h>
#include <libavfilter/buffersrc.h>
@@ -1038,4 +1043,8 @@ const AVCodec *FFmpegEncoder::GetEncoder(ExportCodec::Codec c,
return nullptr;
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
}
+4
View File
@@ -33,8 +33,10 @@
#include <QStyleFactory>
#include "window/mainwindow/mainwindowundo.h"
#ifdef Q_OS_WINDOWS
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QtPlatformHeaders/QWindowsWindowFunctions>
#endif
#endif
#include "audio/audiomanager.h"
#include "cli/clitask/clitaskdialog.h"
@@ -910,10 +912,12 @@ void Core::StartGUI(bool full_screen)
}
#ifdef Q_OS_WINDOWS
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// Workaround for Qt bug where menus don't appear in full screen mode
// See: https://doc.qt.io/qt-5/windows-issues.html
QWindowsWindowFunctions::setHasBorderInFullScreen(
main_window_->windowHandle(), true);
#endif
#endif
// Start autorecovery timer using the config value as its interval
+5
View File
@@ -498,8 +498,13 @@ void MainWindow::closeEvent(QCloseEvent *e)
}
#ifdef Q_OS_WINDOWS
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool MainWindow::nativeEvent(const QByteArray &eventType, void *message,
qintptr *result)
#else
bool MainWindow::nativeEvent(const QByteArray &eventType, void *message,
long *result)
#endif
{
if (static_cast<MSG *>(message)->message == taskbar_btn_id_) {
// Attempt to create taskbar button progress handle
+6 -1
View File
@@ -109,8 +109,13 @@ protected:
virtual void closeEvent(QCloseEvent *e) override;
#ifdef Q_OS_WINDOWS
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
virtual bool nativeEvent(const QByteArray &eventType, void *message,
long *result);
qintptr *result) override;
#else
virtual bool nativeEvent(const QByteArray &eventType, void *message,
long *result) override;
#endif
#endif
private: