Update Qt Sample capture handling
- accept only the supported 48 kHz stereo 16-bit audio format - preserve the last signal, SDI, preview, and audio information after Stop - refresh signal and SDI state when channel Start times out - retain the existing internal diagnostics and timing statistics Validation: git diff --check passed. The MSVC Release gvfg_qt_preview build completed successfully, and the updated Sample behavior was tested on hardware.
This commit is contained in:
@@ -21,6 +21,8 @@
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
constexpr size_t kMaxQueuedAudioFrames = 10;
|
constexpr size_t kMaxQueuedAudioFrames = 10;
|
||||||
|
constexpr int kAudioSampleRate = 48000;
|
||||||
|
constexpr int kAudioChannelCount = 2;
|
||||||
|
|
||||||
#if GVFG_INTERNAL_DIAGNOSTICS
|
#if GVFG_INTERNAL_DIAGNOSTICS
|
||||||
QString boolText(int value) { return value ? QStringLiteral("yes") : QStringLiteral("no"); }
|
QString boolText(int value) { return value ? QStringLiteral("yes") : QStringLiteral("no"); }
|
||||||
@@ -306,18 +308,23 @@ void CaptureController::closeDeviceSession(bool clearSelection)
|
|||||||
appendLog(QStringLiteral("Closed device"));
|
appendLog(QStringLiteral("Closed device"));
|
||||||
}
|
}
|
||||||
|
|
||||||
emit statusChanged(QStringLiteral("Idle"));
|
|
||||||
lastSignalStatusText_.clear();
|
|
||||||
emit sdiInfoChanged(QStringLiteral("SDI Info: --"));
|
|
||||||
if (clearSelection)
|
if (clearSelection)
|
||||||
|
{
|
||||||
|
emit statusChanged(QStringLiteral("Idle"));
|
||||||
|
lastSignalStatusText_.clear();
|
||||||
|
emit sdiInfoChanged(QStringLiteral("SDI Info: --"));
|
||||||
selectedDeviceIndex_ = -1;
|
selectedDeviceIndex_ = -1;
|
||||||
|
}
|
||||||
for (ChannelRuntime &channel : channels_)
|
for (ChannelRuntime &channel : channels_)
|
||||||
{
|
{
|
||||||
channel.opened = false;
|
channel.opened = false;
|
||||||
channel.cachedSignalStatus = {};
|
if (clearSelection)
|
||||||
channel.haveCachedSignalStatus = false;
|
{
|
||||||
channel.cachedSdiInfoText.clear();
|
channel.cachedSignalStatus = {};
|
||||||
channel.lastLoggedInputStatus.clear();
|
channel.haveCachedSignalStatus = false;
|
||||||
|
channel.cachedSdiInfoText.clear();
|
||||||
|
channel.lastLoggedInputStatus.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
closingDevice_ = false;
|
closingDevice_ = false;
|
||||||
emit stateChanged();
|
emit stateChanged();
|
||||||
@@ -351,10 +358,9 @@ void CaptureController::startCapture(int channelIndex)
|
|||||||
closeDeviceIfIdle();
|
closeDeviceIfIdle();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (channel.audioFormat.channels == 0 || channel.audioFormat.sample_rate == 0 ||
|
if (channel.audioFormat.sample_rate != kAudioSampleRate ||
|
||||||
(channel.audioFormat.bits_per_sample != 8 &&
|
channel.audioFormat.channels != kAudioChannelCount ||
|
||||||
channel.audioFormat.bits_per_sample != 16 &&
|
channel.audioFormat.bits_per_sample != 16)
|
||||||
channel.audioFormat.bits_per_sample != 32))
|
|
||||||
{
|
{
|
||||||
appendLog(QStringLiteral("CH%1 [APP] ERROR audio format unsupported | %2 Hz %3 ch %4-bit")
|
appendLog(QStringLiteral("CH%1 [APP] ERROR audio format unsupported | %2 Hz %3 ch %4-bit")
|
||||||
.arg(channelIndex)
|
.arg(channelIndex)
|
||||||
@@ -376,6 +382,11 @@ void CaptureController::startCapture(int channelIndex)
|
|||||||
if (st != GVFG_OK)
|
if (st != GVFG_OK)
|
||||||
{
|
{
|
||||||
reportError(QStringLiteral("gvfg_start_channel"), st, channelIndex);
|
reportError(QStringLiteral("gvfg_start_channel"), st, channelIndex);
|
||||||
|
if (st == GVFG_ETIMEOUT)
|
||||||
|
{
|
||||||
|
updateSignalStatus();
|
||||||
|
refreshSdiInfo(channelIndex);
|
||||||
|
}
|
||||||
emit previewCloseRequested(channelIndex);
|
emit previewCloseRequested(channelIndex);
|
||||||
emit stateChanged();
|
emit stateChanged();
|
||||||
closeDeviceIfIdle();
|
closeDeviceIfIdle();
|
||||||
@@ -485,6 +496,7 @@ void CaptureController::stopCapture(int channelIndex)
|
|||||||
gvfg_stop_channel(handle_, channelIndex);
|
gvfg_stop_channel(handle_, channelIndex);
|
||||||
channel.running.store(false, std::memory_order_release);
|
channel.running.store(false, std::memory_order_release);
|
||||||
channel.frameAvailable.store(false, std::memory_order_release);
|
channel.frameAvailable.store(false, std::memory_order_release);
|
||||||
|
updateSignalStatus(false);
|
||||||
channel.audioEnabled = false;
|
channel.audioEnabled = false;
|
||||||
emit previewCloseRequested(channelIndex);
|
emit previewCloseRequested(channelIndex);
|
||||||
appendLog(QStringLiteral("CH%1 Stopped capture").arg(channelIndex));
|
appendLog(QStringLiteral("CH%1 Stopped capture").arg(channelIndex));
|
||||||
|
|||||||
Reference in New Issue
Block a user