Add some encoder settings
This commit is contained in:
parent
7802f0e9fb
commit
b623c689d9
11
KShare.pro
11
KShare.pro
@ -53,7 +53,9 @@ SOURCES += main.cpp\
|
||||
recording/recordingcontroller.cpp \
|
||||
recording/recordingformats.cpp \
|
||||
formats.cpp \
|
||||
recording/encoders/encoder.cpp
|
||||
recording/encoders/encoder.cpp \
|
||||
recording/encoders/encodersettings.cpp \
|
||||
recording/encoders/encodersettingsdialog.cpp
|
||||
|
||||
HEADERS += mainwindow.hpp \
|
||||
cropeditor/cropeditor.hpp \
|
||||
@ -87,7 +89,9 @@ HEADERS += mainwindow.hpp \
|
||||
recording/recordingcontroller.hpp \
|
||||
recording/recordingformats.hpp \
|
||||
formats.hpp \
|
||||
recording/encoders/encoder.hpp
|
||||
recording/encoders/encoder.hpp \
|
||||
recording/encoders/encodersettings.hpp \
|
||||
recording/encoders/encodersettingsdialog.hpp
|
||||
|
||||
LIBS += -lavcodec -lavformat -lavutil -lswscale -lavutil
|
||||
|
||||
@ -112,7 +116,8 @@ mac {
|
||||
|
||||
FORMS += mainwindow.ui \
|
||||
cropeditor/settings/brushpenselection.ui \
|
||||
cropeditor/settings/blurdialog.ui
|
||||
cropeditor/settings/blurdialog.ui \
|
||||
recording/encoders/encodersettingsdialog.ui
|
||||
|
||||
DISTFILES += \
|
||||
README.md \
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <colorpicker/colorpickerscene.hpp>
|
||||
#include <functional>
|
||||
#include <hotkeying.hpp>
|
||||
#include <recording/encoders/encodersettingsdialog.hpp>
|
||||
#include <recording/recordingformats.hpp>
|
||||
#include <settings.hpp>
|
||||
#include <uploaders/uploadersingleton.hpp>
|
||||
@ -87,7 +88,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
|
||||
ui->hotkeys->setSelectionMode(QListWidget::SingleSelection);
|
||||
|
||||
addHotkeyItem("Fullscreen image", "fullscreen", [] { screenshotter::fullscreen(); });
|
||||
addHotkeyItem("Area image", "area", [] { screenshotter::area(); });
|
||||
addHotkeyItem("Area image", "area", [] { //
|
||||
screenshotter::area(); //
|
||||
});
|
||||
addHotkeyItem("Color picker", "picker", [] { ColorPickerScene::showPicker(); });
|
||||
addHotkeyItem("Stop Recording", "recordingstop", [&] { controller->end(); });
|
||||
addHotkeyItem("Start Recording", "recordingstart", [&] {
|
||||
@ -230,3 +233,9 @@ void MainWindow::on_formatBox_currentIndexChanged(int index) {
|
||||
void MainWindow::on_imageFormatBox_currentIndexChanged(int index) {
|
||||
if (isVisible()) settings::settings().setValue("imageformat", index);
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_clicked() {
|
||||
auto a = new EncoderSettingsDialog();
|
||||
a->setAttribute(Qt::WA_DeleteOnClose);
|
||||
a->show();
|
||||
}
|
||||
|
@ -36,6 +36,8 @@ private slots:
|
||||
void on_formatBox_currentIndexChanged(int index);
|
||||
void on_imageFormatBox_currentIndexChanged(int index);
|
||||
|
||||
void on_pushButton_clicked();
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
|
@ -25,16 +25,6 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="15" column="1">
|
||||
<widget class="QComboBox" name="imageFormatBox"/>
|
||||
</item>
|
||||
<item row="12" column="1" rowspan="2">
|
||||
<widget class="QComboBox" name="formatBox">
|
||||
<property name="currentIndex">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLineEdit" name="nameScheme">
|
||||
<property name="toolTip">
|
||||
@ -73,7 +63,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="0" colspan="2">
|
||||
<item row="17" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string><a href="https://github.com/ArsenArsen/KShare">Source code available free for everyone. Forever.</a>
|
||||
@ -102,6 +92,9 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QListWidget" name="uploaderList"/>
|
||||
</item>
|
||||
<item row="1" column="1" rowspan="5">
|
||||
<widget class="QListWidget" name="hotkeys"/>
|
||||
</item>
|
||||
@ -112,9 +105,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QListWidget" name="uploaderList"/>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
@ -143,6 +133,23 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1">
|
||||
<widget class="QComboBox" name="imageFormatBox"/>
|
||||
</item>
|
||||
<item row="12" column="1" rowspan="2">
|
||||
<widget class="QComboBox" name="formatBox">
|
||||
<property name="currentIndex">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Encoder settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
|
@ -13,7 +13,9 @@ inline void throwAVErr(int ret, std::string section) {
|
||||
throw std::runtime_error("Error during: " + section + ": " + newString);
|
||||
}
|
||||
|
||||
Encoder::Encoder(QString &targetFile, QSize res) {
|
||||
#define OR_DEF(s, e1, e2) s ? s->e1 : e2
|
||||
|
||||
Encoder::Encoder(QString &targetFile, QSize res, CodecSettings *settings) {
|
||||
int ret;
|
||||
// Format
|
||||
ret = avformat_alloc_output_context2(&fc, NULL, NULL, targetFile.toLocal8Bit().constData());
|
||||
@ -38,25 +40,27 @@ Encoder::Encoder(QString &targetFile, QSize res) {
|
||||
out->enc->codec_id = codec->id;
|
||||
out->enc->codec = codec;
|
||||
|
||||
out->enc->bit_rate = 400000;
|
||||
out->enc->bit_rate = OR_DEF(settings, bitrate, 400000);
|
||||
out->enc->width = res.width() % 2 ? res.width() - 1 : res.width();
|
||||
out->enc->height = res.height() % 2 ? res.height() - 1 : res.height();
|
||||
size = QSize(out->enc->width, out->enc->height);
|
||||
out->st->time_base = { 1, fps };
|
||||
out->enc->time_base = out->st->time_base;
|
||||
|
||||
out->enc->gop_size = 12;
|
||||
out->enc->gop_size = OR_DEF(settings, gopSize, 12);
|
||||
out->enc->pix_fmt = AV_PIX_FMT_YUV420P; // blaze it
|
||||
if (out->enc->codec_id == AV_CODEC_ID_MPEG2VIDEO)
|
||||
out->enc->max_b_frames = 2;
|
||||
else if (out->enc->codec_id == AV_CODEC_ID_MPEG1VIDEO)
|
||||
out->enc->mb_decision = 2;
|
||||
else if (out->enc->codec_id == AV_CODEC_ID_GIF)
|
||||
if (out->enc->codec_id == AV_CODEC_ID_GIF)
|
||||
out->enc->pix_fmt = AV_PIX_FMT_RGB8;
|
||||
else if (out->enc->codec_id == AV_CODEC_ID_H264 || out->enc->codec_id == AV_CODEC_ID_H265) {
|
||||
av_opt_set(out->enc->priv_data, "preset", settings->h264Profile.toLocal8Bit().constData(), 0);
|
||||
av_opt_set(out->enc->priv_data, "crf", std::to_string(settings->h264Crf).c_str(), 0);
|
||||
} else if (out->enc->codec_id == AV_CODEC_ID_VP8 || out->enc->codec_id == AV_CODEC_ID_VP9)
|
||||
av_opt_set(out->enc->priv_data, "lossless", std::to_string(settings->vp9Lossless).c_str(), 0);
|
||||
|
||||
|
||||
ret = avcodec_open2(out->enc, codec, NULL);
|
||||
if (ret < 0) throwAVErr(ret, "codec open");
|
||||
if (codec->capabilities & AV_CODEC_CAP_DR1) avcodec_align_dimensions(out->enc, &out->enc->width, &out->enc->height);
|
||||
|
||||
ret = avcodec_parameters_from_context(out->st->codecpar, out->enc);
|
||||
if (ret < 0) throwAVErr(ret, "stream opt copy");
|
||||
|
@ -20,9 +20,19 @@ struct OutputStream {
|
||||
SwsContext *sws = NULL;
|
||||
};
|
||||
|
||||
struct CodecSettings {
|
||||
int bitrate;
|
||||
int gopSize;
|
||||
int bFrames;
|
||||
int mbDecisions;
|
||||
QString h264Profile;
|
||||
int h264Crf;
|
||||
bool vp9Lossless;
|
||||
};
|
||||
|
||||
class Encoder {
|
||||
public:
|
||||
Encoder(QString &targetFile, QSize res);
|
||||
Encoder(QString &targetFile, QSize res, CodecSettings *settings = NULL);
|
||||
~Encoder();
|
||||
bool addFrame(QImage frm);
|
||||
bool isRunning();
|
||||
|
45
recording/encoders/encodersettings.cpp
Normal file
45
recording/encoders/encodersettings.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
#include "encodersettings.hpp"
|
||||
|
||||
#undef SETTINGS_INTERFACE
|
||||
|
||||
#define SETTINGS_FIELD(f, n, d, t) f = settings::settings().value(n, d).value<t>();
|
||||
#define SETTINGS_INTERFACE(F, t) \
|
||||
t EncoderSettings::get##F() { \
|
||||
return F; \
|
||||
} \
|
||||
void EncoderSettings::set##F(t newf) { \
|
||||
F = newf; \
|
||||
}
|
||||
|
||||
EncoderSettings::EncoderSettings() {
|
||||
SETTINGS_FIELD(bitrate, "codec/bitrate", 400000, int);
|
||||
SETTINGS_FIELD(gopSize, "codec/gopsize", 12, int);
|
||||
SETTINGS_FIELD(h264Profile, "codec/h264Profile", "medium", QString);
|
||||
SETTINGS_FIELD(h264Crf, "codec/h264Crf", 23, int);
|
||||
SETTINGS_FIELD(vp9Lossless, "codec/vp9Lossless", false, bool);
|
||||
SETTINGS_FIELD(imageQuality, "imageQuality", -1, int);
|
||||
}
|
||||
|
||||
SETTINGS_INTERFACE(bitrate, int)
|
||||
SETTINGS_INTERFACE(gopSize, int)
|
||||
SETTINGS_INTERFACE(h264Profile, QString)
|
||||
SETTINGS_INTERFACE(h264Crf, int)
|
||||
SETTINGS_INTERFACE(vp9Lossless, int)
|
||||
SETTINGS_INTERFACE(imageQuality, int)
|
||||
|
||||
EncoderSettings EncoderSettings::inst() {
|
||||
static EncoderSettings e;
|
||||
return e;
|
||||
}
|
||||
|
||||
#define SETTINGS_S_S(se) s->se = se;
|
||||
|
||||
CodecSettings *EncoderSettings::getSettings() {
|
||||
auto s = new CodecSettings;
|
||||
SETTINGS_S_S(bitrate)
|
||||
SETTINGS_S_S(gopSize)
|
||||
SETTINGS_S_S(h264Profile)
|
||||
SETTINGS_S_S(h264Crf)
|
||||
SETTINGS_S_S(vp9Lossless)
|
||||
return s;
|
||||
}
|
32
recording/encoders/encodersettings.hpp
Normal file
32
recording/encoders/encodersettings.hpp
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef ENCODERSETTINGS_HPP
|
||||
#define ENCODERSETTINGS_HPP
|
||||
|
||||
#include "encoder.hpp"
|
||||
#include <settings.hpp>
|
||||
#define SETTINGS_INTERFACE(F, t) \
|
||||
t get##F(); \
|
||||
void set##F(t newf);
|
||||
|
||||
class EncoderSettings {
|
||||
public:
|
||||
EncoderSettings();
|
||||
|
||||
static EncoderSettings inst();
|
||||
CodecSettings *getSettings();
|
||||
SETTINGS_INTERFACE(bitrate, int)
|
||||
SETTINGS_INTERFACE(gopSize, int)
|
||||
SETTINGS_INTERFACE(h264Profile, QString)
|
||||
SETTINGS_INTERFACE(h264Crf, int)
|
||||
SETTINGS_INTERFACE(vp9Lossless, int)
|
||||
SETTINGS_INTERFACE(imageQuality, int)
|
||||
|
||||
private:
|
||||
int bitrate;
|
||||
int gopSize;
|
||||
QString h264Profile;
|
||||
int h264Crf;
|
||||
int imageQuality;
|
||||
bool vp9Lossless;
|
||||
};
|
||||
|
||||
#endif // ENCODERSETTINGS_HPP
|
28
recording/encoders/encodersettingsdialog.cpp
Normal file
28
recording/encoders/encodersettingsdialog.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include "encodersettingsdialog.hpp"
|
||||
#include "encodersettings.hpp"
|
||||
#include "ui_encodersettingsdialog.h"
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QSpinBox>
|
||||
|
||||
EncoderSettingsDialog::EncoderSettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::EncoderSettingsDialog) {
|
||||
ui->setupUi(this);
|
||||
setWindowTitle("KShare Encoder Settings");
|
||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, [&] {
|
||||
EncoderSettings::inst().setbitrate(ui->bitrate->value());
|
||||
EncoderSettings::inst().seth264Crf(ui->crf->value());
|
||||
EncoderSettings::inst().seth264Profile(ui->profileBox->currentText());
|
||||
EncoderSettings::inst().setvp9Lossless(ui->vp9Lossless->isChecked());
|
||||
EncoderSettings::inst().setgopSize(ui->gopSize->value());
|
||||
EncoderSettings::inst().setimageQuality(ui->defaultImageQuality->isChecked() ? -1 : ui->imageQuality->value());
|
||||
});
|
||||
}
|
||||
|
||||
EncoderSettingsDialog::~EncoderSettingsDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void EncoderSettingsDialog::on_defaultImageQuality_clicked(bool checked) {
|
||||
ui->imageQuality->setEnabled(!checked);
|
||||
}
|
23
recording/encoders/encodersettingsdialog.hpp
Normal file
23
recording/encoders/encodersettingsdialog.hpp
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef ENCODERSETTINGSDIALOG_HPP
|
||||
#define ENCODERSETTINGSDIALOG_HPP
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class EncoderSettingsDialog;
|
||||
}
|
||||
|
||||
class EncoderSettingsDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit EncoderSettingsDialog(QWidget *parent = 0);
|
||||
~EncoderSettingsDialog();
|
||||
|
||||
private slots:
|
||||
void on_defaultImageQuality_clicked(bool checked);
|
||||
|
||||
private:
|
||||
Ui::EncoderSettingsDialog *ui;
|
||||
};
|
||||
|
||||
#endif // ENCODERSETTINGSDIALOG_HPP
|
278
recording/encoders/encodersettingsdialog.ui
Normal file
278
recording/encoders/encodersettingsdialog.ui
Normal file
@ -0,0 +1,278 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EncoderSettingsDialog</class>
|
||||
<widget class="QDialog" name="EncoderSettingsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>503</width>
|
||||
<height>446</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Image Encoder Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="2" column="0">
|
||||
<widget class="QSpinBox" name="imageQuality">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><a href="http://doc.qt.io/qt-5/qpixmap.html#save"><span style=" text-decoration: underline; color:#007af4;">Quality</span></a></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="defaultImageQuality">
|
||||
<property name="text">
|
||||
<string>Format default</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Video Encoder Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="4" column="0">
|
||||
<widget class="QTabWidget" name="videoTabs">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="hTab">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>h264/h265</string>
|
||||
</attribute>
|
||||
<layout class="QFormLayout" name="verticalLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><a href="https://trac.ffmpeg.org/wiki/Encode/H.264#crf"><span style=" text-decoration: underline; color:#007af4;">Preset</span></a></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="profileBox">
|
||||
<property name="currentText">
|
||||
<string>ultrafast</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ultrafast</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>superfast</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>veryfast</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>faster</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>fast</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>medium</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>slow</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>slower</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>veryslow</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>placebo</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><a href="https://trac.ffmpeg.org/wiki/Encode/H.264#crf"><span style=" text-decoration: underline; color:#007af4;">CRF</span></a></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="crf">
|
||||
<property name="maximum">
|
||||
<number>51</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>23</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="vpTab">
|
||||
<attribute name="title">
|
||||
<string>VP9</string>
|
||||
</attribute>
|
||||
<layout class="QFormLayout" name="verticalLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="vp9Lossless">
|
||||
<property name="text">
|
||||
<string>Lossless (not recommended)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gifTab">
|
||||
<attribute name="title">
|
||||
<string>GIF</string>
|
||||
</attribute>
|
||||
<layout class="QFormLayout" name="verticalLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>TODO: Find whatever configuration GIF can have in ffmpeg's libav</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Bitrate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QDoubleSpinBox" name="bitrate">
|
||||
<property name="suffix">
|
||||
<string>kbps</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>400.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="toolTip">
|
||||
<string>The number of pictures in a group of pictures, or 0 for intra only </string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>GOP size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QSpinBox" name="gopSize">
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>12</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>EncoderSettingsDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>227</x>
|
||||
<y>518</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>EncoderSettingsDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>295</x>
|
||||
<y>524</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -70,6 +70,7 @@ void RecordingController::timeout() {
|
||||
time = 0;
|
||||
preview = 0;
|
||||
area = QRect();
|
||||
timer.stop();
|
||||
return;
|
||||
}
|
||||
time++;
|
||||
@ -91,6 +92,7 @@ void RecordingController::timeout() {
|
||||
if (isRunning())
|
||||
preview->setTime(QString("%1:%2").arg(QString::number(minute)).arg(QString::number(second)), frame);
|
||||
} else {
|
||||
timer.stop();
|
||||
QMutexLocker l(&lock);
|
||||
if (!uploadQueue.isEmpty()) {
|
||||
auto a = uploadQueue.dequeue();
|
||||
|
@ -44,6 +44,7 @@ private slots:
|
||||
|
||||
private:
|
||||
QMutex lock;
|
||||
QMutex timerl;
|
||||
QQueue<_QueueContext> uploadQueue;
|
||||
QRect area;
|
||||
RecordingContext *_context = 0;
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <recording/encoders/encodersettings.hpp>
|
||||
|
||||
RecordingFormats::RecordingFormats(formats::Recording f) {
|
||||
QString tmp = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
|
||||
if (tmp.isEmpty()) {
|
||||
@ -43,7 +45,9 @@ RecordingFormats::RecordingFormats(formats::Recording f) {
|
||||
validator = [&](QSize s) {
|
||||
if (!enc) {
|
||||
try {
|
||||
enc = new Encoder(path, s);
|
||||
auto es = EncoderSettings::inst().getSettings();
|
||||
enc = new Encoder(path, s, es);
|
||||
delete es;
|
||||
if (!enc->isRunning()) {
|
||||
delete enc;
|
||||
return false;
|
||||
@ -56,7 +60,7 @@ RecordingFormats::RecordingFormats(formats::Recording f) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return !interrupt;
|
||||
};
|
||||
consumer = [&](QImage img) {
|
||||
if (!interrupt) try {
|
||||
|
@ -64,7 +64,7 @@ void UploaderSingleton::upload(QPixmap *pixmap) {
|
||||
QFile file(saveDir.absoluteFilePath(formatter::format(settings::settings().value("fileFormat").toString(), format.toLower())));
|
||||
|
||||
if (file.open(QFile::ReadWrite)) {
|
||||
pixmap->save(&file, format.toLocal8Bit().constData());
|
||||
pixmap->save(&file, format.toLocal8Bit().constData(), settings::settings().value("imageQuality", -1).toInt());
|
||||
file.seek(0);
|
||||
u->doUpload(file.readAll(), format);
|
||||
} else
|
||||
|
Loading…
x
Reference in New Issue
Block a user