Unverified Commit 66f8bb33 authored by uku's avatar uku
Browse files

shotcut: 21.09.20 -> 23.11.29

parent 0aa1cc9f
Loading
Loading
Loading
Loading
+23 −39
Original line number Diff line number Diff line
{ lib
, fetchFromGitHub
, mkDerivation
, stdenv
, wrapQtAppsHook
, substituteAll
, SDL2
, frei0r
, ladspaPlugins
@@ -8,72 +10,54 @@
, mlt
, jack1
, pkg-config
, fftw
, qtbase
, qtmultimedia
, qtx11extras
, qtwebsockets
, qtquickcontrols2
, qtgraphicaleffects
, qmake
, qttools
, qtmultimedia
, qtcharts
, cmake
, gitUpdater
}:

assert lib.versionAtLeast mlt.version "6.24.0";

mkDerivation rec {
stdenv.mkDerivation rec {
  pname = "shotcut";
  version = "21.09.20";
  version = "23.11.29";

  src = fetchFromGitHub {
    owner = "mltframework";
    repo = "shotcut";
    rev = "v${version}";
    sha256 = "1y46n5gmlayfl46l0vhg5g5dbbc0sg909mxb68sia0clkaas8xrh";
    hash = "sha256-szWXX/DIJk5ktESgecglptU1qrnrd/u0N6AffwZ5Tos=";
  };

  nativeBuildInputs = [ pkg-config qmake ];
  nativeBuildInputs = [ pkg-config cmake wrapQtAppsHook ];
  buildInputs = [
    SDL2
    frei0r
    ladspaPlugins
    gettext
    mlt
    fftw
    qtbase
    qttools
    qtmultimedia
    qtx11extras
    qtwebsockets
    qtquickcontrols2
    qtgraphicaleffects
    qtcharts
  ];

  env.NIX_CFLAGS_COMPILE = "-I${mlt.dev}/include/mlt++ -I${mlt.dev}/include/mlt";
  qmakeFlags = [
    "QMAKE_LRELEASE=${lib.getDev qttools}/bin/lrelease"
    "SHOTCUT_VERSION=${version}"
    "DEFINES+=SHOTCUT_NOUPGRADE"
  env.NIX_CFLAGS_COMPILE = "-DSHOTCUT_NOUPGRADE";
  cmakeFlags = [
    "-DSHOTCUT_VERSION=${version}"
  ];

  prePatch = ''
    sed 's_shotcutPath, "melt[^"]*"_"${mlt}/bin/melt"_' -i src/jobs/meltjob.cpp
    sed 's_shotcutPath, "ffmpeg"_"${mlt.ffmpeg}/bin/ffmpeg"_' -i src/jobs/ffmpegjob.cpp
    sed 's_qApp->applicationDirPath(), "ffmpeg"_"${mlt.ffmpeg}/bin/ffmpeg"_' -i src/docks/encodedock.cpp
    NICE=$(type -P nice)
    sed "s_/usr/bin/nice_''${NICE}_" -i src/jobs/meltjob.cpp src/jobs/ffmpegjob.cpp
  '';
  patches = [
    (substituteAll { inherit mlt; src = ./fix-mlt-ffmpeg-path.patch; })
  ];

  qtWrapperArgs = [
    "--prefix FREI0R_PATH : ${frei0r}/lib/frei0r-1"
    "--prefix LADSPA_PATH : ${ladspaPlugins}/lib/ladspa"
    "--set FREI0R_PATH ${frei0r}/lib/frei0r-1"
    "--set LADSPA_PATH ${ladspaPlugins}/lib/ladspa"
    "--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [jack1 SDL2]}"
    "--prefix PATH : ${mlt}/bin"
  ];

  postInstall = ''
    mkdir -p $out/share/shotcut
    cp -r src/qml $out/share/shotcut/
  '';

  passthru.updateScript = gitUpdater {
    rev-prefix = "v";
  };
+80 −0
Original line number Diff line number Diff line
diff --git a/src/docks/encodedock.cpp b/src/docks/encodedock.cpp
index 3359f676..24e44f98 100644
--- a/src/docks/encodedock.cpp
+++ b/src/docks/encodedock.cpp
@@ -2177,7 +2177,7 @@ bool EncodeDock::detectHardwareEncoders()
 {
     MAIN.showStatusMessage(tr("Detecting hardware encoders..."));
     QStringList hwlist;
-    QFileInfo ffmpegPath(qApp->applicationDirPath(), "ffmpeg");
+    QFileInfo ffmpegPath("@ffmpeg@/bin/ffmpeg");
     foreach (const QString &codec, codecs()) {
         LOG_INFO() << "checking for" << codec;
         QProcess proc;
@@ -2220,7 +2220,7 @@ bool EncodeDock::detectHardwareEncoders()
 QString &EncodeDock::defaultFormatExtension()
 {
     auto format = ui->formatCombo->currentText();
-    QFileInfo ffmpegPath(qApp->applicationDirPath(), "ffmpeg");
+    QFileInfo ffmpegPath("@ffmpeg@/bin/ffmpeg");
     QProcess proc;
     QStringList args;
     args << "-hide_banner" << "-h" << format.prepend("muxer=");
diff --git a/src/jobs/ffmpegjob.cpp b/src/jobs/ffmpegjob.cpp
index 1f15e647..b6ad6633 100644
--- a/src/jobs/ffmpegjob.cpp
+++ b/src/jobs/ffmpegjob.cpp
@@ -54,7 +54,7 @@ FfmpegJob::~FfmpegJob()
 void FfmpegJob::start()
 {
     QString shotcutPath = qApp->applicationDirPath();
-    QFileInfo ffmpegPath(shotcutPath, "ffmpeg");
+    QFileInfo ffmpegPath("@ffmpeg@/bin/ffmpeg");
     setReadChannel(QProcess::StandardError);
     LOG_DEBUG() << ffmpegPath.absoluteFilePath() + " " + m_args.join(' ');
     AbstractJob::start(ffmpegPath.absoluteFilePath(), m_args);
diff --git a/src/jobs/meltjob.cpp b/src/jobs/meltjob.cpp
index fd8c00b8..9150fe7b 100644
--- a/src/jobs/meltjob.cpp
+++ b/src/jobs/meltjob.cpp
@@ -98,9 +98,9 @@ void MeltJob::start()
     }
     QString shotcutPath = qApp->applicationDirPath();
 #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
-    QFileInfo meltPath(shotcutPath, "melt-7");
+    QFileInfo meltPath("@mlt@/bin/melt");
 #else
-    QFileInfo meltPath(shotcutPath, "melt");
+    QFileInfo meltPath("@mlt@/bin/melt");
 #endif
     setReadChannel(QProcess::StandardError);
     QStringList args;
diff --git a/src/mltcontroller.cpp b/src/mltcontroller.cpp
index 1e2299ac..b8f39f12 100644
--- a/src/mltcontroller.cpp
+++ b/src/mltcontroller.cpp
@@ -1555,9 +1555,9 @@ int Controller::checkFile(const QString &path)
             || path.endsWith(".aep")) {
         QString shotcutPath = qApp->applicationDirPath();
 #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
-        QFileInfo meltPath(shotcutPath, "melt-7");
+        QFileInfo meltPath("@mlt@/bin/melt");
 #else
-        QFileInfo meltPath(shotcutPath, "melt");
+        QFileInfo meltPath("@mlt@/bin/melt");
 #endif
         QStringList args;
         args << "-quiet" << "-consumer" << "null" << "real_time=0" << "out=0" << "terminate_on_pause=1" <<
diff --git a/src/widgets/directshowvideowidget.cpp b/src/widgets/directshowvideowidget.cpp
index c91ba821..73dd5a61 100644
--- a/src/widgets/directshowvideowidget.cpp
+++ b/src/widgets/directshowvideowidget.cpp
@@ -35,7 +35,7 @@ DirectShowVideoWidget::DirectShowVideoWidget(QWidget *parent) :
     ui->setupUi(this);
     Util::setColorsToHighlight(ui->label);
 #ifdef Q_OS_WIN
-    QFileInfo ffmpegPath(qApp->applicationDirPath(), "ffmpeg");
+    QFileInfo ffmpegPath("@ffmpeg@/bin/ffmpeg");
     QProcess proc;
     QStringList args;
     args << "-hide_banner" << "-list_devices" << "true" << "-f" << "dshow" << "-i" << "dummy";
+1 −1
Original line number Diff line number Diff line
@@ -34225,7 +34225,7 @@ with pkgs;
  shod = callPackage ../applications/window-managers/shod { };
  shotcut = libsForQt5.callPackage ../applications/video/shotcut { };
  shotcut = qt6Packages.callPackage ../applications/video/shotcut { };
  shogun = callPackage ../applications/science/machine-learning/shogun {
    protobuf = protobuf_21;