clang optimizations and cleanup
This commit is contained in:
@@ -16,12 +16,11 @@ GStreamerPipelineWidget::GStreamerPipelineWidget(SocketClient* socketClient, QWi
|
||||
|
||||
void GStreamerPipelineWidget::setupUI()
|
||||
{
|
||||
QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
||||
auto* mainLayout = new QVBoxLayout(this);
|
||||
|
||||
QGroupBox* groupBox = new QGroupBox("GStreamer Pipeline", this);
|
||||
QVBoxLayout* groupLayout = new QVBoxLayout(groupBox);
|
||||
auto* groupBox = new QGroupBox("GStreamer Pipeline", this);
|
||||
auto* groupLayout = new QVBoxLayout(groupBox);
|
||||
|
||||
// Info label with instructions
|
||||
m_infoLabel = new QLabel(
|
||||
"<b>Quick Start:</b> Click 'Quick Start' to automatically configure and start streaming.<br>"
|
||||
"<b>Manual:</b> 1. Set video format → 2. Set pipeline → 3. Start stream", this);
|
||||
@@ -29,27 +28,23 @@ void GStreamerPipelineWidget::setupUI()
|
||||
m_infoLabel->setWordWrap(true);
|
||||
groupLayout->addWidget(m_infoLabel);
|
||||
|
||||
// Quick Start button (prominent)
|
||||
m_quickStartBtn = new QPushButton("⚡ Quick Start (Auto Configure & Stream)", this);
|
||||
m_quickStartBtn->setStyleSheet("QPushButton { background-color: #4CAF50; color: white; font-weight: bold; padding: 10px; }");
|
||||
connect(m_quickStartBtn, &QPushButton::clicked, this, &GStreamerPipelineWidget::onQuickStart);
|
||||
groupLayout->addWidget(m_quickStartBtn);
|
||||
|
||||
// Separator
|
||||
QFrame* line = new QFrame(this);
|
||||
auto* line = new QFrame(this);
|
||||
line->setFrameShape(QFrame::HLine);
|
||||
line->setFrameShadow(QFrame::Sunken);
|
||||
groupLayout->addWidget(line);
|
||||
|
||||
// Format selection
|
||||
QLabel* formatLabel = new QLabel("Video Format:", this);
|
||||
auto* formatLabel = new QLabel("Video Format:", this);
|
||||
m_formatCombo = new QComboBox(this);
|
||||
m_formatCombo->addItem("1280x720@30fps UYVY (Default/Supported)", "1280,720,30,UYVY");
|
||||
groupLayout->addWidget(formatLabel);
|
||||
groupLayout->addWidget(m_formatCombo);
|
||||
|
||||
// Pipeline presets
|
||||
QLabel* presetsLabel = new QLabel("Pipeline Presets:", this);
|
||||
auto* presetsLabel = new QLabel("Pipeline Presets:", this);
|
||||
m_pipelinePresets = new QComboBox(this);
|
||||
m_pipelinePresets->addItem("MJPEG UDP Stream (Best for raw formats)", "videoconvert ! jpegenc ! rtpjpegpay ! udpsink host=127.0.0.1 port=5000");
|
||||
m_pipelinePresets->addItem("UDP H.264 Stream (Requires gst-libav)", "videoconvert ! x264enc tune=zerolatency ! rtph264pay ! udpsink host=127.0.0.1 port=5000");
|
||||
@@ -66,8 +61,7 @@ void GStreamerPipelineWidget::setupUI()
|
||||
groupLayout->addWidget(presetsLabel);
|
||||
groupLayout->addWidget(m_pipelinePresets);
|
||||
|
||||
// Pipeline editor
|
||||
QLabel* pipelineLabel = new QLabel("Pipeline:", this);
|
||||
auto* pipelineLabel = new QLabel("Pipeline:", this);
|
||||
m_pipelineEdit = new QTextEdit(this);
|
||||
m_pipelineEdit->setMaximumHeight(80);
|
||||
m_pipelineEdit->setPlaceholderText("Enter GStreamer pipeline here...\nExample: videoconvert ! autovideosink");
|
||||
@@ -75,13 +69,11 @@ void GStreamerPipelineWidget::setupUI()
|
||||
groupLayout->addWidget(pipelineLabel);
|
||||
groupLayout->addWidget(m_pipelineEdit);
|
||||
|
||||
// Set pipeline button
|
||||
m_setPipelineBtn = new QPushButton("Set Pipeline", this);
|
||||
connect(m_setPipelineBtn, &QPushButton::clicked, this, &GStreamerPipelineWidget::onSetPipeline);
|
||||
groupLayout->addWidget(m_setPipelineBtn);
|
||||
|
||||
// Stream control buttons
|
||||
QHBoxLayout* buttonLayout = new QHBoxLayout();
|
||||
auto* buttonLayout = new QHBoxLayout();
|
||||
m_startStreamBtn = new QPushButton("Start Stream", this);
|
||||
m_stopStreamBtn = new QPushButton("Stop Stream", this);
|
||||
m_getStatusBtn = new QPushButton("Get Status", this);
|
||||
@@ -95,7 +87,6 @@ void GStreamerPipelineWidget::setupUI()
|
||||
buttonLayout->addWidget(m_getStatusBtn);
|
||||
groupLayout->addLayout(buttonLayout);
|
||||
|
||||
// Status label
|
||||
m_statusLabel = new QLabel("Status: Unknown", this);
|
||||
m_statusLabel->setStyleSheet("QLabel { background-color: #f0f0f0; padding: 5px; border-radius: 3px; }");
|
||||
groupLayout->addWidget(m_statusLabel);
|
||||
@@ -148,7 +139,6 @@ void GStreamerPipelineWidget::onStartStream()
|
||||
|
||||
m_socketClient->sendCommand("set_format", formatParams,
|
||||
[this](const QJsonObject& response) {
|
||||
// Now start stream
|
||||
m_socketClient->sendCommand("start_stream", QJsonObject(),
|
||||
[this](const QJsonObject& response) {
|
||||
updateStatus("Streaming started", true);
|
||||
@@ -213,7 +203,6 @@ void GStreamerPipelineWidget::updateStatus(const QString& status, bool streaming
|
||||
|
||||
void GStreamerPipelineWidget::onQuickStart()
|
||||
{
|
||||
// Disable button during process
|
||||
m_quickStartBtn->setEnabled(false);
|
||||
m_quickStartBtn->setText("Configuring...");
|
||||
|
||||
@@ -306,10 +295,8 @@ void GStreamerPipelineWidget::onFormatsReceived(const QJsonObject& response)
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear existing formats
|
||||
m_formatCombo->clear();
|
||||
|
||||
// Add all available formats
|
||||
for (const QJsonValue& val : formats) {
|
||||
QJsonObject fmt = val.toObject();
|
||||
int width = fmt["width"].toInt();
|
||||
@@ -317,9 +304,8 @@ void GStreamerPipelineWidget::onFormatsReceived(const QJsonObject& response)
|
||||
int fps = fmt["framerate"].toInt();
|
||||
QString format = fmt["format"].toString();
|
||||
|
||||
QString displayText = QString("%1x%2@%3fps %4")
|
||||
.arg(width).arg(height).arg(fps).arg(format);
|
||||
QString data = QString("%1,%2,%3,%4").arg(width).arg(height).arg(fps).arg(format);
|
||||
QString displayText = QString("%1x%2@%3fps %4").arg(width, height, fps).arg(format);
|
||||
QString data = QString("%1,%2,%3,%4").arg(width, height, fps).arg(format);
|
||||
|
||||
m_formatCombo->addItem(displayText, data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user