Use all GigabyteLib frame metadata
Compared with 13aad44:
- size video buffers from GVFG_VIDEO_INFO.cbBufSize instead of recalculating them in the SDK
- expose the GigabyteLib video interface through channel signal status and display it in the Qt sample
- use GVFG_VIDEO_INFO.FrameCount and GVFG_AUDIO_INFO.FrameCount as the public frame identifiers
- expose all four formatted ST 352 payload descriptions returned by GvfgStringifySdiVideoInputInfo
- remove the redundant SDK-owned video and audio frame counters and the local frame-size helper
- update the customer and frame-flow documentation to identify the GigabyteLib metadata source
This commit is contained in:
@@ -65,7 +65,12 @@ namespace
|
|||||||
? QString::fromLatin1(gvfg_pixel_format_name(signal.pixel_format))
|
? QString::fromLatin1(gvfg_pixel_format_name(signal.pixel_format))
|
||||||
: QStringLiteral("--");
|
: QStringLiteral("--");
|
||||||
const QString bit = signal.bit_depth > 0 ? QString::number(signal.bit_depth) : QStringLiteral("--");
|
const QString bit = signal.bit_depth > 0 ? QString::number(signal.bit_depth) : QStringLiteral("--");
|
||||||
return QStringLiteral("%1 %2 %3-bit").arg(resolution, format, bit);
|
const QString interfaceName = signal.video_interface == GVFG_INPUT_INTERFACE_SDI
|
||||||
|
? QStringLiteral("SDI")
|
||||||
|
: signal.video_interface == GVFG_INPUT_INTERFACE_HDMI
|
||||||
|
? QStringLiteral("HDMI")
|
||||||
|
: QStringLiteral("--");
|
||||||
|
return QStringLiteral("%1 %2 %3-bit %4").arg(resolution, format, bit, interfaceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString eventTypeText(gvfg_event_type_t type)
|
QString eventTypeText(gvfg_event_type_t type)
|
||||||
|
|||||||
@@ -102,6 +102,12 @@ extern "C"
|
|||||||
GVFG_CHANNEL_1 = 1
|
GVFG_CHANNEL_1 = 1
|
||||||
} gvfg_channel_t;
|
} gvfg_channel_t;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
GVFG_INPUT_INTERFACE_SDI = 0,
|
||||||
|
GVFG_INPUT_INTERFACE_HDMI = 1
|
||||||
|
} gvfg_video_interface_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint32_t sample_rate;
|
uint32_t sample_rate;
|
||||||
@@ -134,6 +140,10 @@ extern "C"
|
|||||||
char resolution_name[64];
|
char resolution_name[64];
|
||||||
char fps_name[24];
|
char fps_name[24];
|
||||||
char scan_name[16];
|
char scan_name[16];
|
||||||
|
char st352_format_name[64];
|
||||||
|
char st352_fps_name[24];
|
||||||
|
char st352_chroma_name[36];
|
||||||
|
char st352_bit_depth_name[24];
|
||||||
} gvfg_sdi_info_t;
|
} gvfg_sdi_info_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -144,6 +154,7 @@ extern "C"
|
|||||||
int height; /* Signal height in pixels when connected. */
|
int height; /* Signal height in pixels when connected. */
|
||||||
int pixel_format; /* gvfg_pixel_format_t value for the actual DMA payload. */
|
int pixel_format; /* gvfg_pixel_format_t value for the actual DMA payload. */
|
||||||
int bit_depth; /* Signal bit depth derived from the payload format. */
|
int bit_depth; /* Signal bit depth derived from the payload format. */
|
||||||
|
int video_interface; /* gvfg_video_interface_t reported by GigabyteLib. */
|
||||||
} gvfg_signal_status_t;
|
} gvfg_signal_status_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -161,7 +172,7 @@ extern "C"
|
|||||||
int row_stride_bytes; /* Byte distance between the starts of adjacent rows. */
|
int row_stride_bytes; /* Byte distance between the starts of adjacent rows. */
|
||||||
int pixel_format; /* gvfg_pixel_format_t value. */
|
int pixel_format; /* gvfg_pixel_format_t value. */
|
||||||
int bit_depth; /* Bits per color channel of the native frame. */
|
int bit_depth; /* Bits per color channel of the native frame. */
|
||||||
uint64_t frame_id; /* Monotonic identifier within the current channel start/stop run. */
|
uint64_t frame_id; /* GigabyteLib GVFG_VIDEO_INFO.FrameCount. */
|
||||||
uint64_t timestamp_ns; /* Monotonic SDK delivery time; same clock domain as audio. */
|
uint64_t timestamp_ns; /* Monotonic SDK delivery time; same clock domain as audio. */
|
||||||
} gvfg_frame_t;
|
} gvfg_frame_t;
|
||||||
|
|
||||||
@@ -173,7 +184,7 @@ extern "C"
|
|||||||
uint32_t channels; /* Interleaved PCM channel count. */
|
uint32_t channels; /* Interleaved PCM channel count. */
|
||||||
uint32_t bits_per_sample; /* Bits in each native PCM sample. */
|
uint32_t bits_per_sample; /* Bits in each native PCM sample. */
|
||||||
uint32_t reserved;
|
uint32_t reserved;
|
||||||
uint64_t frame_id; /* Monotonic identifier within the current start/stop run. */
|
uint64_t frame_id; /* GigabyteLib GVFG_AUDIO_INFO.FrameCount. */
|
||||||
uint64_t timestamp_ns; /* Monotonic SDK delivery time; same clock domain as video. */
|
uint64_t timestamp_ns; /* Monotonic SDK delivery time; same clock domain as video. */
|
||||||
} gvfg_audio_frame_t;
|
} gvfg_audio_frame_t;
|
||||||
|
|
||||||
|
|||||||
@@ -217,9 +217,11 @@ gvfg_status_t GigabyteCaptureSession::refresh_video_info() const
|
|||||||
signal.height = info.Height;
|
signal.height = info.Height;
|
||||||
signal.pixel_format = decode_fourcc(info.Fourcc);
|
signal.pixel_format = decode_fourcc(info.Fourcc);
|
||||||
signal.bit_depth = bit_depth(signal.pixel_format);
|
signal.bit_depth = bit_depth(signal.pixel_format);
|
||||||
|
signal.video_interface = static_cast<int>(info.VideoInterface);
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(state_mutex_);
|
std::lock_guard<std::mutex> lock(state_mutex_);
|
||||||
cached_signal_ = signal;
|
cached_signal_ = signal;
|
||||||
|
video_info_ = info;
|
||||||
}
|
}
|
||||||
return GVFG_OK;
|
return GVFG_OK;
|
||||||
}
|
}
|
||||||
@@ -283,6 +285,10 @@ gvfg_status_t GigabyteCaptureSession::get_sdi_info(gvfg_sdi_info_t &out) const
|
|||||||
strncpy_s(out.resolution_name, text.Resol, _TRUNCATE);
|
strncpy_s(out.resolution_name, text.Resol, _TRUNCATE);
|
||||||
strncpy_s(out.fps_name, text.Fps, _TRUNCATE);
|
strncpy_s(out.fps_name, text.Fps, _TRUNCATE);
|
||||||
strncpy_s(out.scan_name, text.Progressive, _TRUNCATE);
|
strncpy_s(out.scan_name, text.Progressive, _TRUNCATE);
|
||||||
|
strncpy_s(out.st352_format_name, text.St352PayloadByte0Fmt, _TRUNCATE);
|
||||||
|
strncpy_s(out.st352_fps_name, text.St352PayloadByte1Fps, _TRUNCATE);
|
||||||
|
strncpy_s(out.st352_chroma_name, text.St352PayloadByte2Chroma, _TRUNCATE);
|
||||||
|
strncpy_s(out.st352_bit_depth_name, text.St352PayloadByte3BitDepth, _TRUNCATE);
|
||||||
return GVFG_OK;
|
return GVFG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,6 +307,7 @@ gvfg_status_t GigabyteCaptureSession::get_audio_format(GigabyteAudioInfo &out) c
|
|||||||
out.bits_per_sample = audio_info_.BitsPerSample;
|
out.bits_per_sample = audio_info_.BitsPerSample;
|
||||||
out.frames_per_second = audio_info_.FramesPerSec;
|
out.frames_per_second = audio_info_.FramesPerSec;
|
||||||
out.frame_bytes = audio_info_.cbBufSize;
|
out.frame_bytes = audio_info_.cbBufSize;
|
||||||
|
out.frame_count = audio_info_.FrameCount;
|
||||||
return GVFG_OK;
|
return GVFG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,7 +345,6 @@ gvfg_status_t GigabyteCaptureSession::start_stream()
|
|||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(state_mutex_);
|
std::lock_guard<std::mutex> lock(state_mutex_);
|
||||||
frame_held_ = false;
|
frame_held_ = false;
|
||||||
frame_id_ = 0;
|
|
||||||
}
|
}
|
||||||
running_ = true;
|
running_ = true;
|
||||||
start_event_monitoring();
|
start_event_monitoring();
|
||||||
@@ -414,7 +420,13 @@ gvfg_status_t GigabyteCaptureSession::wait_frame(uint32_t timeoutMs, gvfg_frame_
|
|||||||
if (!signal.connected || signal.width == 0 || signal.height == 0)
|
if (!signal.connected || signal.width == 0 || signal.height == 0)
|
||||||
return GVFG_ETIMEOUT;
|
return GVFG_ETIMEOUT;
|
||||||
|
|
||||||
const size_t bytes = frame_size_bytes();
|
size_t bytes = 0;
|
||||||
|
uint64_t frameCount = 0;
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(state_mutex_);
|
||||||
|
bytes = video_info_.cbBufSize;
|
||||||
|
frameCount = video_info_.FrameCount;
|
||||||
|
}
|
||||||
const void *data = nullptr;
|
const void *data = nullptr;
|
||||||
gvfg_status_t status = GVFG_OK;
|
gvfg_status_t status = GVFG_OK;
|
||||||
if (zero_copy_enabled_)
|
if (zero_copy_enabled_)
|
||||||
@@ -443,7 +455,7 @@ gvfg_status_t GigabyteCaptureSession::wait_frame(uint32_t timeoutMs, gvfg_frame_
|
|||||||
std::lock_guard<std::mutex> lock(state_mutex_);
|
std::lock_guard<std::mutex> lock(state_mutex_);
|
||||||
out.data = data;
|
out.data = data;
|
||||||
out.data_size = bytes;
|
out.data_size = bytes;
|
||||||
out.frame_id = ++frame_id_;
|
out.frame_id = frameCount;
|
||||||
out.timestamp_ns = monotonic_ns();
|
out.timestamp_ns = monotonic_ns();
|
||||||
out.width = signal.width;
|
out.width = signal.width;
|
||||||
out.height = signal.height;
|
out.height = signal.height;
|
||||||
@@ -471,9 +483,11 @@ gvfg_status_t GigabyteCaptureSession::release_frame()
|
|||||||
}
|
}
|
||||||
|
|
||||||
gvfg_status_t GigabyteCaptureSession::wait_audio(
|
gvfg_status_t GigabyteCaptureSession::wait_audio(
|
||||||
uint32_t timeoutMs, void *destination, uint32_t destinationCapacity, uint32_t &outBytes)
|
uint32_t timeoutMs, void *destination, uint32_t destinationCapacity, uint32_t &outBytes,
|
||||||
|
uint64_t &outFrameCount)
|
||||||
{
|
{
|
||||||
outBytes = 0;
|
outBytes = 0;
|
||||||
|
outFrameCount = 0;
|
||||||
if (!running_ || !audio_enabled_ || !destination)
|
if (!running_ || !audio_enabled_ || !destination)
|
||||||
return reject(GVFG_ESTATE, "GigabyteLib audio read rejected");
|
return reject(GVFG_ESTATE, "GigabyteLib audio read rejected");
|
||||||
GigabyteAudioInfo format{};
|
GigabyteAudioInfo format{};
|
||||||
@@ -506,11 +520,17 @@ gvfg_status_t GigabyteCaptureSession::wait_audio(
|
|||||||
else
|
else
|
||||||
++extra_audio_event_wakes_;
|
++extra_audio_event_wakes_;
|
||||||
}
|
}
|
||||||
|
const uint32_t frameBytes = format.frame_bytes;
|
||||||
const gvfg_status_t status = from_vendor(
|
const gvfg_status_t status = from_vendor(
|
||||||
GvfgGetAudioFrame(context_, channel_, destination, format.frame_bytes), "GvfgGetAudioFrame");
|
GvfgGetAudioFrame(context_, channel_, destination, frameBytes), "GvfgGetAudioFrame");
|
||||||
if (status != GVFG_OK)
|
if (status != GVFG_OK)
|
||||||
return status;
|
return status;
|
||||||
outBytes = format.frame_bytes;
|
GigabyteAudioInfo latestInfo{};
|
||||||
|
const gvfg_status_t infoStatus = get_audio_format(latestInfo);
|
||||||
|
if (infoStatus != GVFG_OK)
|
||||||
|
return infoStatus;
|
||||||
|
outBytes = frameBytes;
|
||||||
|
outFrameCount = latestInfo.frame_count;
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(state_mutex_);
|
std::lock_guard<std::mutex> lock(state_mutex_);
|
||||||
++audio_frames_from_driver_;
|
++audio_frames_from_driver_;
|
||||||
@@ -656,16 +676,6 @@ gvfg_status_t GigabyteCaptureSession::reject(gvfg_status_t status, const char *m
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t GigabyteCaptureSession::frame_size_bytes() const
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lock(state_mutex_);
|
|
||||||
const uint32_t width = cached_signal_.width;
|
|
||||||
const uint32_t height = cached_signal_.height;
|
|
||||||
const int format = cached_signal_.pixel_format;
|
|
||||||
const size_t bytesPerPixel = format == GVFG_PIXFMT_Y210 ? 4u : 2u;
|
|
||||||
return static_cast<size_t>(width) * height * bytesPerPixel;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GigabyteCaptureSession::record_get_frame_timing(double elapsedUs)
|
void GigabyteCaptureSession::record_get_frame_timing(double elapsedUs)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(state_mutex_);
|
std::lock_guard<std::mutex> lock(state_mutex_);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ namespace gvfg::internal
|
|||||||
uint32_t bits_per_sample = 0;
|
uint32_t bits_per_sample = 0;
|
||||||
uint32_t frames_per_second = 0;
|
uint32_t frames_per_second = 0;
|
||||||
uint32_t frame_bytes = 0;
|
uint32_t frame_bytes = 0;
|
||||||
|
uint64_t frame_count = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
using GigabyteEventCallback = void (*)(gvfg_event_type_t event, void *user);
|
using GigabyteEventCallback = void (*)(gvfg_event_type_t event, void *user);
|
||||||
@@ -56,7 +57,8 @@ namespace gvfg::internal
|
|||||||
gvfg_status_t stop_stream();
|
gvfg_status_t stop_stream();
|
||||||
gvfg_status_t wait_frame(uint32_t timeoutMs, gvfg_frame_t &out);
|
gvfg_status_t wait_frame(uint32_t timeoutMs, gvfg_frame_t &out);
|
||||||
gvfg_status_t wait_audio(uint32_t timeoutMs, void *destination,
|
gvfg_status_t wait_audio(uint32_t timeoutMs, void *destination,
|
||||||
uint32_t destinationCapacity, uint32_t &outBytes);
|
uint32_t destinationCapacity, uint32_t &outBytes,
|
||||||
|
uint64_t &outFrameCount);
|
||||||
gvfg_status_t release_frame();
|
gvfg_status_t release_frame();
|
||||||
void fill_debug_stats(gvfg_debug_backend_stats_t &out) const;
|
void fill_debug_stats(gvfg_debug_backend_stats_t &out) const;
|
||||||
gvfg_status_t debug_read_register(uint32_t offset, uint32_t &outValue) const;
|
gvfg_status_t debug_read_register(uint32_t offset, uint32_t &outValue) const;
|
||||||
@@ -74,7 +76,6 @@ namespace gvfg::internal
|
|||||||
gvfg_status_t from_vendor(GVFG_HRESULT result, const char *operation) const;
|
gvfg_status_t from_vendor(GVFG_HRESULT result, const char *operation) const;
|
||||||
gvfg_status_t reject(gvfg_status_t status, const char *message) const;
|
gvfg_status_t reject(gvfg_status_t status, const char *message) const;
|
||||||
void record_get_frame_timing(double elapsedUs);
|
void record_get_frame_timing(double elapsedUs);
|
||||||
size_t frame_size_bytes() const;
|
|
||||||
|
|
||||||
ChannelErrorState &error_state_;
|
ChannelErrorState &error_state_;
|
||||||
std::wstring device_path_;
|
std::wstring device_path_;
|
||||||
@@ -85,6 +86,7 @@ namespace gvfg::internal
|
|||||||
mutable bool events_created_ = false;
|
mutable bool events_created_ = false;
|
||||||
mutable bool channel_open_ = false;
|
mutable bool channel_open_ = false;
|
||||||
mutable gvfg_signal_status_t cached_signal_{};
|
mutable gvfg_signal_status_t cached_signal_{};
|
||||||
|
mutable GVFG_VIDEO_INFO video_info_{};
|
||||||
mutable GVFG_AUDIO_INFO audio_info_{};
|
mutable GVFG_AUDIO_INFO audio_info_{};
|
||||||
uint32_t channel_ = 0;
|
uint32_t channel_ = 0;
|
||||||
bool configured_ = false;
|
bool configured_ = false;
|
||||||
@@ -99,7 +101,6 @@ namespace gvfg::internal
|
|||||||
mutable std::mutex state_mutex_;
|
mutable std::mutex state_mutex_;
|
||||||
std::vector<uint8_t> copy_buffer_;
|
std::vector<uint8_t> copy_buffer_;
|
||||||
bool frame_held_ = false;
|
bool frame_held_ = false;
|
||||||
uint64_t frame_id_ = 0;
|
|
||||||
uint64_t audio_frames_from_driver_ = 0;
|
uint64_t audio_frames_from_driver_ = 0;
|
||||||
uint64_t audio_bytes_from_driver_ = 0;
|
uint64_t audio_bytes_from_driver_ = 0;
|
||||||
uint64_t video_event_wakes_ = 0;
|
uint64_t video_event_wakes_ = 0;
|
||||||
|
|||||||
@@ -195,7 +195,6 @@ struct gvfg_channel_session_t
|
|||||||
std::lock_guard<std::mutex> lock(audioMutex);
|
std::lock_guard<std::mutex> lock(audioMutex);
|
||||||
heldAudioFrame = {};
|
heldAudioFrame = {};
|
||||||
audioFrameHeld = false;
|
audioFrameHeld = false;
|
||||||
audioFrameId = 0;
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(eventMutex);
|
std::lock_guard<std::mutex> lock(eventMutex);
|
||||||
@@ -621,11 +620,13 @@ struct gvfg_channel_session_t
|
|||||||
GigabyteAudioInfo format{};
|
GigabyteAudioInfo format{};
|
||||||
gvfg_status_t status = session->get_audio_format(format);
|
gvfg_status_t status = session->get_audio_format(format);
|
||||||
uint32_t bytes = 0;
|
uint32_t bytes = 0;
|
||||||
|
uint64_t frameCount = 0;
|
||||||
if (status == GVFG_OK)
|
if (status == GVFG_OK)
|
||||||
{
|
{
|
||||||
audioBuffer.resize(format.frame_bytes);
|
audioBuffer.resize(format.frame_bytes);
|
||||||
status = session->wait_audio(timeoutMs, audioBuffer.data(),
|
status = session->wait_audio(timeoutMs, audioBuffer.data(),
|
||||||
static_cast<uint32_t>(audioBuffer.size()), bytes);
|
static_cast<uint32_t>(audioBuffer.size()), bytes,
|
||||||
|
frameCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -636,13 +637,12 @@ struct gvfg_channel_session_t
|
|||||||
if (!running.load(std::memory_order_acquire) || bytes == 0 || bytes > audioBuffer.size())
|
if (!running.load(std::memory_order_acquire) || bytes == 0 || bytes > audioBuffer.size())
|
||||||
return reject(GVFG_ESTATE, "gvfg_read_channel_audio_frame completed after capture stopped or returned invalid data");
|
return reject(GVFG_ESTATE, "gvfg_read_channel_audio_frame completed after capture stopped or returned invalid data");
|
||||||
audioFrameHeld = true;
|
audioFrameHeld = true;
|
||||||
++audioFrameId;
|
|
||||||
out.data = audioBuffer.data();
|
out.data = audioBuffer.data();
|
||||||
out.data_size = bytes;
|
out.data_size = bytes;
|
||||||
out.sample_rate = format.sample_rate;
|
out.sample_rate = format.sample_rate;
|
||||||
out.channels = format.channels;
|
out.channels = format.channels;
|
||||||
out.bits_per_sample = format.bits_per_sample;
|
out.bits_per_sample = format.bits_per_sample;
|
||||||
out.frame_id = audioFrameId;
|
out.frame_id = frameCount;
|
||||||
out.timestamp_ns = now_ns();
|
out.timestamp_ns = now_ns();
|
||||||
heldAudioFrame = out;
|
heldAudioFrame = out;
|
||||||
}
|
}
|
||||||
@@ -753,7 +753,6 @@ struct gvfg_channel_session_t
|
|||||||
std::vector<uint8_t> audioBuffer;
|
std::vector<uint8_t> audioBuffer;
|
||||||
bool audioReadInProgress = false;
|
bool audioReadInProgress = false;
|
||||||
bool audioFrameHeld = false;
|
bool audioFrameHeld = false;
|
||||||
uint64_t audioFrameId = 0;
|
|
||||||
gvfg_audio_frame_t heldAudioFrame{};
|
gvfg_audio_frame_t heldAudioFrame{};
|
||||||
std::mutex eventMutex;
|
std::mutex eventMutex;
|
||||||
std::condition_variable eventCv;
|
std::condition_variable eventCv;
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ Audio 採用相同的 pull 與 ownership 模型:
|
|||||||
- `width`、`height`:影像尺寸。
|
- `width`、`height`:影像尺寸。
|
||||||
- `row_stride_bytes`:相鄰兩列起點的 byte 距離。
|
- `row_stride_bytes`:相鄰兩列起點的 byte 距離。
|
||||||
- `pixel_format`、`bit_depth`:原生 payload 格式。
|
- `pixel_format`、`bit_depth`:原生 payload 格式。
|
||||||
- `frame_id`:同一次 start/stop session 中單調遞增的識別值。
|
- `frame_id`:GigabyteLib `GVFG_VIDEO_INFO.FrameCount`。
|
||||||
- `timestamp_ns`:SDK monotonic delivery timestamp,與 audio 使用相同 clock domain。
|
- `timestamp_ns`:SDK monotonic delivery timestamp,與 audio 使用相同 clock domain。
|
||||||
|
|
||||||
### PCM audio
|
### PCM audio
|
||||||
@@ -179,7 +179,7 @@ Audio 採用相同的 pull 與 ownership 模型:
|
|||||||
|
|
||||||
- `data`、`data_size`:SDK-owned PCM 與本次有效 byte 數。
|
- `data`、`data_size`:SDK-owned PCM 與本次有效 byte 數。
|
||||||
- `sample_rate`、`channels`、`bits_per_sample`:此 frame 的 PCM 格式。
|
- `sample_rate`、`channels`、`bits_per_sample`:此 frame 的 PCM 格式。
|
||||||
- `frame_id`:同一次 start/stop session 中單調遞增的 audio frame ID。
|
- `frame_id`:GigabyteLib `GVFG_AUDIO_INFO.FrameCount`。
|
||||||
- `timestamp_ns`:SDK monotonic delivery timestamp,與 video 使用相同 clock domain。
|
- `timestamp_ns`:SDK monotonic delivery timestamp,與 video 使用相同 clock domain。
|
||||||
|
|
||||||
`timestamp_ns` 用於比較同一 process/session 內的 video/audio delivery timing;它
|
`timestamp_ns` 用於比較同一 process/session 內的 video/audio delivery timing;它
|
||||||
|
|||||||
@@ -48,6 +48,13 @@ register 與 DMA 實作不屬於本文件。
|
|||||||
| `GVFG_CHANNEL_0` | 0 | 裝置輸入通道 0 |
|
| `GVFG_CHANNEL_0` | 0 | 裝置輸入通道 0 |
|
||||||
| `GVFG_CHANNEL_1` | 1 | 裝置輸入通道 1 |
|
| `GVFG_CHANNEL_1` | 1 | 裝置輸入通道 1 |
|
||||||
|
|
||||||
|
### 1.4a `gvfg_video_interface_t`
|
||||||
|
|
||||||
|
| 成員 | 值 | 說明 |
|
||||||
|
| --- | ---: | --- |
|
||||||
|
| `GVFG_INPUT_INTERFACE_SDI` | 0 | GigabyteLib 回報 SDI input |
|
||||||
|
| `GVFG_INPUT_INTERFACE_HDMI` | 1 | GigabyteLib 回報 HDMI input |
|
||||||
|
|
||||||
### 1.5 `gvfg_device_info_t`
|
### 1.5 `gvfg_device_info_t`
|
||||||
|
|
||||||
由 `gvfg_enumerate_devices()` 填入。
|
由 `gvfg_enumerate_devices()` 填入。
|
||||||
@@ -56,6 +63,18 @@ register 與 DMA 實作不屬於本文件。
|
|||||||
| ------- | ----------- | --------------------------------------- |
|
| ------- | ----------- | --------------------------------------- |
|
||||||
| `name` | `char[128]` | 供 UI/log 顯示的 UTF-8、null-terminated 裝置名稱 |
|
| `name` | `char[128]` | 供 UI/log 顯示的 UTF-8、null-terminated 裝置名稱 |
|
||||||
|
|
||||||
|
### 1.5a `gvfg_device_capabilities_t`
|
||||||
|
|
||||||
|
由 `gvfg_get_device_capabilities()` 填入;`video_channel_count` 與 `has_audio`
|
||||||
|
直接來自 GigabyteLib `GVFG_DEV_INFO`。
|
||||||
|
|
||||||
|
### 1.5b `gvfg_sdi_info_t`
|
||||||
|
|
||||||
|
由 `gvfg_get_channel_sdi_info()` 填入。數值欄位直接來自
|
||||||
|
`GVFG_SDI_VIDEO_INFO`;`mode_name`、`resolution_name`、`fps_name`、`scan_name`
|
||||||
|
以及 `st352_format_name`、`st352_fps_name`、`st352_chroma_name`、
|
||||||
|
`st352_bit_depth_name` 直接來自 `GvfgStringifySdiVideoInputInfo()`。
|
||||||
|
|
||||||
### 1.6 `gvfg_signal_status_t`
|
### 1.6 `gvfg_signal_status_t`
|
||||||
|
|
||||||
由 `gvfg_get_channel_signal_status()` 填入。
|
由 `gvfg_get_channel_signal_status()` 填入。
|
||||||
@@ -68,6 +87,7 @@ register 與 DMA 實作不屬於本文件。
|
|||||||
| `height` | `int` | 連線時的輸入高度;未連線時為 0 |
|
| `height` | `int` | 連線時的輸入高度;未連線時為 0 |
|
||||||
| `pixel_format` | `int` | 實際 frame payload 的 `gvfg_pixel_format_t` 值 |
|
| `pixel_format` | `int` | 實際 frame payload 的 `gvfg_pixel_format_t` 值 |
|
||||||
| `bit_depth` | `int` | 從 payload 格式取得的每色彩 channel bit depth |
|
| `bit_depth` | `int` | 從 payload 格式取得的每色彩 channel bit depth |
|
||||||
|
| `video_interface` | `int` | GigabyteLib 回傳的 `gvfg_video_interface_t`,為 SDI 或 HDMI |
|
||||||
|
|
||||||
### 1.7 `gvfg_runtime_info_t`
|
### 1.7 `gvfg_runtime_info_t`
|
||||||
|
|
||||||
@@ -88,13 +108,13 @@ timing 屬於內部診斷資訊,不放入客戶 runtime 結構。
|
|||||||
| 欄位 | 型別 | 說明 |
|
| 欄位 | 型別 | 說明 |
|
||||||
| ------------------ | -------------- | -------------------------------------------- |
|
| ------------------ | -------------- | -------------------------------------------- |
|
||||||
| `data` | `const void *` | Copy mode 為 SDK-owned、zero-copy 為 driver-owned;release 或 stop 後失效 |
|
| `data` | `const void *` | Copy mode 為 SDK-owned、zero-copy 為 driver-owned;release 或 stop 後失效 |
|
||||||
| `data_size` | `uint64_t` | `data` 指向的總 byte 數 |
|
| `data_size` | `uint64_t` | GigabyteLib `GVFG_VIDEO_INFO.cbBufSize` 回傳的總 byte 數 |
|
||||||
| `width` | `int` | frame 寬度,單位 pixel |
|
| `width` | `int` | frame 寬度,單位 pixel |
|
||||||
| `height` | `int` | frame 高度,單位 pixel |
|
| `height` | `int` | frame 高度,單位 pixel |
|
||||||
| `row_stride_bytes` | `int` | 相鄰兩列起點間距,單位 byte;處理每列時必須使用此值 |
|
| `row_stride_bytes` | `int` | 相鄰兩列起點間距,單位 byte;處理每列時必須使用此值 |
|
||||||
| `pixel_format` | `int` | `gvfg_pixel_format_t` 值 |
|
| `pixel_format` | `int` | `gvfg_pixel_format_t` 值 |
|
||||||
| `bit_depth` | `int` | 原生 frame 每色彩 channel 的 bit depth |
|
| `bit_depth` | `int` | 原生 frame 每色彩 channel 的 bit depth |
|
||||||
| `frame_id` | `uint64_t` | 此次 start/stop run 中單調遞增的 frame ID |
|
| `frame_id` | `uint64_t` | GigabyteLib `GVFG_VIDEO_INFO.FrameCount` |
|
||||||
| `timestamp_ns` | `uint64_t` | SDK 交付時間;與 audio 共用 monotonic clock,單位 ns |
|
| `timestamp_ns` | `uint64_t` | SDK 交付時間;與 audio 共用 monotonic clock,單位 ns |
|
||||||
|
|
||||||
Caller 不得修改任何欄位再 release。SDK 會將完整 token 與目前 held frame 比對。
|
Caller 不得修改任何欄位再 release。SDK 會將完整 token 與目前 held frame 比對。
|
||||||
@@ -125,7 +145,7 @@ Driver 一次傳回多少 bytes、buffer capacity 與 block alignment 均由 SDK
|
|||||||
| `sample_rate` | `uint32_t` | 每秒 sample 數 |
|
| `sample_rate` | `uint32_t` | 每秒 sample 數 |
|
||||||
| `channels` | `uint32_t` | interleaved PCM channel 數 |
|
| `channels` | `uint32_t` | interleaved PCM channel 數 |
|
||||||
| `bits_per_sample` | `uint32_t` | 每個 PCM sample 的 bit 數 |
|
| `bits_per_sample` | `uint32_t` | 每個 PCM sample 的 bit 數 |
|
||||||
| `frame_id` | `uint64_t` | 此次 start/stop run 中單調遞增的 audio frame ID |
|
| `frame_id` | `uint64_t` | GigabyteLib `GVFG_AUDIO_INFO.FrameCount` |
|
||||||
| `timestamp_ns` | `uint64_t` | SDK 交付時間;與 video 共用 monotonic clock,單位 ns |
|
| `timestamp_ns` | `uint64_t` | SDK 交付時間;與 video 共用 monotonic clock,單位 ns |
|
||||||
|
|
||||||
與 video 相同,每個 channel 同時只能持有一個 audio frame,且 caller 不得修改
|
與 video 相同,每個 channel 同時只能持有一個 audio frame,且 caller 不得修改
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ currentIndex = -1
|
|||||||
1. 讀取 signal status。
|
1. 讀取 signal status。
|
||||||
2. 決定 width、height、pixel format。
|
2. 決定 width、height、pixel format。
|
||||||
3. 呼叫 backend `configure_stream()`。
|
3. 呼叫 backend `configure_stream()`。
|
||||||
4. 計算 `frame_size_bytes()`。
|
4. 使用 GigabyteLib `GVFG_VIDEO_INFO.cbBufSize` 作為 frame buffer size。
|
||||||
5. 清除上一份 held/read/timing state。
|
5. 清除上一份 held/read/timing state。
|
||||||
|
|
||||||
Copy mode:
|
Copy mode:
|
||||||
|
|||||||
Reference in New Issue
Block a user