Merge pull request #1441 from cg2121/auto-remux-refactor
UI: Add option to auto remux
This commit is contained in:
commit
e08e3c9c29
@ -760,6 +760,8 @@ Basic.Settings.Advanced.Network.BindToIP="Bind to IP"
|
||||
Basic.Settings.Advanced.Network.EnableNewSocketLoop="Enable new networking code"
|
||||
Basic.Settings.Advanced.Network.EnableLowLatencyMode="Low latency mode"
|
||||
Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Disable hotkeys when main window is in focus"
|
||||
Basic.Settings.Advanced.AutoRemux="Automatically remux to mp4"
|
||||
Basic.Settings.Advanced.AutoRemux.MP4="(record as mkv)"
|
||||
|
||||
# advanced audio properties
|
||||
Basic.AdvAudio="Advanced Audio Properties"
|
||||
|
@ -145,8 +145,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>801</width>
|
||||
<height>836</height>
|
||||
<width>804</width>
|
||||
<height>1072</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_19">
|
||||
@ -797,8 +797,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>818</width>
|
||||
<height>697</height>
|
||||
<width>813</width>
|
||||
<height>770</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_21">
|
||||
@ -1389,7 +1389,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="advOutTabs">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="usesScrollButtons">
|
||||
<bool>true</bool>
|
||||
@ -1668,21 +1668,6 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="advOutRecStandard">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="QWidget" name="widget_7" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_15">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@ -1959,6 +1944,21 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="QWidget" name="widget_7" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_15">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -3498,8 +3498,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>69</height>
|
||||
<width>98</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
@ -4265,7 +4265,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
@ -4297,7 +4297,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_57">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.Output.ReplayBuffer.Prefix</string>
|
||||
@ -4320,6 +4320,26 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="autoRemux">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.Advanced.AutoRemux</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="horizontalSpacer_16">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -77,6 +77,9 @@ string opt_starting_collection;
|
||||
string opt_starting_profile;
|
||||
string opt_starting_scene;
|
||||
|
||||
bool remuxAfterRecord = false;
|
||||
string remuxFilename;
|
||||
|
||||
// GPU hint exports for AMD/NVIDIA laptops
|
||||
#ifdef _MSC_VER
|
||||
extern "C" __declspec(dllexport) DWORD NvOptimusEnablement = 1;
|
||||
@ -1493,8 +1496,18 @@ string GenerateTimeDateFilename(const char *extension, bool noSpace)
|
||||
string GenerateSpecifiedFilename(const char *extension, bool noSpace,
|
||||
const char *format)
|
||||
{
|
||||
OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow());
|
||||
bool autoRemux = config_get_bool(main->Config(), "Video", "AutoRemux");
|
||||
|
||||
if ((strcmp(extension, "mp4") == 0) && autoRemux)
|
||||
extension = "mkv";
|
||||
|
||||
BPtr<char> filename = os_generate_formatted_filename(extension,
|
||||
!noSpace, format);
|
||||
|
||||
remuxFilename = string(filename);
|
||||
remuxAfterRecord = autoRemux;
|
||||
|
||||
return string(filename);
|
||||
}
|
||||
|
||||
|
@ -197,6 +197,10 @@ static inline int GetProfilePath(char *path, size_t size, const char *file)
|
||||
}
|
||||
|
||||
extern bool portable_mode;
|
||||
|
||||
extern bool remuxAfterRecord;
|
||||
extern std::string remuxFilename;
|
||||
|
||||
extern bool opt_start_streaming;
|
||||
extern bool opt_start_recording;
|
||||
extern bool opt_start_replaybuffer;
|
||||
|
@ -5018,6 +5018,23 @@ void OBSBasic::StreamingStop(int code, QString last_error)
|
||||
}
|
||||
}
|
||||
|
||||
void OBSBasic::AutoRemux()
|
||||
{
|
||||
const char *mode = config_get_string(basicConfig, "Output", "Mode");
|
||||
const char *path = strcmp(mode, "Advanced") ?
|
||||
config_get_string(basicConfig, "SimpleOutput", "FilePath") :
|
||||
config_get_string(basicConfig, "AdvOut", "RecFilePath");
|
||||
std::string s(path);
|
||||
s += "/";
|
||||
s += remuxFilename;
|
||||
const QString &str = QString::fromStdString(s);
|
||||
QString file = str.section(".", 0, 0);
|
||||
|
||||
OBSRemux *remux = new OBSRemux(path, this, true);
|
||||
remux->show();
|
||||
remux->AutoRemux(str, file + ".mp4");
|
||||
}
|
||||
|
||||
void OBSBasic::StartRecording()
|
||||
{
|
||||
if (outputHandler->RecordingActive())
|
||||
@ -5116,6 +5133,9 @@ void OBSBasic::RecordingStop(int code)
|
||||
if (api)
|
||||
api->on_event(OBS_FRONTEND_EVENT_RECORDING_STOPPED);
|
||||
|
||||
if (remuxAfterRecord)
|
||||
AutoRemux();
|
||||
|
||||
OnDeactivate();
|
||||
}
|
||||
|
||||
|
@ -507,6 +507,8 @@ private:
|
||||
|
||||
static void HotkeyTriggered(void *data, obs_hotkey_id id, bool pressed);
|
||||
|
||||
void AutoRemux();
|
||||
|
||||
public:
|
||||
OBSSource GetProgramSource();
|
||||
OBSScene GetCurrentScene();
|
||||
|
@ -448,6 +448,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
|
||||
HookWidget(ui->enableNewSocketLoop, CHECK_CHANGED, ADV_CHANGED);
|
||||
HookWidget(ui->enableLowLatencyMode, CHECK_CHANGED, ADV_CHANGED);
|
||||
HookWidget(ui->disableFocusHotkeys, CHECK_CHANGED, ADV_CHANGED);
|
||||
HookWidget(ui->autoRemux, CHECK_CHANGED, ADV_CHANGED);
|
||||
|
||||
#if !defined(_WIN32) && !defined(__APPLE__)
|
||||
delete ui->enableAutoUpdates;
|
||||
@ -2236,6 +2237,8 @@ void OBSBasicSettings::LoadAdvancedSettings()
|
||||
"RecRBTime");
|
||||
int rbSize = config_get_int(main->Config(), "AdvOut",
|
||||
"RecRBSize");
|
||||
bool autoRemux = config_get_bool(main->Config(), "Video",
|
||||
"AutoRemux");
|
||||
|
||||
loading = true;
|
||||
|
||||
@ -2262,6 +2265,7 @@ void OBSBasicSettings::LoadAdvancedSettings()
|
||||
ui->streamDelaySec->setValue(delaySec);
|
||||
ui->streamDelayPreserve->setChecked(preserveDelay);
|
||||
ui->streamDelayEnable->setChecked(enableDelay);
|
||||
ui->autoRemux->setChecked(autoRemux);
|
||||
|
||||
|
||||
SetComboByName(ui->colorFormat, videoColorFormat);
|
||||
@ -2935,6 +2939,7 @@ void OBSBasicSettings::SaveAdvancedSettings()
|
||||
SaveSpinBox(ui->reconnectRetryDelay, "Output", "RetryDelay");
|
||||
SaveSpinBox(ui->reconnectMaxRetries, "Output", "MaxRetries");
|
||||
SaveComboData(ui->bindToIP, "Output", "BindIP");
|
||||
SaveCheckBox(ui->autoRemux, "Video", "AutoRemux");
|
||||
|
||||
#if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO
|
||||
QString newDevice = ui->monitoringDevice->currentData().toString();
|
||||
@ -3914,6 +3919,13 @@ void OBSBasicSettings::AdvOutRecCheckWarnings()
|
||||
if (!warningMsg.isEmpty())
|
||||
warningMsg += "\n\n";
|
||||
warningMsg += QTStr("OutputWarnings.MP4Recording");
|
||||
ui->autoRemux->setText(
|
||||
QTStr("Basic.Settings.Advanced.AutoRemux")
|
||||
+ " " +
|
||||
QTStr("Basic.Settings.Advanced.AutoRemux.MP4"));
|
||||
} else {
|
||||
ui->autoRemux->setText(
|
||||
QTStr("Basic.Settings.Advanced.AutoRemux"));
|
||||
}
|
||||
|
||||
delete advOutRecWarning;
|
||||
@ -4370,6 +4382,13 @@ void OBSBasicSettings::SimpleRecordingEncoderChanged()
|
||||
if (!warning.isEmpty())
|
||||
warning += "\n\n";
|
||||
warning += QTStr("OutputWarnings.MP4Recording");
|
||||
ui->autoRemux->setText(
|
||||
QTStr("Basic.Settings.Advanced.AutoRemux")
|
||||
+ " " +
|
||||
QTStr("Basic.Settings.Advanced.AutoRemux.MP4"));
|
||||
} else {
|
||||
ui->autoRemux->setText(
|
||||
QTStr("Basic.Settings.Advanced.AutoRemux"));
|
||||
}
|
||||
|
||||
if (warning.isEmpty())
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <QStandardItemModel>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QToolButton>
|
||||
#include <QTimer>
|
||||
|
||||
#include "qt-wrappers.hpp"
|
||||
|
||||
@ -632,12 +633,13 @@ void RemuxQueueModel::finishEntry(bool success)
|
||||
The actual remux window implementation
|
||||
**********************************************************/
|
||||
|
||||
OBSRemux::OBSRemux(const char *path, QWidget *parent)
|
||||
OBSRemux::OBSRemux(const char *path, QWidget *parent, bool autoRemux_)
|
||||
: QDialog (parent),
|
||||
queueModel(new RemuxQueueModel),
|
||||
worker (new RemuxWorker()),
|
||||
ui (new Ui::OBSRemux),
|
||||
recPath (path)
|
||||
recPath (path),
|
||||
autoRemux (autoRemux_)
|
||||
{
|
||||
setAcceptDrops(true);
|
||||
|
||||
@ -651,6 +653,13 @@ OBSRemux::OBSRemux(const char *path, QWidget *parent)
|
||||
ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)->
|
||||
setEnabled(false);
|
||||
|
||||
if (autoRemux) {
|
||||
resize(280, 40);
|
||||
ui->tableView->hide();
|
||||
ui->buttonBox->hide();
|
||||
ui->label->hide();
|
||||
}
|
||||
|
||||
ui->progressBar->setMinimum(0);
|
||||
ui->progressBar->setMaximum(1000);
|
||||
ui->progressBar->setValue(0);
|
||||
@ -862,7 +871,14 @@ void OBSRemux::beginRemux()
|
||||
setAcceptDrops(false);
|
||||
|
||||
remuxNextEntry();
|
||||
}
|
||||
|
||||
void OBSRemux::AutoRemux(QString inFile, QString outFile)
|
||||
{
|
||||
if (inFile != "" && outFile != "" && autoRemux) {
|
||||
emit remux(inFile, outFile);
|
||||
autoRemuxFile = inFile;
|
||||
}
|
||||
}
|
||||
|
||||
void OBSRemux::remuxNextEntry()
|
||||
@ -875,12 +891,15 @@ void OBSRemux::remuxNextEntry()
|
||||
} else {
|
||||
queueModel->endProcessing();
|
||||
|
||||
OBSMessageBox::information(this, QTStr("Remux.FinishedTitle"),
|
||||
if (!autoRemux) {
|
||||
OBSMessageBox::information(this,
|
||||
QTStr("Remux.FinishedTitle"),
|
||||
queueModel->checkForErrors()
|
||||
? QTStr("Remux.FinishedError")
|
||||
: QTStr("Remux.Finished"));
|
||||
}
|
||||
|
||||
ui->progressBar->setVisible(false);
|
||||
ui->progressBar->setVisible(autoRemux);
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->
|
||||
setText(QTStr("Remux.Remux"));
|
||||
ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)->
|
||||
@ -914,7 +933,16 @@ void OBSRemux::updateProgress(float percent)
|
||||
|
||||
void OBSRemux::remuxFinished(bool success)
|
||||
{
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->
|
||||
setEnabled(true);
|
||||
|
||||
queueModel->finishEntry(success);
|
||||
|
||||
if (autoRemux && autoRemuxFile != "") {
|
||||
QFile::remove(autoRemuxFile);
|
||||
QTimer::singleShot(3000, this, SLOT(close()));
|
||||
}
|
||||
|
||||
remuxNextEntry();
|
||||
}
|
||||
|
||||
|
@ -56,12 +56,18 @@ class OBSRemux : public QDialog {
|
||||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
virtual void reject() override;
|
||||
|
||||
bool autoRemux;
|
||||
QString autoRemuxFile;
|
||||
|
||||
public:
|
||||
explicit OBSRemux(const char *recPath, QWidget *parent = nullptr);
|
||||
explicit OBSRemux(const char *recPath, QWidget *parent = nullptr,
|
||||
bool autoRemux = false);
|
||||
virtual ~OBSRemux() override;
|
||||
|
||||
using job_t = std::shared_ptr<struct media_remux_job>;
|
||||
|
||||
void AutoRemux(QString inFile, QString outFile);
|
||||
|
||||
protected:
|
||||
void dropEvent(QDropEvent *ev);
|
||||
void dragEnterEvent(QDragEnterEvent *ev);
|
||||
|
Loading…
x
Reference in New Issue
Block a user