Restore GVFG features missing from GigabyteLib
Compared with a04bd61:
- Restore the existing gvfg_set_channel_video_format API and the Qt sample YUY2/Y210 output-format controls with the original dual-channel Y210 restriction.
- Restore gvfg_debug_read_register, gvfg_debug_write_register, and the original gvfg_debug_get_channel_backend_stats names and fields so the established internal API remains compatible.
- Implement the three missing operations through a small in-process driver extension using the existing register read/write requests; capture, audio, events, signal queries, copy, and zero-copy paths continue to use GvfgSdk.lib.
- Mark every fallback as a GIGABYTELIB GAP and add a focused gap report requesting official format-selection and diagnostic register APIs from the GigabyteLib owner.
- Remove empty legacy backend and giga_ioctl directories without restoring giga_ioctl.dll or a second capture backend.
Validation: git diff --cached --check passed. MSVC x64 Release and Debug gvfg.dll builds passed, the Release Qt sample rebuilt and linked successfully, dumpbin confirmed all original 32 exports are present, and the Release package contains gvfg.dll without giga_ioctl.dll or private GigabyteLib files. The actual register operations, output-format switching, capture, audio, zero-copy, hot-plug, dual-channel behavior, shutdown, MinGW, and hardware behavior were not runtime-tested.
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_channel_stats_t &stats, bool signalConnected)
|
||||
QString captureStatusText(const gvfg_debug_backend_stats_t &stats, bool signalConnected)
|
||||
{
|
||||
if (!stats.session_running) return QStringLiteral("stopped");
|
||||
if (!stats.backend_running) return QStringLiteral("stopped");
|
||||
if (!signalConnected) return QStringLiteral("waiting_signal");
|
||||
if (!stats.session_capture_active) return QStringLiteral("paused");
|
||||
if (!stats.backend_capture_active) return QStringLiteral("paused");
|
||||
return QStringLiteral("streaming");
|
||||
}
|
||||
#endif
|
||||
@@ -98,11 +98,13 @@ CaptureController::~CaptureController()
|
||||
closeDevice();
|
||||
}
|
||||
|
||||
void CaptureController::setChannelOptions(int channel, bool zeroCopy, bool audioEnabled)
|
||||
void CaptureController::setChannelOptions(int channel, bool zeroCopy,
|
||||
gvfg_pixel_format_t format, 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;
|
||||
}
|
||||
|
||||
@@ -229,7 +231,7 @@ bool CaptureController::openChannel(int channel)
|
||||
{
|
||||
ChannelRuntime &runtime = channels_[channel];
|
||||
if (runtime.opened)
|
||||
return true;
|
||||
return applyOutputFormat(channel);
|
||||
if (handle_ == nullptr && !openDevice())
|
||||
return false;
|
||||
|
||||
@@ -247,6 +249,8 @@ 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_)
|
||||
@@ -256,6 +260,25 @@ bool CaptureController::openChannel(int channel)
|
||||
return true;
|
||||
}
|
||||
|
||||
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("gvfg_set_channel_video_format"), status, channel);
|
||||
return false;
|
||||
}
|
||||
appendLog(QStringLiteral("CH%1 Output format | %2 (GigabyteLib extension)")
|
||||
.arg(channel)
|
||||
.arg(format == GVFG_PIXFMT_Y210 ? QStringLiteral("Y210") : QStringLiteral("YUY2")));
|
||||
return true;
|
||||
}
|
||||
|
||||
void CaptureController::closeDevice()
|
||||
{
|
||||
if (runtimeStatusTimer_)
|
||||
@@ -633,8 +656,8 @@ void CaptureController::updateSignalStatus(bool queryHardware)
|
||||
sdkBytes = channel.audioReceivedBytes;
|
||||
appOutputBytes = channel.audioAcceptedBytes;
|
||||
}
|
||||
gvfg_debug_channel_stats_t audioStats{};
|
||||
if (gvfg_debug_get_channel_stats(handle_, channelIndex, &audioStats) == GVFG_OK)
|
||||
gvfg_debug_backend_stats_t audioStats{};
|
||||
if (gvfg_debug_get_channel_backend_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)
|
||||
@@ -679,23 +702,23 @@ void CaptureController::updateSignalStatus(bool queryHardware)
|
||||
}
|
||||
|
||||
#if GVFG_INTERNAL_DIAGNOSTICS
|
||||
gvfg_debug_channel_stats_t channelStats{};
|
||||
if (gvfg_debug_get_channel_stats(handle_, channelIndex, &channelStats) == GVFG_OK)
|
||||
gvfg_debug_backend_stats_t channelStats{};
|
||||
if (gvfg_debug_get_channel_backend_stats(handle_, channelIndex, &channelStats) == GVFG_OK)
|
||||
{
|
||||
statusLines << QStringLiteral("CH%1 Capture | status=%2 dma_errors=%3 no_frame_waits=%4")
|
||||
.arg(channelIndex)
|
||||
.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)
|
||||
.arg(static_cast<qulonglong>(channelStats.backend_dma_errors))
|
||||
.arg(static_cast<qulonglong>(channelStats.backend_wait_timeouts));
|
||||
if (channel.haveDebugBaseline && channelStats.backend_dma_errors > channel.lastDebugDmaErrors)
|
||||
{
|
||||
appendLog(QStringLiteral("CH%1 ERROR DMA failures +%2, total=%3")
|
||||
.arg(channelIndex)
|
||||
.arg(valueOrDash(channelStats.session_dma_errors - channel.lastDebugDmaErrors),
|
||||
valueOrDash(channelStats.session_dma_errors)));
|
||||
.arg(valueOrDash(channelStats.backend_dma_errors - channel.lastDebugDmaErrors),
|
||||
valueOrDash(channelStats.backend_dma_errors)));
|
||||
diagnosticProblemDetected = true;
|
||||
}
|
||||
channel.lastDebugDmaErrors = channelStats.session_dma_errors;
|
||||
channel.lastDebugDmaErrors = channelStats.backend_dma_errors;
|
||||
channel.haveDebugBaseline = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user