Simplify the SDK around GigabyteLib
Compared with 0af70a5:
- Remove the generic backend directory and legacy PCIE S2MM naming so the SDK now has a direct gvfg facade to GigabyteCaptureSession to GvfgSdk.lib structure.
- Delete the unsupported video-format setter and direct register read/write APIs instead of retaining compatibility methods that cannot be implemented by the supplied GigabyteLib interface.
- Remove output-format controls and requested-format state from the Qt sample; capture now follows the native YUY2 or Y210 format reported by GvfgGetVideoInfo.
- Eliminate the placeholder stream descriptor and allocate copy buffers from current GigabyteLib video metadata when a frame becomes available.
- Rename the internal debug stats API and fields from backend terminology to channel/session terminology, while retaining capture, audio, event, timeout, timing, and zero-copy diagnostics.
- Update source paths and documentation to describe GigabyteLib as the only lower layer and remove stale format-setting, register, and direct IOCTL guidance.
Validation: git diff --cached --check passed. MSVC x64 Release and Debug gvfg.dll builds passed, the Release Qt sample rebuilt and linked successfully, dumpbin verified the intentional 29-export API, and the Release package script produced an archive containing the sample and gvfg.dll without private GigabyteLib files or giga_ioctl.dll. No runtime capture, audio, zero-copy, hot-plug, dual-channel, shutdown, MinGW, or hardware validation was run.
This commit is contained in:
@@ -39,11 +39,11 @@ namespace
|
||||
QString boolText(int value) { return value ? QStringLiteral("yes") : QStringLiteral("no"); }
|
||||
QString valueOrDash(uint64_t value) { return QString::number(static_cast<qulonglong>(value)); }
|
||||
|
||||
QString captureStatusText(const gvfg_debug_backend_stats_t &stats, bool signalConnected)
|
||||
QString captureStatusText(const gvfg_debug_channel_stats_t &stats, bool signalConnected)
|
||||
{
|
||||
if (!stats.backend_running) return QStringLiteral("stopped");
|
||||
if (!stats.session_running) return QStringLiteral("stopped");
|
||||
if (!signalConnected) return QStringLiteral("waiting_signal");
|
||||
if (!stats.backend_capture_active) return QStringLiteral("paused");
|
||||
if (!stats.session_capture_active) return QStringLiteral("paused");
|
||||
return QStringLiteral("streaming");
|
||||
}
|
||||
#endif
|
||||
@@ -98,13 +98,11 @@ CaptureController::~CaptureController()
|
||||
closeDevice();
|
||||
}
|
||||
|
||||
void CaptureController::setChannelOptions(int channel, bool zeroCopy,
|
||||
gvfg_pixel_format_t format, bool audioEnabled)
|
||||
void CaptureController::setChannelOptions(int channel, bool zeroCopy, bool audioEnabled)
|
||||
{
|
||||
if (channel < GVFG_CHANNEL_0 || channel > GVFG_CHANNEL_1)
|
||||
return;
|
||||
channels_[channel].zeroCopy = zeroCopy;
|
||||
channels_[channel].requestedFormat = format;
|
||||
channels_[channel].requestedAudio = channel == GVFG_CHANNEL_0 && audioEnabled;
|
||||
}
|
||||
|
||||
@@ -231,7 +229,7 @@ bool CaptureController::openChannel(int channel)
|
||||
{
|
||||
ChannelRuntime &runtime = channels_[channel];
|
||||
if (runtime.opened)
|
||||
return applyOutputFormat(channel);
|
||||
return true;
|
||||
if (handle_ == nullptr && !openDevice())
|
||||
return false;
|
||||
|
||||
@@ -249,8 +247,6 @@ bool CaptureController::openChannel(int channel)
|
||||
return false;
|
||||
}
|
||||
runtime.opened = true;
|
||||
if (!applyOutputFormat(channel))
|
||||
return false;
|
||||
|
||||
appendLog(QStringLiteral("Opened device index %1 CH%2 | mode=%3")
|
||||
.arg(selectedDeviceIndex_)
|
||||
@@ -295,25 +291,6 @@ void CaptureController::closeDevice()
|
||||
emit stateChanged();
|
||||
}
|
||||
|
||||
bool CaptureController::applyOutputFormat(int channel)
|
||||
{
|
||||
if (handle_ == nullptr || !channels_[channel].opened ||
|
||||
channels_[channel].running.load(std::memory_order_acquire))
|
||||
return false;
|
||||
|
||||
const gvfg_pixel_format_t format = channels_[channel].requestedFormat;
|
||||
const gvfg_status_t status = gvfg_set_channel_video_format(handle_, channel, format);
|
||||
if (status != GVFG_OK)
|
||||
{
|
||||
reportError(QStringLiteral("set output format register"), status, channel);
|
||||
return false;
|
||||
}
|
||||
appendLog(QStringLiteral("CH%1 Output format | %2")
|
||||
.arg(channel)
|
||||
.arg(format == GVFG_PIXFMT_Y210 ? QStringLiteral("Y210") : QStringLiteral("YUY2")));
|
||||
return true;
|
||||
}
|
||||
|
||||
void CaptureController::startCapture(int channelIndex)
|
||||
{
|
||||
ChannelRuntime &channel = channels_[channelIndex];
|
||||
@@ -656,8 +633,8 @@ void CaptureController::updateSignalStatus(bool queryHardware)
|
||||
sdkBytes = channel.audioReceivedBytes;
|
||||
appOutputBytes = channel.audioAcceptedBytes;
|
||||
}
|
||||
gvfg_debug_backend_stats_t audioStats{};
|
||||
if (gvfg_debug_get_channel_backend_stats(handle_, channelIndex, &audioStats) == GVFG_OK)
|
||||
gvfg_debug_channel_stats_t audioStats{};
|
||||
if (gvfg_debug_get_channel_stats(handle_, channelIndex, &audioStats) == GVFG_OK)
|
||||
{
|
||||
statusLines << QStringLiteral("CH%1 Audio Debug | Events DMA=%2 Extra=%3 | Driver->SDK %4 frames/%5 bytes | SDK->APP %6 frames/%7 bytes | APP->Output %8 bytes")
|
||||
.arg(channelIndex)
|
||||
@@ -702,23 +679,23 @@ void CaptureController::updateSignalStatus(bool queryHardware)
|
||||
}
|
||||
|
||||
#if GVFG_INTERNAL_DIAGNOSTICS
|
||||
gvfg_debug_backend_stats_t backendStats{};
|
||||
if (gvfg_debug_get_channel_backend_stats(handle_, channelIndex, &backendStats) == GVFG_OK)
|
||||
gvfg_debug_channel_stats_t channelStats{};
|
||||
if (gvfg_debug_get_channel_stats(handle_, channelIndex, &channelStats) == GVFG_OK)
|
||||
{
|
||||
statusLines << QStringLiteral("CH%1 Capture | status=%2 dma_errors=%3 no_frame_waits=%4")
|
||||
.arg(channelIndex)
|
||||
.arg(captureStatusText(backendStats, signal.connected != 0))
|
||||
.arg(static_cast<qulonglong>(backendStats.backend_dma_errors))
|
||||
.arg(static_cast<qulonglong>(backendStats.backend_wait_timeouts));
|
||||
if (channel.haveDebugBaseline && backendStats.backend_dma_errors > channel.lastDebugDmaErrors)
|
||||
.arg(captureStatusText(channelStats, signal.connected != 0))
|
||||
.arg(static_cast<qulonglong>(channelStats.session_dma_errors))
|
||||
.arg(static_cast<qulonglong>(channelStats.session_wait_timeouts));
|
||||
if (channel.haveDebugBaseline && channelStats.session_dma_errors > channel.lastDebugDmaErrors)
|
||||
{
|
||||
appendLog(QStringLiteral("CH%1 ERROR DMA failures +%2, total=%3")
|
||||
.arg(channelIndex)
|
||||
.arg(valueOrDash(backendStats.backend_dma_errors - channel.lastDebugDmaErrors),
|
||||
valueOrDash(backendStats.backend_dma_errors)));
|
||||
.arg(valueOrDash(channelStats.session_dma_errors - channel.lastDebugDmaErrors),
|
||||
valueOrDash(channelStats.session_dma_errors)));
|
||||
diagnosticProblemDetected = true;
|
||||
}
|
||||
channel.lastDebugDmaErrors = backendStats.backend_dma_errors;
|
||||
channel.lastDebugDmaErrors = channelStats.session_dma_errors;
|
||||
channel.haveDebugBaseline = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user