Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions src/builder/include/ai_processing_page.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "progress_widget.h"
#include "batch_output_widget.h"
#include "batch_mode_helper.h"
#include "bitrate_widget.h"
#include <QComboBox>
#include <QGroupBox>
#include <QLabel>
Expand Down Expand Up @@ -56,7 +55,6 @@ private slots:
void OnInputFileSelected(const QString &filePath);
void OnOutputFileSelected(const QString &filePath);
void OnAlgorithmChanged(int index);
void OnFormatChanged(int index);
void OnProcessClicked();
void OnProcessFinished(bool success);

Expand Down Expand Up @@ -90,25 +88,6 @@ private slots:
QLabel *upscaleFactorLabel;
QSpinBox *upscaleFactorSpinBox;

// Video settings section
QGroupBox *videoGroupBox;
QLabel *videoCodecLabel;
QComboBox *videoCodecComboBox;
QLabel *videoBitrateLabel;
BitrateWidget *videoBitrateWidget;

// Audio settings section
QGroupBox *audioGroupBox;
QLabel *audioCodecLabel;
QComboBox *audioCodecComboBox;
QLabel *audioBitrateLabel;
BitrateWidget *audioBitrateWidget;

// Format section
QGroupBox *formatGroupBox;
QLabel *formatLabel;
QComboBox *formatComboBox;

// Progress section
ProgressWidget *progressWidget;

Expand Down
2 changes: 2 additions & 0 deletions src/builder/include/info_view_page.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ private slots:
QLabel *colorSpaceValue;
QLabel *videoCodecLabel;
QLabel *videoCodecValue;
QLabel *pixelFormatLabel;
QLabel *pixelFormatValue;
QLabel *videoBitRateLabel;
QLabel *videoBitRateValue;
QLabel *frameRateLabel;
Expand Down
122 changes: 6 additions & 116 deletions src/builder/src/ai_processing_page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,7 @@ void AIProcessingPage::OnPageActivated() {
}

void AIProcessingPage::OnInputFileChanged(const QString &newPath) {
QString ext = GetFileExtension(newPath);
if (!ext.isEmpty()) {
int index = formatComboBox->findText(ext);
if (index >= 0) {
formatComboBox->setCurrentIndex(index);
}
}
Q_UNUSED(newPath);
// Update output path when input changes
UpdateOutputPath();
}
Expand All @@ -102,7 +96,7 @@ void AIProcessingPage::OnOutputPathUpdate() {
void AIProcessingPage::OnPageDeactivated() {
BasePage::OnPageDeactivated();
HandleSharedDataUpdate(inputFileSelector->GetLineEdit(), outputFileSelector->GetLineEdit(),
formatComboBox->currentText());
GetFileExtension(inputFileSelector->GetFilePath()));
}

