AJA NTV2 SDK  17.5.0.1242
NTV2 SDK 17.5.0.1242
ntv2configts2022.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #ifndef NTV2_2022CONFIGTS_H
9 #define NTV2_2022CONFIGTS_H
10 
11 #include "ntv2card.h"
12 #include "ntv2enums.h"
13 #include "ntv2registers2022.h"
14 #include "ntv2mbcontroller.h"
15 #include "ntv2tshelper.h"
16 #include "ntv2config2022.h"
17 #include <string.h>
18 
19 // Encoder part numbers
20 #define ENCODE_TS_TIMER 0
21 #define ENCODE_TS_J2K_ENCODER 1
22 #define ENCODE_TS_MPEG_J2K_ENCAP 2
23 #define ENCODE_TS_AES_ENCAP 3
24 #define ENCODE_TS_MPEG_AES_ENCAP 4
25 #define ENCODE_TS_MPEG_ANC_ENCAP 6
26 #define ENCODE_TS_MPEG_PCR_ENCAP 7
27 
28 // Decoder part numbers
29 #define DECODE_TS_MPEG_J2K_DECAP 0
30 #define DECODE_TS_J2K_DECODER 1
31 #define DECODE_TS_MPEG_AES_DECAP 2
32 #define DECODE_TS_AES_DECAP 3
33 #define DECODE_TS_MPEG_ANC_DECAP 5
34 
35 
36 #define PES_HDR_LOOKUP 0x0
37 #define PES_HDR_LEN 0xc0
38 #define PTS_OFFSET 0xc1
39 #define J2K_TS_OFFSET 0xc2
40 #define AUF1_OFFSET 0xc3
41 #define AUF2_OFFSET 0xc4
42 #define PACKET_RATE 0xca
43 #define HOST_EN 0xe0
44 #define INTERLACED_VIDEO 0xe1
45 #define PAYLOAD_PARAMS 0xe2
46 #define LOOPBACK 0xe3
47 #define PAT_TABLE_LOOKUP 0x100
48 #define PAT_PMT_PERIOD 0x1f0
49 #define PMT_TABLE_LOOKUP 0x200
50 #define ADAPTATION_LOOKUP 0x300
51 #define ADAPTATION_HDR_LENGTH 0x3f0
52 
53 #define MODE_STOP 0x00
54 #define MODE_RECORD 0x10
55 
61 {
62 public:
63  CNTV2ConfigTs2022 (CNTV2Card & device);
64 
65  // Setup the J2K encoder
66  bool SetupJ2KEncoder(const NTV2Channel channel, const j2kEncoderConfig &config);
67  bool ReadbackJ2KEncoder(const NTV2Channel channel, j2kEncoderConfig &config);
68 
69  // Setup the J2K decoder
70  bool SetupJ2KDecoder(const j2kDecoderConfig & config);
71  bool ReadbackJ2KDecoder(j2kDecoderConfig &config);
72  bool GetJ2KDecoderStatus(j2kDecoderStatus &status);
73 
74  // If method returns false call this to get the error code
75  NTV2IpError getLastErrorCode();
76 
77  private:
78 
79  // Setup the J2K encoder and TS
80  bool SetupJ2KForEncode(const NTV2Channel channel);
81  bool SetupTsForEncode(const NTV2Channel channel);
82 
83  // Setup individual TS encode parts
84  bool SetupEncodeTsTimer(const NTV2Channel channel);
85  bool SetupEncodeTsJ2KEncoder(const NTV2Channel channel);
86  bool SetupEncodeTsMpegJ2kEncap(const NTV2Channel channel);
87  bool SetupEncodeTsMpegPcrEncap(const NTV2Channel channel);
88  bool SetupEncodeTsMpegAesEncap(const NTV2Channel channel);
89  bool SetupEncodeTsAesEncap(const NTV2Channel channel);
90 
91  // Routines to talk to the J2K part
92  bool J2kCanAcceptCmd(const NTV2Channel channel);
93  bool J2KGetNextT0Status(const NTV2Channel channel, uint32_t *pStatus);
94  bool GetT0CmdStatus( const NTV2Channel channel, const uint32_t cmdId, uint32_t *pStatus );
95  void J2kSetParam(const NTV2Channel channel, uint32_t config, uint32_t param, uint32_t value);
96  void J2kSetMode(const NTV2Channel channel, uint32_t tier, uint32_t mode);
97  uint32_t J2kGetFrameCounter(const NTV2Channel channel, uint32_t tier);
98  void J2kSetConfig(const NTV2Channel channel, uint32_t config);
99 
100  uint32_t GetFeatures();
101 
102  void GenerateTableForMpegJ2kEncap(const NTV2Channel channel);
103  void GenerateTableForMpegPcrEncap(const NTV2Channel channel);
104  void GenerateTableForMpegAesEncap(const NTV2Channel channel);
105  uint32_t GetIpxJ2KAddr(const NTV2Channel channel);
106  uint32_t GetIpxTsAddr(const NTV2Channel channel);
107 
108  bool WriteJ2KConfigReg(const NTV2Channel channel, const uint32_t reg, const uint32_t value);
109  bool ReadJ2KConfigReg(const NTV2Channel channel, const uint32_t reg, uint32_t * value);
110 
111  void SetEncoderInputEnable(const NTV2Channel channel, bool bEnable, bool bMDEnable );
112  void SetEncoderReset(const NTV2Channel channel, bool bReset );
113  int32_t CalculateTsGen(const NTV2Channel channel);
114 
115  bool _is2022_6;
116  bool _is2022_2;
117 
118  int32_t _transactionTable[1024][2];
119  int32_t _transactionCount;
120 
121 }; // CNTV2ConfigTs2022
122 
123 #endif // NTV2_2022CONFIGTS_H
j2kEncoderConfig
Definition: ntv2config2022.h:87
ntv2tshelper.h
Declares Transport Stream helper classes.
NTV2Channel
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
Definition: ntv2enums.h:1334
ntv2config2022.h
Declares the CNTV2Config2022 class.
j2kDecoderStatus
Definition: ntv2config2022.h:135
ntv2registers2022.h
Defines the KonaIP/IoIP S2022 registers.
ntv2card.h
Declares the CNTV2Card class.
ntv2enums.h
Enumerations for controlling NTV2 devices.
CNTV2Card
I interrogate and control an AJA video/audio capture/playout device.
Definition: ntv2card.h:28
j2kDecoderConfig
Definition: ntv2config2022.h:110
CNTV2MBController
Definition: ntv2mbcontroller.h:128
NTV2IpError
NTV2IpError
Definition: ntv2enums.h:4265
AJAExport
#define AJAExport
Definition: export.h:33
ntv2mbcontroller.h
Declares the CNTV2MBController class.
CNTV2ConfigTs2022
The CNTV2ConfigTs2022 class is the interface to Kona-IP SMPTE 2022 J2K encoder and TS chips.
Definition: ntv2configts2022.h:60