Skip to content

Commit

Permalink
remove JACK audio capture and deprecated screen capture
Browse files Browse the repository at this point in the history
x11grab and gdigrab were hidden a long time ago as inefficient and
troublesome. Moreover, X11 is on its way out with Wayland. Time to
remove these as well as the hard dependency of linking FFmpeg with
libjack to enable a rarely used JACK audio capture for which there are
better tools. Besides, JACK has been integrated with PipeWire now, which
is available through our existing PulseAudio API integration.
  • Loading branch information
ddennedy committed Jan 18, 2025
1 parent fd39ff3 commit 83605c2
Show file tree
Hide file tree
Showing 18 changed files with 18 additions and 1,232 deletions.
4 changes: 2 additions & 2 deletions scripts/build-shotcut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ FFMPEG_HEAD=0
FFMPEG_REVISION="origin/release/7.1"
FFMPEG_SUPPORT_H264=1
FFMPEG_SUPPORT_H265=1
FFMPEG_SUPPORT_JACK=1
FFMPEG_SUPPORT_JACK=0
FFMPEG_SUPPORT_LIBVPX=1
FFMPEG_SUPPORT_THEORA=1
FFMPEG_SUPPORT_MP3=1
Expand Down Expand Up @@ -820,7 +820,7 @@ function set_globals {
BUILD[0]="build_ffmpeg_darwin"
INSTALL[0]="install_ffmpeg_darwin"
elif test "$TARGET_OS" = "Linux" ; then
CONFIG[0]="${CONFIG[0]} --enable-libxcb --enable-libpulse --prefix=$FINAL_INSTALL_DIR"
CONFIG[0]="${CONFIG[0]} --enable-libpulse --prefix=$FINAL_INSTALL_DIR"
BUILD[0]="make -j$MAKEJ"
INSTALL[0]="make install"
fi
Expand Down
6 changes: 0 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,12 @@ add_executable(shotcut WIN32 MACOSX_BUNDLE
widgets/editmarkerwidget.cpp widgets/editmarkerwidget.h
widgets/exportpresetstreeview.cpp widgets/exportpresetstreeview.h
widgets/frameratewidget.cpp widgets/frameratewidget.h
widgets/gdigrabwidget.cpp widgets/gdigrabwidget.h
widgets/gdigrabwidget.ui
widgets/glaxnimateproducerwidget.cpp widgets/glaxnimateproducerwidget.h
widgets/glaxnimateproducerwidget.ui
widgets/imageproducerwidget.cpp widgets/imageproducerwidget.h
widgets/imageproducerwidget.ui
widgets/isingwidget.cpp widgets/isingwidget.h
widgets/isingwidget.ui
widgets/jackproducerwidget.cpp widgets/jackproducerwidget.h
widgets/jackproducerwidget.ui
widgets/lineeditclear.cpp widgets/lineeditclear.h
widgets/lissajouswidget.cpp widgets/lissajouswidget.h
widgets/lissajouswidget.ui
Expand Down Expand Up @@ -212,8 +208,6 @@ add_executable(shotcut WIN32 MACOSX_BUNDLE
widgets/trackpropertieswidget.ui
widgets/video4linuxwidget.cpp widgets/video4linuxwidget.h
widgets/video4linuxwidget.ui
widgets/x11grabwidget.cpp widgets/x11grabwidget.h
widgets/x11grabwidget.ui
../icons/resources.qrc
)

Expand Down
6 changes: 2 additions & 4 deletions src/abstractproducerwidget.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2023 Meltytech, LLC
* Copyright (c) 2012-2025 Meltytech, LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -43,8 +43,6 @@ bool AbstractProducerWidget::isDevice(const QWidget *widget)
|| "AvfoundationProducerWidget" == name || "avfoundationWidget" == name
|| "DecklinkProducerWidget" == name || "decklinkWidget" == name
|| "DirectShowVideoWidget" == name || "dshowVideoWidget" == name
|| "GDIgrabWidget" == name || "gdigrabWidget" == name
|| "PulseAudioWidget" == name || "pulseWidget" == name
|| "Video4LinuxWidget" == name || "v4lWidget" == name
|| "X11grabWidget" == name || "x11grabWidget" == name;
|| "Video4LinuxWidget" == name || "v4lWidget" == name;
}
12 changes: 3 additions & 9 deletions src/docks/encodedock.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2024 Meltytech, LLC
* Copyright (c) 2012-2025 Meltytech, LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -1929,14 +1929,8 @@ void EncodeDock::on_encodeButton_clicked()
connect(m_immediateJob.data(), SIGNAL(finished(AbstractJob *, bool, QString)), this,
SLOT(onFinished(AbstractJob *, bool)));

if (MLT.resource().startsWith("gdigrab:") || MLT.resource().startsWith("x11grab:")) {
ui->stopCaptureButton->show();
} else {
ui->encodeButton->setText(tr("Stop Capture"));
ui->fromCombo->setDisabled(true);
}
if (MLT.resource().startsWith("gdigrab:"))
MAIN.showMinimized();
ui->encodeButton->setText(tr("Stop Capture"));
ui->fromCombo->setDisabled(true);

int msec = MLT.producer()->get_int(kBackgroundCaptureProperty) * 1000;
QTimer::singleShot(msec, m_immediateJob.data(), SLOT(start()));
Expand Down
35 changes: 9 additions & 26 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2024 Meltytech, LLC
* Copyright (c) 2011-2025 Meltytech, LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -29,14 +29,12 @@
#include "widgets/directshowvideowidget.h"
#include "widgets/glaxnimateproducerwidget.h"
#include "widgets/isingwidget.h"
#include "widgets/jackproducerwidget.h"
#include "widgets/toneproducerwidget.h"
#include "widgets/lissajouswidget.h"
#include "widgets/noisewidget.h"
#include "widgets/plasmawidget.h"
#include "widgets/pulseaudiowidget.h"
#include "widgets/video4linuxwidget.h"
#include "widgets/x11grabwidget.h"
#include "widgets/avformatproducerwidget.h"
#include "widgets/imageproducerwidget.h"
#include "widgets/blipproducerwidget.h"
Expand Down Expand Up @@ -66,7 +64,6 @@
#include "shotcut_mlt_properties.h"
#include "widgets/avfoundationproducerwidget.h"
#include "dialogs/textviewerdialog.h"
#include "widgets/gdigrabwidget.h"
#include "models/audiolevelstask.h"
#include "widgets/trackpropertieswidget.h"
#include "widgets/timelinepropertieswidget.h"
Expand All @@ -84,7 +81,6 @@
#include "dialogs/longuitask.h"
#include "dialogs/systemsyncdialog.h"
#include "proxymanager.h"
#include "transcoder.h"
#include "models/motiontrackermodel.h"
#if defined(Q_OS_WIN) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#include "windowstools.h"
Expand Down Expand Up @@ -143,14 +139,6 @@ MainWindow::MainWindow()
, m_keyframesDock(0)
{
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
QLibrary libJack("libjack.so.0");
if (!libJack.load()) {
QMessageBox::critical(this, qApp->applicationName(),
tr("Error: This program requires the JACK 1 library.\n\nPlease install it using your package manager. It may be named libjack0, jack-audio-connection-kit, jack, or similar."));
::exit(EXIT_FAILURE);
} else {
libJack.unload();
}
QLibrary libSDL("libSDL2-2.0.so.0");
if (!libSDL.load()) {
QMessageBox::critical(this, qApp->applicationName(),
Expand Down Expand Up @@ -1195,7 +1183,13 @@ void MainWindow::setupSettingsMenu()
// then Shotcut crashes inside MLT's call to jack_client_open().
// Therefore, the JACK option for Shotcut is banned on Windows.
delete ui->actionJack;
ui->actionJack = 0;
ui->actionJack = nullptr;
#else
std::unique_ptr<Mlt::Properties> filters(MLT.repository()->filters());
if (filters && !filters->get_data("jack")) {
delete ui->actionJack;
ui->actionJack = nullptr;
}
#endif
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
// Setup the display method actions.
Expand Down Expand Up @@ -1305,7 +1299,6 @@ void MainWindow::setupOpenOtherMenu()
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
otherMenu->addAction(tr("Video4Linux"), this, SLOT(onOpenOtherTriggered()))->setObjectName("v4l2");
otherMenu->addAction(tr("PulseAudio"), this, SLOT(onOpenOtherTriggered()))->setObjectName("pulse");
otherMenu->addAction(tr("JACK Audio"), this, SLOT(onOpenOtherTriggered()))->setObjectName("jack");
otherMenu->addAction(tr("ALSA Audio"), this, SLOT(onOpenOtherTriggered()))->setObjectName("alsa");
#elif defined(Q_OS_WIN) || defined(Q_OS_MAC)
otherMenu->addAction(tr("Audio/Video Device"), this,
Expand Down Expand Up @@ -3002,9 +2995,7 @@ void MainWindow::onEncodeTriggered(bool checked)

void MainWindow::onCaptureStateChanged(bool started)
{
if (started && (MLT.resource().startsWith("x11grab:") ||
MLT.resource().startsWith("gdigrab:") ||
MLT.resource().startsWith("avfoundation"))
if (started && MLT.resource().startsWith("avfoundation")
&& !MLT.producer()->get_int(kBackgroundCaptureProperty))
showMinimized();
}
Expand Down Expand Up @@ -3466,19 +3457,13 @@ QWidget *MainWindow::loadProducerWidget(Mlt::Producer *producer)
w = new Video4LinuxWidget(this);
else if (resource.startsWith("pulse:"))
w = new PulseAudioWidget(this);
else if (resource.startsWith("jack:"))
w = new JackProducerWidget(this);
else if (resource.startsWith("alsa:"))
w = new AlsaWidget(this);
else if (resource.startsWith("dshow:")
|| QString::fromUtf8(producer->get("resource1")).startsWith("dshow:"))
w = new DirectShowVideoWidget(this);
else if (resource.startsWith("avfoundation:"))
w = new AvfoundationProducerWidget(this);
else if (resource.startsWith("x11grab:"))
w = new X11grabWidget(this);
else if (resource.startsWith("gdigrab:"))
w = new GDIgrabWidget(this);
else if (service.startsWith("avformat") || shotcutProducer == "avformat")
w = new AvformatProducerWidget(this);
else if (MLT.isImageProducer(producer)) {
Expand Down Expand Up @@ -4910,8 +4895,6 @@ void MainWindow::onOpenOtherTriggered()
onOpenOtherTriggered(new Video4LinuxWidget(this));
else if (sender()->objectName() == "pulse")
onOpenOtherTriggered(new PulseAudioWidget(this));
else if (sender()->objectName() == "jack")
onOpenOtherTriggered(new JackProducerWidget(this));
else if (sender()->objectName() == "alsa")
onOpenOtherTriggered(new AlsaWidget(this));
#if defined(Q_OS_MAC)
Expand Down
27 changes: 1 addition & 26 deletions src/openotherdialog.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2023 Meltytech, LLC
* Copyright (c) 2012-2025 Meltytech, LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -21,8 +21,6 @@
#include <Mlt.h>
#include <QtWidgets>

#define ENABLE_SCREEN_CAPTURE (0)

OpenOtherDialog::OpenOtherDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::OpenOtherDialog)
Expand Down Expand Up @@ -51,21 +49,11 @@ OpenOtherDialog::OpenOtherDialog(QWidget *parent) :
item->setData(0, Qt::UserRole, ui->v4lTab->objectName());
item = new QTreeWidgetItem(group, QStringList(tr("PulseAudio")));
item->setData(0, Qt::UserRole, ui->pulseTab->objectName());
item = new QTreeWidgetItem(group, QStringList(tr("JACK Audio")));
item->setData(0, Qt::UserRole, ui->jackTab->objectName());
item = new QTreeWidgetItem(group, QStringList(tr("ALSA Audio")));
item->setData(0, Qt::UserRole, ui->alsaTab->objectName());
#if ENABLE_SCREEN_CAPTURE
item = new QTreeWidgetItem(group, QStringList(tr("Screen")));
item->setData(0, Qt::UserRole, ui->x11grabTab->objectName());
#endif
#elif defined(Q_OS_WIN)
QTreeWidgetItem *item = new QTreeWidgetItem(group, QStringList(tr("Audio/Video Device")));
item->setData(0, Qt::UserRole, ui->dshowVideoTab->objectName());
#if ENABLE_SCREEN_CAPTURE
item = new QTreeWidgetItem(group, QStringList(tr("Screen")));
item->setData(0, Qt::UserRole, ui->gdigrabTab->objectName());
#endif
#elif defined(Q_OS_MAC)
QTreeWidgetItem *item = new QTreeWidgetItem(group, QStringList(tr("Audio/Video Device")));
item->setData(0, Qt::UserRole, ui->avfoundationTab->objectName());
Expand Down Expand Up @@ -145,14 +133,10 @@ void OpenOtherDialog::load(Mlt::Producer *producer)
selectTreeWidget(tr("Video4Linux"));
else if (resource.startsWith("pulse:"))
selectTreeWidget(tr("PulseAudio"));
else if (resource.startsWith("jack:"))
selectTreeWidget(tr("JACK Audio"));
else if (resource.startsWith("alsa:"))
selectTreeWidget(tr("ALSA Audio"));
else if (resource.startsWith("dshow:"))
selectTreeWidget(tr("Audio/Video Device"));
else if (resource.startsWith("x11grab:") || resource.startsWith("gdigrab:"))
selectTreeWidget(tr("Screen"));
else if (service.startsWith("avformat"))
selectTreeWidget(tr("Network"));
else if (service == "decklink" || resource.contains("decklink"))
Expand Down Expand Up @@ -232,18 +216,9 @@ void OpenOtherDialog::on_treeWidget_currentItemChanged(QTreeWidgetItem *current,
} else if (w == ui->pulseTab) {
m_current = ui->pulseWidget;
m_addTimelineButton->setVisible(false);
} else if (w == ui->jackTab) {
m_current = ui->jackWidget;
m_addTimelineButton->setVisible(false);
} else if (w == ui->alsaTab) {
m_current = ui->alsaWidget;
m_addTimelineButton->setVisible(false);
} else if (w == ui->x11grabTab) {
m_current = ui->x11grabWidget;
m_addTimelineButton->setVisible(false);
} else if (w == ui->gdigrabTab) {
m_current = ui->gdigrabWidget;
m_addTimelineButton->setVisible(false);
} else if (w == ui->dshowVideoTab) {
m_current = ui->dshowVideoWidget;
m_addTimelineButton->setVisible(false);
Expand Down
39 changes: 0 additions & 39 deletions src/openotherdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -170,34 +170,13 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="jackTab">
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="JackProducerWidget" name="jackWidget" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="alsaTab">
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<widget class="AlsaWidget" name="alsaWidget" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="x11grabTab">
<layout class="QVBoxLayout" name="verticalLayout_11">
<item>
<widget class="X11grabWidget" name="x11grabWidget" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="gdigrabTab">
<layout class="QVBoxLayout" name="verticalLayout_16">
<item>
<widget class="GDIgrabWidget" name="gdigrabWidget" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="toneTab">
<layout class="QVBoxLayout" name="verticalLayout_17">
<item>
Expand Down Expand Up @@ -295,30 +274,12 @@
<header>widgets/pulseaudiowidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>JackProducerWidget</class>
<extends>QWidget</extends>
<header>widgets/jackproducerwidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>AlsaWidget</class>
<extends>QWidget</extends>
<header>widgets/alsawidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>X11grabWidget</class>
<extends>QWidget</extends>
<header>widgets/x11grabwidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GDIgrabWidget</class>
<extends>QWidget</extends>
<header>widgets/gdigrabwidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>DirectShowVideoWidget</class>
<extends>QWidget</extends>
Expand Down
Loading

0 comments on commit 83605c2

Please sign in to comment.