DTAPI Reference - Encoder Control
DTAPI Reference - Encoder Control
ENCODER CONTROL
REFERENCE
Apr 2025
1
DTAPI – Audio/Video Encoding Classes
Reference Manual
Table of Contents
2
DTAPI – Audio/Video Encoding Classes
Reference Manual
3
DTAPI – Audio/Video Encoding Classes
Reference Manual
1. Tutorial
1.1. Introduction
To control DekTec encoder cards, three main classes are used:
1. DtEncPars for specifying the encoding parameters. It has many subclasses containing video
encoding parameters, audio encoding parameters, etc.
2. DtEncControl for controlling the encoder, mainly applying parameters and starting/stopping
encoding.
3. DtInpChannel for reading the encoded transport stream into an application.
This tutorial demonstrates the usage of the DTAPI encoder-control classes by example programs and
code snippets. To keep the examples short, error-checking code is omitted. In production-quality code
it is obviously very important to check the result of every DTAPI call.
4
DTAPI – Audio/Video Encoding Classes
Reference Manual
int main()
{
// Set up encoding parameters (1)
DtEncPars EncPars(2180); // Step 1A
EncPars.m_VidPars.m_VidStd = DTAPI_VIDSTD_1080I50; // Step 1B
EncPars.m_VidPars.SetVidEncStd(DT_VIDENCSTD_H264); // Step 1C
EncPars.m_VidPars.SetDefaultsForProfileLevel( // Step 1D
DtEncVidParsH264::PROFILE_HIGH, DtEncVidParsH264::LEVEL_AUTO);
while (!StopSignal)
;
}
The encoded output will be available on the ASI output. Simultaneously, your application can read the
transport stream for further processing (e.g. forwarding to IP) from port 4. Please refer to §1.4.4 for
example code.
Encoding parameters are set up in object EncPars of type DtEncPars, which is the top-level DTAPI
type to specify encoding parameters. The sub-steps in this example show a bare basics method to
initialize the encoding parameter in a meaningful way.
This step consists of sub-steps 1A to 1D:
5
DTAPI – Audio/Video Encoding Classes
Reference Manual
1A. First EncPars is constructed with the type number of the encoding hardware (2180 for DTA-
2180) as parameter, so that DtEncPars “knows” what type of encoder hardware the param-
eters are targeted for. This is required, amongst others, so that DtEncPars::CheckValidity()
can check whether the encoding parameters are valid on the target hardware.
The EncPars object is initialized with default parameters that make sense for the selected
hardware, in this case the DTA-2180. By default the SDI port (port# 1) is selected as input.
1B. The “expected” input video standard is set to 1080i50 (note that the video standard must be
set before setting the video encoding standard).
This is an important concept: DekTec video encoders do not automatically follow the video
format present at the encoder input. Instead the video standard has to be specified explicitly
in m_VidStd.
If the input format is different from the specified format, the encoding result is undefined.
1C. The video encoding standard is set to H.264. SetVidEncStd will set the value of the other
parameters to reasonable defaults. To be able to do this, m_VidStd must be initialized before
setting the video encoding standard.
1D. The video encoding parameters are set to defaults that are suitable for High Profile (HP), au-
tomatic level. You can also explicitly specify a level, but typically it is more convenient to use
the automatic level setting.
The video encoding parameters have now been set up to reasonable values for H.264 encoding of a
1080i50 stream. No audio will be encoded. The multiplexing parameters such as PIDs and repetition
rates are all set to defaults.
Similarly to using other DekTec hardware, a DtDevice object has to be attached the hardware, in this
case the DTA-2180 HD H.264 encoder card. Then a DtEncControl has to be attached to port 4,
which represents the audio/video encoder. Note that the SDI input is port 1 and the HDMI input is
port 2.
Encoder hardware is a subsystem with a local processor that has a certain boot time before it is
operational. The WaitForInitialized method must be called to wait until the encoder is booted
and initialized completely. It is very important to not forget this step, otherwise other encoder-control
calls may fail randomly.
6
DTAPI – Audio/Video Encoding Classes
Reference Manual
Apply the encoder parameters. At this stage, the encoder is still in the idle state, so the effect is just to
preload the initial parameters.
Start encoding using the just uploaded parameters. The encoder will now start encoding and continue
to do so until stopped. Please note that if your application quits, automatic close and detach operations
are executed, which will also stop the encoder.
Checking the validity after building encoding parameters can be very helpful as a debugging aid. If
some mistake has been made you can use the error code returned by CheckValidity to get a clue
on what went wrong.
7
DTAPI – Audio/Video Encoding Classes
Reference Manual
EncPars.m_VidPars.m_VidStd = DTAPI_VIDSTD_1080I50;
EncPars.m_VidPars.SetVidEncStd(DT_VIDENCSTD_H264);
EncPars.m_VidPars.SetDefaultsForProfileLevel(…);
// etc.
Similarly, you can define audio-encoding parameters for a second audio component by enabling and
initializing m_AudPars[1], etc.
NOTE: The DTA-2180 can only encode audio together with video. It is not possible to encode a “radio
service” without video.
8
DTAPI – Audio/Video Encoding Classes
Reference Manual
// Start receiving
DtInpChan.SetRxControl(DTAPI_RXCTRL_RCV);
// Loop until stopped via QuitFlag (can be set from another thread)
bool QuitFlag = false;
while (!QuitFlag)
{
// Read FIFO load
int FifoLoad;
DtInpChan.GetFifoLoad(FifoLoad);
if (FifoLoad >= 1024)
{
// If sufficient load is available, read and process 1024 bytes of data
char TsData[1024];
DtInpChan.Read(TsData, 1024);
Process(TsData);
} else {
// Insufficient FIFO load => Sleep a while and try again
::Sleep(50);
}
}
9
DTAPI – Audio/Video Encoding Classes
Reference Manual
2. Video Encoding
2.1. Video Encoding Standards
The video encoding standards supported by DekTec encoders are defined by enumeration
DtVidEncStd:
H.265 (HEVC) is already defined as a video-encoding standard, but not currently supported by DekTec
encoder hardware.
The combination of profile and level targets a specific application, or a class of applications. For
example, Main Profile, Main Level (MP@ML) for MPEG-2 video is aimed at direct-to-home broadcast-
ing of SD television signals. Similarly, High Profile for H.264 is a profile used for broadcasting of
HDTV.
From an encoder point of view, profile and level specify a set of limits on the values that may be taken
by the video encoding parameters and by certain bit-stream attributes.
10
DTAPI – Audio/Video Encoding Classes
Reference Manual
The table below lists the coding features supported for each of the supported H.264 profiles.
Feature CBP MP HP
Bit depth 8 bits 8 bits 8 bits
Chroma formats 4:2:0 4:2:0 4:2:0
MBAFF coding - ✓ ✓
B pictures - ✓ ✓
CABAC coding - ✓ ✓
8x8 Transform - - ✓
Weighted prediction - ✓ ✓
The following constraints apply to the H.264 levels. Only levels supported by DekTec encoders are
listed in this table.
Level Max. decoding speed Max. frame size Max. video bitrate
(macroblocks/s) (macroblocks)
HP CBP, MP
AUTO Level constraints are ignored
3 40,500 1,620 12.5 Mbit/s 10 Mbit/s
3.1 108,000 3,600 17.5 Mbit/s 14 Mbit/s
3.2 216,000 5,120 25 Mbit/s 20 Mbit/s
4 245,760 8,192 25 Mbit/s 20 Mbit/s
4.1 245,760 8,192 62.5 Mbit/s 50 Mbit/s
11
DTAPI – Audio/Video Encoding Classes
Reference Manual
The table below lists the coding features supported for each of the supported MPEG-2 profiles.
Feature SP MP HP
Aspect ratios 4:3, 16:9 4:3, 16:9 4:3, 16:9
Bit depth 8 bits 8 bits 8 bits
Chroma formats 4:2:0 4:2:0 4:2:0
B pictures - ✓ ✓
Intra DC precision 8, 9, 10 8, 9, 10 8, 9, 10, 11
12
DTAPI – Audio/Video Encoding Classes
Reference Manual
13
DTAPI – Audio/Video Encoding Classes
Reference Manual
14
DTAPI – Audio/Video Encoding Classes
Reference Manual
3. Audio Encoding
3.1. Audio Encoding Standards
The audio encoding standards supported by DekTec encoders are defined by the enumeration type
DtAudEncStd:
The table below provides some additional information for each of the supported audio encoding
standards:
Value Meaning
DT_AUDENCSTD_UNKNOWN The audio standard is not known (yet), or irrelevant.
DT_AUDENCSTD_AAC AAC encoded audio.
To select between AAC-LC, HE-AAC v1 or HE-AAC v2, use pa-
rameter DtEncAudParsAac::m_Profile.
DT_AUDENCSTD_AC3 Dolby AC-3 encoded audio.
DT_AUDENCSTD_DOLBY_E Dolby E.
Currently only supported in pass-through mode.
DT_AUDENCSTD_EAC3 Dolby E-AC-3 encoded audio.
Currently only supported in pass-through mode.
DT_AUDENCSTD_MP1LII MPEG-1 Layer II audio encoding.
DT_AUDENCSTD_PCM Direct embedding of PCM samples without encoding into an
MPEG-2 transport stream according to the SMPTE 302M.
15
DTAPI – Audio/Video Encoding Classes
Reference Manual
For example, if one 5.1 surround-sound service is used, 5 additional stereo pairs can be encoded.
16
DTAPI – Audio/Video Encoding Classes
Reference Manual
1 1/0 1 C SVC_MONO
2 2/0 2 L, R SVC_STEREO
17
DTAPI – Audio/Video Encoding Classes
Reference Manual
Value Meaning
0 (default) Standard.
1 HDCD.
Value Meaning
false (default) Mixing level and room type parameters are valid.
true Mixing level and room type parameters are invalid (ignored).
Value Meaning
0 (default) Main audio service: complete main (CM).
The bitstream is the main audio service for the program and all
elements are present to form a complete audio program. This is
the most common default setting. The CM service may contain
from one (mono) to six (5.1) channels.
1 Main audio service: music and effects (ME).
The bitstream is the main audio service for the program, minus
a dialogue channel. The dialogue channel, if any, is intended
to be carried by an associated dialogue service. Different dia-
logue services can be associated with a single ME service to
support multiple languages.
2 Associated audio service: visually impaired (VI).
Typically a single-channel program intended to provide a nar-
rative description of the picture content to be decoded along
with the main audio service. The VI service may be comprised
of up to six channels.
3 Associated audio service: hearing impaired (HI).
Typically a single-channel program intended to convey audio
that has been processed for increased intelligibility and de-
coded along with the main audio service. The HI service may
be comprised of up to six channels.
4 Associated audio service: dialogue (D).
18
DTAPI – Audio/Video Encoding Classes
Reference Manual
19
DTAPI – Audio/Video Encoding Classes
Reference Manual
In a RDD 6 metadata stream, compr can be encoded in the same way as in AC-3 (see above), or
alternatively RDD6 allows compr to be encoded as a compression profile. RDD 6 defines the following
(RF1) compression profiles.
Value Meaning
0 No compression.
1 Film standard compression.
2 Film light compression.
3 Music standard compression.
4 Music light compression.
5 Speech compression.
6-255 Reserved.
The DTA-2180 AC-3 encoder only supports static control of compr, encoded as a compression profile.
A change of compr cannot be applied seamlessly.
Value Meaning
0 Not copyright protected.
1 (default) Copyright protected bitstream.
Value Meaning
0 Not indicated.
1 Dolby headphone disabled.
2 Dolby headphone enabled.
3 (default) Reserved, to be interpreted as “not indicated”.
1
RF is a leftover from the “old days”. It is used to indicate that the audio compression is important when the signal is
modulated with an RF modulator.
20
DTAPI – Audio/Video Encoding Classes
Reference Manual
Value Meaning
0 Not indicated.
1 Lt/Rt downmix preferred.
2 Lo/Ro downmix preferred.
3 (default) Reserved, to be interpreted as “not indicated”.
Value Meaning
0 Not indicated.
1 (default) Not encoded in Dolby Surround EX. The decoded PCM audio
should be processed by a Dolby Digital Surround EX decoder.
2 Encoded in Dolby Surround EX.
Value Description
Meaning
0 Not encoded in Dolby Surround.
1 Encoded in Dolby Surround. The decoded PCM audio should
be processed by a Dolby Pro Logic matrix decoder.
2 There is no indication.
3 (default) Reserved, to be interpreted as “not encoded”.
21
DTAPI – Audio/Video Encoding Classes
Reference Manual
NOTE: dynrng (3-bit 6dB increment, 5-bit linear) is coded similarly to compr (4-bit 6dB increment, 4-bit
linear gain).
In a RDD 6 metadata stream, dynrng can be encoded in the same way as in AC-3 (see above), or
alternatively dynrng can encoded as a compression profile. The profiles are the same as for parameter
compr, see the description of compr for a table with defined profiles.
An RDD Dolby Digital Complete + Essential metadata segment contains 8 dynrng values. They are
intended to control a AC-3 encoder that transcodes from Dolby E to AC-3. Each dynrng values spec-
ifies the dynamic range for 1/8 of a Dolby E frame.
The DTA-2180 AC-3 encoder only supports static control of dynrng, encoded as a compression pro-
file. A change of dynrng cannot be applied seamlessly.
Value Meaning
0 1.414 (+3.0dB)
1 1.189 (+1.5dB)
2 1.000 (0.0dB)
3 0.841 (-1.5dB)
4 0.707 (-3.0dB)
5 0.595 (-4.5dB)
6 0.500 (-6.0dB)
7 0
22
DTAPI – Audio/Video Encoding Classes
Reference Manual
Value Meaning
0, 1, 2 Reserved
3 0.841 (-1.5dB)
4 0.707 (-3.0dB)
5 0.595 (-4.5dB)
6 0.500 (-6.0dB)
7 0
Value Meaning
0 1.414 (+3.0dB)
1 1.189 (+1.5dB)
2 1.000 (0.0dB)
3 0.841 (-1.5dB)
4 0.707 (-3.0dB)
5 0.595 (-4.5dB)
6 0.500 (-6.0dB)
7 0
23
DTAPI – Audio/Video Encoding Classes
Reference Manual
Value Meaning
0, 1, 2 Reserved
3 0.841 (-1.5dB)
4 0.707 (-3.0dB)
5 0.595 (-4.5dB)
6 0.500 (-6.0dB)
7 0
Value Meaning
0 Copied.
1 (default) Not copied.
Value Meaning
0 Not indicated.
1 Large room, X curve monitor.
2 (default) Small room, flat monitor.
3 Reserved, to be interpreted as “not indicated”.
24
DTAPI – Audio/Video Encoding Classes
Reference Manual
25
DTAPI – Audio/Video Encoding Classes
Reference Manual
Originally (before defining the extended bitstream syntax) this section of the AC-3 bitstream definition
looked as follows:
: :
timecod1e 1
if (timecod1e)
timecod1 14
timecod2e 1
if (timecod2e)
timecod2 14
: :
This construction works because xbsi1e and timecod1e have opposite definitions. If this bit is ‘0’, the
bitstream contains timecod1, it this bit is ‘1’ the bitstream contains the extended metadata parameters.
The same applies to xbsi2e and timecod2e.
26
DTAPI – Audio/Video Encoding Classes
Reference Manual
class DtEncParsBase
Base class for (most) encoding parameter classes, storing the type number of the encoder hardware.
The parameter classes use the type number to implement encoder-specific parameter constraints and
mappings.
The following classes are derived from DtEncParsBase: DtEncPars, DtEncAudPars,
DtEncAudParsAc3, DtEncMuxPars, DtEncVidParsH264, DtEncVidParsMp2V, DtEncVidPars. The
public methods SetEncType and GetEncType are available on each of these classes.
27
DTAPI – Audio/Video Encoding Classes
Reference Manual
class DtEncAncPars
Class for specifying encoding and embedding parameters for data that is not audio or video.
Public Members
m_AfdBarMode
AFD/BAR insertion mode.
Value Meaning
AFDBAR_NONE Do not extract/insert AFD/BAR.
AFDBAR_WHENNEEDED Insert/extract AFD/BAR as needed.
AFDBAR_ALWAYS (default) Always extract/insert AFD/BAR.
m_CcMode
Closed caption mode.
Value Meaning
CC_DISABLE Do not extract/insert captions.
Set m_CcSource to CC_NONE.
CC_ALL (default) Extract/insert all captions.
CC_608B Extract/insert EIA608B field 1 and EIA608B field 2.
CC_608B_FLD1 Extract/insert EIA608B field 1.
CC_608B_FLD2 Extract/insert EIA608B field 2.
CC_708B Extract/insert EIA708B.
28
DTAPI – Audio/Video Encoding Classes
Reference Manual
m_CcSource
Closed caption source.
Value Meaning
CS_NONE Closed captions not used.
Set m_CcMode to CC_DISABLE.
CS_VANC Closed caption data taken from VANC.
CS_WAVEFORM For SD only: Decode waveform in line 21.
CS_ALL (default) Take closed captions from VANC and/or from line 21.
m_VbiFormat
VBI input in MSB or LSB.
Value Meaning
VBI_MSB VBI input in MSB.
VBI_LSB (default) VBI input in LSB.
m_VideoIndex
Enable or disable (default) video index processing.
m_Vitc
Enable or disable (default) Digital Vertical Interval Time Code (D-VITC) extraction from SDI and
insertion in ??? in the transport stream.
SetEncType()
Set the type number of the encoder card for which the parameters are meant. The encoder type
number can be read back with GetEncType (implemented in DtEncParsBase).
This method returns DTAPI_E_INVALID_ARG if the encoder type number is invalid, or if the type
number is valid but it is not encoder hardware.
29
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncAncPars::CheckValidity
Check the validity of the ancillary data encoding and embedding parameters.
DtEncResult DtEncAncPars::CheckValidity
();
Function Arguments
Result
For generic result codes, see the Results table listed on the DtEncAncPars::CheckValidity
page. The following result codes are specific for ancillary data encoding and embedding:
DT_ENC_E_INV_AFDBARMODE The value in DtEncAncPars::m_AfdBarMode is not a valid
AFD/BAR value.
DT_ENC_E_INV_CCMODE The value in DtEncAncPars::m_CcMode is not a valid closed
captioning extraction/processing mode.
DT_ENC_E_INV_CCSOURCE The value in DtEncAncPars::m_CcSource is not a valid
closed captioning source.
Remarks
30
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncAncPars::SetDefaultPars
Set defaults for the current object with ancillary data encoding and embedding parameters.
DtEncResult DtEncAncPars::SetDefaultPars
();
Function Arguments
Result
DtEncResult Meaning
DT_ENC_OK Defaults for the ancillary data encoding and embedding pa-
rameters have been set successfully.
Remarks
31
DTAPI – Audio/Video Encoding Classes
Reference Manual
class DtEncAudPars
Class for specifying the encoding parameters for a single audio service.
32
DTAPI – Audio/Video Encoding Classes
Reference Manual
Public Members
m_Enable
Enable or disable (default) encoding of this audio service. If disabled, all remaining parameters
are ignored.
m_AudChans
This vector of integer specifies the input indices of the audio channels to be included in the audio
service. An audio channel is defined as a single stream of audio samples.
Channel index is zero-based: The index of the first audio channel is 0, the index of the second
channel is 1, etc.
Encoder Type Channel Index Range
DTA-2180 0 through 15 for HD-SDI input.
0 through 5 for HDMI input.
0 through 31 for 3G-SDI input (not supported at the moment).
The size of vector m_AudChans must be set to the number of channels required for the service
configuration (see m_SvcType). A stereo service requires two audio channels (vector size is two),
while a 5.1 surround service requires six audio channels.
If the HDMI-input is selected, the first audio channel must be 0.
m_Bitrate
Integer defining the bitrate of the encoded audio service in bits per second. The table below
shows the bitrates that can be used for encoded audio (32k = 32000, etc.). Dependent on the
audio encoding- and service type only a subset of these bitrates may be valid. The default bitrate
is 96kbps.
Bitrate Values for Encoded Audio
32k, 48k, 56k, 64k, 80k, 96k, 112k, 128k, 160k, 192k, 224k, 256k, 320k, 384k, 448k,
576k, 640k
If service type is SVC_PASSTHROUGH, then m_Bitrate has to be set to the maximum bitrate of
the audio stream that is passed through.
If the audio encoding standard is DT_AUDENCSTD_PCM, then m_Bitrate has to be set to:
m_SampleRate * (m_BitsPerSample+4) * 2.
m_Delay
Audio delay relative to the encoder’s end-to-end delay, expressed in milliseconds. This delay
can be used for lip-sync correction. The valid range is -100 to 400ms. The default delay is 0ms.
33
DTAPI – Audio/Video Encoding Classes
Reference Manual
m_SampleRate
Integer defining the audio-channel sample rate. This parameter needs to match the source sam-
ple rate of uncompressed audio samples. The table below shows the valid sample rates. The
default sample rate is 48000.
Value Meaning
32000 32kHz, currently not supported
48000 48kHz
If service type is SVC_PASSTHROUGH, m_SampleRate has to be set to the sample rate of the
source AES3 stream with the encoded audio to be passed through (typically 48kHz). This is not
necessarily equal to the original source sample frequency of the audio before encoding.
m_AlignedPes
Enable (default) or disable alignment of PES packets to the start of transport packets.
m_VolumeAdjust
Enable or disable (default) adjustment of the audio volume prior to encoding. If service type is
SVC_PASSTHROUGH, the volume cannot be adjusted and m_VolumeAdjust must be set to
false.
m_VolumeAdjustdB
Volume adjustment amount applied to audio samples prior to encoding when
m_VolumeAdjust is set to true (enabled). The valid range is from 0.0 dB to 24.0dB. The default
value is 0.0 dB (no adjustment).
SetEncType()
Set the type number of the encoder card for which the parameters are meant. The encoder type
number can be read back with GetEncType (implemented in DtEncParsBase).
This method returns DTAPI_E_INVALID_ARG if the encoder type number is invalid, or if the type
number is valid but it is not encoder hardware.
34
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncAudPars::CheckValidity
Check the validity of the encoding parameters for the audio service.
DtEncResult DtEncVidPars::CheckValidity
(
[in] int SourcePort = -1 // Source port number
);
Function Arguments
SourcePort
Port number of the physical port connected to encoder’s input. The default value of this argu-
ment is -1, which selects the encoder’s default source port. The table below lists the source ports
available on the different DekTec encoders.
2 HDMI input.
Result
See the Results table listed on the DtEncPars::CheckValidity page.
Remarks
35
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncAudPars::GetAudEncStd
Get the current audio encoding standard.
DtAudEncStd DtEncAudPars::GetAudEncStd();
Function Arguments
None.
Result
This function does not return a DTAPI_RESULT but directly returns the audio-encoding standard.
Value Meaning
DT_AUDENCSTD_UNKNOWN The audio standard is not known.
DT_AUDENCSTD_AAC AAC encoded audio.
DT_AUDENCSTD_AC3 Dolby AC-3 encoded audio.
DT_AUDENCSTD_DOLBY_E Dolby E.
DT_AUDENCSTD_EAC3 Dolby E-AC-3 encoded audio.
DT_AUDENCSTD_MP1LII MPEG-1 Layer II audio encoding.
DT_AUDENCSTD_PCM Direct embedding of PCM samples without encoding into an
MPEG-2 transport stream according to the SMPTE 302M.
Remarks
36
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncAudPars::GetSvcType
Get the audio service type.
DtEncAudPars::AudServiceType DtEncAudPars::GetSvcType();
Function Arguments
None.
Result
Type of audio service.
Value Meaning
SVC_DUAL_MONO Service consisting of two mono channels.
SVC_MONO Mono service. Not supported for AAC HEv2.
SVC_PASSTHROUGH Pass-through mode. The audio service is already encoded, and
the encoder passes through the encoded audio data.
SVC_STEREO Stereo audio service.
SVC_SURROUND_5_1 5.1 surround sound service.
Not supported for AAC HEv2 and MPEG-1 layer II.
Remarks
37
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncAudPars::SetAudEncStd
Set audio encoding standard and service type. If AudEncStd is new, create an internal object with
encoding-standard specific parameters (DtEncAudParsAc3, etc.), and initialize these parameters with
default values.
DTAPI_RESULT DtEncAudPars::SetAudEncStd
(
[in] DtAudEncStd AudEncStd; // Audio encoding standard
[in] DtAudServiceType SvcType; // Service type: SVC_STEREO, …
};
Function Arguments
AudEncStd
New audio-encoding standard.
Value Meaning
DT_AUDENCSTD_UNKNOWN The audio standard is not known.
DT_AUDENCSTD_AAC AAC encoded audio.
DT_AUDENCSTD_AC3 Dolby AC-3 encoded audio.
DT_AUDENCSTD_DOLBY_E Dolby E.
DT_AUDENCSTD_EAC3 Dolby E-AC-3 encoded audio.
DT_AUDENCSTD_MP1LII MPEG-1 Layer II audio encoding.
DT_AUDENCSTD_PCM Direct embedding of PCM samples without encoding into an
MPEG-2 transport stream according to the SMPTE 302M.
SvcType
Type of audio service. Refer to the table below for a list of available service configurations. The
default service type is SVC_STEREO.
Value Meaning
SVC_DUAL_MONO Service consisting of two mono channels.
SVC_MONO Mono service. Not supported for AAC HEv2.
SVC_PASSTHROUGH Pass-through mode. The audio service is already encoded, and
the encoder passes through the encoded audio data.
SVC_STEREO Stereo audio service.
SVC_SURROUND_5_1 5.1 surround sound service.
Not supported for AAC HEv2 and MPEG-1 layer II.
38
DTAPI – Audio/Video Encoding Classes
Reference Manual
Result
DTAPI_RESULT Meaning
DTAPI_OK The new audio encoding standard has been set successfully.
DTAPI_E_INVALID_ARG The specified audio-encoding standard or the service type is in-
valid.
DTAPI_E_PASSTHROUGH_ONLY Pass-through mode is not allowed for the specified audio-en-
coding standard.
DTAPI_E_PASSTHROUGH_INV Pass-through mode (service type is SVC_PASSTHROUGH) is not
allowed for the specified audio-encoding standard.
Remarks
If the audio encoding standard was already set to the standard specified in AudEncStd, then
SetAudEncStd is a no-operation. In this case default parameters will not be set.
39
DTAPI – Audio/Video Encoding Classes
Reference Manual
class DtEncAudParsAac
Class for specifying audio encoding parameters for AAC. The profile discriminates between AAC-LC
and HE-AAC.
Public Members
m_ContainerFormat
Defines the container format to be used for encapsulating the encoded AAC audio data.
Value Meaning
CF_ADTS (default) Audio Data Transport Stream (ADTS) container format.
CF_LATM Low Overhead Audio Transport Multiplex (LATM) container for-
mat. Incompatible with m_EncVersion=AAC_MP2
m_Profile
Defines the AAC profile.
Value Meaning
AAC_LC (default) Low Complexity (LC) profile
AAC_HE High Efficiency profile (HE-AAC or HE-AAC v1). Uses spectral
band replication (SBR) to enhance the compression efficiency in
the frequency domain.
AAC_HEv2 High Efficiency version 2 profile (HE-AAC v2). Uses spectral
band replication (SBR) and parametric stereo (PS) to enhance
the compression efficiency of stereo signals.
Only supported for service type SVC_STEREO.
m_Crc
Enable or disable (default) a 16-bit CRC appended to the AAC data packets.
40
DTAPI – Audio/Video Encoding Classes
Reference Manual
m_EncVersion
Defines the AAC version.
Value Meaning
AAC_MP4 (default) MPEG-4 AAC.
AAC_MP2 MPEG-2 AAC.
m_Lowload
Enable or disable (default) a low-load algorithm for encoding AAC. If disabled, “full mode” is
used.
41
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncAudParsAac::CheckValidity
Check the validity of the AAC audio encoding parameters.
DtEncResult DtEncAudParsAac::CheckValidity
();
Validity Checks
For AAC, the following minimum and maximum service bitrates apply for the different service types:
Result
See the Results table listed on the DtEncPars::CheckValidity page.
Remarks
42
DTAPI – Audio/Video Encoding Classes
Reference Manual
class DtEncAudParsAc3
// Dolby metadata
int m_DialNorm; // Dialog normalisation
bool m_DcFilter; // Enable DC filter
int m_CompChar; // Global compression profile
int m_DComp; // Line mode profile
int m_D2Comp; // Line mode profile second channel
int m_CComp; // RF mode profile
int m_C2Comp; // RF mode profile second channel
bool m_Deemphasis; // Enable digital deemphasis
bool m_BwFilter; // Enable bandwidth filter
bool m_Phase90; // 90-degree surround phase shift
bool m_Xbsi2Ex; // Enable extended bitstream ind
int m_HeadphoneMode; // Dolby headphone mode
int m_AdConvType; // A/D converter type
int m_MixingLevel; // Mixing level
bool m_Copyright; // Copyright flag
bool m_OriginalBs; // Original bitstream flag
int m_BitstreamMode; // Bitstream mode
int m_RoomType; // Room type
int m_SurroundMode; // Dolby surround mode
bool m_Xbsi1Ex; // Enable extended bitstream ind.
bool m_AdvDrc; // Enable advanced DRC
int m_CenterMixLevel; // Center mix level
int m_SurroundMixLevel; // Surround mix level
int m_DownMixMode; // Preferred stereo downmix mode
int m_LtRtCenterMixLevel; // Lt/Rt center mix level
int m_LtRtSurroundMixLevel; // Lt/Rt surround mix level
int m_LoRoCenterMixLevel; // Lo/Ro center mix level
int m_LoRoSurroundMixLevel; // Lo/Ro surround mix level
int m_SurroundExMode; // Dolby surround EX mode
bool m_SurroundAttn; // 3dB surround attenuation flag
bool m_AudioProdInfo; // Audio production info
};
43
DTAPI – Audio/Video Encoding Classes
Reference Manual
Public Members
m_DynRangeCtrl1
Enable (default) or disable normal dynamic-range reduction.
m_DynRangeCtrl2
Enable or disable (default) large dynamic-range reduction.
m_LfeFilter
Enable or disable (default) the LE low-pass filter (120Hz).
m_SurroundDelay
Enable or disable (default) additional delay of the surround channel.
m_DcFilter
Enable (default) or disable DC filter.
m_CompChar
Global compression profile.
Value Meaning
0 No compression.
1 (default) Film standard compression.
2 Film light compression.
3 Music standard compression.
4 Music light compression.
5 Speech compression.
m_DComp
Line mode profile.
Value Meaning
0 No compression.
1 Film standard compression.
2 Film light compression.
3 Music standard compression.
4 Music light compression.
5 Speech compression.
7 (default) Unspecified
44
DTAPI – Audio/Video Encoding Classes
Reference Manual
m_D2Comp
Line mode profile for second channel.
Value Meaning
0 No compression.
1 Film standard compression.
2 Film light compression.
3 Music standard compression.
4 Music light compression.
5 Speech compression.
7 (default) Unspecified
m_CComp
RF mode profile.
Value Meaning
0 No compression.
1 Film standard compression.
2 Film light compression.
3 Music standard compression.
4 Music light compression.
5 Speech compression.
7 (default) Unspecified
m_C2Comp
RF mode profile for second channel.
Value Meaning
0 No compression.
1 Film standard compression.
2 Film light compression.
3 Music standard compression.
4 Music light compression.
5 Speech compression.
7 (default) Unspecified
m_Deemphasis
Enable or disable (default) digital deemphasis.
m_BwFilter
Enable or disable (default) bandwidth filter.
45
DTAPI – Audio/Video Encoding Classes
Reference Manual
m_Phase90
Enable (default) or disable 90-degree phase shift for surround.
m_Xbsi2Ex
m_HeadphoneMode
m_AdConvType
m_MixingLevel
m_Copyright
m_OriginalBs
m_RoomType
m_SurroundMode
m_Xbsi1Ex
m_AdvDrc
m_CenterMixLevel
m_SurroundMixLevel
m_DownMixMode
m_LtRtCenterMixLevel
m_LtRtSurroundMixLevel
m_LoRoCenterMixLevel
m_LoRoSurroundMixLevel
m_SurroundExMode
m_SurroundAttn
3dB surround attenuation flag.
Value Meaning
false (default) 3dB surround attenuation disabled.
true 3dB surround attenuation enabled.
m_AudioProdInfo
46
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncAudParsAc3::CheckValidity
Check the validity of the AC-3 audio encoding parameters.
DtEncResult DtEncAudParsAc3::CheckValidity
();
Validity Checks
For AC-3, the following minimum, maximum and typical service bitrates apply for the different service
types.
Result
For generic result codes, see the Results table listed on the DtEncPars::CheckValidity page. The
following result codes are specific for AC-3 audio encoding:
Remarks
47
DTAPI – Audio/Video Encoding Classes
Reference Manual
class DtEncAudParsMp1LII
Class for specifying audio encoding parameters for MPEG 1 layer II.
m_Crc
Enable or disable (default) a 16-bit CRC appended to the MPEG-1 layer II data packets.
48
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncAudParsMp1LII::CheckValidity
Check the validity of the MPEG-1 layer II audio encoding parameters.
DtEncResult DtEncAudParsMp1LII::CheckValidity
();
Validity Checks
For MPEG-1 layer II audio encoding, the following minimum and maximum service bitrates apply for
the different service types:
Result
See the Results table listed on the DtEncPars::CheckValidity page.
Remarks
49
DTAPI – Audio/Video Encoding Classes
Reference Manual
class DtEncAudParsPcm
Class for specifying audio encoding parameters for mapping PCM samples in AES3 frames directly
(without encoding) into an MPEG-2 transport stream according to SMPTE 302M-2002. The encoder
will generate one PES packet with audio samples per video frame.
m_BitPerSample
Number of bits per audio sample. Valid values are 16 (default), 20 and 24.
Remarks
The audio service type in DtEncAudPars::m_SvcType must be set to SVC_STEREO.
50
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncAudParsPcm::CheckValidity
Check the validity of the parameters for embedding PCM samples in a transport stream without en-
coding.
DtEncResult DtEncAudParsPcm::CheckValidity
();
Validity Checks
The audio service type DtEncAudPars::m_SvcType must be set to SVC_STEREO.
The bitrate in DtEncAudPars::m_Bitrate must be set to a specific value (see table below), dependent
on the specified number of bits per sample (DtEncAudParsPcm::m_BitPerSample).
Result
For generic result codes, see the Results table listed on the DtEncPars::CheckValidity page. The
following result codes are specific for PCM sample embedding:
Remarks
51
DTAPI – Audio/Video Encoding Classes
Reference Manual
class DtEncControl
DtEncControl
Top-level class for controlling DekTec video encoder hardware.
class DtEncControl;
Video encoder hardware may require significant time to boot and to initialize. When DtEncControl
is attached, the underlying hardware may still be booting or initializing. While this is the case, no
operations can be performed on the encoder (DTAPI_E_INITIALIZING will be returned). Should the
encoder hardware encounter a fatal error, all further operations will return an error code
(DTAPI_E_IN_ERROR_STATE). To rectify this, detach from the channel and attach again. This process
will reboot the encoder hardware.
Two methods are provided to check the initialization status:
DtEncControl::GetOperationalState to poll the current initialization state of the encoder;
DtEncControl::WaitForInitialized to wait, optionally with a timeout, until the initialization state
is OS_NORMAL.
When a DtEncControl object is detached, the encoder will be brought back to the reset state. This
may take some time, so that the user application has to wait for the normal state again when a
DtEncControl object is attached.
52
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncControl::AttachToPort
Attach the encoder-control object to an encoder port. Only one encoder-control object can be at-
tached to an encoder port at a time (exclusive access).
DTAPI_RESULT DtEncControl::AttachToPort
(
[in] DtDevice* pDtDvc, // Device object
[in] int Port, // Physical port number (1…#ports)
[in] bool ProbeOnly=false // Just check whether channel is in use
);
Function Arguments
pDtDvc
Pointer to the device object that represents a DekTec encoder device. The device object must
have been attached to the device hardware.
Port
Physical port number (must be an encoder port) to which the encoder-control object is attached.
DekTec has the following devices with encoder ports available.
Type Port Encoder type
DTA-2180 4 Magnum D7Pro encoder
ProbeOnly
Probe whether the encoder is in use, but do not actually attach.
Result
DTAPI_RESULT Meaning
DTAPI_OK Channel object has been attached successfully to the port.
DTAPI_E_ATTACHED Channel object is already attached.
DTAPI_E_DEVICE Pointer pDtDvc is not valid or the device object is not attached
to a hardware device.
DTAPI_E_DEV_DRIVER Unclassified failure in device driver.
DTAPI_E_IN_USE Another channel object is already attached to this port.
DTAPI_E_NO_ENCODER Port is not an encoder.
DTAPI_E_NO_SUCH_PORT Invalid port number for this device.
Remarks
53
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncControl::Detach
Detach encoder-control object from the encoder hardware and free resources.
DTAPI_RESULT DtEncControl::Detach
();
Function Arguments
Result
DTAPI_RESULT Meaning
DTAPI_OK Encoder-control object has been detached successfully.
DTAPI_E_NOT_ATTACHED Encoder-control object is not attached to encoder hardware, so
it cannot be detached.
Remarks
54
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncControl::GetEncPars
Get the current encoding parameters. This method will always return the parameters that have been
set with DtEncControl::SetEncPars.
DTAPI_RESULT DtEncControl::GetEncPars
(
[out] DtEncPars& EncPars // Retrieved encoding parameters
);
Function Arguments
EncPars
Output argument that receives the current set of encoding parameters.
Result
DTAPI_RESULT Meaning
DTAPI_OK The encoding parameters have been retrieved successfully.
DTAPI_E_FAN_FAIL The fan is failing. No operations can be performed.
DTAPI_E_IN_ERROR_STATE The encoder is in a fatal error state and no operations can be
performed.
DTAPI_E_INITIALIZING The encoder is initializing and no operations can be performed.
DTAPI_E_NO_POWER The power has not been connected properly to the encoder
hardware. No operations can be performed.
DTAPI_E_NOT_ATTACHED Encoder-control object is not attached to encoder hardware.
Remarks
55
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncControl::GetOperationalState
Get the current operational state of the encoder hardware.
DTAPI_RESULT DtEncControl::GetOperationalState
(
[out] OpState& State // Operational state
);
Function Arguments
State
Receives the current operational state of the encoder hardware.
Value Meaning
OS_BOOTING The encoder hardware is booting. This may take considerable
time, up to 11s for the DTA-2180 and DTA-2182.
OS_INIT The encoder hardware is initializing. This may take considera-
ble time, but not as long as booting. For the DTA-2180 or
DTA-2182, the maximum initialization time is TBDs.
OS_IDLE The encoder hardware is initialized, but still idle (not encoding).
In this state parameters can be specified and encoding can be
started with SetOperationalState.
OS_RUN The encoder hardware is encoding. Parameters can be
changed and encoding can be stopped.
OS_ERROR The encoder hardware is in a fatal error state. The only way to
recover from this situation is attempting a reboot by detaching
and re-attaching (which will cause a reboot), or by an explicit
reboot with DtEncControl::Reboot.
OS_FAN_FAIL The fan is failing and caused the encoder stop. The only way to
recover from this situation is attempting a reboot by detaching
and re-attaching (which will cause a reboot), or by an explicit
reboot with DtEncControl::Reboot.
OS_NO_POWER The external power connection of the encoder hardware (6-pin
PCIe power connector) is not connected to a power supply. The
only way to recover from this situation is attempting a reboot by
detaching and re-attaching (which will cause a reboot), or by
an explicit reboot with DtEncControl::Reboot.
Result
DTAPI_RESULT Meaning
DTAPI_OK The operational state has been retrieved successfully.
DTAPI_E_NOT_ATTACHED Encoder-control object is not attached to encoder hardware.
Remarks
56
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncControl::IsSeamless
Check whether the transition from the current to a new set of encoding parameters can be performed
seamlessly, or not. A transition is seamless if no artefacts are visible. For many encoding-parameter
transitions the encoder has to be stopped and restarted, causing a non-seamless transition.
DTAPI_RESULT DtEncControl::IsSeamless
(
[in] const DtEncPars& NewPars // New encoding parameters
[out] bool& Seamless // Transition is seamless yes/no
);
Function Arguments
NewPars
The new encoding parameters.
Seamless
Indicates whether the transition can be performed seamlessly.
Result
DTAPI_RESULT Meaning
DTAPI_OK The check for a seamless transition has been performed suc-
cessfully.
DTAPI_E_FAN_FAIL The fan is failing. No operations can be performed.
DTAPI_E_IN_ERROR_STATE The encoder is in a fatal error state and no operations can be
performed.
DTAPI_E_NO_POWER The power has not been connected properly to the encoder
hardware. No operations can be performed.
DTAPI_E_INITIALIZING The encoder is initializing and no operations can be performed.
DTAPI_E_INVALID_PARS The new encoding parameters are invalid.
DTAPI_E_NOT_ATTACHED Encoder-control object is not attached to encoder hardware.
Remarks
57
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncControl::Reboot
Reboot the encoder hardware.
WARNING. Rebooting encoder hardware takes considerable time (about 11s for the DTA-2180 and
DTA-2182) and is not necessary except as “emergency measure” if the encoder is stuck (e.g. due to
an issue with the power or fan).
DTAPI_RESULT DtEncControl::Reboot
();
Function Arguments
Result
DTAPI_RESULT Meaning
DTAPI_OK The encoder is rebooting.
DTAPI_E_NOT_ATTACHED Encoder-control object is not attached to encoder hardware.
Remarks
58
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncControl::SetEncPars
Set the encoding parameters. Only the full set of parameters can be specified, incremental changes
are not supported.
If the encoder is not running (state is not OS_RUN), the encoding parameters will become active when
the encoder state is changed to OS_RUN.
If the encoder is running (state is OS_RUN), the encoding parameters will be applied on the fly, and
SetEncPars will return when the encoder is running with the new parameter set. If possible, DTAPI
will change the parameters seamlessly. Otherwise the encoder will be stopped and restarted with the
new parameters.
DTAPI_RESULT DtEncControl::SetEncPars
(
[in] const DtEncPars& EncPars // New encoding parameters
);
Function Arguments
EncPars
New set of encoding parameters.
Result
DTAPI_RESULT Meaning
DTAPI_OK The new parameters have been set successfully.
DTAPI_E_FAN_FAIL The fan is failing. No operations can be performed.
DTAPI_E_IN_ERROR_STATE The encoder is in a fatal error state and no operations can be
performed.
DTAPI_E_INITIALIZING The encoder is initializing and no operations can be performed.
DTAPI_E_INVALID_PARS The new encoding parameters are invalid.
DTAPI_E_LICENSE The new encoding parameters need a license that is not availa-
ble.
DTAPI_E_NO_POWER The power has not been connected properly to the encoder
hardware. No operations can be performed.
DTAPI_E_NOT_ATTACHED Encoder-control object is not attached to encoder hardware.
Remarks
59
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncControl::SetOperationalState
Set the operational state in order to start or stop encoding.
DTAPI_RESULT DtEncControl::SetOperationalState
(
[in] const OpState& State // New operational state
);
Function Arguments
State
New operational state.
Value Meaning
OS_IDLE Go to the idle state. If the current operational state is OS_RUN,
encoding is stopped.
OS_RUN Go to the run state. If the current operational state is OS_IDLE,
encoding is started.
Result
DTAPI_RESULT Meaning
DTAPI_OK The new operational state has been applied successfully.
DTAPI_E_FAN_FAIL The fan is failing. No operations can be performed.
DTAPI_E_IN_ERROR_STATE The encoder is in a fatal error state and no operations can be
performed.
DTAPI_E_INITIALIZING The encoder is initializing and the operational state cannot yet
be set.
DTAPI_E_INVALID_ARG The argument State has an invalid value.
DTAPI_E_NO_POWER The power has not been connected properly to the encoder
hardware. No operations can be performed.
DTAPI_E_NOT_ATTACHED Encoder-control object is not attached to encoder hardware.
Remarks
It’s an error to call SetOperationalState while the encoder is booting or initializing (operational
state is OS_BOOTING or OS_INIT).
60
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncControl::WaitForInitialized
Wait until the encoder hardware is initialized, this is operational state is not OS_BOOTING and not
OS_INIT.
DTAPI_RESULT DtEncControl::WaitForInitialized
(
[in] int TimeOut // Timeout in ms
);
Function Arguments
TimeOut
Timeout in milliseconds. The valid range is 1 to 20.000ms (20 seconds). An infinite time out is
not supported.
Result
DTAPI_RESULT Meaning
DTAPI_OK The encoder hardware is initialized.
DTAPI_E_FAN_FAIL The fan is failing. No operations can be performed.
DTAPI_E_IN_ERROR_STATE The encoder is in a fatal error state and no operations can be
performed.
DTAPI_E_NO_POWER The external power of the encoder is not connected.
DTAPI_E_NOT_ATTACHED Encoder-control object is not attached to encoder hardware.
DTAPI_E_TIMEOUT The timeout period expired while waiting for the encoder hard-
ware to boot and initialize.
Remarks
61
DTAPI – Audio/Video Encoding Classes
Reference Manual
class DtEncMuxPars
Class for specifying transport-stream multiplexing and system parameters for encoders.
DtEncMuxPars::EsPars
Helper structure describing the multiplexing parameters for an elementary stream.
struct EsPars
{
public:
int m_Pid; // PID; -1=disabled
int m_StreamId; // Stream ID of the elementary stream
Public Members
m_Pid
PID on which the elementary stream is multiplexed. The valid range for m_Pid is 16 to 8190
(0x1FFE). MPEG-2, DVB and ATSC reserve certain low PID values, refer to the respective stand-
ards. A value of -1 indicates that the elementary stream is not multiplexed in the output transport
stream.
m_StreamId
Stream ID assigned to the elementary stream. The valid range for m_StreamId for video is 224
to 239 and for audio is 192 to 223, except for AC-3 audio, which is limited to 189 (private
stream).
SetEncType()
Set the type number of the encoder card for which the parameters are meant. The encoder type
number can be read back with GetEncType (implemented in DtEncParsBase).
This method returns DTAPI_E_INVALID_ARG if the encoder type number is invalid, or if the type
number is valid but it is not encoder hardware.
62
DTAPI – Audio/Video Encoding Classes
Reference Manual
// Scheduling intervals
int m_PatInterval; // PAT interval in ms
int m_PmtInterval; // PMT interval in ms
int m_PcrInterval; // PCR interval in ms
Public Members
m_Bitrate
Transport stream output bitrate. The valid range for the Magnum D7Pro (DTA-2180, DTA-2182)
is 2.5Mbps to 128Mbps. The default value depends on the selected format: 10Mbps for SD and
20Mbps for HD.
m_TsId
Transport stream ID inserted into the output transport stream. The valid range is 0 through
0xFFFF and the default value is 0.
m_PcrPid
PID of the stream into which the PCRs are inserted. If the PCR PID is the same as the video PID
(m_VidPid), then the PCR values are inserted into the video elementary stream. Otherwise a
separate PCR elementary stream is generated.
The default value for PCR PID is 0x100, which is the same default as for the video PID, so by
default the video PID contains PCRs.
m_PmtPid
PID of the PMT (Program Map Table). The default value for PMT PID is 0x50.
m_VidEsPars
PID and stream ID of the video elementary stream stored in an EsPars object. The default value
for the video PID is 0x100. The valid range for the video stream ID is 0 to 255, and the default
value is 224.
63
DTAPI – Audio/Video Encoding Classes
Reference Manual
m_PatInterval
Interval (ms) with which the PAT (Program Association Table) is scheduled in the output transport
stream. The valid range is 1 to 100ms, and the default value is 50ms.
m_PmtInterval
Interval (ms) with which the PMT (Program Map Table) is scheduled in the output transport
stream. The valid range is 1 to 100ms and the default value is 50ms.
m_PcrInterval
Interval (ms) with which PCR values are scheduled into the output transport stream. The valid
range is 1 to 40ms and the default value is 35ms.
SetEncType()
Set the type number of the encoder card for which the parameters are meant. The encoder type
number can be read back with GetEncType (implemented in DtEncParsBase).
This method returns DTAPI_E_INVALID_ARG if the encoder type number is invalid, or if the type
number is valid but it is not encoder hardware.
64
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncMuxPars::CheckValidity
Check the validity of the multiplexing parameters.
DtEncResult DtEncMuxPars::CheckValidity
();
Function Arguments
Result
See the Results table listed on the DtEncPars::CheckValidity page.
Remarks
65
DTAPI – Audio/Video Encoding Classes
Reference Manual
class DtEncPars
Public Members
m_SourcePort
Port number of the physical port connected to encoder’s input. The table below lists the source
ports available on the different DekTec encoders.
Type Source Port Description
DTA-2180 1 (default) SDI input, accepting SD-SDI and HD-SDI.
2 HDMI input.
m_AncPars
Encoding and embedding parameters for data that is not audio or video: AFD/BAR insertion,
closed captioning, video index, VITC insertion.
m_MuxPars
Parameters specifying the structure of the transport stream generated by the encoder, and spec-
ifying system-level parameters such as the end-to-end delay.
m_VidPars
Video encoding parameters, specifying both the video preprocessing and the actual video en-
coding parameters. The video PID and stream ID are located in m_MuxPars.
m_AudPars
Audio encoding parameters per service. This vector is sized to the maximum number of audio
services that can be encoded when the DtEncPars object is constructed with an EncType argu-
ment, or when DtEncPars::SetEncType() is called.
66
DTAPI – Audio/Video Encoding Classes
Reference Manual
Each DtEncAudPars object has an enable flag, so the actual number of encoded audio services
depends on the number of ‘enabled’ objects. The audio PIDs and stream IDs are located in
m_MuxPars.
67
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncPars::CheckValidity
Check the validity of the encoding parameters. If the parameters are invalid, return a result value
indicating the reason of invalidity. If the encoding parameters have multiple errors, the first detected
error is returned. This needs not be the “most important” error.
DtEncResult DtEncPars::CheckValidity
(
[in] bool SkipRateChecks = false // Skip checks related to bitrates
);
Function Arguments
SkipRateChecks
If this argument is true, checks related to bitrates are skipped. This enables checking, for ex-
ample, the validity of the encoding parameters when the transport-stream bitrate has not been
set yet. The default value of this argument is false, which means that bitrates are checked.
Result
DtEncResult Meaning
DT_ENC_OK The encoding parameters are valid.
DT_ENC_E_AUDBITRATETOOLOW The encoded-audio bitrate is too low for the audio service
type.
DT_ENC_E_AUDBITRATETOOHIGH The encoded-audio bitrate is too high for the audio service
type.
DT_ENC_E_EXC_NUMAAC The number of AAC audio services is too high for the current
encoder hardware.
DT_ENC_E_EXC_NUMDOLBYE The number of Dolby-E audio services is too high for the
current encoder hardware.
DT_ENC_E_EXC_NUMNONSURROUND The number of non-surround audio services (mono, dual
mono, stereo) is too high for the current encoder hardware.
DT_ENC_E_EXC_NUMSURROUND The number of surround services is too high for the current
encoder hardware. For the DTA-2180, the maximum num-
ber of surround services is 2.
DT_ENC_E_INV_AACPAR The value of one of the AAC enumeration parameters is in-
valid.
DT_ENC_E_INV_AC3MODE The value of one of the AC-3 enumeration parameters is in-
valid.
DT_ENC_E_INV_AFDBARMODE The value in DtEncAncPars::m_AfdBarMode is not a valid
AFD/BAR value.
DT_ENC_E_INV_ASPECTRATIO The value in DtEncVidPars::m_AspectRatio is not a valid
aspect ratio.
DT_ENC_E_INV_AUDBITRATE The audio service bitrate is invalid.
68
DTAPI – Audio/Video Encoding Classes
Reference Manual
69
DTAPI – Audio/Video Encoding Classes
Reference Manual
70
DTAPI – Audio/Video Encoding Classes
Reference Manual
Remarks
71
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncPars::FromXml
Initialize the encoding parameters in this DtEncPars object from an XML string.
DTAPI_RESULT DtEncPars::FromXml
(
[in] const wstring& XmlString // Parameters encoded in XML
);
int DtEncPars::GetEncType();
Function Arguments
XmlString
XML string containing the encoding parameters in a serialized form.
Result
DTAPI_RESULT Meaning
DTAPI_OK The encoding parameters have been initialized successfully.
DTAPI_E_XML_ELEM A required element in the XML string is missing at the expected
location.
DTAPI_E_XML_SYNTAX The XML string is not well-formed XML.
Remarks
DtEncPars::FromXml accepts XML strings that are incomplete, e.g. generated by an older DTAPI
version in which certain encoding parameters were missing.
• For all parameters except video-encoding parameters, DtEncPars::FromXml leaves DtEncPars
fields that are not present in the XML string untouched. We therefor recommend to initialize the
DtEncPars objects with default values before invoking DtEncPars::FromXml.
• For video-encoding parameters this works differently: DtEncPars::FromXml starts by reading
the video standard, the video-encoding standard, the profile and the level. These values are
passed to SetDefaultsForProfileLevel, which sets the video-encoding parameters to sensi-
ble default values for the given profile and level. This way, if a certain video-encoding parameter
is not contained in the XML string, the corresponding will get a reasonable value anyway.
This means that with respect to defaults, DtEncPars::FromXml operates asymmetrically between
video-encoding parameters and other parameters. Video encoding parameters are automatically in-
itialized to defaults, while the user has to set defaults for the other parameters before calling this
routine.
72
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncPars::IsSeamless
Check whether the transition from one set of encoding parameters to another can be performed
seamlessly, or not. A transition is seamless if no artefacts are visible. For many encoding-parameter
transitions the encoder has to be stopped and restarted, causing a non-seamless transition.
Function Arguments
OldPars, NewPars
The old and the new encoding parameters for the transition.
Seamless
Indicates whether the transition is seamless.
Result
DTAPI_RESULT Meaning
DTAPI_OK The check for a seamless transition has been performed suc-
cessfully.
DTAPI_E_INVALID_PARS The old or new encoding parameters are invalid.
Remarks
73
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncPars::MinTsRate
Compute the minimum transport-stream rate – valid for the current encoder type number – corre-
sponding to the encoding parameters in this DtEncPars object.
This method can be used to find a suitable value to initialize m_MuxPars.m_Bitrate.
int DtEncPars::MinTsRate
();
Function Arguments
Result
The minimum transport-stream rate required for this set of encoding parameters. If the encoding
parameters are invalid, -1 is returned.
Remarks
MinTsRate() checks the validity of the encoding parameters, but as this method is meant to compute
a valid value for the transport-stream bitrate, parameter m_MuxPars.m_Bitrate is not used in the
validity check.
74
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncPars::NumAudPars
Method that returns the number of DtEncAudPars objects available. This is the maximum number of
audio services that can be encoded. Each DtEncAudPars object has an enable flag, so the actual
number of encoded audio services depends on the number of ‘enabled’ objects.
int DtEncPars::NumAudPars
();
Function Arguments
Result
The number of DtEncAudPars objects (audio parameter structures) available in vector
DtEncPars::m_AudPars (the size of this vector).
Remarks
75
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncPars::ReqNumLicPoints
Method that computes the number of license points required for the specified audio-encoding stand-
ard (e.g. for Dolby AC-3), given the encoding parameters in this DtEncPars object. This routine ac-
cumulates the number of license points required for each enabled audio service that uses the specified
audio-encoding standard.
DTAPI_RESULT DtEncPars::ReqNumLicPoints
(
[in] DtAudEncStd AudEncStd; // Audio encoding standard
[out] int& NumPoints; // Number of license points required
);
Function Arguments
AudEncStd
Audio-encoding standard for which to determine the number of required license points. See 3.1
Audio Encoding Standards for a list of supported audio encoding standards.
NumPoints
The computed number of license points required for the specified audio-encoding standard.
Result
DTAPI_RESULT Meaning
DTAPI_OK The number of required license points has been computed suc-
cessfully.
DTAPI_E_NOT_INITIALIZED The encoding parameters in this DtEncPars objects have not
been initialized properly, they are invalid.
Remarks
76
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncPars::SetEncType
Set the type number of the encoder card for which the encoding parameters are meant. The encoder
type number can be read back with GetEncType.
DTAPI_RESULT DtEncPars::SetEncType
(
[in] int EncType // Type of encoder card (e.g. 2180)
);
int DtEncPars::GetEncType();
Function Arguments
EncType
Type number of the encoder card, e.g. 2180.
Result
DTAPI_RESULT Meaning
DTAPI_OK The encoder type number has been set successfully.
DTAPI_E_INVALID_ARG The encoder type number is invalid or the type number is valid
but the device is not an encoder.
Remarks
77
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncPars::SetVidEncDefaultPars
Set default video encoding parameters for a given video-encoding standard (e.g. H.264) and video
standard (e.g. 1080i50). Before calling this routine the encoder type must have been set with
SetEncType.
DTAPI_RESULT DtEncPars::SetVidEncDefaultPars
(
[in] DtVidEncStd VidEncStd // Encoding standard: DT_VIDENC_STD_xxx
[in] int VidStd; // Video standard: DTAPI_VIDSTD_xxx
);
Function Arguments
VidEncStd
Video encoding standard, either DT_VIDENCSTD_H264 or DT_VIDENCSTD_MP2V.
VidStd
Video standard coded as a DTAPI_VIDSTD_xxx constant.
Result
DTAPI_RESULT Meaning
DTAPI_OK The video-encoding parameters have been set to their defaults
successfully.
DTAPI_E_INVALID_ARG The video encoding standard or the video standard is invalid.
DTAPI_E_NOT_INITIALIZED The encoder type number has not been set yet.
Remarks
78
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncPars::ToXml
Serialize the encoding parameters in this DtEncPars object into an XML string.
DTAPI_RESULT DtEncPars::ToXml
(
[out] wstring& XmlString // Parameters encoded in XML
);
int DtEncPars::GetEncType();
Function Arguments
XmlString
XML string receiving the serialized encoding parameters.
Result
DTAPI_RESULT Meaning
DTAPI_OK The encoding parameters have been initialized successfully.
Remarks
79
DTAPI – Audio/Video Encoding Classes
Reference Manual
class DtEncVidPars
// Constructor
DtEncVidPars(int EncType = -1);
The behavior of the constructor depends on the value of EncType. If EncType is -1, the default value,
then minimal initialization is applied and most members remain uninitialized. If a valid EncType is
passed to the constructor, DtEncVidPars fills the object with default values that are documented in
the member descriptions below.
80
DTAPI – Audio/Video Encoding Classes
Reference Manual
Public Members
m_AspectRatio
Aspect ratio signaled in the encoded video stream.
Value Meaning
DT_AR_4_3 4x3, not supported for HD
DT_AR_16_9 (default) 16x9
DT_AR_14_9 14x9, not supported for HD
m_Dithering
If true, use dithering to reduce the 10-bit video input data to 8 bits. If false, truncate 10-bit
input words to 8 bits. The default value is truncate (false).
m_HorResolutionRescaled
Horizontally rescale the input video to this resolution before encoding. The values allowed are
dependent on the width of the input video, as listed in the table below.
Input video width Value Meaning
any 0 (default) Disable rescaling
1920 pixels 1440 Scale by 3/4
1280 Scale by 2/3
960 Scale by 1/2
1280 pixels 960 Scale by 3/4
640 Scale by 1/2
720 pixels 704 Drop 16 pixels
640 Scale by 8/9 (square pixels)
544 Scale by 3/4
528 Drop 16, scale by 3/4
480 Scale by 2/3
352 Drop 16, scale by 1/2
m_InpLossImage
Enumeration that specifies the image to be used for encoding when the input signal to the
encoder is lost. The default value is IL_COLORBARS.
Value Meaning
IL_BLACKFRAME Encode black frames upon loss of input signal
IL_COLORBARS (default) Encode color bars upon loss of input signal
m_InvTelecineDetect
Detect telecine (film) patterns in the input video and perform the inverse operation.
81
DTAPI – Audio/Video Encoding Classes
Reference Manual
m_InvTelecineDetect can only be set to true if the frame rate is 59.94Hz or 60Hz. The
default value for m_InvTelecineDetect is false.
To convert 24-Hz film material to 60-Hz video, one easy-to-implement method is to convert two
24-Hz frames to five 60-Hz fields by duplicating one field of the second frame. This technique
is called 2:3 pulldown, as the first frame is copied to two fields, while the second frame is
converted to three fields.
If setting m_InvTelecineDetect is true, the 2-3 pattern is automatically detected in the 60Hz
video, and if found the video signal is converted back to 24-Hz by deleting duplicated fields.
m_PixelDepth
Pixel depth used for encoding. For the moment only 8-bit is supported and this is the default. In
future versions of DTAPI a pixel depth of 10 bits may be supported.
m_UvSampling
Chroma subsampling pattern used. In the current version of DTAPI 4:2:0 is the only supported
value.
Value Meaning
UV_420 (default) 4:2:0
UV_422 4:2:2. At the moment this value is not supported.
m_VidStd
Video standard (not the video-encoding standard!) coded as a DTAPI_VIDSTD_xxx constant.
The encoder hardware expects this video standard at its input. Currently progressive segmented
frame formats (e.g. DTAPI_VIDSTD_1080PSF30) are not supported.
The default video standard is DTAPI_VIDSTD_1080I50 for 1080i50.
m_EndToEndDelay
End-to-end delay in ms. The valid values for the Magnum D7Pro (DTA-2180, DTA-2182) are
150ms, 200ms, 350ms and 650ms. The default value is 650ms.
There are specific constraints for each value of end-to-end delay. Please refer to m_GopSize,
m_GopNumBPictures, m_CodingMode and DtEncAudParsAac::m_Profile for the details
of these constraints.
H264()
Pointer to the H.264 video-encoding parameters. Will return NULL if the video-encoding stand-
ard is not DT_VIDENCSTD_H264.
Mp2V()
Pointer to the MPEG-2 video encoding parameters. Will return NULL if the video-encoding stand-
ard is not DT_VIDENCSTD_MP2V.
SetEncType()
Set the type number of the encoder card for which the parameters are meant. The encoder type
number can be read back with GetEncType (implemented in DtEncParsBase).
This method returns DTAPI_E_INVALID_ARG if the encoder type number is invalid, or if the type
number is valid but it is not encoder hardware.
82
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncVidPars::CheckValidity
Check the validity of the video encoding parameters.
DtEncResult DtEncVidPars::CheckValidity
();
Function Arguments
Result
See the Results table listed on the DtEncPars::CheckValidity page.
Remarks
83
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncVidPars::Es2TpRate
Static function to convert a video elementary-stream bitrate (without transport-packet overhead) to a
video transport-packet bitrate (the bitrate of video stream packaged in transport packets).
Function Arguments
PcrInterval
Interval (ms) with which PCR values are scheduled into the video stream. For the valid range,
refer to DtEncMuxPars.m_PcrInterval.
Value Meaning
0 Another elementary stream is used to carry PCR.
VidStd
Video standard (not the video-encoding standard!) coded as a DTAPI_VIDSTD_xxx constant.
EsRate
Bitrate of the encoded video elementary stream in bits per second.
TpRate
Output argument that receives the bitrate of the video transport packets in bits per second.
Result
DTAPI_RESULT Meaning
DTAPI_OK The video transport-packet bitrate was computed successfully.
DTAPI_E_INVALID_ARG The value in PcrInterval or in EsRate is not valid.
DTAPI_E_INVALID_VIDSTD The value in VidStd is not a valid video standard.
Remarks
84
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncVidPars::H264
Get a pointer to the embedded H.264 video encoding parameters.
DtEncVidParsH264* DtEncVidPars::H264
();
Function Arguments
Result
DtEncVidParsH264*
Pointer to a DtEncVidParsH264 object containing the H.264 video encoding parameters. If the
video encoding standard stored in DtEncVidPars is not H.264 (DT_VIDENCSTD_H264), NULL is
returned.
85
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncVidPars::Mp2V
Get a pointer to the embedded MPEG-2 video encoding parameters.
DtEncVidParsMp2V* DtEncVidPars::Mp2V
();
Function Arguments
Result
DtEncVidParsMp2V*
Pointer to a DtEncVidParsMp2V object containing the MPEG-2 video encoding parameters. If
the video encoding standard stored in DtEncVidPars is not MPEG-2 video
(DT_VIDENCSTD_MP2V), NULL is returned.
86
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncVidPars::SetDefaultsForProfileLevel
Set default video-encoding parameters for a given profile and level.
DtEncResult DtEncVidPars::SetDefaultsForProfileLevel
(
[in] H264Profile Profile // H.264 profile: PROFILE_MAIN, …
[in] H264Level Level // H.264 profile: LEVEL_1_0, …
);
DtEncResult DtEncVidPars::SetDefaultsForProfileLevel
(
[in] Mp2VProfile Profile // MPEG-2 video profile: PROFILE_MAIN, …
[in] Mp2VLevel Level // MPEG-2 video profile: LEVEL_1_0, …
);
Function Arguments
Profile
Defines the H.264 or MPEG-2 video profile. Please refer to §1 Profiles and Levels for a descrip-
tion of profiles, and the values supported for DekTec encoders.
Level
Defines the H.264 or MPEG-2 video profile. Please refer to §1 Profiles and Levels for a descrip-
tion of profiles, and the values supported for DekTec encoders.
Result
DtEncResult Meaning
DT_ENC_OK The new video encoding parameters have been set successfully.
DT_ENC_E_INV_PROFILE Invalid H.264 or MPEG-2 video profile, or the profile is not
supported by the current encoder hardware.
DT_ENC_E_INV_LEVEL Invalid H.264 or MPEG-2 video level, or the level is not sup-
ported by the specified profile and/or current encoder hard-
ware.
DT_ENC_E_INV_TYPE The type number set with SetEncType() is not valid encoder
hardware.
DT_ENC_E_INV_VIDSTD The value in DtEncVidPars::m_VidStd is not a valid video
standard, not supported by the encoder or incompatible with
the current profile and level.
DT_ENC_E_TYPE_NOT_SET No type number has been set with SetEncType().
Remarks
Parameters DtEncVidPars.m_VidStd, DtEncVidPars.m_HorResolutionRescaled and
DtEncVidPars.m_AspectRatio, which have dependencies to the profile and level constraints, are
not affected by this method and need to be set separately.
87
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncVidPars::SetVidEncStd, GetVidEncStd
Set the video encoding standard. If VidEncStd changes (different from the value stored in the
DtEncVidPars object), SetVidEncStd deletes the old parameters object, if any, and creates a new
internal object with encoding-standard specific parameters (either DtEncVidParsH264 or
DtEncVidParsMp2V), and initializes these parameters with default values.
Before calling SetVidEncStd, set the encoder type and the video standard DtEncVidPars::m_VidStd
to a valid value. This is required so that meaningful defaults can be computed.
The video-encoding standard can be read back with GetVidEncStd.
DTAPI_RESULT DtEncVidPars::SetVidEncStd
(
[in] DtVidEncStd VidEncStd; // Video encoding standard
};
DtVidEncStd DtEncVidPars::GetVidEncStd();
Function Arguments
VidEncStd
Video-encoding standard.
Value Meaning
DT_VIDENCSTD_H264 H.264 (AVC)
DT_VIDENCSTD_H265 H.265; Not supported by DekTec encoder hardware yet
DT_VIDENCSTD_MP2V MPEG-2 video
Result
DTAPI_RESULT Meaning
DTAPI_OK The new video encoding standard has been set successfully.
DTAPI_E_ENC_TYPE_NOTSET The encoder type has not been set.
Remarks
If the video encoding standard was already set to the standard specified in VidEncStd, then
SetVidEncStd is a no-operation. In this case default parameters will not be set.
88
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncVidPars::Tp2EsRate
Static function to convert a video transport-packet bitrate (the bitrate of video stream packaged in
transport packets) to a video elementary-stream bitrate (without transport-packet overhead).
Function Arguments
PcrInterval
Interval (ms) with which PCR values are scheduled into the video stream. For the valid range,
refer to DtEncMuxPars.m_PcrInterval.
Value Meaning
0 Another elementary stream is used to carry PCR.
VidStd
Video standard (not the video-encoding standard!) coded as a DTAPI_VIDSTD_xxx constant.
TpRate
Bitrate of the video transport packets in bits per second.
EsRate
Output argument that receives the bitrate of the encoded video elementary stream in bits per
second.
Result
DTAPI_RESULT Meaning
DTAPI_OK The video transport-packet bitrate was computed successfully.
DTAPI_E_INVALID_ARG The value in PcrInterval or in TpRate is not valid.
DTAPI_E_INVALID_VIDSTD The value in VidStd is not a valid video standard.
Remarks
89
DTAPI – Audio/Video Encoding Classes
Reference Manual
DtEncVidPars::TpRate
Compute the video transport-packet bitrate (the bitrate of video stream packaged in transport packets)
for the video-encoding parameters in the DtEncVidPars object. The PCR interval must be specified
as an argument.
int DtEncVidPars::TpRate
(
[in] int PcrInterval; // PCR interval in ms
};
Function Arguments
PcrInterval
Interval (ms) for which PCR values are scheduled into the video transport packets. For the valid
range, refer to DtEncMuxPars.m_PcrInterval.
Value Meaning
0 Another elementary stream is used to carry PCR.
Result
The computed video transport-packet bitrate. If the encoding parameters or PcrInterval are
invalid, -1 is returned.
Remarks
90
DTAPI – Audio/Video Encoding Classes
Reference Manual
class DtEncVidParsH264
// GOP parameters
bool m_ClosedGop; // Use closed GOPs
int m_GopSize; // GOP size in #frames (-1=auto)
int m_GopNumBPictures; // Number of B pictures (-1=auto)
m_Profile
Defines the H.264 profile. Please refer to §1 Profiles and Levels for a description of profiles.
Value Meaning
PROFILE_CONSTRAINED_BASE H.264 Constrained Baseline Profile (CBP)
PROFILE_MAIN H.264 Main Profile (MP)
PROFILE_HIGH (default) H.264 High Profile (HP)
PROFILE_AVCI50 AVC-Intra 50 profile: Currently not supported by DekTec en-
coder hardware.
PROFILE_AVCI100 AVC-Intra 100 profile: Currently not supported by DekTec en-
coder hardware.
91
DTAPI – Audio/Video Encoding Classes
Reference Manual
m_Level
Defines the H.264 level. Please refer to §1 Profiles and Levels for a description of levels.
Value Meaning
LEVEL_AUTO (default) Level constraints are ignored
LEVEL_1 Level 1
LEVEL_1.1 Level 1.1
LEVEL_1.2 Level 1.2
LEVEL_1.3 Level 1.3
LEVEL_2 Level 2
LEVEL_2.1 Level 2.1
LEVEL_2.2 Level 2.2
LEVEL_3 Level 3
LEVEL_3.1 Level 3.1
LEVEL_3.2 Level 3.2
LEVEL_4 Level 4
LEVEL_4.1 Level 4.1
LEVEL_4.2 Level 4.2
LEVEL_5 Level 5
LEVEL_5.1 Level 5.1
m_Bitrate
Bitrate of the encoded video in bits per second. The bitrate must be between 256kbps and
80Mbps. The default bitrate is 80Mbps.
m_VbvDelayMax
Maximum VBV delay in milliseconds. The value must be between 30 and 1000ms, with -1
(default) meaning “automatic” maximum VBV delay.
m_ClosedGop
If true, close every GOP. If false, open GOPs are used. The default is open GOPs (false).
m_GopSize
The size of each GOP in number of frames. The valid range is 1 through 300, or -1 (default)
indicating “automatic” GOP size. The table below describes the meaning of “automatic GOP
size” as a function of the system delay.
System delay Meaning of value -1 (automatic GOP size)
150ms/250ms/350ms GOP size is infinite. This means that there will be I-fields only at
scene changes and all other fields will be P-fields using Contin-
uous Decoder Refresh (CDR).
650ms GOP size is 300 frames
92
DTAPI – Audio/Video Encoding Classes
Reference Manual
m_GopNumBPictures
Number of B pictures between I/P pictures, which specifies the GOP structure of the encoded
video (see the table below). A value of -1 (default) indicates that the encoder “automatically”
chooses the GOP structure. The table below describes the meaning of “automatic GOP size” as
a function of the system delay.
m_GopNumBPictures GOP structure
-1 (default) Automatic
0 IP
1 IPB
2 IPBB
3 IPBBB
m_8x8Transform
Enable 8x8 transforms. If 8x8 transforms are not enabled, the less efficient scheme 4x4 is used.
The default is true.
m_Cabac
Enable CABAC (Context-Adaptive Binary Arithmetic Coding), an advanced form of entropy en-
coding. If CABAC is not enabled, the simpler scheme CAVLC (Context-Adaptive Variable-Length
Coding) is used. The default is CABAC enabled (true).
m_AdaptiveQuantization
Enable adaptive quantization. The default value is true.
m_ChromaScalingList
Enable chrominance scaling list to get a better video quality for Sarnoff-like content. The default
is to disable chrominance scaling (false).
93
DTAPI – Audio/Video Encoding Classes
Reference Manual
m_CodingMode
The coding mode to use.
Value Meaning
CM_AUTO (default) Automatically select an appropriate coding mode
CM_FRAME Frame coding for progressive video
CM_FIELD Field coding for interlaced video
CM_MBAFF MBAFF coding for interlaced video
m_IdrFrequency
Frequency of IDRs relative to I frames: 0=No IDR frames, 1=every I-frame, 2=every second
I-frame, etc. The valid range is 0 through 255. The default is no IDR frames (value 0).
m_IntraScoreAvg
Use averaged intra score to compute the QP (Quantization Parameter) increase. The default
value is false.
m_QuantizationTable
Quantization table to use for encoding. A default table (value 0) and five custom tables are
defined (value 1 through 5).
m_WeightedPrediction
Enable weighted prediction. The default value is true.
94
DTAPI – Audio/Video Encoding Classes
Reference Manual
class DtEncVidParsMp2V
// GOP parameters
bool m_ClosedGop; // Use closed GOPs
int m_GopSize; // GOP size in #frames (-1=auto)
int m_GopNumBPictures; // Number of B pictures (-1=auto)
m_Profile
Defines the MPEG-2 video profile. Please refer to §1 Profiles and Levels for a description of
profiles.
Value Meaning
PROFILE_SIMPLE MPEG-2 video simple profile
PROFILE_MAIN MPEG-2 video Main Profile (MP)
PROFILE_HIGH (default) MPEG-2 video High Profile (HP)
PROFILE_422P MPEG-2 video 422P profile. Not supported by current DekTec
encoder hardware.
95
DTAPI – Audio/Video Encoding Classes
Reference Manual
m_Level
Defines the MPEG-2 video level. Please refer to §1 Profiles and Levels for a description of levels.
Value Meaning
LEVEL_AUTO (default) Level constraints are ignored
LEVEL_HIGH High Level (HL)
LEVEL_HIGH1440 High 1440 Level
LEVEL_MAIN Main Level (ML)
m_Bitrate
Bitrate of the encoded MPEG-2 video in bits per second. The bitrate must be between 512kbps
and 80Mbps. The default bitrate is 80Mbps.
m_VbvDelayMax
Maximum VBV delay in milliseconds. The value must be between 30 and 728ms, with -1 (de-
fault) meaning “automatic” maximum VBV delay.
m_ClosedGop
If true, close every GOP. If false, open GOPs are used. The default is open GOPs (false).
m_GopSize
The size of each GOP in number of frames. The valid range is 1 through 300, or -1 (default)
indicating “automatic” GOP size. The table below describes the meaning of “automatic GOP
size” as a function of the system delay.
System delay Meaning of value -1 (automatic GOP size)
150ms/250ms/350ms GOP size is infinite. This means that there will be I-fields only at
scene changes and all other fields will be P-fields using Contin-
uous Decoder Refresh (CDR).
650ms GOP size is 132 frames
m_GopNumBPictures
Number of B pictures between I/P pictures, which specifies the GOP structure of the encoded
video (see the table below). A value of -1 (default) indicates that the encoder “automatically”
chooses the GOP structure. The table below describes the meaning of “automatic GOP size” as
a function of the system delay.
m_GopNumBPictures GOP structure
-1 Automatic
0 IP
1 IPB
2 IPBB
3 IPBBB
96
DTAPI – Audio/Video Encoding Classes
Reference Manual
m_AlternateScan
Use alternate scan pattern for VLC coefficients. The default is true.
m_IntraDcPrecision
Number of bits used for intra-DC values: 8…11, or -1 for a ‘dynamic’ number of bits to use.
The default intra-DC precision is 8 bits.
m_IntraVlcFmt
The intra VLC format to use.
Value Meaning
IV_ALTERNATE (default) Alternate intra-VLC format
IV_MPEG1 MPEG-1 intra-VLC format
m_LowDelayFlag
Set the low delay flag (no B pictures). The default value is false.
m_QScaleType
Type of quantization scale.
Value Meaning
QS_LINEAR Linear quantization scale
QS_NONLINEAR (default) Non-linear quantization scale
m_AdaptiveQuantization
Enable adaptive quantization. The default value is true.
m_IdrFrequency
Frequency of IDRs relative to I frames: 0=No IDR frames, 1=every I-frame, 2=every second
I-frame, etc. The valid range is 0 through 255. The default is no IDR frames (value 0).
m_QuantizationTable
Quantization table to use for encoding. A default table (value 0) and five custom tables are
defined (value 1 through 5).
97