void AIProcessingPage::SetupUI() {
Expand Down Expand Up @@ -168,63 +162,6 @@ void AIProcessingPage::SetupUI() {
algoSettingsLayout->addWidget(algoSettingsStack, 0, 0, 1, 2);
mainLayout->addWidget(algoSettingsGroupBox);

// Video Settings Section
videoGroupBox = new QGroupBox(tr("Video Settings"), this);
QGridLayout *videoLayout = new QGridLayout(videoGroupBox);
videoLayout->setSpacing(10);

videoCodecLabel = new QLabel(tr("Codec:"), videoGroupBox);
videoCodecComboBox = new QComboBox(videoGroupBox);
videoCodecComboBox->addItems({"auto", "libx264", "libx265", "libvpx-vp9", "copy"});
videoCodecComboBox->setCurrentText("auto");

videoBitrateLabel = new QLabel(tr("Bitrate:"), videoGroupBox);
videoBitrateWidget = new BitrateWidget(BitrateWidget::Video, videoGroupBox);

videoLayout->addWidget(videoCodecLabel, 0, 0);
videoLayout->addWidget(videoCodecComboBox, 0, 1);
videoLayout->addWidget(videoBitrateLabel, 1, 0);
videoLayout->addWidget(videoBitrateWidget, 1, 1);

mainLayout->addWidget(videoGroupBox);

// Audio Settings Section
audioGroupBox = new QGroupBox(tr("Audio Settings"), this);
QGridLayout *audioLayout = new QGridLayout(audioGroupBox);
audioLayout->setSpacing(10);

audioCodecLabel = new QLabel(tr("Codec:"), audioGroupBox);
audioCodecComboBox = new QComboBox(audioGroupBox);
audioCodecComboBox->addItems({"auto", "aac", "libmp3lame", "libopus", "copy"});
audioCodecComboBox->setCurrentText("auto");

audioBitrateLabel = new QLabel(tr("Bitrate:"), audioGroupBox);
audioBitrateWidget = new BitrateWidget(BitrateWidget::Audio, audioGroupBox);

audioLayout->addWidget(audioCodecLabel, 0, 0);
audioLayout->addWidget(audioCodecComboBox, 0, 1);
audioLayout->addWidget(audioBitrateLabel, 1, 0);
audioLayout->addWidget(audioBitrateWidget, 1, 1);

mainLayout->addWidget(audioGroupBox);

// Format Section
formatGroupBox = new QGroupBox(tr("File Format"), this);
QHBoxLayout *formatLayout = new QHBoxLayout(formatGroupBox);

formatLabel = new QLabel(tr("Format:"), formatGroupBox);
formatComboBox = new QComboBox(formatGroupBox);
formatComboBox->addItems({"mp4", "mkv", "avi", "mov", "flv", "webm", "ts", "jpg", "png"});
formatComboBox->setCurrentText("mp4");
connect(formatComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &AIProcessingPage::OnFormatChanged);

formatLayout->addWidget(formatLabel);
formatLayout->addWidget(formatComboBox);
formatLayout->addStretch();

mainLayout->addWidget(formatGroupBox);

// Output File Selector
outputFileSelector = new FileSelectorWidget(
tr("Output File"),
Expand Down Expand Up @@ -285,15 +222,6 @@ void AIProcessingPage::OnInputFileSelected(const QString &filePath) {
mainWindow->GetSharedData()->SetInputFilePath(filePath);
}

// Set default format to same as input file
QString ext = GetFileExtension(filePath);
if (!ext.isEmpty()) {
int index = formatComboBox->findText(ext);
if (index >= 0) {
formatComboBox->setCurrentIndex(index);
}
}

// Update output path
UpdateOutputPath();
}
Expand All @@ -311,16 +239,11 @@ void AIProcessingPage::OnAlgorithmChanged(int index) {
algoSettingsStack->setCurrentIndex(index);
}

void AIProcessingPage::OnFormatChanged(int index) {
Q_UNUSED(index);
UpdateOutputPath();
}

void AIProcessingPage::OnProcessClicked() {
// Check if batch mode is active
if (batchModeHelper->IsBatchMode()) {
// Batch mode: Add to queue
QString format = formatComboBox->currentText();
QString format = GetFileExtension(inputFileSelector->GetFilePath());
batchModeHelper->AddToQueue(format);
return;
}
Expand Down Expand Up @@ -362,7 +285,7 @@ void AIProcessingPage::UpdateOutputPath() {
if (!inputPath.isEmpty()) {
OpenConverter *mainWindow = qobject_cast<OpenConverter *>(window());
if (mainWindow && mainWindow->GetSharedData()) {
QString format = formatComboBox->currentText();
QString format = GetFileExtension(inputPath);
QString outputPath = mainWindow->GetSharedData()->GenerateOutputPath(format);
outputFileSelector->SetFilePath(outputPath);
processButton->setEnabled(true);
Expand All @@ -385,25 +308,8 @@ EncodeParameter* AIProcessingPage::CreateEncodeParameter() {
encodeParam->set_upscale_factor(upscaleFactorSpinBox->value());
}

// Set video codec and bitrate
QString videoCodec = videoCodecComboBox->currentText();
if (videoCodec != "auto")
encodeParam->set_video_codec_name(videoCodec.toStdString());

int videoBitrate = videoBitrateWidget->GetBitrate();
if (videoBitrate > 0) {
encodeParam->set_video_bit_rate(videoBitrate);
}

// Set audio codec and bitrate
QString audioCodec = audioCodecComboBox->currentText();
if (audioCodec != "auto")
encodeParam->set_audio_codec_name(audioCodec.toStdString());

int audioBitrate = audioBitrateWidget->GetBitrate();
if (audioBitrate > 0) {
encodeParam->set_audio_bit_rate(audioBitrate);
}
// Video/audio codec and bitrate are auto-detected from input file
// No user configuration needed for AI processing

return encodeParam;
}
Expand All @@ -423,22 +329,6 @@ void AIProcessingPage::RetranslateUi() {
algoSettingsGroupBox->setTitle(tr("Algorithm Settings"));
upscaleFactorLabel->setText(tr("Upscale Factor:"));

// Update video settings section
videoGroupBox->setTitle(tr("Video Settings"));
videoCodecLabel->setText(tr("Codec:"));
videoBitrateLabel->setText(tr("Bitrate:"));
videoBitrateWidget->RetranslateUi();

// Update audio settings section
audioGroupBox->setTitle(tr("Audio Settings"));
audioCodecLabel->setText(tr("Codec:"));
audioBitrateLabel->setText(tr("Bitrate:"));
audioBitrateWidget->RetranslateUi();

// Update format section
formatGroupBox->setTitle(tr("File Format"));
formatLabel->setText(tr("Format:"));

// Update output file selector
outputFileSelector->setTitle(tr("Output File"));
outputFileSelector->SetPlaceholder(tr("Output file path..."));
Expand Down
16 changes: 12 additions & 4 deletions src/builder/src/info_view_page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ void InfoViewPage::SetupUI() {
colorSpaceValue = new QLabel("-", this);
videoCodecLabel = new QLabel(tr("Video Codec:"), this);
videoCodecValue = new QLabel("-", this);
pixelFormatLabel = new QLabel(tr("Pixel Format:"), this);
pixelFormatValue = new QLabel("-", this);
videoBitRateLabel = new QLabel(tr("Bit Rate:"), this);
videoBitRateValue = new QLabel("-", this);
frameRateLabel = new QLabel(tr("Frame Rate:"), this);
Expand All @@ -101,10 +103,12 @@ void InfoViewPage::SetupUI() {
videoLayout->addWidget(colorSpaceValue, 3, 1);
videoLayout->addWidget(videoCodecLabel, 4, 0);
videoLayout->addWidget(videoCodecValue, 4, 1);
videoLayout->addWidget(videoBitRateLabel, 5, 0);
videoLayout->addWidget(videoBitRateValue, 5, 1);
videoLayout->addWidget(frameRateLabel, 6, 0);
videoLayout->addWidget(frameRateValue, 6, 1);
videoLayout->addWidget(pixelFormatLabel, 5, 0);
videoLayout->addWidget(pixelFormatValue, 5, 1);
videoLayout->addWidget(videoBitRateLabel, 6, 0);
videoLayout->addWidget(videoBitRateValue, 6, 1);
videoLayout->addWidget(frameRateLabel, 7, 0);
videoLayout->addWidget(frameRateValue, 7, 1);

mainLayout->addWidget(videoGroupBox);

Expand Down Expand Up @@ -213,6 +217,7 @@ void InfoViewPage::DisplayInfo(QuickInfo *quickInfo) {
heightValue->setText(QString("%1 px").arg(quickInfo->height));
colorSpaceValue->setText(QString::fromStdString(quickInfo->colorSpace));
videoCodecValue->setText(QString::fromStdString(quickInfo->videoCodec));
pixelFormatValue->setText(QString::fromStdString(quickInfo->pixelFormat));
videoBitRateValue->setText(FormatBitrate(quickInfo->videoBitRate));
frameRateValue->setText(QString("%1 fps").arg(quickInfo->frameRate, 0, 'f', 2));
} else {
Expand All @@ -221,6 +226,7 @@ void InfoViewPage::DisplayInfo(QuickInfo *quickInfo) {
heightValue->setText("-");
colorSpaceValue->setText("-");
videoCodecValue->setText("-");
pixelFormatValue->setText("-");
videoBitRateValue->setText("-");
frameRateValue->setText("-");
}
Expand Down Expand Up @@ -249,6 +255,7 @@ void InfoViewPage::ClearInfo() {
heightValue->setText("-");
colorSpaceValue->setText("-");
videoCodecValue->setText("-");
pixelFormatValue->setText("-");
videoBitRateValue->setText("-");
frameRateValue->setText("-");

Expand Down Expand Up @@ -295,6 +302,7 @@ void InfoViewPage::RetranslateUi() {
heightLabel->setText(tr("Height:"));
colorSpaceLabel->setText(tr("Color Space:"));
videoCodecLabel->setText(tr("Video Codec:"));
pixelFormatLabel->setText(tr("Pixel Format:"));
videoBitRateLabel->setText(tr("Bit Rate:"));
frameRateLabel->setText(tr("Frame Rate:"));

Expand Down
1 change: 1 addition & 0 deletions src/common/include/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ typedef struct QuickInfo {

std::string colorSpace;
std::string videoCodec;
std::string pixelFormat;

int64_t videoBitRate;
double frameRate;
Expand Down
8 changes: 8 additions & 0 deletions src/common/src/info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ void Info::init() {
quickInfo->height = 0;
quickInfo->colorSpace = "";
quickInfo->videoCodec = "";
quickInfo->pixelFormat = "";
quickInfo->videoBitRate = 0;
quickInfo->frameRate = 0;

Expand Down Expand Up @@ -82,6 +83,13 @@ void Info::send_info(char *src) {
if (avCtx->streams[quickInfo->videoIdx]->codecpar->codec_id != AV_CODEC_ID_NONE)
quickInfo->videoCodec = avcodec_get_name(
avCtx->streams[quickInfo->videoIdx]->codecpar->codec_id);
// Get pixel format
AVPixelFormat pix_fmt = (AVPixelFormat)avCtx->streams[quickInfo->videoIdx]->codecpar->format;
if (pix_fmt != AV_PIX_FMT_NONE) {
const char *pix_fmt_name = av_get_pix_fmt_name(pix_fmt);
if (pix_fmt_name)
quickInfo->pixelFormat = pix_fmt_name;
}
quickInfo->videoBitRate =
avCtx->streams[quickInfo->videoIdx]->codecpar->bit_rate;
quickInfo->frameRate =
Expand Down
Binary file modified src/resources/lang_chinese.qm
Binary file not shown.
Loading
Loading