diff --git a/.github/workflows/qmake.yml b/.github/workflows/qmake.yml index ccdbd2d..4fd9b96 100644 --- a/.github/workflows/qmake.yml +++ b/.github/workflows/qmake.yml @@ -54,7 +54,7 @@ jobs: shell: pwsh run: | ..\scripts\windows\setVsDev.ps1 -VersionRange "[16.0,17.0)" -Arch "x64" - & qmake "CONFIG-=BUILD_MPV" ./../. + & qmake ./../. & jom working-directory: build - name: ubuntu-build @@ -68,6 +68,6 @@ jobs: if: startsWith(matrix.os, 'macos') shell: bash run: | - qmake QMAKE_APPLE_DEVICE_ARCHS="arm64" ./../. + qmake ./../. QMAKE_APPLE_DEVICE_ARCHS="arm64" make -j $(sysctl -n hw.ncpu) working-directory: build diff --git a/examples/examples.pro b/examples/examples.pro index 5f7b6c1..09dc8a9 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -5,6 +5,18 @@ SUBDIRS += \ ffmpegplayer \ ffmpegtranscoder -contains(CONFIG, BUILD_MPV) { +win32 { + exists("C:/3rd/x64/mpv/include"){ + SUBDIRS += mpvplayer + } +} + +macx { + exists("/opt/homebrew/include/mpv"){ + SUBDIRS += mpvplayer + } +} + +unix:!macx{ SUBDIRS += mpvplayer } diff --git a/examples/mpvplayer/CMakeLists.txt b/examples/mpvplayer/CMakeLists.txt index 1c0ee4b..d8b91f0 100644 --- a/examples/mpvplayer/CMakeLists.txt +++ b/examples/mpvplayer/CMakeLists.txt @@ -28,7 +28,7 @@ qt_add_executable(MpvPlayer MANUAL_FINALIZATION ${PROJECT_SOURCES}) target_compile_definitions(MpvPlayer PRIVATE "MPV_ON") target_link_libraries( MpvPlayer - PRIVATE custommpv + PRIVATE qmpv thirdparty dump utils @@ -41,10 +41,9 @@ if(CMAKE_HOST_WIN32) file(COPY C:\\3rd\\x64\\mpv\\libmpv-2.dll DESTINATION ${EXECUTABLE_OUTPUT_PATH}/) elseif(CMAKE_HOST_APPLE) - target_link_directories(MpvPlayer PRIVATE /usr/lib) - target_link_directories(MpvPlayer PRIVATE /usr/local/lib) + target_link_directories(MpvPlayer PRIVATE "/opt/homebrew/lib") target_link_libraries(MpvPlayer PRIVATE mpv) -elseif(CMAKE_HOST_UNIX) +elseif(CMAKE_HOST_LINUX) target_link_libraries(MpvPlayer PRIVATE mpv) endif() diff --git a/examples/mpvplayer/mpvplayer.pro b/examples/mpvplayer/mpvplayer.pro index d3a009a..27a537d 100644 --- a/examples/mpvplayer/mpvplayer.pro +++ b/examples/mpvplayer/mpvplayer.pro @@ -9,7 +9,7 @@ TARGET = MpvPlayer DEFINES += MPV_ON LIBS += \ - -l$$replaceLibName(custommpv) \ + -l$$replaceLibName(qmpv) \ -l$$replaceLibName(thirdparty) \ -l$$replaceLibName(dump) \ -l$$replaceLibName(utils) diff --git a/src/ffmpeg/codeccontext.cpp b/src/ffmpeg/codeccontext.cpp index 10985ef..2191968 100644 --- a/src/ffmpeg/codeccontext.cpp +++ b/src/ffmpeg/codeccontext.cpp @@ -168,7 +168,7 @@ class CodecContext::CodecContextPrivate codecCtx->global_quality = encodeContext.crf * FF_QP2LAMBDA; codecCtx->flags |= AV_CODEC_FLAG_QSCALE; if (encodeContext.codecInfo().name.contains("fdk")) { - auto vbr = QString::asprintf("%.1g", encodeContext.crf); + auto vbr = QString::asprintf("%.1d", encodeContext.crf); av_dict_set(&encodeOptions, "vbr", vbr.toUtf8().data(), 0); } } diff --git a/src/mpv/CMakeLists.txt b/src/mpv/CMakeLists.txt index b81c139..e9c10e7 100644 --- a/src/mpv/CMakeLists.txt +++ b/src/mpv/CMakeLists.txt @@ -12,21 +12,20 @@ set(PROJECT_SOURCES previewwidget.hpp qthelper.hpp) -add_custom_library(custommpv ${PROJECT_SOURCES} ${SOURCES}) -target_link_libraries(custommpv PRIVATE Qt6::Widgets Qt6::OpenGLWidgets) +add_custom_library(qmpv ${PROJECT_SOURCES}) +target_link_libraries(qmpv PRIVATE Qt6::Widgets Qt6::OpenGLWidgets) if(CMAKE_HOST_WIN32) - target_include_directories(custommpv PRIVATE "C:\\3rd\\x64\\mpv\\include") - target_link_libraries(custommpv PRIVATE C:\\3rd\\x64\\mpv\\libmpv.dll.a) + target_include_directories(qmpv PRIVATE "C:\\3rd\\x64\\mpv\\include") + target_link_libraries(qmpv PRIVATE C:\\3rd\\x64\\mpv\\libmpv.dll.a) elseif(CMAKE_HOST_APPLE) - target_include_directories(custommpv PRIVATE "/usr/local/include") - target_link_directories(custommpv PRIVATE /usr/lib) - target_link_directories(custommpv PRIVATE /usr/local/lib) - target_link_libraries(custommpv PRIVATE mpv) + target_include_directories(qmpv PRIVATE "/opt/homebrew/include") + target_link_directories(qmpv PRIVATE "/opt/homebrew/lib") + target_link_libraries(qmpv PRIVATE mpv) elseif(CMAKE_HOST_LINUX) - target_link_libraries(custommpv PRIVATE mpv) + target_link_libraries(qmpv PRIVATE mpv) endif() if(CMAKE_HOST_WIN32) - target_compile_definitions(custommpv PRIVATE "MPV_LIBRARY") + target_compile_definitions(qmpv PRIVATE "MPV_LIBRARY") endif() diff --git a/src/mpv/mpv.pri b/src/mpv/mpv.pri index 6e9defd..2c12526 100644 --- a/src/mpv/mpv.pri +++ b/src/mpv/mpv.pri @@ -1,5 +1,5 @@ QT_CONFIG -= no-pkg-config -CONFIG += link_pkgconfig debug +# CONFIG += link_pkgconfig debug #PKGCONFIG += mpv win32 { @@ -8,11 +8,11 @@ win32 { } macx { - INCLUDEPATH += /usr/local/include - LIBS += -L/usr/lib -L/usr/local/lib + INCLUDEPATH += /opt/homebrew/include + LIBS += -L/opt/homebrew/lib LIBS += -lmpv } unix:!macx{ LIBS += -lmpv -} \ No newline at end of file +} diff --git a/src/mpv/mpv.pro b/src/mpv/mpv.pro index 8648f52..bfea717 100644 --- a/src/mpv/mpv.pro +++ b/src/mpv/mpv.pro @@ -4,7 +4,7 @@ include(mpv.pri) QT += core gui network widgets openglwidgets DEFINES += MPV_LIBRARY -TARGET = $$replaceLibName(custommpv) +TARGET = $$replaceLibName(qmpv) SOURCES += \ mediainfo.cc \ diff --git a/src/mpv/qthelper.hpp b/src/mpv/qthelper.hpp index 7f9557b..feb11f4 100644 --- a/src/mpv/qthelper.hpp +++ b/src/mpv/qthelper.hpp @@ -122,7 +122,7 @@ struct node_builder // "QVariant::Type(obsolete), the return value should be interpreted // as QMetaType::Type." // So a cast really seems to be needed to avoid warnings (urgh). - return static_cast(v.type()) == static_cast(t); + return v.typeId() == static_cast(t); } void set(mpv_node *dst, const QVariant &src) { diff --git a/src/src.pro b/src/src.pro index d78c8d3..3836ead 100644 --- a/src/src.pro +++ b/src/src.pro @@ -7,6 +7,18 @@ SUBDIRS += \ 3rdparty \ ffmpeg -contains(CONFIG, BUILD_MPV) { +win32 { + exists("C:/3rd/x64/mpv/include"){ + SUBDIRS += mpv + } +} + +macx { + exists("/opt/homebrew/include/mpv"){ + SUBDIRS += mpv + } +} + +unix:!macx{ SUBDIRS += mpv } diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index 3291132..e96978a 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -18,7 +18,7 @@ set(PROJECT_SOURCES utils.h utilstr.h) -add_custom_library(utils ${PROJECT_SOURCES} ${SOURCES}) +add_custom_library(utils ${PROJECT_SOURCES}) target_link_libraries(utils PRIVATE Qt6::Widgets Qt6::Core5Compat) if(CMAKE_HOST_WIN32) diff --git a/src/utils/utils.pro b/src/utils/utils.pro index 073b28d..765cae1 100644 --- a/src/utils/utils.pro +++ b/src/utils/utils.pro @@ -1,14 +1,10 @@ include(../slib.pri) -QT += widgets - -greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat +QT += widgets core5compat DEFINES += UTILS_LIBRARY TARGET = $$replaceLibName(utils) -DEFINES += QT_DEPRECATED_WARNINGS - SOURCES += \ countdownlatch.cc \ fps.cc \