-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
759 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#include "audioencoderwidget.hpp" | ||
|
||
#include <ffmpeg/ffmpegutils.hpp> | ||
|
||
#include <QtWidgets> | ||
|
||
class AudioEncoderWidget::AudioEncoderWidgetPrivate | ||
{ | ||
public: | ||
explicit AudioEncoderWidgetPrivate(AudioEncoderWidget *q) | ||
: q_ptr(q) | ||
{ | ||
audioEncoderCbx = new QComboBox(q_ptr); | ||
audioEncoderCbx->setView(new QListView(audioEncoderCbx)); | ||
audioEncoderCbx->setMaxVisibleItems(10); | ||
audioEncoderCbx->setStyleSheet("QComboBox {combobox-popup:0;}"); | ||
|
||
auto audioEncodercs = Ffmpeg::getCurrentSupportCodecs(AVMEDIA_TYPE_AUDIO, true); | ||
for (auto iter = audioEncodercs.cbegin(); iter != audioEncodercs.cend(); ++iter) { | ||
audioEncoderCbx->addItem(iter.value(), iter.key()); | ||
} | ||
audioEncoderCbx->setCurrentIndex(audioEncoderCbx->findData(AV_CODEC_ID_AAC)); | ||
audioEncoderCbx->model()->sort(0); | ||
} | ||
|
||
AudioEncoderWidget *q_ptr; | ||
|
||
QComboBox *audioEncoderCbx; | ||
}; | ||
|
||
AudioEncoderWidget::AudioEncoderWidget(QWidget *parent) | ||
: QWidget{parent} | ||
, d_ptr(new AudioEncoderWidgetPrivate(this)) | ||
{ | ||
setupUI(); | ||
buildConnect(); | ||
} | ||
|
||
AudioEncoderWidget::~AudioEncoderWidget() = default; | ||
|
||
auto AudioEncoderWidget::setEncoder(AVCodecID codecId) -> bool | ||
{ | ||
auto index = d_ptr->audioEncoderCbx->findData(codecId); | ||
auto finded = (index >= 0); | ||
if (finded) { | ||
d_ptr->audioEncoderCbx->setCurrentIndex(index); | ||
} | ||
return finded; | ||
} | ||
|
||
auto AudioEncoderWidget::encoder() const -> QString | ||
{ | ||
return d_ptr->audioEncoderCbx->currentText(); | ||
} | ||
|
||
void AudioEncoderWidget::setupUI() | ||
{ | ||
auto *layout = new QHBoxLayout(this); | ||
layout->addWidget(new QLabel(tr("Encoder:"))); | ||
layout->addWidget(d_ptr->audioEncoderCbx); | ||
layout->addStretch(); | ||
} | ||
|
||
void AudioEncoderWidget::buildConnect() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#ifndef AUDIOENCODERWIDGET_HPP | ||
#define AUDIOENCODERWIDGET_HPP | ||
|
||
#include <QWidget> | ||
|
||
extern "C" { | ||
#include <libavcodec/codec_id.h> | ||
} | ||
|
||
class AudioEncoderWidget : public QWidget | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit AudioEncoderWidget(QWidget *parent = nullptr); | ||
~AudioEncoderWidget() override; | ||
|
||
auto setEncoder(AVCodecID codecId) -> bool; | ||
[[nodiscard]] auto encoder() const -> QString; | ||
|
||
private: | ||
void setupUI(); | ||
void buildConnect(); | ||
|
||
class AudioEncoderWidgetPrivate; | ||
QScopedPointer<AudioEncoderWidgetPrivate> d_ptr; | ||
}; | ||
|
||
#endif // AUDIOENCODERWIDGET_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.