DTAPI Reference - AvFifo
DTAPI Reference - AvFifo
REFERENCE
Jan 2025
1
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
Table of Contents
2
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
3
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
1. Introduction
1.1. What is the AvFifo Interface?
AvFifo, short for Audio/Video FIFO Interface, is a component of the DekTec Application Programming Interface
(DTAPI). While DTAPI offers multiple programming models, including the "input/output channel" model and the
“Matrix API” model, AvFifo introduces a third, FIFO-based model.
Designed specifically for software-based digital-TV processing applications, like video encoders and decoders,
AvFifo facilitates efficient interfacing with SMPTE 2110 and SMPTE 2022-5/6 streams through the DTA-2110
10GbE NIC (Network Interface Card) and DTA-2125 25GbE NIC.
For a comprehensive overview of DTAPI and installation instructions, refer to the "DTAPI Manual – Overview and
Data Formats", included with the DTAPI installation.
This manual focuses on the details of the AvFifo API, providing examples to help you understand and implement
the AvFifo interfacing model within your applications.
Note: Although the PTP agent is installed by default, it must be enabled manually, as outlined in the subse-
quent sections.
All timestamps in the AvFifo interface are relative to PTP time, ensuring precise synchronization for audio, video,
and ancillary data streams. The AvFifo implementation handles all time-sensitive operations, eliminating the
need for users to perform any manual time-sensitive tasks. This simplifies the process and improves overall
efficiency of the system.
4
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
<DekTec>
<PtpClockSlave Cnt="6">
<ParStrVal S="IpV6Scope" VT="2" VV="5"/>
<ParStrVal S="DelayMechanism" VT="2" VV="0"/>
<ParStrVal S="NetworkProtocol" VT="2" VV="0"/>
<ParStrVal S="PeerUnicastAddress" VT="5" VV="[Link]"/>
<ParStrVal S="DomainNumber" VT="2" VV="127"/>
<ParStrVal S="Enable" VT="4" VV="true"/>
</PtpClockSlave>
</DekTec>
The 'VV' attribute contains the value of the parameter with the attribute name 'S'. Only the 'VV' attribute may be
changed.
Changes made to the settings will come into effect following a restart of the DTAPI service.
5
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
3. AvFifo_AncTx – This code serves as an example of sending “Ancillary Data “ specified in SMPTE 2110-40
ANC.
4. AvFifo_AncRx – This code serves as an example of receiving “Ancillary Data “ specified in SMPTE 2110-
40 ANC.
For updates and additions to these examples, we recommend regularly checking the DekTec website.
6
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
2. Tutorial
2.1. Introduction
In this tutorial, we will explore a straightforward reception and transmission scenario. We will demonstrate the
process by implementing a basic receive loop using an RxFifo object and a basic transmission loop using a
TxFifo object.
Note: Error handling is omitted for simplicity and clarity; ensure to include it in your production code.
// 5. Read and process a frame from the RxFifo if one is available; otherwise, sleep briefly.
if ([Link]() > 0)
{
AvFifo::Frame* Frm{[Link]()};
ProcessReceivedFrame(Frm);
[Link](Frm);
} else
std::this_thread::sleep_for(10ms);
}
// 6. Clean up.
[Link]();
[Link]();
[Link]();
Note This code example is for illustrative purposes only and is not suitable for production use. In a production environment, it is
important to handle errors appropriately by checking return values and using try-catch blocks around sections of code that
may throw exceptions, to ensure that DTAPI operates as expected.
To use the A/V FIFO classes, instantiate a DtDevice object and attach it to the DTA-2110, following the instruc-
tions of the "DTAPI Manual – Overview and Data Formats".
7
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
Note
• Several DtDevice methods are available to attach to the hardware. The example uses
DtDevice::AttachToType() to attach to the first available DekTec adapter with the specified type number.
// 2. Declare the RxFifo object, attach to port 1 of the DTA-2110, and configure for reception.
AvFifo::RxFifo RxFifo{};
[Link](Dta2110, 1, HwOrSwPipe::PreferHwPipe);
[Link]({…});
[Link]({…});
After attaching the DtDevice object to the hardware, instantiate an RxFifo (Receive FIFO) object and attach it
to the device object. A parameter of the RxFifo::Attach() call allows specifying a preference for a hardware
or software pipe.
Starting the RxFifo instructs the hardware to begin receiving IP packets on the configured IP address and port.
When a frame (audio/video/ ancillary data unit) is received, it is written to the RxFifo and its load is incre-
mented.
// 5. Read and process a frame from the RxFifo if one is available; otherwise, sleep briefly.
if ([Link]() > 0)
{
AvFifo::Frame* Frame{[Link]()};
ProcessReceivedFrame(Frame);
[Link](Frame);
} else
std::this_thread::sleep_for(10ms);
In the main loop, check the RxFifo’s load to determine if one or more frames are available.
• If a frame is available, read it from the RxFifo, process it and return it to the Frame Memory Pool for
recycling.
• If no frame is available, sleep for a short period of time and try again.
// 6. Clean up.
[Link]();
[Link]();
[Link]();
Once the stop condition is met, stop the RxFifo, detach it from the DtDevice object, and detach the DtDevice
object from the hardware if no further actions are needed.
8
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
// 2. Declare TxFifo object, attach to port 1 of the DTA-2110, and configure for transmission.
AvFifo::TxFifo TxFifo{};
[Link](Dta2110, 1, HwOrSwPipe::PreferHwPipe);
[Link]({…});
[Link]({…});
size_t FrameSize{…}; // Compute frame size matching configuration parameters.
// 3. Initialize ToD to current time. Add 100ms to have time to create the first few frames.
DtTimeOfDay ToD{};
[Link](ToD);
ToD += 100’000’000; // 100,000,000ns = 100ms
// 6. We only write a new Frame to the TxFifo if it has space, otherwise we sleep.
if ([Link]() < [Link]())
{
// 7. Ensure frame is transmitted at the correct time by aligning to the video media grid.
ToD = AvFifo::Tod2Grid_Video(ToD, {50, 1});
// 8. Obtain a Frame from the memory pool, and assemble a video frame in it.
AvFifo::Frame* Frame{[Link](FrameSize)};
Frame->ToD = ToD;
Frame->RtpTime = AvFifo::St2110::Tod2Rtp_Video(ToD);
CreateVideoFrame(Frame);
// 9. Write the newly assembled Frame to the TxFifo for transmission.
[Link](Frame);
// 10. Advance the time-of-day (ToD) to the next frame time, which is 20ms later.
ToD += 20000000; // 20,000,000ns = 20ms
} else {
std::this_thread::sleep_for(10ms);
}
}
// 11. Break down.
[Link]();
[Link]();
[Link]();
Note This code example is for illustrative purposes only and is not suitable for production use. In a production environment, it is
important to handle errors appropriately by checking return values and using try-catch blocks around sections of code that
may throw exceptions, to ensure that DTAPI operates as expected.
9
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
Before utilizing the A/V FIFO classes, declare a DtDevice object and attach it to the hardware, in this case to a
DekTec SMPTE 2110 NIC. This step corresponds to the instructions detailed in Section 3.1 of the "DTAPI Manual
– Overview and Data Formats."
Several DtDevice methods are available for attaching to the hardware. In this example, we use
DtDevice::AttachToType(), which establishes a connection with the first available DekTec adapter that
matches the specified type number.
// 2. Declare TxFifo object, attach to port 1 of the DTA-2110, and configure for transmission.
AvFifo::TxFifo TxFifo{};
[Link](Dta2110, 1, HwOrSwPipe::PreferHwPipe);
[Link]({…});
[Link]({…});
size_t FrameSize{…}; // Compute frame size matching configuration parameters.
Once a DtDevice object attached to the hardware is available, the next step is to create a TxFifo (Transmit
FIFO) object and attach it to the DtDevice object. During the Attach call, a parameter is available to specify a
preference for a hardware or a software pipe.
// 3. Initialize ToD to current time. Add 100ms to have time to create the first few frames.
DtTimeOfDay ToD{};
[Link](ToD);
ToD += 100’000’000; // 100,000,000ns = 100ms
When writing frames to the TxFifo, timestamps are required to indicate the desired transmission time for each
frame. To ensure smooth transmission and accommodate potential OS scheduling jitter, frames should be pre-
pared and buffered in the TxFifo ahead of time. In this example, we work 100ms ahead (which could easily
be increased to, for instance, 200ms). To calculate the timestamp for the first frame to be transmitted, we obtain
the current time and add 100ms.
With the configuration complete, the TxFifo can be started. Note that starting with an empty TxFifo is valid and
will not lead to an exception. Once the first frame has been written to the TxFifo, it will be read by the AvFifo-
internal internal transmit thread and scheduled.
The main loop continues until a stop condition is detected. This condition can only be set from another thread.
// 6. We only write a new Frame to the TxFifo if it has space, otherwise we sleep.
if ([Link]() < [Link]())
{
We only write a new Frame to the TxFifo if it has space, otherwise we sleep briefly and check again.
10
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
// 7. Ensure frame is transmitted at the correct time by aligning to the video media grid.
ToD = AvFifo::Tod2Grid_Video(ToD, {50, 1});
To generate a SMPTE 2110 compliant stream, the transmission timestamp must be aligned to the video media
grid, aka “Media Clock”. The AvFifo::Tod2Grid_Video() function can perform this alignment. To be able to
do so, it needs the frame rate as an exact fraction.
// 8. Obtain a Frame from the memory pool, and assemble a video frame in it.
AvFifo::Frame* Frame{[Link](FrameSize)};
Frame->ToD = ToD;
Frame->RtpTime = AvFifo::St2110::Tod2Rtp_Video(ToD);
CreateVideoFrame(Frame);
At this stage, the application needs to create a Frame with a transmission timestamp. To achieve this, first obtain
a Frame containing an embedded frame BLOB from the TxFifo’s Frame Memory Pool. Next, set the transmis-
sion and RTP timestamps and fill the BLOB with frame data using the CreateVideoFrame() function. The Frame
is now prepared and ready to be written to the TxFifo in the subsequent step.
Note
• In CreateVideoFrame(), the application needs to set Frame->NumValidBytes to the number of valid data
bytes in the Frame, which may be less than the Frame’s size.
• The Frame obtained from the Frame Memory Pool will be returned to the AvFifo implementation in the next step.
[Link]() writes the Frame to the TxFifo. The transmit scheduling thread running in the AvFifo imple-
mentation examines the Frames written to the TxFifo and transmits a Frame when the current time matches the
Frame’s timestamp.
Note
• After a Frame is transmitted, it is returned to the Frame Memory Pool for recycling.
// 10. Advance the time-of-day (ToD) to the next frame time, which is 20ms later.
ToD += 20000000; // 20,000,000ns = 20ms
Advance the time-of-day (ToD) to the next frame time, which is 20ms later for the 50Hz frame rate used in this
example.
Once the stop condition is met, stop the TxFifo, detach it from the DtDevice object, and detach the DtDevice
object from the hardware if no further actions are needed.
11
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
3. AvFifo Concepts
3.1. Frame Memory Pool
The Frame Memory Pool is designed to optimize performance and minimize memory overhead in real-time
audio/video applications. Each RxFifo and TxFifo has its own dedicated Frame Memory Pool, ensuring effi-
cient resource management. The memory pool acts as a dynamic buffer, allocating memory for frames on
demand, and focuses on recycling frames to prevent constant memory allocation and deallocation.
Frames can only be allocated after the RxFifo or TxFifo is configured, so that the frame BLOB size is known.
In the transmit scenario, users request a Frame from the memory pool, fill it with data, and write it to the TxFifo.
Once transmitted, the Frame returns to the pool for reuse. In the receive scenario, the RxFifo acquires a Frame
from the memory pool when a frame is received. Users read the Frame from the RxFifo and return it to the
pool after processing.
The AvFifo API offers users an "observing pointer" to the frames while the memory pool retains ownership. The
memory pool releases allocated frames when the RxFifo or TxFifo is cleared, reconfigured, or detached from
the hardware.
The frame memory pool is also used for SMPTE-2110-40 Ancillary Data and SMPTE-2110-41 FastMetadata.
See section 3.4
std::bad_alloc Indicates excessive memory usage, typically resulting from allocating too much
memory for the Frame Memory Pools in the Rx/TxFifos.
std::invalid_argument Indicates that a function received an argument with a value that is outside the ex-
pected range.
12
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
dealing with SMPTE 2110 substandards not yet supported by AvFifo, or when experimenting with new or pro-
prieatary standards.
It's important to note that IP packets are transmitted using big endian byte order, while Intel CPUs typically
process data in little endian byte order. Understanding the implications of this difference is crucial, and this
section aims to discuss the ramifications of this contrast.
In this type of diagram, the leftmost bit, labeled 0, is the most significant bit. When a multi-byte integer is
transmitted, the most significant byte is transmitted first.
Labeling the bits in little endian order enables clarity in bit numbering. However, the byte ordering remains big
endian. If, for example, byte 1 and 2 constitute a 16-bit integer in network byte order, the high and low order
bytes should be swapped to get the same 16-bit value in little endian.
13
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
As an example, let’s extract the line number from the ancillary header defined in SMPTE 2110-40. This header
is composed of big-endian fields and will appear in memory as follows, adopting the little-endian bit numbering
scheme discussed earlier:
|7 0|15 8|22 16|31 23|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|C| Line_Number | Horizontal_Offset |S| StreamNum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| DID | SDID | Data_Count |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Bits 6 to 0 of byte 0 contain bits 10 to 4 of the Line Number, while byte 1 holds bits 3 to 0. The line number can
be reconstructed using the following code:
struct Smpte2110_40_Header
{
unsigned LineNumberH : 7;
unsigned C : 1;
unsigned HorizontalOffsetH : 4;
unsigned LineNumberL : 4;
unsigned HorizontalOffsetL : 8;
unsigned StreamNum : 7;
unsigned S : 1;
// Etc.
};
This approach is considered cleaner as it reduces the need for explicit bitwise operations and value shifting,
resulting in more readable code. However, the portability of code utilizing bit fields may be compromised due
to differences in how compilers or platforms handle them.
Consider the specific requirements of your project and any portability concerns when deciding whether to use
bit fields or alternative bitwise operations.
Instead of using the RAW mode for SMPTE-2110-40, you can use the type-specific class for transmitting and
receiving Ancillary Data as described in the following section. The data is encapsulated and extracted by the
AvFifo itself and you don’t need to handle the RAW payload headers.
14
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
The following table gives an overview of the type-specific classes and ‘frame’ types that are available in the
AvFifo.
15
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
Values
Ok
The IP link is operational and functioning correctly.
LinkDown
The network link is completely down, possibly due to a disabled network port.
MulticastFail
There has been a failure in registering the multicast address.
ResolveFail
There has been a failure in resolving the destination MAC address, which may be due to a non-existent
IP address.
Unplugged
The network cable is disconnected or unplugged.
Remarks
• Use function FifoStatusToMessage() for translating a FifoStatus value into a human-readable string,.
This function will return a short descriptive string corresponding to the FifoStatus value.
• Always check the status of the IP link and handle different statuses appropriately in your code to ensure a
smooth network operation.
16
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
Values
Auto
DTAPI chooses a suitable pipe type.
ForceHwPipe
Forces the usage of a hardware pipe.
PreferHwPipe
Prefers the usage of a hardware pipe, but accepts a software pipe if no hardware pipe is available.
UseSwPipe
Use software pipe, bypassing any available hardware pipes.
Remarks
For handling audio and ancillary data, it is recommended to use a software pipe, as these types of data generally
have lower bandwidth requirements compared to high-resolution video data. By delegating audio and ancillary
data processing to software pipes, you can reserve the hardware pipes for more demanding video processing
tasks, thus ensuring efficient utilization of the available resources on the board.
17
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
enum IpProtocolVersion
Enumerates the available IP protocol versions supported by the A/V FIFO interface.
enum class IpProtocolVersion
{
IPv4, // IP protocol version 4 - 32-bit addresses.
IPv6 // IP protocol version 6 - 128-bit addresses.
};
Values
IPv4
IP protocol version 4. IPv4 uses 32-bit addresses.
IPv6
IP protocol version 6. IPv6 uses 128-bit addresses. In addition to a larger address space, IPv6 also includes
improvements to security, quality of service (QoS), and other enhancements compared to IPv4.
Remarks
18
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
enum IpTransportProtocol
Selects between RTP-over-UDP and plain UDP without RTP.
enum class IpTransportProtocol
{
Rtp, // RTP-over-UDP.
Udp // UDP. Data is encapsulated in UDP without RTP.
};
Values
Rtp
RTP-over-UDP transport protocol.
Udp
Plain UDP transport protocol without RTP.
Remarks
19
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
enum RxFifoOverflowStrategy
Enumerates different strategies to manage situations in which the AvFifo API receives a frame while the RxFifo
is already at maximum capacity, unable to store additional frames.
enum class RxFifoOverflowStrategy
{
DropFrame, // When the RxFifo is full: Drop the received frame.
ThrowException // When the RxFifo is full: Throw exception.
};
Values
DropFrame
Indicates a ‘strategy’ to discard the most recently received frame when the RxFifo is full. This strategy is
suitable for applications that can withstand occasional loss of frames. For instance, it could be useful in
viewer or multiviewer applications, where occasional frame loss does not significantly disrupt the user
experience.
ThrowException
Indicates a ‘strategy’ to throw an exception when the RxFifo is full while a new frame has been received.
The exception is not immediately thrown at the time of overflow, but rather at the first subsequent user
call to the RxFifo::GetStatus() method. This strategy is intended for real-time applications where
dropping a frame could disrupt processing and lead to synchronization issues. Normally, overflow should
not occur in such applications. If an overflow does occur, this strategy allows for immediate detection and
suggests that the application should be restarted to regain synchronized processing.
Remarks
• The DropFrame strategy is appropriate for applications where the occasional loss of frames is acceptable.
The ThrowException strategy is more suitable for real-time applications that can't afford to lose frames.
• In either case, it is crucial to implement measures to mitigate the impact of the selected strategy on your
application. If the DropFrame strategy is used, consider notifying the user when a frame has been dropped.
With the ThrowException strategy, ensure your application has sufficient exception handling mechanisms
in place to prevent abrupt terminations and to handle the restart process smoothly.
20
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
enum St2022::FecMode
Specifies the operating mode of SMPTE 2022-1 Forward Error Correction (FEC) for a stream, indicating whether
it is enabled or disabled. FEC appends error-correction bytes to the transmitted data, enabling the receiver to
detect and correct transmission errors, thus enhancing communication reliability and robustness.
enum class FecMode
{
Disable, // FEC is disabled.
Enable // FEC is enabled: Tx adds FEC bytes; Rx: decodes FEC
// bytes if present and corrects data as needed.
};
Values
Disabled
Indicates FEC is disabled. No SMPTE 2022-1 FEC bytes will be added during transmission. On reception,
FEC data, even if present, will not be decoded.
Enabled
Indicates FEC is enabled, allowing the stream to utilize SMPTE 2022-1 FEC's error detection and correction
capabilities. With FEC enabled, FEC bytes are added during transmission, and during reception FEC bytes
are decoded and data is corrected as needed.
Remarks
21
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
enum St2022::LinkMode
Enumerates the SMPTE 2022-7 link modes, allowing the selection between a single link and dual-link mode.
The dual-link mode provides “seamless protection switching”, ensuring high reliability and redundancy in the
transmission of professional media streams over IP networks.
enum class LinkMode
{
Single, // Single link mode, uses a single network path.
Dual, // SMPTE 2022-7 dual-link mode, provides redundancy.
};
Values
Single
Single link mode, where the stream is transmitted over a single network path. This mode offers simplicity
and lower overhead but lacks redundancy, making it more vulnerable to network failures and other issues.
Dual
SMPTE 2022-7 dual-link mode, which uses two separate network paths for data transmission. This mode
offers redundancy and seamless protection switching, allowing the receiver to switch between the two
paths without interrupting the media stream. This ensures high reliability and resilience to network issues.
Remarks
22
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
enum St2110::AudioFormat
Enumerates the supported SMPTE 2110 audio formats, providing options for different bit depths and byte orders
of Pulse Code Modulation (PCM) audio, as well as raw audio data.
enum class AudioFormat
{
L16BE, // 16-bit PCM, big endian byte order.
L24BE, // 24-bit PCM, big endian byte order.
Raw
};
Values
L16BE
Indicates 16-bit PCM audio with a big endian byte order.
L24BE
Indicates 24-bit PCM audio with a big endian byte order. This format offers higher audio quality and
dynamic range compared to 16-bit PCM, at the cost of increased data size.
Raw
Indicates raw audio data without any specific formatting, providing flexibility for handling custom or non-
standard audio formats.
When working with raw audio data, additional processing or conversion may be necessary to interpret or
process the audio correctly.
Remarks
23
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
enum St2110::PackingMode
Enumerates the SMPTE 2110 video packing modes.
enum class PackingMode
{
General, // Only pgroup size restriction.
Block // Each packet must contain a multiple of 180 bytes.
};
Values
General
In the General packing mode, there are no specific restrictions on the packet size, except that it must
adhere to the packet group (pgroup) size limitation. This mode offers flexibility in packet size.
Block
In the Block packing mode, each packet must contain a multiple of 180 bytes. This mode ensures a
consistent and predictable packet size.
Remarks
24
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
enum St2110::RxFrameFormat
Enumerates the supported pixel formats for incoming SMPTE 2110 video.
Used to specify the pixel format on the line when configuring the AvFifo::RxFifo, so that AvFifo can assume
that the video has the specified format.
enum class RxFrameFormat
{
Raw, // Raw underlying format without any conversion.
Uyvy422_8b, // 8-bit UYVY packed pixel format.
Uyvy422_10b, // 10-bit packed UYVY pixel format.
Uyvy422_10b_to_8b, // 10-bit packed UYVY converted to 8-bit UYVY.
Yuv422p_8b // 8-bit planar YUV (3 planes: Y,U,V).
};
Values
Raw
Specifies that the raw video data without any conversion should be put in the RxFifo.
Uyvy422_8b
Specifies an 8-bit UYVY packed pixel format, where the chroma and luma components are interleaved.
Uyvy422_10b
Specifies a 10-bit packed UYVY pixel format with higher color depth compared to the 8-bit format.
Uyvy422_10b_to_8b
Represents a 10-bit packed UYVY pixel format on the line. When the video data is received by the RxFifo,
it is first converted to an 8-bit UYVY format by DTAPI, for faster and more convenient processing.
Yuv422p_8b
Specifies an 8-bit planar YUV format with separate planes for Y, U, and V components.
Remarks
The St2110::RxFrameFormat enumeration specifies the pixel format of incoming SMPTE 2110 video streams.
This ensures that AvFifo::RxFifo processes the video data using the correct format.
25
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
enum St2110::Scheduling
Enumerates the SMPTE 2110 packet scheduling method.
enum class Scheduling
{
Linear, // Packets are transmitted evenly spaced in time.
Gapped // Packets are sent with variable gaps between them.
};
Values
Linear
In the Linear scheduling method, packets are transmitted at evenly spaced time intervals. This approach
ensures a consistent and predictable transmission rate.
Gapped
In the Gapped scheduling method, packets are transmitted with variable gaps between them. This ap-
proach allows for more flexibility in packet transmission.
Remarks
26
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
enum St2110::TxFrameFormat
Enumerates the supported pixel formats for transmitting SMPTE 2110 video. The AvFifo::TxFifo class assumes
that the video frame data supplied by the application adheres to one of these formats.
enum class VideoScanning
{
Uyvy422_8b, // 8-bit UYVY pixel format.
Uyvy422_10b // 10-bit packed UYVY pixel format.
};
Values
Uyvy422_8b
Specifies an 8-bit UYVY packed pixel format, where the chroma and luma components are interleaved.
Uyvy422_10b
Specifies a 10-bit packed UYVY pixel format with higher color depth compared to the 8-bit format.
Remarks
27
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
enum St2110::VideoScanning
Enumerates the supported video scanning modes for received and transmitted video.
enum class VideoScanning
{
Progressive, // Full frames, no separation in odd and even lines.
Interlaced, // Alternating odd lines of a frame are placed in a
// field, followed by a field with the even lines of
// the next frame.
PsF // Each frame is split into 2 fields, one containing
// odd lines, another containing even lines.
};
Values
Progressive
Each frame is transmitted in its entirety.
Interlaced
The odd lines of a frame are placed in a field, followed by placing the even lines of the next frame in the
next field. This alternates between odd and even lines of consecutive frames.
PsF
Progressive video is transmitted as Interlaced video, but with double the field rate. Each frame is split into
two fields, one containing the odd lines, and another containing the even lines.
Remarks
28
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
Exceptions
The AvFifo exception classes are all derived from the exceptions defined in the C++ standard library (std).
Exceptions
Exception Derived from std:: Meaning
DriverError runtime_error Occurs when the AvFifo implementation calls the network or PCIe
driver, signaling an issue with the driver. To resolve, check driver
version and update if necessary.
HardwarePipe runtime_error Signals that a hardware pipe is unavailable, potentially because all
Unavailable hardware pipes are currently in use by this or other processes.
InvalidFormatError runtime_error Occurs when a user writes a Frame to the TxFifo with a format
that doesn't comply with the configured format. This points to an
error in the code creating Frames.
OverflowError runtime_error Occurs when the AvFifo receive thread has a new Frame available,
but the RxFifo has reached its maximum capacity. Since the re-
ceive thread cannot throw exceptions, this error is signaled from
RxFifo::GetStatus().
SchedulingError runtime_error Occurs when the AvFifo transmit thread encounters an invalid
timestamp that is too far in the future or the past. Since the trans-
mit thread cannot throw exceptions, this error is signaled from
TxFifo::GetStatus().
invalid_argument logic_error Occurs when an AvFifo method receives an argument with an in-
appropriate or invalid value.
Members
what()
Returns a C-style string representing a human-readable error message describing the exception.
Remarks
• All AvFifo exceptions are derived from std::exception and support the what() function.
29
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct BlobMetadata
Encapsulates metadata needed for allocating frame BLOBs. This metadata is used by RxFifo and TxFifo ob-
jects whenever a new frame needs to be allocated. The struct provides parameters for setting alignment and
additional space requirements for the BLOB.
struct BlobMetadata
{
int Alignment{32}; // Address alignment (e.g. 32 = 32-byte alignment).
int ExtraSize{0}; // Extra bytes allocated at the end of the BLOB.
};
Members
Alignment
Sets the alignment of the start address of the frame BLOB. The alignment is defined as the number of
bytes to which the start address of the BLOB must align. For instance, an alignment of 32 means that the
BLOB's start address will be a multiple of 32 bytes. The alignment value must be a power of 2.
ExtraSize
Defines the additional number of bytes that should be allocated at the end of the BLOB. This extra space
is typically utilized to facilitate algorithms that process data in groups of pixels, e.g. with SSE/AVX instruc-
tions. By allocating extra bytes, these algorithms can safely operate without the risk of accessing or over-
flowing into memory space beyond the allocated BLOB. ExtraSize defaults to zero, indicating no addi-
tional bytes are allocated by default.
Remarks
• BlobMetadata enables customized memory management for frame BLOBs. It's crucial to correctly set
Alignment and ExtraSize to ensure efficient and safe memory operations.
30
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct ExactRatio
Represents an exact rational number as a fraction with a numerator and a denominator. It's useful for precise
representation and manipulation of fractional frame rates, such as 29.97 (represented exactly as 30000/1001),
and helps avoiding rounding errors from floating-point approximations.
struct ExactRatio
{
int Numerator{-1}; // Represents the numerator of the rational number.
int Denominator{-1}; // Represents the denominator of the rational number.
};
Members
Numerator
Stores the integer value of the numerator part of the rational number.
Denominator
Stores the integer value of the denominator part of the rational number.
Remarks
• Using ExactRatio helps preventing synchronization issues over time by providing exact fractional frame rate
representations, avoiding floating-point approximations.
31
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct IpPars
Defines IP parameters for transmission or reception of SMPTE 2110 and SMPTE 2022 streams, including IP
address, port, and various optional settings to customize and optimize communication.
struct IpPars
{
array<uint8_t, 16> IpAddr{}; // IPv4 or IPv6 address.
IpProtocolVersion IpVersion{IPv4}; // IP protocol version.
int Port{-1}; // IP port number.
vector<IpSrcFlt> SrcFlt{}; // Optional SSM filter.
int DiffServ{34 << 2}; // Differentiated service field.
array<uint8_t, 16> Gateway{}; // Optional gateway address.
int RtpPayloadType{0}; // RTP payload packet type.
int TimeToLive{64}; // Time to live (TTL) value.
IpTransportProtocol TransportProtocol{Udp};
struct {
int Id{0}; // ID for network segmentation.
int Priority{0}; // Priority for traffic prioritization.
} Vlan; // VLAN parameters.
};
Members
IpAddr
Holds the IP address, either IPv4 or IPv6.
IpVersion
Specifies the IP protocol version, either IPv4 or IPv6.
Port
Defines the IP port number.
SrcFlt
Optional source-specific multicast (SSM) filter to manage incoming multicast traffic. The filter consists of
a vector of IP addresses/port numbers to choose which sources are allowed.
DiffServ
Sets the Differentiated Services Field (DS Field) value for Quality of Service (QoS) purposes.
Gateway
Optional gateway address for routing purposes.
RtpPayloadType
Defines the payload type that will be set in the RTP packet.
TimeToLive
Specifies the Time to Live (TTL) value for IP packets during transmission.
TransportProtocol
Indicates the transport protocol to be used, either UDP or RTP.
Vlan
Contains VLAN parameters, including the VLAN ID and priority for network segmentation and traffic
prioritization.
Remarks
32
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct IpSrcFilt
Defines the address filter for source-specific multicast, allowing control over incoming multicast traffic based on
the source IP address and port.
struct IpSrcFilt
{
array<uint8_t, 16> IpAddr{}; // 4 or 16 address bytes representing
// the IPv4 or IPv6 source address.
int Port{-1}; // Source port number for filtering.
};
Members
IpAddr
Holds the source IP address for the multicast traffic filter. The array can contain either 4 bytes for an IPv4
address or 16 bytes for an IPv6 address.
Port
Specifies the source port number for filtering the multicast traffic. By setting a specific port, the filter will
only allow multicast traffic from the source IP address and the specified port.
Remarks
Utilizing the IpSrcFilt struct, you can define a source-specific multicast (SSM) filter to enhance control over in-
coming multicast traffic. SSM allows you to accept data exclusively from specific sources, based on the source IP
address and port number.
33
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct RxStatistics
Stores reception statistics as a structure containing several counter values.
struct RxStatistics
{
int FramesOk{0}; // Number of correctly received frames.
int FramesIncomplete{0}; // Number of frames with missing IP packets.
int FramesSizeError{0}; // Number of frames with unexpected size.
int Gaps{0}; // Number of discontinuities in complete frames.
int IpPacketErrors{0}; // Number of IP packets with corrupted headers.
int DroppedFrames{0}; // Number of dropped frames due to FIFO full.
int SyncErrors{0}; // Number of out-of-sync errors.
};
Members
FramesOk
Counts the number of correctly received frames.
FramesIncomplete
Counts the number of frames with missing IP packets.
FramesSizeError
Counts the number of frames with unexpected size.
Gaps
Counts the number of frames with discontinuities in the RTP sequence numbers at the start of a new frame
(after a frame end is detected).
IpPacketErrors
Counts the number of IP packets with an unrecognized header or with a syntax error in the header.
DroppedFrames
Counts the number of frames dropped because the receive FIFO was full.
SyncErrors
Counts the number of out-of-sync errors.
Remarks
All statistics will be reset when the RxFifo::Start function is called. This ensures that the statistics only reflect
the data received since the last time the RxFifo was started, providing an accurate characterization of the current
reception process.
34
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct TxStatistics
Stores reception statistics as a structure containing several counter values.
struct TxStatistics
{
int FramesOk{0}; // Number of frames transmitted.
};
Members
FramesOk
Counts the number of transmitted frames.
Remarks
All statistics will be reset when the TxFifo::Start function is called. This ensures that the statistics only reflect
the data received since the last time the TxFifo was started, providing an accurate characterization of the current
reception process.
35
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct VideoSize
Represents the dimension of a video signal in number of pixels.
struct VideoSize
{
int Width{-1}; // The width of the video, in pixels.
int Height{-1}; // The height of the video, in pixels.
};
Members
Width
The width of the video, in pixels. Initialized to -1 to indicate that it hasn't been set yet.
Height
The height of the video, in pixels. Initialized to -1 to indicate that it hasn't been set yet.
Remarks
36
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct YuvPlanes
Contains pointers and sizes for 8-bit [Link] YUV formatted video data in a Frame, assuming that the video format
is RxFrameFormat::Yuv422p_8b. This struct is returned by Frame::Yuv422P_8b_GetPlanes.
struct YuvPlanes
{
uint8_t* Y{nullptr}; // Pointer to the Y plane (luminance).
uint8_t* U{nullptr}; // Pointer to the U plane.
uint8_t* V{nullptr}; // Pointer to the V plane.
int SizeY{0}; // Size of the Y plane in bytes.
int SizeU{0}; // Size of the U plane in bytes.
int SizeV{0}; // Size of the V plane in bytes.
};
Members
Y
A pointer to the start of the Y plane, which contains luminance samples.
U
A pointer to the start of the U plane, which contains chrominance samples representing the blue color
difference.
V
A pointer to the start of the V plane, which contains chrominance samples representing the red color
difference.
SizeY
The size of the Y plane in bytes, indicating the amount of memory allocated for the luminance data.
SizeU
The size of the U plane in bytes, indicating the amount of memory allocated for the blue color difference
(U) data.
SizeV
The size of the V plane in bytes, indicating the amount of memory allocated for the red color difference
(V) data.
Remarks
37
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct St2022::RxConfig
Configures the reception of an ST2022-5/6 stream.
struct RxConfig
{
bool EnableFecDecoding{false}; // Enables FEC decoding.
struct {
IpPars IpParsLink2; // IP parameters for redundant link if
// ST2022-7 mode is 'Dual'.
LinkMode Mode{Single}; // Single or dual link.
DtIpProfile Profile; // Maximum bitrate and maximum skew.
} St2022_7;
};
Members
EnableFecDecoding
Enables or disables FEC decoding. If false, FEC decoding is disabled even if FEC packets are present.
IpParsLink2
IP parameters for the redundant link if ST2022-7 Mode is LinkMode::Dual. Note that parameters of the
main link can be specified with RxFifo::SetIpPars.
Mode
Single link (no network redundancy), or dual link (network redundancy).
Profile
Configuration: Maximum bitrate and maximum skew between path 1 and path 2.
Remarks
38
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct St2022::TxConfig
Configures the transmission of an SMPTE 2022-5/6 stream.
struct TxConfig
{
int VideoStandard{-1}; // DTAPI_VIDSTD_...
int TrOffset{-1}; // PTP transmit time offset.
int PayloadSize{-1};
St2022::FecMode FecMode{Disable}; // Add FEC bytes?
struct {
IpPars IpParsPath2; // IP parameters for redundant link.
LinkMode Mode{Single}; // Single or dual link mode.
} St2022_7; // SMPTE 2022-7 parameters.
};
Members
VideoStandard
Specifies the video standard to be encoded, see the DTAPI_VIDSTD_... definitions.
TrOffset
The PTP (Precision Time Protocol) transmit time offset with respect to the most recent integer multiple of
the time period between consecutive frames of video at the prevailing frame rate, starting from the EPOCH
time.
If the value is -1, a default value is used.
PayloadSize
Specifies the size of the payload for the SMPTE 2022 stream. If the value is -1, the default size is used.
FecMode
Configures the Forward Error Correction (FEC) mode for the transmission. Possible values are defined in
the St2022::FecMode enumeration.
St2022_7
Contains the SMPTE 2022-7 parameters, including:
IpParsPath2
Specifies the IP parameters for the redundant link when the SMPTE 2022-7 mode is set to 'Dual'.
Mode
Determines the link mode for the SMPTE 2022-7 transmission. Possible values are defined in the
St2022::LinkMode enumeration: Single or Dual.
Remarks
39
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct St2110::AncId
Identifies an ANC packet with the corresponding DID and optional SDID.
struct AncId
{
uint8_t Did{0}; // Data identifier
optional<uint8_t> Sdid; // Secondary Data identifier if applicable.
};
Members
Did
Specifies the data identifier of an ANC packet used for indicating a specific ANC packet type.
Sdid
If Did is less than 0x80, the Did in combination with the secondary data identifier (Sdid) is used for
identifying the ANC packet type.
Remarks
40
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct St2110::AncLocation
Identifies the location of the ANC packet in the corresponding video frame.
struct AncLocation
{
bool IsColorDiff{false}; // Is located in the color difference data channel.
int LineNumber{0x7FF}; // SDI line number
int HorizontalOffset{0xFFF}; // Horizontal offset relative to the SAV
Members
IsColorDiff
If true, the ANC packet is located in the color difference data channel. Otherwise, it is located in the luma
data channel, originates from an SD signal, or comes from a source without specific luma or color differ-
ence data channels.
LineNumber
Either the SDI line number or:
0x7FF: No specific location.
0x7FE: Any line in the range from the second line after the line specified for switching, as defined in
SMPTE RP 168 [RP168], to the last line before active video, inclusive.
0x7FD: A line number larger than can be represented in 11-bits.
HorizontalOffset
Either the horizontal offset in 10-bit words relative to the SAV or:
0xFFF: No specific offset.
0xFFE: Within HANC data space.
0xFFD: Within VANC data space.
0xFFC: An offset larger than can be represented in 12-bits.
Remarks
41
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct St2110::RxConfigAnc
Configures the reception parameters of an SMPTE 2110-40 ANC stream.
struct RxConfigAnc
{
vector<AncId> Filter; // Only receive ANC packets specified in this filter.
bool IncluseUserWords{true}; // Return the user data words(UDW)
bool IncluseRawData{false}; // Return DID,SDID,CNT,UDW[CNT] and checksum.
};
Members
Filter
A user specified filter to return only specific ANC packet types specified in the filter. If the filter is empty,
all ANC packets received are returned.
If the filter is not empty, only ANC packets with correct DID/SDID parity bits are filtered out.
IncludeUserWords
true: Returns the 10-bit user data words (UDW) in the RxAncFrame.
IncludeRawData
true: Returns the 10-bit DID,SDID,CNT, UDW[CNT] and checksum in the RxAncFrame.
Remarks
The St2110::RxConfigAnc struct is used to set up and configure the reception parameters for an SMPTE 2110-
40 ANC stream using the St2110::RxFifoAnc class.
42
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct St2110::RxConfigAudio
Configures the reception parameters of an SMPTE 2110 audio stream.
struct RxConfigAudio
{
AudioFormat Format{Raw}; // Specifies the audio format.
int SampleRate{48000}; // Defines the audio sample rate in Hz.
};
Members
Format
Represents the audio format used for the SMPTE 2110 audio stream. It can be one of the following: 16-bit
PCM, 24-bit PCM, or raw. The default value is set to AudioFormat::Raw.
SampleRate
Defines the audio sample rate for the SMPTE 2110 audio stream, expressed in Hertz (Hz). The default
sample rate is set to 48,000 Hz.
Remarks
The St2110::RxConfigAudio struct is used to set up and configure the reception parameters for an
SMPTE 2110 audio stream.
43
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct St2110::RxConfigFastMetadata
Configures the reception parameters of an SMPTE 2110-41 stream.
struct RxConfigFastMetadata
{
vector<uint32_t> Filter; // Type filter for regular packets
vector<uint32_t> SegFilter; // Type filter for segmented packets
};
Members
Filter
A user specified filter to return only the FastMetadata items with the types specified in this filter.
SegFilter
A user specified filter to return only the FastMetadata items with the types specified in this filter. The
FastMetadata with these types uses the Simple Object Segmentation Method as described in the SMPTE-
2110-41 specification. All segments are reassembled by the AvFifo and the complete reassembled Appli-
cation object is returned.
Remarks
The St2110::RxConfigFastMetadata struct is used to set up and configure the reception parameters for an
SMPTE 2110-41 stream using the St2110::RxFifoFastMetadata class.
If both filters are empty, all packets received are returned as regular packets. If the Simple Object Segmentation
Method is used for some item types, the user application should reassemble the Application object by itself.
44
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct St2110::RxConfigRaw
Configures the parameters for the reception of raw SMPTE 2110 payload data using Frame structs. It facilitates
a flexible interface for raw data extraction, so that users have access to all data fields. Optionally, the raw frame
data can include the RTP header.
struct RxConfigRaw
{
bool IncludeRtpHeader{false}; // RTP header included in payload?
int MaxRate{-1}; // Max expected rate (bytes per second).
};
Members
IncludeRtpHeader
Determines whether the RTP header will be included in the frame data.
MaxRate
Specifies the maximum expected data rate, in bytes per second. This rate is used to set the default size of
the shared buffer. Users are required to replace the default value of -1 with a valid rate; failure to do so
will result in an error.
Remarks
• The RxConfigRaw struct is constructed for usage scenarios that require direct access to raw SMPTE 2110
data.
• Raw mode can be used to receive SMPTE 2110-40 ancillary data. Refer to §3.3 for an explanation and
example of the usage of raw mode.
• Proper configuration of the MaxRate field is crucial to correctly dimension the shared buffer.
45
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct St2110::RxConfigVideo
Configures the parameters for receiving an SMPTE 2110 video stream.
struct RxConfigVideo
{
RxFrameFormat Format{Raw}; // Specifies the video format.
};
Members
Format
Represents the pixel format of the incoming SMPTE 2110 video stream. It can be one of the following: 8-
bit UYVY, 10-bit packed UYVY, 10-bit packed UYVY converted to 8-bit UYVY, or the raw underlying format
without any conversion. The default value is set to RxFrameFormat::Raw.
Remarks
The St2110::RxConfigVideo struct is used to set up and configure the parameters for receiving an SMPTE
2110 video stream through a RxFifo (RxFifo).
46
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct St2110::TxConfigAnc
Configures the parameters for transmitting a SMPTE 2110-40 ANC stream
struct TxConfigAnc
{
St2110::VideoScanning VideoScanning{Progressive};
};
Members
VideoScanning
Sets the scanning mode used for the video transmission belonging to this ANC stream. Options include
Progressive, Interlaced, and PsF (progressive segmented frame).
Remarks
The St2110::TxConfigAnc struct is used to set up and configure the transmission parameters for a SMPTE
2110-40 ANC stream. It’s used with the St2110::TxFifoAnc class.
47
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct St2110::TxConfigAudio
Configures the parameters for transmitting an SMPTE 2110 audio stream.
struct TxConfigAudio
{
AudioFormat Format{L16BE}; // Audio format.
int NumChannels{2}; // Number of channels.
int NumSamplesPerIpPacket{-1}; // Number of samples per IP packet.
int SampleRate{48000}; // Defines the audio sample rate in Hz.
};
Members
Format
Defines the audio format used for the SMPTE 2110 audio stream. It can be one of the following: 16-bit
PCM, 24-bit PCM, or raw. The default value is set to AudioFormat::Raw.
NumChannels
Defines the number of audio channels. The default value is 2 for stereo audio.
NumSamplesPerIpPacket
Defines the number of samples packaged per IP packet.
SampleRate
Defines the audio sample rate for the SMPTE 2110 audio stream, expressed in Hertz (Hz). The default
sample rate is set to 48,000 Hz.
Remarks
The St2110::TxConfigAudio struct is used to set up and configure the transmission parameters for an SMPTE
2110 audio stream.
48
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct St2110::TxConfigFastMetadata
Configures the transmission parameters of an SMPTE 2110-41 stream.
struct TxConfigFastMetadata
{
};
Members
Remarks
The St2110::TxConfigFastMetadata struct is used to set up and configure the transmission parameters for
an SMPTE 2110-41 stream using the St2110::TxFifoFastMetadata class.
At this moment, nothing needs to be configured, and all frame specific configuration can be set in the
FastMetadataFrame itself.
49
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct St2110::TxConfigRaw
Configures the parameters for transmitting raw SMPTE 2110 payload data. This mode gives users the flexibility
to fully customize the contents of the payload. Users can choose to supply their own RTP header or allow the
AvFifo API to generate it automatically.
struct TxConfigRaw
{
bool CustomRtpHeader{false}; // RTP header in payload?
int MaxRate{-1}; // Maximum rate in bytes per second.
};
Members
CustomRtpHeader
Indicates whether a custom RTP header will be included in the payload data. When set to true, the user is
obligated to provide an RTP header as part of the frame data.
MaxRate
Specifies the maximum rate that will be transmitted in bytes per second. This value is used for configuring
the default size of the shared buffer. The default value of -1 must be replaced by a valid rate, otherwise
an error will be generated.
Remarks
• The TxConfigRaw struct is designed for advanced usage scenarios where complete control over payload
content, possibly including a custom RTP header, is required.
• Raw mode can be used to transmit SMPTE 2110-40 ancillary data. Refer to §3.3 for an explanation and
example of the usage of raw mode.
• When CustomRtpHeader is set to true, the user assumes responsibility for supplying a suitable RTP header
as part of the frame data to be transmitted.
50
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct St2110::TxConfigRawVideo
Configures the parameters for transmitting raw SMPTE 2110 video. The TxConfigRawVideo structure lets you
control all aspects of video transmission, including active video ratio, chroma subsampling, frame dimensions,
packing parameters, pixel groups, row size, timing parameters, and PTP transmit time offset.
struct TxConfigRawVideo
{
Ratio ActiveVideo{}; // Active video time relative to total line time.
bool Is420{false}; // [Link] chroma subsampling?
int NumRows{-1}; // Total number of rows in a frame.
VideoPacking Packing{}; // Packet packing parameters.
struct {
int NumBytes{-1}; // Number of bytes in a ST2110-20 pgroup.
int NumPixels{-1}; // Number of pixels in a ST2110-20 pgroup.
} PGroup;
int RowSize{-1}; // Total number of bytes in a row.
VideoTiming Timing{}; // Video timing parameters.
int TrOffset{-1}; // PTP transmit time offset.
};
Members
ActiveVideo
Specifies the active video time relative to the total line time. This parameter determines the proportion of
active video data within each transmitted line.
Is420
Specifies whether [Link] chroma subsampling is to be used for video transmission.
NumRows
Specifies the total number of rows in a video frame. This parameter defines the vertical resolution of the
transmitted video.
Packing
Specifies the packet packing parameters, with constraints on packet contents, packing mode, and payload
size.
PGroup
A structure with two integer members, NumBytes and NumPixels, which represent the number of bytes
and pixels in a ST2110-20 pixel group (pgroup), respectively.
RowSize
Specifies the total number of bytes in a row of video data.
Timing
Specifies the video timing parameters, such as frame rate, packet scheduling method, and scanning
mode.
TrOffset
Specifies the PTP (Precision Time Protocol) transmit time offset with respect to the most recent integer
multiple of the time period between consecutive frames of video at the prevailing frame rate, starting from
the EPOCH time.
If the value is -1, a default value is used.
Remarks
51
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct St2110::TxConfigVideo
Configures the parameters for transmitting SMPTE 2110 video.
struct TxConfigVideo
{
TxFrameFormat Format{Uyvy422_10b};
VideoPacking Packing; // Video packing parameters.
VideoSize Resolution; // Resolution of the active video.
VideoTiming Timing; // Video timing parameters.
};
Members
Format
Specifies the video frame format. The default value is TxFrameFormat::Uyvy422_10b, which represents a
10-bit UYVY [Link] format. Other supported formats can be found in the St2110::TxFrameFormat enu-
meration.
Packing
Specifies the packing parameters for the video frames. These parameters include the storage layout and
organization of pixel data within the video frame.
Resolution
Sets the resolution of the active video. The VideoSize structure contains width and height values, speci-
fying the dimensions of the video frame in pixels.
Timing
Configures the video timing parameters. These parameters include frame rate, interlacing, and synchro-
nization details, ensuring the proper display and synchronization of the transmitted video.
Remarks
52
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct St2110::VideoPacking
Specifies the SMPTE 2110 video packing parameters.
struct VideoPacking
{
bool OneLinePerPacket{false}; // Only allow data from a single line
// in one packet.
St2110::PackingMode PackingMode{General};
int PayloadSize{-1}; // Specifies the payload size used.
};
Members
OneLinePerPacket
When set to true, restricts data to one line per packet. This ensures that each packet only contains data
from a single line, simplifying processing.
PackingMode
Determines the video packing mode to be used. Available options are General (flexible packet size,
adhering to packet group size limitations) and Block (packets must contain a multiple of 180 bytes).
PayloadSize
Specifies the payload size used in the video packets. A value of -1 indicates that the payload size will be
automatically set to a reasonable size.
Remarks
53
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct St2110::VideoTiming
Configures the timing aspects of SMPTE 2110 video transmission.
struct VideoTiming
{
FrameRate Rate; // Frame rate; field rate for Interlaced/PsF.
St2110::Scheduling Scheduling{Gapped};
St2110::VideoScanning VideoScanning{Progressive};
};
Members
Rate
Specifies the frame rate for progressive scanning modes, or the field rate for interlaced or PsF scanning
mode. This parameter is crucial for determining the timing and synchronization of video transmission.
Scheduling
Defines the packet scheduling method to be used. Available options are Linear (evenly spaced packet
transmission) and Gapped (variable gaps between packet transmissions).
VideoScanning
Sets the scanning mode for the video transmission. Options include Progressive, Interlaced, and PsF
(progressive segmented frame).
Remarks
54
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
Important Note – For progressive video, a Frame object represents a complete video frame. However, for
interlaced or PsF (Progressive Segmented Frame) video, a Frame object represents a single video FIELD in-
stead.
struct Frame
{
uint32_t RtpTime{0}; // RTP timestamp assigned to RTP packets of the frame.
DtTimeOfDay ToD{}; // Time-of-day of the first sample of the frame.
// Helper functions meaningful only when SMPTE 2110 video frames are received.
bool Is420() const; // Is [Link] chroma subsampling used?
int NumRows() const; // Gets total number of rows in a video frame.
};
Members
RtpTime
Indicates the RTP timestamp assigned to RTP packets of the frame.
ToD
Indicates the time-of-day of the first sample of the frame.
Data
Points to the actual frame/field data as a BLOB.
Field
Indicates, for video frames with scanning mode Interlaced or PsF, whether this data is the first field (0) or
the second field (1).
NumValidBytes
Indicates or specifies the number of valid bytes in the frame-data BLOB. The size of the frame BLOB may
be larger, to accommodate frames of the same size but with varying odd and even field sizes.
Size()
Returns the frame BLOB's size in number of bytes, excluding any oversizing that was specified in the
BlobMetadata allocator metadata.
Is420()
Returns whether [Link] chroma subsampling is used. Relevant only when receiving SMPTE 2110 video
frames.
NumRows()
Returns the total number of rows in a video frame. Relevant only when receiving SMPTE 2110 video
frames.
Remarks
Memory management for frame data must be performed manually. When reading a Frame using RxFifo, the
ownership of the frame data is transferred from the library to the user application. Once the application has
processed the Frame, it should return ownership by calling RxFifo::ReturnToMemPool.
55
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
To transmit a Frame, the user application should first request empty frame memory by invoking
TxFifo::GetFrameFromMemPool and then write the frame data into the obtained Frame. When the frame is
written to TxFifo, its ownership will be transferred to the TxFifo instance.
56
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
Frame::Yuv422P_8b_GetPlanes
Obtains pointers and sizes for 8-bit [Link] YUV formatted video data in a Frame.
This function assumes that the video format is RxFrameFormat::Yuv422p_8b. It calculates pointers to the Y
(luminance), U- and V-plane data within the frame and determines the sizes in bytes for each respective plane.
YuvPlanes Frame::Yuv422P_8b_GetPlanes();
Parameters
None.
Return Value
The plane pointers and plane sizes are returned in a YuvPlanes struct.
Remarks
By calling Frame::Yuv422P_8b_GetPlanes(), users can easily access the YUV planes and their sizes for further
processing or analysis of 8-bit [Link] YUV formatted video frames.
57
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
RxFifo::Attach
Attaches an RxFifo object to a specified DekTec device and port.
void Attach
(
const DtDevice& Device, // DekTec device to attach to.
int Port, // Port number (1-based) to attach to.
HwOrSwPipe Pref=Auto // Prefer hardware or software pipe?
);
Parameters
Device
Specifies the DekTec device to attach the RxFifo to. The device must be attached to the hardware, otherwise
attaching the RxFifo will fail.
Port
Specifies the device’s port number (1-based) to attach the RxFifo to.
Pref
Indicates the user's preference for a hardware or software pipe.
Value Meaning
HwOrSwPipe::Auto DTAPI chooses suitable pipe type.
HwOrSwPipe::PreferHwPipe Prefer hardware pipe, but accept a software pipe as second choice.
Return Value
None.
Exceptions
Exception Meaning
UsageError Attaching the RxFifo to the device object will fail if the device object is not at-
tached to the hardware.
DriverError A fatal error occurred while accessing the DtPcie PCIe device driver or the
DtaNw network driver.
Remarks
• If a preference for a hardware pipe is specified (ForceHwPipe), and no hardware is available, no exception
will be raised. Instead, the exception will be thrown when executing RxFifo::Start().
58
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
RxFifo::Clear
Empties the RxFifo and the Frame Memory Pool, releasing all memory resources associated with the RxFifo.
void Clear();
Parameters
None.
Return Value
None.
Exceptions
Exception Generated when
UsageError RxFifo not started with RxFifo::Start().
Remarks
• The RxFifo::Clear() function cannot be called if the RxFifo is already started.
59
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
RxFifo::Configure
A set of overloaded functions used to configure the RxFifo. The appropriate function overload is called depend-
ing on the configuration parameter type provided.
void Configure
(
const St2022::RxConfig& Config // SMPTE 2022 configuration.
BlobMetadata& Metadata // Frame BLOB alignment metadata.
);
void Configure
(
const St2110::RxConfigRaw& Config // SMPTE 2110 raw data configuration.
BlobMetadata& Metadata // Frame BLOB alignment metadata.
);
void Configure
(
const St2110::RxConfigAudio& Config // SMPTE 2110 audio configuration.
BlobMetadata& Metadata // Frame BLOB alignment metadata.
);
void Configure
(
const St2110::RxConfigVideo& Config // SMPTE 2110 video configuration.
BlobMetadata& Metadata // Frame BLOB alignment metadata.
);
Parameters
Config
Represents the configuration parameters. The specific parameter type determines which function overload
is called.
Metadata
Metadata that governs the alignment and number of extra bytes allocated when a new frame BLOB must
be allocated.
Return Value
None.
Exceptions
Exception Generated when
UsageError This exception is thrown under the following conditions:
• If the RxFifo is not currently attached to the hardware.
• If the RxFifo is already started.
Remarks
• The RxFifo must be configured before starting it.
• Configuring the RxFifo also clears it.
60
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
RxFifo::Detach
Detaches an RxFifo object from the hardware. Releases all resources that were associated with the RxFifo.
void Detach();
Parameters
Return Value
None.
Remarks
All resources related to the RxFifo are released.
61
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
RxFifo::GetFifoLoad
Retrieves the current number of frames in the RxFifo.
If the RxFifo has been started, this method also checks if the receive thread has been unable to write a received
Frame to the RxFifo because it had encountered its maximum capacity. If this condition was detected, an
OverflowError is thrown.
Parameters
Return Value
The current FIFO load, expressed as the number of frames in the RxFifo.
Exceptions
Exception Meaning
OverflowError The receive thread has received a new Frame, but the RxFifo has reached
its maximum capacity. The reception process enters the stop state as if
RxFifo::Stop() has been called.
To recover from this error, it is recommended to clear the RxFifo and restart
reception from scratch.
Remarks
• The receive thread is unable to throw exceptions directly to the user application. As a result,
RxFifo::GetFifoLoad() serves as a means to communicate such exceptions to the user application.
62
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
RxFifo::GetMaxSize
Retrieves the maximum number of frames that the RxFifo can store.
int GetMaxSize() const;
Parameters
None.
Return Value
The maximum size of the RxFifo, expressed as the number of frames it can hold.
Remarks
• Frames in the RxFifo are dynamically allocated up to a maximum limit set with SetMaxSize(). The default
RxFifo size is 4 frames.
• If a frame is received but cannot be written to the FIFO due to its maximum size being reached, the frame
will be dropped and the NumFramesFifoFull statistic will be incremented by 1.
63
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
RxFifo::GetSharedBufferSize
Gets the current size of the shared buffer (in bytes) used to pass data from the NIC to the RxFifo.
int GetSharedBufferSize() const;
Parameters
None.
Return Value
The current size of the shared buffer expressed in bytes.
Remarks
• The shared buffer is an intermediate buffer used to transfer data from the NIC to the RxFifo. For hardware
pipes, this buffer is a DMA buffer. For software pipes, it’s a buffer shared between the AvFifo implementation
and the driver.
• The default size of the shared buffer depends on the configured media format.
• Increasing the size of the shared buffer allows for greater task-scheduling jitter tolerance for the thread re-
sponsible for reading from the shared buffer.
64
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
RxFifo::GetStatistics
Retrieves the receive statistics.
RxStatistics GetStatistics() const;
Parameters
None.
Return Value
Returns an RxStatistics struct.
Remarks
• All statistics will be reset when the Start function is called.
65
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
RxFifo::Read
Reads a frame from the RxFifo. Users must verify that the RxFifo is not empty prior to invoking this method.
Frame* Read();
Parameters
Return Value
A pointer to a Frame containing the received frame.
Exceptions
Exception Generated when
UsageError • RxFifo empty.
Remarks
• Prior to reading from RxFifo, users should call the RxFifo::GetFifoLoad() method to ensure that at least
one frame is available.
66
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
RxFifo::ReturnToMemPool
Returns a Frame to the Frame Memory Pool once the user has completed processing a frame that was read from
the RxFifo. The memory pool is a pre-allocated space designed to store frames, minimizing the overhead
associated with frequent memory allocation and deallocation of individual frames.
void ReturnToMemPool
(
Frame* Frame // Frame to be returned to the memory pool.
);
Parameters
Frame
Pointer to the Frame to be returned to the memory pool.
Return Value
None.
Remarks
• Call this function after processing a frame to avoid memory leaks.
• Assumes the frame is no longer needed and can be reclaimed.
67
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
RxFifo::SetIpPars
Pre-configures the IP parameters for receiving a stream. Please note that these parameters are only checked
and applied when the RxFifo::Start() function is invoked.
void SetIpPars
(
const IpPars& Pars // IP configuration parameters.
);
Parameters
Pars
IP parameters to be used for receiving the stream.
Return Value
None.
Exceptions
Exception Meaning
UsageError This exception is thrown under the following conditions:
• If the RxFifo is not currently attached to the hardware.
• If the RxFifo is already started.
Remarks
• This function requires that the RxFifo is attached to a device.
• IP parameters cannot be changed if the RxFifo is already started.
68
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
RxFifo::SetMaxSize
Sets the maximum number of frames that the RxFifo can store.
void SetMaxSize
(
int Size // New maximum FIFO size in number of frames.
);
Parameters
Size
The new maximum size of the RxFifo, expressed as the number of frames it can hold.
Return Value
None.
Exceptions
Exception Meaning
UsageError The RxFifo size cannot be changed once it is started.
Remarks
• Frames in the RxFifo are dynamically allocated up to a maximum limit set with this function. The default
RxFifo size is 4 frames.
• If a frame is received but cannot be written to the RxFifo due to its maximum size being reached, the frame
will be dropped and the NumFramesFifoFull statistic will be incremented by 1.
69
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
RxFifo::SetSharedBufferSize
Sets the size of the shared buffer (in bytes) used to pass data from the NIC to the RxFifo. The size of the shared
buffer can only be changed if the RxFifo is not started.
int SetSharedBufferSize
(
int Size // New shared buffer size in bytes.
);
Parameters
Size
The new size of the shared buffer, expressed in bytes. The size must be a multiple of the page size (4096).
Return Value
None.
Exceptions
Exception Meaning
UsageError The shared buffer size cannot be changed if the RxFifo is already started.
Remarks
• The shared buffer is an intermediate buffer used to transfer data from the NIC to the RxFifo. For hardware
pipes, this buffer is a DMA buffer. For software pipes, it’s a buffer shared between the AvFifo implementation
and the driver.
• The default size of the shared buffer depends on the media format.
• Increasing the size of the shared buffer allows for greater task-scheduling jitter tolerance for the thread re-
sponsible for reading from the shared buffer.
70
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
RxFifo::Start
Starts the receiving of frames in the RxFifo and resets the receive statistics. Before starting, this function performs
a series of checks: verifies whether a hardware pipe is available (if one was requested), ensures the IP parameters
are valid, and ascertains that the Rx FIFO is properly configured. In case of an error, it throws an exception for
fatal errors trigger and returns false for non-fatal ones.
bool Start();
Parameters
None.
Return Value
Returns a boolean indicating the success or failure of starting the RxFifo.
If false is returned, use GetStatus() to identify the reason for the failure to start.
Exceptions
Exception Meaning
DriverError A fatal error occurred while accessing the DtPcie PCIe device driver or the
DtaNw network driver. The cause may vary greatly. Refer to the what()
string for an explanation of the failure.
HardwarePipeUnavailable Thrown when ForceHwPipe was specified in RxFifo::Attach(), but no
hardware pipe is currently available.
NetworkError A network related error occurred, such as the network link being down or a
failure to resolve the destination MAC address.
UsageError This exception is thrown under any of the following conditions:
• If the RxFifo is not currently attached to the hardware.
• If the RxFifo is already started.
• If the RxFifo is not configured with one of the Configure functions.
• If the IP parameters have not been set.
Remarks
Ensure that Configure() (any of the overloads) and SetIpPars() have been executed before calling this func-
tion.
71
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
RxFifo::Stop
Stops receiving frames in the RxFifo.
void Start();
Parameters
None.
Return Value
None.
Remarks
72
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
RxFifo::UsesHwPipe
Indicates whether a hardware pipe (true) or software pipe (false) is used for receiving SMPTE 2110 or
SMPTE 2022 frames. Hardware pipes are assigned when the RxFifo started, taking into account the
HwOrSwPipe preference specified in the RxFifo::Attach() call and the count of already allocated hardware
transmit pipes. Hence, this method can only be employed after the RxFifo has been started.
bool UsesHwPipe() const;
Parameters
None.
Return Value
A boolean value indicating whether a hardware pipe (true) or software pipe (false) is used.
Exceptions
Exception Meaning
UsageError The pipe type cannot be determined because the RxFifo is not started yet.
Remarks
This function is useful for identifying which type of pipe is used by the RxFifo and can help with optimizing
performance. Hardware pipes get their own DMA controller and therefore have significantly higher performance
than software pipes. However, hardware pipes are in limited supply.
73
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifo::Attach
Attaches a Transmit FIFO to a specified DekTec device and port.
void Attach
(
const DtDevice& Device, // DekTec device to attach to.
int Port, // Port number (1-based) to attach to.
HwOrSwPipe Pref=Auto // Prefer hardware or software pipe?
);
Parameters
Device
Specifies the DekTec device to attach the Transmit FIFO to. The device must be attached to the hardware,
otherwise attaching the Transmit FIFO will fail.
Port
Specifies the device’s port number (1-based) to attach the Transmit FIFO to.
Pref
Indicates the user's preference for a hardware or software pipe.
Value Meaning
HwOrSwPipe::Auto DTAPI chooses a suitable pipe type.
HwOrSwPipe::PreferHwPipe Prefer hardware pipe, but accept software pipe as a second choice.
Return Value
None.
Exceptions
Exception Meaning
UsageError Attaching the TxFifo to the device object will fail if the device object is not at-
tached to the hardware.
DriverError A fatal error occurred while accessing the DtPcie PCIe device driver or the
DtaNw network driver.
Remarks
74
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifo::Clear
Empties the Transmit FIFO and the Frame Memory Pool, releasing all memory resources associated with the
Transmit FIFO.
void Clear();
Parameters
None.
Return Value
None.
Exceptions
Exception Meaning
UsageError The FIFO cannot be cleared once the Transmit FIFO is started with
TxFifo::Start().
Remarks
The TxFifo::Clear() function cannot be called to clear the Transmit FIFO if it has already been started using
TxFifo::Start().
75
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifo::Configure
A set of overloaded functions used to configure the Transmit FIFO. The appropriate function overload is called
depending on the configuration parameter type provided.
// SMPTE 2022-5/6
void Configure
(
const St2022::TxConfigVideo& Config, // SMPTE 2022 configuration.
BlobMetadata& Metadata // Frame BLOB alignment metadata.
);
// SMPTE 2110
void Configure
(
const St2110::TxConfigAudio& Config // SMPTE 2110 audio configuration.
BlobMetadata& Metadata // Frame BLOB alignment metadata.
);
void Configure
(
const St2110::TxConfigRaw& Config // Any SMPTE 2110 substandard.
BlobMetadata& Metadata // Frame BLOB alignment metadata.
);
void Configure
(
const St2110::TxConfigRawVideo& Config // SMPTE 2110 raw video configuration.
BlobMetadata& Metadata // Frame BLOB alignment metadata.
);
void Configure
(
const St2110::TxConfigVideo& Config // SMPTE 2110 video configuration.
BlobMetadata& Metadata // Frame BLOB alignment metadata.
);
Parameters
Config
Represents the configuration parameters. The specific parameter type determines which function overload
is called.
Metadata
Metadata that governs the alignment and number of extra bytes allocated when a new frame BLOB must
be allocated.
Return Value
None.
Exceptions
Exception Meaning
UsageError Configuring the Transmit FIFO requires that the TxFifo object is attached to
the hardware and not started yet.
Remarks
• The Transmit FIFO must be configured before starting it with the TxFifo::Start() method.
• Configuring the Transmit FIFO also clears it.
76
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifo::Detach
Detaches a Transmit FIFO from the hardware. Releases all related resources, including the Frame Memory Pool
associated with the TxFifo object.
void Detach();
Parameters
Return Value
None.
Remarks
All resources related to the Transmit FIFO are released.
77
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifo::GetFifoLoad
Retrieves the current number of frames in the TxFifo.
If the TxFifo has been started, this method also checks if the packet scheduler in the transmit thread has
detected any invalid transmit timestamps. If an invalid timestamp is detected, a SchedulingError is thrown.
int GetFifoLoad() const;
Parameters
Return Value
The current FIFO load, expressed as the number of frames in the TxFifo.
Exceptions
Exception Meaning
SchedulingError The scheduler in the transmit thread has encountered an invalid timestamp
that is too far in the future or the past, causing the transmission to enter the
stop state as if TxFifo::Stop() has been called.
To recover from this error, it is recommended to clear the TxFifo and restart
the transmission loop from scratch.
Remarks
• The transmit thread is unable to throw exceptions directly to the user application. As a result,
TxFifo::GetFifoLoad() serves as a means to communicate such exceptions to the user application.
78
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifo::GetFrameFromMemPool
Retrieves a Frame of the requested size from the memory pool, with the intention of filling the Frame with data
for transmission and writing the Frame to the Transmit FIFO.
Frame* GetFrameFromMemPool
(
size_t Size // Requested size of the embedded frame BLOB.
);
Parameters
Return Value
A pointer to a Frame in the Frame Memory Pool.
Exceptions
Exception Meaning
std::bad_alloc Insufficient memory to allocate a frame.
Remarks
• To write a frame, the application must first obtain a Frame (struct Frame with embedded memory for storing
frame data) from the memory pool.
• The memory pool manages available Frames. If a Frame is available and can be recycled, its size is checked
to ensure it can accommodate the requested frame size. If the available frame BLOB in the frame is too
small, it is resized; if too large, it remains unchanged.
• If no frames are available in the memory pool, a new frame is dynamically allocated.
• After the application writes the frame to the TxFifo, DTAPI returns the Frame to the memory pool once the
data is transmitted.
79
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifo::GetMaxSize
Retrieves the maximum number of frames that the Transmit FIFO can store.
int GetMaxSize() const;
Parameters
None.
Return Value
The maximum size of the Transmit FIFO, expressed as the number of frames it can hold.
Remarks
80
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifo::GetSharedBufferSize
Gets the current size of the shared buffer (in bytes) used to pass data from the TxFifo to the NIC.
int GetSharedBufferSize() const;
Parameters
None.
Return Value
The current size of the shared buffer, expressed in bytes.
Remarks
• The shared buffer is an intermediate buffer used to transfer data from the TxFifo to the NIC. For hardware
pipes, this buffer is a DMA buffer. For software pipes, it’s a buffer shared between the AvFifo implementation
and the driver.
• The default size of the shared buffer depends on the configured media format.
• Increasing the size of the shared buffer allows for greater task-scheduling jitter tolerance for the thread re-
sponsible for writing to the shared buffer.
81
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifo::GetStatistics
Retrieves the receive statistics.
TxStatistics GetStatistics() const;
Parameters
None.
Return Value
Transmit statistics as a structure containing several counter values:
Remarks
• All statistics will be reset when the Start function is called.
82
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifo::GetStatus
Retrieves the status of the TxFifo’s IP connection.
FifoStatus GetStatus() const;
Parameters
None.
Return Value
Returns a FifoStatus enumeration.
Remarks
83
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifo::SetIpPars
Configures the IP parameters to be used for transmitting a stream.
void SetIpPars
(
const IpPars& Pars // IP configuration parameters.
);
Parameters
Pars
IP parameters to be used for transmitting the stream.
Return Value
None.
Exceptions
Exception Meaning
UsageError The IP parameters cannot be set if:
- the Transmit FIFO is not attached to the hardware;
- the Transmit FIFO is already started.
std::invalid_argument One of the IpPars fields is outside its valid range. The what() string will indi-
cate which field value is invalid.
Remarks
• This function requires that the Transmit FIFO is attached to a device.
• IP parameters cannot be changed if the Transmit FIFO is already started.
84
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifo::SetMaxSize
Sets the maximum number of frames that the Transmit FIFO can store.
void SetMaxSize
(
int Size // New maximum FIFO size in number of frames.
);
Parameters
Size
The new maximum size of the Transmit FIFO, expressed as the number of frames it can hold.
Return Value
None.
Exceptions
Exception Meaning
UsageError The Transmit FIFO size cannot be changed once it is started.
Remarks
85
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifo::SetSharedBufferSize
Sets the size of the shared buffer (in bytes) used to pass data from the TxFifo to the NIC. The size of the shared
buffer can only be changed if the TxFifo is not started.
void SetSharedBufferSize
(
int Size // New shared buffer size in bytes.
);
Parameters
Size
The new size of the shared buffer, expressed in bytes. The size must be a multiple of the page size (4096).
Return Value
None.
Exceptions
Exception Meaning
UsageError The shared buffer size cannot be changed if the TxFifo is already started.
Remarks
• The shared buffer is an intermediate buffer used to transfer data from the TxFifo to the NIC. For hardware
pipes, this buffer is a DMA buffer. For software pipes, it’s a buffer shared between the AvFifo implementation
and the driver.
• The default size of the shared buffer depends on the media format.
• Increasing the size of the shared buffer allows for greater task-scheduling jitter tolerance for the thread re-
sponsible for writing to the shared buffer.
86
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifo::Start
Starts transmitting frames in the Transmit FIFO.
void Start();
Parameters
None.
Return Value
None.
Exceptions
Exception Meaning
DriverError A fatal error occurred while accessing the DtPcie PCIe device driver or the
DtaNw network driver.
NetworkError A network related error occurred, e.g. the network link is down or resolving
the destination MAC address failed.
UsageError Frame transmission cannot be started if:
- the Transmit FIFO is not attached to the hardware;
- the Transmit FIFO is not configured;
- IP parameters have not been configured.
Remarks
87
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifo::Stop
Stops transmitting frames.
void Stop();
Parameters
None.
Return Value
None.
Remarks
88
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifo::UsesHwPipe
Indicates whether a hardware pipe (true) or software pipe (false) is used for transmitting SMPTE 2110 or
SMPTE 2022 frames. Hardware pipes are assigned when the TxFifo started, taking into account the
HwOrSwPipe preference specified in the TxFifo::Attach() call and the count of already allocated hardware
transmit pipes. Hence, this method can only be employed after the TxFifo has been started.
bool UsesHwPipe() const;
Parameters
None.
Return Value
A boolean value indicating whether a hardware pipe (true) or software pipe (false) is used.
Exceptions
Exception Meaning
UsageError The pipe type cannot be determined because the TxFifo is not started yet.
Remarks
This function is useful for identifying which type of pipe is used by the TxFifo and can help with optimizing
performance. Hardware pipes get their own DMA controller and therefore have significantly higher performance
than software pipes. However, hardware pipes are in limited supply.
89
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifo::Write
Writes a frame to the Transmit FIFO.
void Write
(
Frame* Frame // Unit of audio/video/raw data.
);
Parameters
Frame
Frame to be stored in the Transmit FIFO for transmission.
Return Value
None.
Remarks
The user must obtain a Frame by calling TxFifo::GetFrameFromMemPool().
90
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
Members
RtpTime
Indicates the RTP timestamp assigned to RTP packets of the frame.
ToD
Indicates the time-of-day of the first sample of the frame.
IsSegmented
Indicates whether this frame uses the Simple Object Segmentation Method.
Items
Contains the FastMetadata Items received or the items to be transmitted. If IsSegmented is true, only one
item can be in the list. For transmit the AvFifo will split the data elements into segments. The size of one
packet will the maximal UDP packet size. For receive, the segmented packets are reassembled into one
FastMetadataItem. See the RxConfigFastMetadata.
Remarks
Memory management for frame data must be performed manually. When reading a Frame using
RxFifoFastmetadata, the ownership of the frame data is transferred from the library to the user application.
Once the application has processed the Frame, it should return ownership by calling
RxFifoFastMetadata::ReturnToMemPool.
To transmit a Frame, the user application should first request an empty frame by invoking
TxFifoFastMetadata::GetFrameFromMemPool and then add the FastMetadataItem to the frame. When the
frame is written to TxFifoFastMetadata, its ownership will be transferred to the TxFifoFastMetadata instance.
91
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
struct FastMetadataItem
{
uint32_t Type{}; // Data item type of this FastMetadata item.
bool Kbit{false}; // Unused if IsSegmented is set
vector<uint32_t> Data; // Application Object data.
};
Members
Type
Indicates the data item type corresponding to the contents of the Data.
Kbit
If IsSegmented is set in the frame belonging to this item, the Kbit is ignored and automatically set by the
AvFifo when splitting up the data into segments (using the Simple Object Segmentation Method).
Otherwise the meaning of the Kbit is specified by the document that defines the contents of the Data Item
indicated by the data item type.
Data
The data item content. The data item content is specified by the document that defines the contents of the
Data item indicated by the data item type.
Remarks
92
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
Members
RtpTime
Indicates the RTP timestamp assigned to RTP packets of the frame.
ToD
Indicates the time-of-day of the first sample of the frame.
Field
Indicates whether this ANC data belongs to the first field (0) or the second field (1) for the video frames
belonging to this ANC stream with scanning mode Interlaced or PsF.
Packets
Contains the ANC packets received after filtering. If no filter is specified, all received ANC packets are in
this list.
Remarks
Memory management for frame data must be performed manually. When reading a Frame using RxFifoAnc,
the ownership of the frame data is transferred from the library to the user application. Once the application has
processed the Frame, it should return ownership by calling RxFifoAnc::ReturnToMemPool.
93
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
Members
Location
Location information of this ANC packet.
StreamNumber
If the optional stream number is transmitted, it’s stored in this member.
Id
Identification of this ANC packet
UserWords
If the IncluseUserWords is set to true in the RxConfigAnc struct, the 10-bit UserDataWords are stored
in this member.
RawData
If the IncluseRawData is set to true in the RxConfigAnc struct, the 10-bit DID, SDID, COUNT,
UserDataWords and Checksum are stored in this member.
94
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
The RxFifoAnc class handles the extraction of Ancillary data from IP-packets. Is uses the same generic interface
as the Dtapi::AvFifo::RxFifo class.
In this section, only the type-specific functions are described for using the SMPTE-2110-40 configuration and
frame type. See the Dtapi::AvFifo::RxFifo section for the generic interface function descriptions.
RxFifoAnc::Configure
Function to configure the RxFifoAnc.
void Configure
(
const St2110::RxConfigAnc& Config // SMPTE 2110-40 configuration.
);
Parameters
Config
Represents the configuration parameters for receiving Ancillary data
Return Value
None.
Exceptions
Exception Generated when
UsageError This exception is thrown under the following conditions:
• If the RxFifoAnc is not currently attached to the hardware.
• If the RxFifoAnc is already started.
Remarks
• The RxFifoAnc must be configured before starting it.
• Configuring the RxFifoAnc also clears it.
95
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
RxFifoAnc::Read
Reads a frame with ANC packets from the RxFifoAnc. Users must verify that the RxFifoAnc is not empty prior
to invoking this method.
RxAncFrame* Read();
Parameters
Return Value
A pointer to a RxAncFrame containing the received ANC data.
Exceptions
Exception Generated when
UsageError • RxFifoAnc empty.
Remarks
• Prior to reading from RxFifoAnc, users should call the RxFifoAnc::GetFifoLoad() method to ensure that
at least one frame is available.
96
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
RxFifoAnc::ReturnToMemPool
Returns a RxAncFrame to the Frame Memory Pool once the user has completed processing a frame that was
read from the RxFifoAnc. The memory pool is a pre-allocated space designed to store frames, minimizing the
overhead associated with frequent memory allocation and deallocation of individual frames.
void ReturnToMemPool
(
RxAncFrame* Frame // Frame to be returned to the memory pool.
);
Parameters
Frame
Pointer to the Frame to be returned to the memory pool.
Return Value
None.
Remarks
• Call this function after processing a frame to avoid memory leaks.
• Assumes the frame is no longer needed and can be reclaimed.
97
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
The RxFifoFastMetadata class handles the extraction of FastMetadata items from IP-packets. Is uses the same
generic interface as the Dtapi::AvFifo::RxFifo class.
In this section, only the type-specific functions are described for using the SMPTE-2110-41 configuration and
frame type. See the Dtapi::AvFifo::RxFifo section for the generic interface function descriptions.
RxFifoFastMetadata::Configure
Function to configure the RxFifoAnc.
void Configure
(
const St2110::RxConfigFastMetadata& Config // SMPTE 2110-41 configuration.
);
Parameters
Config
Represents the configuration parameters for receiving FastMetadata items.
Return Value
None.
Exceptions
Exception Generated when
UsageError This exception is thrown under the following conditions:
• If the RxFifoFastMetadata is not currently attached to the hardware.
• If the RxFifoFastMetadata is already started.
Remarks
• The RxFifoFastMetadata must be configured before starting it.
• Configuring the RxFifoFastMetadata also clears it.
98
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
RxFifoFastMetadata::Read
Reads a frame with FastMetadata items from the RxFifoFastMetadata. Users must verify that the
RxFifoFastMetadata is not empty prior to invoking this method.
FastMetadataFrame* Read();
Parameters
Return Value
A pointer to a FastMetadataFrame containing the received items.
Exceptions
Exception Generated when
UsageError • RxFifoFastMetadata empty.
Remarks
• Prior to reading from RxFifoFastMetadata, users should call the RxFifoFastMetadata::GetFifoLoad()
method to ensure that at least one frame is available.
99
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
RxFifoFastMetadata::ReturnToMemPool
Returns a FastMetadataFrame to the Frame Memory Pool once the user has completed processing a frame that
was read from the RxFifoFastMetadata. The memory pool is a pre-allocated space designed to store frames,
minimizing the overhead associated with frequent memory allocation and deallocation of individual frames.
void ReturnToMemPool
(
FastMetadataFrame* Frame // Frame to be returned to the memory pool.
);
Parameters
Frame
Pointer to the Frame to be returned to the memory pool.
Return Value
None.
Remarks
• Call this function after processing a frame to avoid memory leaks.
• Assumes the frame is no longer needed and can be reclaimed.
100
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
Members
RtpTime
Indicates the RTP timestamp assigned to RTP packets of the frame.
ToD
Indicates the time-of-day of the first sample of the frame.
Field
Indicates whether this ANC data belongs to the first field (0) or the second field (1) for the video frames
belonging to this ANC stream with scanning mode Interlaced or PsF.
Packets
Contains the ANC packets to be transmitted.
Remarks
Memory management for frame data must be performed manually.
To transmit a Frame, the user application should first request an empty frame by invoking
TxFifoAnc::GetFrameFromMemPool and then add the ANC packets to the frame. When the frame is written to
TxFifoAnc, its ownership will be transferred to the TxFifoAnc instance.
101
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
Members
Location
Location information of this ANC packet.
StreamNumber
Optional stream number for this ANC packet if applicable.
Packet
Packet can be one of the following:
1) the RAW 10-bit values of DID, SDID, COUNT, UserDataWords[COUNT] and Checksum
2) An ANC packet described with the TxAncPacket_Sdi class
102
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
Members
Did
Specifies the data identifier of an ANC packet used for indicating a specific ANC packet type.
SdidOrDbn
If Did is less than 0x80, the Did in combination with the secondary data identifier (Sdid) is used for
identifying the ANC packet type otherwise it indicates the Data Block Number.
UserWords
Contains the 10-bit ANC User Data Words.
103
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifoAnc::Configure
Used to configure the Transmit FIFO.
void Configure
(
const St2110::TxConfigAnc& Config // SMPTE 2110-40 configuration.
);
Parameters
Config
Represents the configuration parameters for transmitting Ancillary data.
Return Value
None.
Exceptions
Exception Meaning
UsageError Configuring the Transmit FIFO requires that the TxFifoAnc object is attached
to the hardware and not started yet.
Remarks
• The Transmit FIFO must be configured before starting it with the TxFifoAnc::Start() method.
• Configuring the Transmit FIFO also clears it.
104
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifoAnc::GetFrameFromMemPool
Retrieves an empty ANC Frame from the memory pool, with the intention of filling the Frame with data for
transmission and writing the Frame to the Transmit FIFO.
TxAncFrame* GetFrameFromMemPool();
Parameters
Return Value
A pointer to a TxAncFrame in the Frame Memory Pool.
Exceptions
Exception Meaning
std::bad_alloc Insufficient memory to allocate a frame.
Remarks
• To write a frame, the application must first obtain a Frame (struct TxAncFrame) from the memory pool.
• The memory pool manages available Frames. If a Frame is available and can be recycled, it’s returned.
• If no frames are available in the memory pool, a new frame is dynamically allocated.
• After the application writes the frame to the TxFifoAnc, DTAPI returns the Frame to the memory pool once
the data is transmitted.
105
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifoAnc::Write
Writes a frame to the Transmit FIFO.
void Write
(
TxAncFrame* Frame // Frame filled with Ancillary data elements
);
Parameters
Frame
Frame to be stored in the Transmit FIFO for transmission.
Return Value
None.
Remarks
The user must obtain a Frame by calling TxFifoAnc::GetFrameFromMemPool().
106
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifoFastMetadataI::Configure
Used to configure the Transmit FIFO.
void Configure
(
const St2110::TxConfigFastMetadata& Config // SMPTE 2110-41 configuration.
);
Parameters
Config
Represents the configuration parameters for transmitting fast metadata items.
Return Value
None.
Exceptions
Exception Meaning
UsageError Configuring the Transmit FIFO requires that the TxFifoAnc object is attached
to the hardware and not started yet.
Remarks
• The Transmit FIFO must be configured before starting it with the TxFifoFastMEtadata::Start() method.
• Configuring the Transmit FIFO also clears it.
107
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifoFastMetadata::GetFrameFromMemPool
Retrieves an empty Frame from the memory pool, with the intention of filling the Frame with items for transmis-
sion and writing the Frame to the Transmit FIFO.
FastMetadataFrame* GetFrameFromMemPool();
Parameters
Return Value
A pointer to a FastMetadataFrame in the Frame Memory Pool.
Exceptions
Exception Meaning
std::bad_alloc Insufficient memory to allocate a frame.
Remarks
• To write a frame, the application must first obtain a Frame (struct FastMetadataFrame) from the memory
pool.
• The memory pool manages available Frames. If a Frame is available and can be recycled, it’s returned.
• If no frames are available in the memory pool, a new frame is dynamically allocated.
• After the application writes the frame to the TxFifoFastMetadata, DTAPI returns the Frame to the memory
pool once the data is transmitted.
108
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
TxFifoFastMetadata::Write
Writes a frame to the Transmit FIFO.
void Write
(
FastMetadataFrame* Frame // Frame filled with fast metadata items
);
Parameters
Frame
Frame to be stored in the Transmit FIFO for transmission.
Return Value
None.
Remarks
The user must obtain a Frame by calling TxFifoFastMetadata::GetFrameFromMemPool().
109
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
FifoStatusToMessage
Converts a FifoStatus enumeration value to a readable string message.
string FifoStatusToMessage
(
FifoStatus Status // Status code to be converted to a message.
)
Parameters
Status
The FifoStatus enumeration value to be converted into a message.
Return Value
string
A brief message describing the corresponding link status.
Remarks
• The FifoStatusToMessage function provides a mechanism to translate the FifoStatus enumeration values
into human-readable messages, aiding in the debugging and understanding of the link status. Always check
the returned message to understand the status of the IP link in your network operation.
110
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
FifoStatusToMessage
Converts a FifoStatus enumeration value to a readable string message.
string FifoStatusToMessage
(
FifoStatus Status // Status code to be converted to a message.
)
Parameters
Status
The FifoStatus enumeration value to be converted into a message.
Return Value
string
A brief message describing the corresponding link status.
Remarks
• The FifoStatusToMessage function provides a mechanism to translate the FifoStatus enumeration values
into human-readable messages, aiding in the debugging and understanding of the link status. Always check
the returned message to understand the status of the IP link in your network operation.
111
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
112
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
St2022::Tod2Rtp
Converts a time-of-day value to the corresponding RTP timestamp for a SMPTE 2022-5/6 (SDI over IP) stream.
uint32_t Tod2Rtp
(
DtTimeOfDay ToD // Time-of-day value to be converted.
)
Parameters
ToD
Time-of-day value to be converted to an RTP timestamp.
Return Value
uint32_t
The RTP timestamp corresponding to the time-of-day value.
Remark
113
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
St2110::Rtp2Tod_Audio
Converts an RTP timestamp to a time-of-day value for audio. The calculated time-of-day will align with the audio
media grid for the specified sample rate, provided that the given RTP timestamp is also grid-aligned.
DtTimeOfDay Rtp2Tod_Audio
(
uint32_t RtpTime, // Timestamp in RTP header.
DtTimeOfDay ApproxToD, // Approximate time of day.
int SampleRate // Audio sample rate in Hz.
)
Parameters
RtpTime
Timestamp retrieved from the RTP header, in 90kHz units.
ApproxToD
Specifies the approximate time of day, which helps the function determine the time window containing
the RTP timestamp. The approximate time of day does not need to be accurate, even a deviation of plus
or minus one day is sufficient.
SampleRate
Specifies the audio sample rate expressed in Hertz (Hz).
Return Value
DtTimeOfDay
The time-of-day value corresponding to the RTP timestamp.
Remarks
Typically, the current time of day can be used for ApproxTod.
114
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
St2110::Rtp2Tod_Video
Converts an RTP timestamp to a time-of-day value for video. The calculated time-of-day will align with the video
media grid, provided that the given RTP timestamp is also grid-aligned.
DtTimeOfDay Rtp2Tod_Video
(
uint32_t RtpTime, // Timestamp in RTP header.
DtTimeOfDay ApproxToD // Approximate time of day.
)
Parameters
RtpTime
Timestamp retrieved from the RTP header, in 90kHz units.
ApproxToD
Specifies the approximate time of day, which helps the function determine the time window containing
the RTP timestamp. The approximate time of day does not need to be accurate, even a deviation of plus
or minus one day is sufficient.
Return Value
DtTimeOfDay
The time-of-day value corresponding to the RTP timestamp.
Remarks
Typically, the current time of day can be used for ApproxTod.
115
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
St2110::Tod2Rtp_Audio
Converts a time-of-day value to the corresponding RTP timestamp for audio. If the specified time-of-day value
is aligned to the audio media grid for the given sample rate, then the calculated RTP timestamp is guaranteed
to be aligned as well.
uint32_t Tod2Rtp_Audio
(
DtTimeOfDay ToD // Time-of-day value to be converted.
int SampleRate // Audio sample rate in Hz.
)
Parameters
ToD
Time-of-day value to be converted to an RTP timestamp.
SampleRate
Specifies the audio sample rate expressed in Hertz (Hz).
Return Value
uint32_t
The RTP timestamp corresponding to the time-of-day value.
Remarks
If the input time-of-day value is not grid-aligned, the function will make a reasonable rounding attempt to
determine the closest RTP timestamp, taking into account complexities arising from fractional video frame rates.
116
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
St2110::Tod2Rtp_Video
Converts a time-of-day value to the corresponding RTP timestamp for video. If the specified time-of-day value is
aligned to the video media grid, then the calculated RTP timestamp is guaranteed to be aligned as well.
uint32_t Tod2Rtp_Video
(
DtTimeOfDay ToD // Time-of-day value to be converted.
)
Parameters
ToD
Time-of-day value to be converted to an RTP timestamp.
Return Value
uint32_t
The RTP timestamp corresponding to the time-of-day value.
Remarks
If the input time-of-day value is not grid-aligned, the function will make a reasonable rounding attempt to
determine the closest RTP timestamp, taking into account complexities arising from fractional video frame rates.
117
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
Tod2Grid_Audio
Aligns a specified time-of-day value with the media grid for audio.
DtTimeOfDay Tod2Grid_Audio
(
DtTimeOfDay ToD, // Time of day to be aligned.
int SampleRate // Audio sample rate in Hz.
)
Parameters
ToD
Time of day to be aligned to the audio media clock grid.
SampleRate
Specifies the audio sample rate expressed in Hertz (Hz).
Return Value
DtTimeOfDay
The nearest media-grid aligned time-of-day value corresponding to the input parameters.
Remarks
118
DTAPI – Audio/Video FIFO Interface (AvFifo)
Reference Manual
Tod2Grid_Video
Aligns a specified time-of-day value with the media grid for video.
DtTimeOfDay Tod2Grid_Video
(
DtTimeOfDay ToD, // Time of day to be aligned.
FrameRate Rate; // Frame rate; field rate for Interlaced/PsF.
)
Parameters
ToD
Time of day to be aligned to the audio media clock grid.
Rate
Specifies the frame rate for progressive scanning modes, or the field rate for interlaced or PsF scanning
mode.
Return Value
DtTimeOfDay
The nearest media-clock grid aligned time-of-day value corresponding to the input parameters.
Remarks
In SMPTE 2110, timestamps are calculated relative to the starting point of the PTP timescale, denoted as T0. This
function computes the number of frames that have occurred since T0 for a given time-of-day value (also referred
to as PTP time), considering the specified frame rate. The function then returns the time-of-day corresponding
to the nearest start-of-frame time point.
Providing an exact frame rate is crucial for accurate computation, which is why the frame rate is specified as an
exact rational number.
119