AJA NTV2 SDK  17.5.0.1242
NTV2 SDK 17.5.0.1242
ntv2config2110.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #include "ntv2config2110.h"
9 #include "ntv2endian.h"
10 #include "ntv2card.h"
11 #include "ntv2utils.h"
12 #include <sstream>
13 #include <ajabase/network/network.h>
15 #include <algorithm>
16 #include <math.h>
17 
18 #if defined (AJALinux) || defined (AJAMac)
19 #include <stdlib.h>
20 #include <sys/socket.h>
21 #include <netinet/in.h>
22 #include <arpa/inet.h>
23 #endif
24 
25 #define RESET_MILLISECONDS 5
26 
31 
36 
41 
46 
51 
52 using namespace std;
53 
55 {
56  for (int i=0; i < 2; i++)
57  {
58  localPort[i] = 0;
59  remotePort[i] = 0;
60  remoteIP[i].erase();
61  }
62  videoFormat = NTV2_FORMAT_UNKNOWN;
63  videoSamples = VPIDSampling_YUV_422;
64  ttl = 0x40;
65  tos = 0x64;
66  ssrc = 1000;
67  numAudioChannels = 0;
68  firstAudioChannel = 0;
69  audioPktInterval = PACKET_INTERVAL_1mS;
70  channel = (NTV2Channel)0;
71 }
72 
74 {
75  return !(*this == other);
76 }
77 
79 {
80  if ((localPort == other.localPort) &&
81  (remotePort == other.remotePort) &&
82  (remoteIP == other.remoteIP) &&
83  (videoFormat == other.videoFormat) &&
84  (videoSamples == other.videoSamples) &&
85  (numAudioChannels == other.numAudioChannels) &&
86  (firstAudioChannel == other.firstAudioChannel) &&
87  (audioPktInterval == other.audioPktInterval))
88  {
89  return true;
90  }
91  else
92  {
93  return false;
94  }
95 }
96 
98 {
99  rxMatch = 0;
100  sourceIP.erase();
101  destIP.erase();
102  sourcePort = 0;
103  destPort = 0;
104  ssrc = 1000;
105  vlan = 1;
106  payloadType = 0;
107  videoFormat = NTV2_FORMAT_UNKNOWN;
108  videoSamples = VPIDSampling_YUV_422;
109  numAudioChannels = 2;
110  audioPktInterval = PACKET_INTERVAL_1mS;
111 }
112 
114 {
115  return (!(*this == other));
116 }
117 
119 {
120  if ( (rxMatch == other.rxMatch) &&
121  (sourceIP == other.sourceIP) &&
122  (destIP == other.destIP) &&
123  (sourcePort == other.sourcePort) &&
124  (destPort == other.destPort) &&
125  (ssrc == other.ssrc) &&
126  (vlan == other.vlan) &&
127  (videoFormat == other.videoFormat) &&
128  (videoSamples == other.videoSamples) &&
129  (numAudioChannels == other.numAudioChannels) &&
130  (audioPktInterval == other.audioPktInterval))
131  {
132  return true;
133  }
134  else
135  {
136  return false;
137  }
138 }
139 
141 //
142 // CNTV2Config2110
143 //
145 
147 {
148  uint32_t features = getFeatures();
149 
150  _numTx0Chans = (features & (SAREK_TX0_MASK)) >> 28;
151  _numRx0Chans = (features & (SAREK_RX0_MASK)) >> 24;
152  _numTx1Chans = (features & (SAREK_TX1_MASK)) >> 20;
153  _numRx1Chans = (features & (SAREK_RX1_MASK)) >> 16;
154 
155  _numRxChans = _numRx0Chans + _numRx1Chans;
156  _numTxChans = _numTx0Chans + _numTx1Chans;
157 
158  _biDirectionalChannels = false;
159 }
160 
162 {
163 }
164 
166 {
167  string ip, subnet, gateway;
168  struct in_addr addr;
169  addr.s_addr = (uint32_t)netConfig.ipc_ip;
170  ip = AJANetwork::aja_inet_ntoa(addr);
171  addr.s_addr = (uint32_t)netConfig.ipc_subnet;
172  subnet = AJANetwork::aja_inet_ntoa(addr);
173  addr.s_addr = (uint32_t)netConfig.ipc_gateway;
174  gateway = AJANetwork::aja_inet_ntoa(addr);
175 
176  bool rv = SetNetworkConfiguration(sfp, ip, subnet, gateway);
177  return rv;
178 }
179 
181 {
182  string ip, subnet, gateway;
183  GetNetworkConfiguration(sfp, ip, subnet, gateway);
184 
185  netConfig.ipc_ip = NTV2EndianSwap32((uint32_t)AJANetwork::aja_inet_addr(ip.c_str()));
186  netConfig.ipc_subnet = NTV2EndianSwap32((uint32_t)AJANetwork::aja_inet_addr(subnet.c_str()));
187  netConfig.ipc_gateway = NTV2EndianSwap32((uint32_t)AJANetwork::aja_inet_addr(gateway.c_str()));
188 
189  return true;
190 }
191 
192 bool CNTV2Config2110::SetNetworkConfiguration(const eSFP sfp, const std::string localIPAddress, const std::string subnetMask, const std::string gateway)
193 {
194  if (!mDevice.IsMBSystemReady())
195  {
197  return false;
198  }
199 
200  if (!mDevice.IsMBSystemValid())
201  {
203  return false;
204  }
205 
206  uint32_t addr = AJANetwork::aja_inet_addr(localIPAddress.c_str());
207  addr = NTV2EndianSwap32(addr);
208 
209  uint32_t macLo;
210  uint32_t macHi;
211 
212  // get sfp1 mac address
213  uint32_t macAddressRegister = SAREK_REGS + kRegSarekMAC;
214  mDevice.ReadRegister(macAddressRegister, macHi);
215  macAddressRegister++;
216  mDevice.ReadRegister(macAddressRegister, macLo);
217 
218  uint32_t boardHi = (macHi & 0xffff0000) >>16;
219  uint32_t boardLo = ((macHi & 0x0000ffff) << 16) + ((macLo & 0xffff0000) >> 16);
220 
221  // get sfp2 mac address
222  macAddressRegister++;
223  mDevice.ReadRegister(macAddressRegister, macHi);
224  macAddressRegister++;
225  mDevice.ReadRegister(macAddressRegister, macLo);
226 
227  uint32_t boardHi2 = (macHi & 0xffff0000) >>16;
228  uint32_t boardLo2 = ((macHi & 0x0000ffff) << 16) + ((macLo & 0xffff0000) >> 16);
229 
230 
231  uint32_t core;
238 
245 
246  bool rv = SetMBNetworkConfiguration (sfp, localIPAddress, subnetMask, gateway);
247  if (!rv) return false;
248 
249  if (sfp == SFP_1)
250  {
251  ConfigurePTP(sfp,localIPAddress);
252  }
253 
254  return true;
255 }
256 
257 bool CNTV2Config2110::GetNetworkConfiguration(const eSFP sfp, std::string & localIPAddress, std::string & subnetMask, std::string & gateway)
258 {
259  struct in_addr addr;
260 
261  if (sfp == SFP_1)
262  {
263  uint32_t val;
265  addr.s_addr = val;
266  localIPAddress = AJANetwork::aja_inet_ntoa(addr);
267 
269  addr.s_addr = val;
270  subnetMask = AJANetwork::aja_inet_ntoa(addr);
271 
273  addr.s_addr = val;
274  gateway = AJANetwork::aja_inet_ntoa(addr);
275  }
276  else
277  {
278  uint32_t val;
280  addr.s_addr = val;
281  localIPAddress = AJANetwork::aja_inet_ntoa(addr);
282 
284  addr.s_addr = val;
285  subnetMask = AJANetwork::aja_inet_ntoa(addr);
286 
288  addr.s_addr = val;
289  gateway = AJANetwork::aja_inet_ntoa(addr);
290  }
291  return true;
292 }
293 
295 {
297 }
298 
299 bool CNTV2Config2110::SetRxStreamConfiguration(const eSFP sfp, const NTV2Stream stream, const rx_2110Config & rxConfig)
300 {
303  {
305  return false;
306  }
307 
308  if ((StreamType(stream) == VIDEO_STREAM) ||
309  (StreamType(stream) == AUDIO_STREAM) ||
310  (StreamType(stream) == ANC_STREAM))
311  {
312  if (GetSFPActive(sfp) == false)
313  {
315  return false;
316  }
317 
318  SetRxStreamEnable(sfp, stream, false);
319 
320  ResetDepacketizerStream(stream);
321  SetupDepacketizerStream(stream,rxConfig);
322  SetupDecapsulatorStream(sfp, stream, rxConfig);
323  return true;
324  }
325  else
326  {
328  return false;
329  }
330 }
331 
332 void CNTV2Config2110::SetupDecapsulatorStream(const eSFP sfp, const NTV2Stream stream, const rx_2110Config & rxConfig)
333 {
334  uint32_t decapBaseAddr = GetDecapsulatorAddress(sfp, stream);
335 
336  // source ip address
337  uint32_t sourceIp = AJANetwork::aja_inet_addr(rxConfig.sourceIP.c_str());
338  sourceIp = NTV2EndianSwap32(sourceIp);
339  mDevice.WriteRegister(kRegDecap_match_src_ip + decapBaseAddr, sourceIp);
340 
341  // dest ip address
342  uint32_t destIp = AJANetwork::aja_inet_addr(rxConfig.destIP.c_str());
343  destIp = NTV2EndianSwap32(destIp);
344  mDevice.WriteRegister(kRegDecap_match_dst_ip + decapBaseAddr, destIp);
345 
346  // source port
348 
349  // dest port
350  mDevice.WriteRegister(kRegDecap_match_udp_dst_port + decapBaseAddr, rxConfig.destPort);
351 
352  // ssrc
353  mDevice.WriteRegister(kRegDecap_match_ssrc + decapBaseAddr, rxConfig.ssrc);
354 
355  // vlan
356  //WriteRegister(kRegDecap_match_vlan + decapBaseAddr, rxConfig.VLAN);
357 
358  // payloadType
359  mDevice. WriteRegister(kRegDecap_match_payload + decapBaseAddr, rxConfig.payloadType);
360 
361  // matching
362  mDevice.WriteRegister(kRegDecap_match_sel + decapBaseAddr, rxConfig.rxMatch);
363 }
364 
366 {
367  uint32_t depacketizerBaseAddr = GetDepacketizerAddress(stream);
368 
369  if (StreamType(stream) == VIDEO_STREAM)
370  {
371  mDevice.WriteRegister(kReg4175_depkt_control + depacketizerBaseAddr, 0x00);
372  }
373  else if (StreamType(stream) == AUDIO_STREAM)
374  {
375  mDevice.WriteRegister(kReg3190_depkt_enable + depacketizerBaseAddr, 0x00);
376  }
377 }
378 
380 {
381  uint32_t depacketizerBaseAddr = GetDepacketizerAddress(stream);
382 
383  if (StreamType(stream) == VIDEO_STREAM)
384  {
385  mDevice.WriteRegister(kReg4175_depkt_control + depacketizerBaseAddr, 0x01);
386  }
387  else if (StreamType(stream) == AUDIO_STREAM)
388  {
389  mDevice.WriteRegister(kReg3190_depkt_enable + depacketizerBaseAddr, 0x01);
390  }
391 }
392 
394 {
395  // disable decasulator
396  uint32_t decapBaseAddr = GetDecapsulatorAddress(sfp, stream);
397  mDevice.WriteRegister(kRegDecap_chan_enable + decapBaseAddr, 0x00);
398 }
399 
401 {
402  // enable decasulator
403  uint32_t decapBaseAddr = GetDecapsulatorAddress(sfp, stream);
404  mDevice.WriteRegister(kRegDecap_chan_enable + decapBaseAddr, 0x01);
405 }
406 
408 {
409  if (StreamType(stream) == VIDEO_STREAM)
410  {
411  uint32_t val;
412  uint32_t bit;
413 
414  switch(stream)
415  {
416  default:
417  case NTV2_VIDEO1_STREAM:
418  bit = BIT(16);
419  break;
420  case NTV2_VIDEO2_STREAM:
421  bit = BIT(17);
422  break;
423  case NTV2_VIDEO3_STREAM:
424  bit = BIT(18);
425  break;
426  case NTV2_VIDEO4_STREAM:
427  bit = BIT(19);
428  break;
429  }
430 
431  // read/modify/write reset bit for a given channel
433 
434  // Set reset bit
435  val |= bit;
437 
438  // Unset reset bit
439  val &= ~bit;
441 
442  // Wait just a bit
444  }
445 }
446 
448 {
449  if (StreamType(stream) == VIDEO_STREAM)
450  {
451  uint32_t val;
452  uint32_t bit;
453 
454  switch(stream)
455  {
456  default:
457  case NTV2_VIDEO1_STREAM:
458  bit = BIT(0);
459  break;
460  case NTV2_VIDEO2_STREAM:
461  bit = BIT(1);
462  break;
463  case NTV2_VIDEO3_STREAM:
464  bit = BIT(2);
465  break;
466  case NTV2_VIDEO4_STREAM:
467  bit = BIT(3);
468  break;
469  }
470 
471  // read/modify/write reset bit for a given channel
473 
474  // Set reset bit
475  val |= bit;
477 
478  // Unset reset bit
479  val &= ~bit;
481 
482  // Wait just a bit
484  }
485 }
486 
488 {
489  if (StreamType(stream) == VIDEO_STREAM)
490  {
491  SetVideoFormatForRxTx(stream, (NTV2VideoFormat) rxConfig.videoFormat, true);
492  }
493  else if (StreamType(stream) == AUDIO_STREAM)
494  {
495  // setup 3190 depacketizer
496  uint32_t depacketizerBaseAddr = GetDepacketizerAddress(stream);
497 
498  mDevice.WriteRegister(kReg3190_depkt_enable + depacketizerBaseAddr, 0x00);
499  uint32_t num_samples = (rxConfig.audioPktInterval == PACKET_INTERVAL_125uS) ? 6 : 48;
500  uint32_t num_channels = rxConfig.numAudioChannels;
501  uint32_t val = (num_samples << 8) + num_channels;
502  mDevice.WriteRegister(kReg3190_depkt_config + depacketizerBaseAddr,val);
503 
504  // audio channels
505  mDevice.WriteRegister(kReg3190_depkt_enable + depacketizerBaseAddr,0x01);
506  }
507 }
508 
509 void CNTV2Config2110::SetVideoFormatForRxTx(const NTV2Stream stream, const NTV2VideoFormat format, const bool rx)
510 {
511  if (StreamType(stream) == VIDEO_STREAM)
512  {
514 
517  NTV2Standard std = fd.GetVideoStandard();
518  bool is2K = fd.Is2KFormat();
519 
520  uint32_t val = ( (((uint32_t) fr) << 8) |
521  (((uint32_t) fg) << 4) |
522  ((uint32_t) std ) );
523 
524  if (is2K)
525  val += BIT(13);
526 
527  if (NTV2_IS_PSF_VIDEO_FORMAT (format))
528  val += BIT(15);
529 
530  uint32_t reg, reg2;
531  if (rx)
532  {
533  reg = stream - NTV2_CHANNEL1 + kRegRxVideoDecode1;
534  reg2 = stream - NTV2_CHANNEL1 + kRegRxNtv2VideoDecode1;
535  }
536  else
537  {
538  reg = stream - NTV2_CHANNEL1 + kRegTxVideoDecode1;
539  reg2 = stream - NTV2_CHANNEL1 + kRegTxNtv2VideoDecode1;
540  }
541 
542  // Write the format for the firmware and also tuck it away in NTV2 flavor so we can retrieve it easily
544  mDevice.WriteRegister(reg2 + SAREK_REGS2, format);
545  }
546 }
547 
548 void CNTV2Config2110::GetVideoFormatForRxTx(const NTV2Stream stream, NTV2VideoFormat & format, uint32_t & hwFormat, const bool rx)
549 {
550  if (StreamType(stream) == VIDEO_STREAM)
551  {
552  uint32_t reg, reg2, value;
553  if (rx)
554  {
555  reg = stream - NTV2_CHANNEL1 + kRegRxVideoDecode1;
556  reg2 = stream - NTV2_CHANNEL1 + kRegRxNtv2VideoDecode1;
557  }
558  else
559  {
560  reg = stream - NTV2_CHANNEL1 + kRegTxVideoDecode1;
561  reg2 = stream - NTV2_CHANNEL1 + kRegTxNtv2VideoDecode1;
562  }
563 
564  // Write the format for the firmware and also tuck it away in NTV2 flavor so we can retrieve it easily
566  hwFormat = value;
567  mDevice.ReadRegister(reg2 + SAREK_REGS2, value);
568  format = (NTV2VideoFormat)value;
569  }
570 }
571 
573 {
576  {
578  return false;
579  }
580 
581  if ((StreamType(stream) == VIDEO_STREAM) ||
582  (StreamType(stream) == AUDIO_STREAM) ||
583  (StreamType(stream) == ANC_STREAM))
584  {
585  uint32_t val;
586  uint32_t depacketizerBaseAddr;
587 
588  // get address,strean
589  uint32_t decapBaseAddr = GetDecapsulatorAddress(sfp, stream);
590 
591  // source ip address
592  mDevice.ReadRegister(kRegDecap_match_src_ip + decapBaseAddr, val);
593  struct in_addr in;
594  in.s_addr = NTV2EndianSwap32(val);
595  char * ip = AJANetwork::aja_inet_ntoa(in);
596  rxConfig.sourceIP = ip;
597 
598  // dest ip address
599  mDevice.ReadRegister(kRegDecap_match_dst_ip + decapBaseAddr, val);
600  in.s_addr = NTV2EndianSwap32(val);
601  ip = AJANetwork::aja_inet_ntoa(in);
602  rxConfig.destIP = ip;
603 
604  // source port
605  mDevice.ReadRegister(kRegDecap_match_udp_src_port + decapBaseAddr, rxConfig.sourcePort);
606 
607  // dest port
608  mDevice.ReadRegister(kRegDecap_match_udp_dst_port + decapBaseAddr, rxConfig.destPort);
609 
610  // ssrc
611  mDevice.ReadRegister(kRegDecap_match_ssrc + decapBaseAddr, rxConfig.ssrc);
612 
613  // vlan
614  //mDevice.ReadRegister(kRegDecap_match_vlan + decapBaseAddr, val);
615  //rxConfig.VLAN = val & 0xffff;
616 
617  // payloadType
618  mDevice.ReadRegister(kRegDecap_match_payload + decapBaseAddr, val);
619  rxConfig.payloadType = val & 0x7f;
620 
621  // matching
622  mDevice.ReadRegister(kRegDecap_match_sel + decapBaseAddr, rxConfig.rxMatch);
623 
624  if (StreamType(stream) == VIDEO_STREAM)
625  {
626  NTV2VideoFormat format;
627  uint32_t hwFormat;
628 
629  depacketizerBaseAddr = GetDepacketizerAddress(stream);
630  GetVideoFormatForRxTx(stream, format, hwFormat, true);
631  rxConfig.videoFormat = format;
632  }
633  else if (StreamType(stream) == AUDIO_STREAM)
634  {
635  uint32_t samples;
636 
637  depacketizerBaseAddr = GetDepacketizerAddress(stream);
638  mDevice.ReadRegister(kReg3190_depkt_config + depacketizerBaseAddr, samples);
639  rxConfig.audioPktInterval = (((samples >> 8) & 0xff) == 6) ? PACKET_INTERVAL_125uS : PACKET_INTERVAL_1mS;
640  rxConfig.numAudioChannels = samples & 0xff;
641  }
642  return true;
643  }
644  else
645  {
647  return false;
648  }
649 }
650 
651 bool CNTV2Config2110::SetRxStreamEnable(const eSFP sfp, const NTV2Stream stream, bool enable)
652 {
655  {
657  return false;
658  }
659 
660  if ((StreamType(stream) == VIDEO_STREAM) ||
661  (StreamType(stream) == AUDIO_STREAM) ||
662  (StreamType(stream) == ANC_STREAM))
663  {
664  if (GetSFPActive(sfp) == false)
665  {
667  return false;
668  }
669 
670  if (enable)
671  {
672  uint32_t decapBaseAddr = GetDecapsulatorAddress(sfp, stream);
673 
674  // get source and dest ip address
675  uint32_t srcIp, destIp;
676  mDevice.ReadRegister(kRegDecap_match_src_ip + decapBaseAddr, srcIp);
677  mDevice.ReadRegister(kRegDecap_match_dst_ip + decapBaseAddr, destIp);
678 
679  // setup IGMP subscription
680  uint8_t ip0 = (destIp & 0xff000000)>> 24;
681  if (ip0 >= 224 && ip0 <= 239)
682  {
683  // is multicast
684  SetIGMPGroup(sfp, stream, destIp, srcIp, true);
685  }
686  else
687  {
688  UnsetIGMPGroup(sfp, stream);
689  }
690 
691  EnableDepacketizerStream(stream);
692  EnableDecapsulatorStream(sfp, stream);
693  }
694  else
695  {
696  // disable IGMP subscription
697  bool disableIGMP;
698  GetIGMPDisable(sfp, disableIGMP);
699  if (!disableIGMP)
700  {
701  EnableIGMPGroup(sfp, stream, false);
702  }
703 
704  DisableDecapsulatorStream(sfp, stream);
706  }
707  return true;
708  }
709  else
710  {
712  return false;
713  }
714 }
715 
716 bool CNTV2Config2110::GetRxStreamEnable(const eSFP sfp, const NTV2Stream stream, bool & enabled)
717 {
720  {
722  return false;
723  }
724 
725  enabled = false;
726 
727  if ((StreamType(stream) == VIDEO_STREAM) ||
728  (StreamType(stream) == AUDIO_STREAM) ||
729  (StreamType(stream) == ANC_STREAM))
730  {
731  // get address
732  uint32_t decapBaseAddr = GetDecapsulatorAddress(sfp, stream);
733 
734  uint32_t val;
735  mDevice.ReadRegister(kRegDecap_chan_enable + decapBaseAddr, val);
736  enabled = (val & 0x01);
737  return true;
738  }
739  else
740  {
742  return false;
743  }
744 }
745 
746 bool CNTV2Config2110::GetRxPacketCount(const NTV2Stream stream, uint32_t & packets)
747 {
748  uint32_t depacketizerBaseAddr;
749 
750  if (StreamType(stream) == VIDEO_STREAM)
751  {
752  depacketizerBaseAddr = GetDepacketizerAddress(stream);
753  mDevice.ReadRegister(kReg4175_depkt_rx_pkt_cnt+ depacketizerBaseAddr, packets);
754  }
755  else if (StreamType(stream) == AUDIO_STREAM)
756  {
757  depacketizerBaseAddr = GetDepacketizerAddress(stream);
758  mDevice.ReadRegister(kReg3190_depkt_rx_pkt_count + depacketizerBaseAddr, packets);
759  }
760  else
761  {
762  packets = 0;
763  }
764 
765  return true;
766 }
767 
768 bool CNTV2Config2110::GetRxByteCount(const NTV2Stream stream, uint32_t & bytes)
769 {
770  uint32_t depacketizerBaseAddr;
771 
772  if (StreamType(stream) == VIDEO_STREAM)
773  {
774  depacketizerBaseAddr = GetDepacketizerAddress(stream);
775  mDevice.ReadRegister(kReg4175_depkt_rx_byte_cnt+ depacketizerBaseAddr, bytes);
776  }
777  // Currently only the video stream reports bytes
778  else
779  {
780  bytes = 0;
781  }
782 
783  return true;
784 }
785 
786 bool CNTV2Config2110::GetRxByteCount(const eSFP sfp, uint64_t & bytes)
787 {
788  uint32_t val_lo, val_hi;
789 
790  if (sfp == SFP_1)
791  {
794  }
795  else
796  {
799  }
800 
801  bytes = ((uint64_t)val_hi << 32) + val_lo;
802  return true;
803 }
804 
805 bool CNTV2Config2110::GetTxPacketCount(const NTV2Stream stream, uint32_t & packets)
806 {
807  if (StreamType(stream) == VIDEO_STREAM)
808  {
809  uint32_t count;
810 
811  uint32_t baseAddrPacketizer = GetPacketizerAddress(NTV2_VIDEO1_STREAM, GetSampling(SFP_1, stream));
812  mDevice.ReadRegister(kReg4175_pkt_tx_pkt_cnt + baseAddrPacketizer, count);
813  packets = count;
814  }
815  else
816  {
817  // TODO:
818  packets = 0;
819  }
820 
821  return true;
822 }
823 
824 bool CNTV2Config2110::GetTxByteCount(const eSFP sfp, uint64_t & bytes)
825 {
826  uint32_t val_lo, val_hi;
827 
828  if (sfp == SFP_1)
829  {
832  }
833  else
834  {
837  }
838 
839  bytes = ((uint64_t)val_hi << 32) + val_lo;
840  return true;
841 }
842 
843 int CNTV2Config2110::LeastCommonMultiple(int a,int b)
844 {
845  int m = a;
846  int n = b;
847  while (m != n)
848  {
849  if (m < n)
850  m += a;
851  else
852  n +=b;
853  }
854  return m;
855 }
856 
858 {
859  if (GetSFPActive(SFP_1) == false)
860  {
862  return false;
863  }
864 
865  ResetPacketizerStream(stream);
866 
867  SetFramerStream(SFP_1, stream, txConfig);
868  SetFramerStream(SFP_2, stream, txConfig);
869  SetSampling(SFP_1, stream, txConfig.videoSamples);
870  SetSampling(SFP_2, stream, txConfig.videoSamples);
871 
872  if (StreamType(stream) == VIDEO_STREAM)
873  {
874  // video setup 3190 packetizer
875  uint32_t baseAddrPacketizer = GetPacketizerAddress(stream, GetSampling(SFP_1, stream));
876 
877  NTV2VideoFormat vfmt = txConfig.videoFormat;
878 
879  // Write the video format into the arbitrator
880  SetVideoFormatForRxTx(stream, vfmt, false);
881 
882  // setup 4175 packetizer
883  bool interlaced = false;
885  {
886  interlaced = true;
887  }
888  else if (NTV2_IS_PSF_VIDEO_FORMAT(vfmt))
889  {
890  interlaced = true;
891  }
892 
894 
895  // width
896  uint32_t width = fd.GetRasterWidth();
897  mDevice.WriteRegister(kReg4175_pkt_width + baseAddrPacketizer,width);
898 
899  // height
900  uint32_t height = fd.GetRasterHeight();
901  if (interlaced)
902  {
903  height /= 2;
904  }
905  mDevice.WriteRegister(kReg4175_pkt_height + baseAddrPacketizer,height);
906 
907  // video format = sampling
908  int vf;
909  int componentsPerPixel;
910  int componentsPerUnit;
911 
912  VPIDSampling sampling = GetSampling(SFP_1, stream);
913  switch(sampling)
914  {
916  vf = 0;
917  componentsPerPixel = 3;
918  componentsPerUnit = 3;
919  break;
920  default:
922  componentsPerPixel = 2;
923  componentsPerUnit = 4;
924  vf = 2;
925  break;
926  }
927  mDevice.WriteRegister(kReg4175_pkt_vid_fmt + baseAddrPacketizer,vf);
928 
929  const int bitsPerComponent = 10;
930  const int pixelsPerClock = 1;
931  int activeLineLength = (width * componentsPerPixel * bitsPerComponent)/8;
932 
933  int pixelGroup_root = LeastCommonMultiple((bitsPerComponent * componentsPerUnit), 8);
934  int pixelGroupSize = pixelGroup_root/8;
935 
936  int bytesPerCycle = (pixelsPerClock * bitsPerComponent * componentsPerPixel)/8;
937 
938  int lcm = LeastCommonMultiple(pixelGroupSize,bytesPerCycle);
939  int payloadLength_root = min(activeLineLength,1376)/lcm;
940  int payloadLength = payloadLength_root * lcm;
941 
942  float pktsPerLine = ((float)activeLineLength)/((float)payloadLength);
943  int ipktsPerLine = (int)ceil(pktsPerLine);
944 
945  int payloadLengthLast = activeLineLength - (payloadLength * (ipktsPerLine -1));
946 
947  int ppp = (payloadLength/pixelGroupSize) * 2; // as per JeffL
948 
949  if ((sampling == VPIDSampling_GBR_444) &&
952  {
954  {
955  ipktsPerLine = 0x07;
956  payloadLength = 0x0558;
957  payloadLengthLast = 0x03f0;
958  ppp = 0x0130;
959  }
960  else if (NTV2_IS_720P_VIDEO_FORMAT(txConfig.videoFormat))
961  {
962  ipktsPerLine = 0x05;
963  payloadLength = 0x0558;
964  payloadLengthLast = 0x0120;
965  ppp = 0x0130;
966  }
967  // assume 1920x1080 format
968  else
969  {
970  ipktsPerLine = 0x07;
971  payloadLength = 0x0558;
972  payloadLengthLast = 0x01b0;
973  ppp = 0x0130;
974  }
975  }
976 
977  // pkts per line
978  mDevice.WriteRegister(kReg4175_pkt_pkts_per_line + baseAddrPacketizer,ipktsPerLine);
979 
980  // payload length
981  mDevice.WriteRegister(kReg4175_pkt_payload_len + baseAddrPacketizer,payloadLength);
982 
983  // payload length last
984  mDevice.WriteRegister(kReg4175_pkt_payload_len_last + baseAddrPacketizer,payloadLengthLast);
985 
986  // payloadType
987  mDevice.WriteRegister(kReg4175_pkt_payload_type + baseAddrPacketizer,txConfig.payloadType);
988 
989  // SSRC
990  mDevice.WriteRegister(kReg4175_pkt_ssrc + baseAddrPacketizer,txConfig.ssrc);
991 
992  // pix per pkt
993  mDevice.WriteRegister(kReg4175_pkt_pix_per_pkt + baseAddrPacketizer,ppp);
994 
995  // interlace
996  int ilace = (interlaced) ? 0x01 : 0x00;
997  mDevice.WriteRegister(kReg4175_pkt_interlace_ctrl + baseAddrPacketizer,ilace);
998 
999  // end setup 4175 packetizer
1000  SetTxFormat(VideoStreamToChannel(stream), txConfig.videoFormat);
1001  }
1002  else if (StreamType(stream) == AUDIO_STREAM)
1003  {
1004  // audio setup 3190 packetizer
1005  uint32_t baseAddrPacketizer = GetPacketizerAddress(stream, GetSampling(SFP_1, stream));
1006 
1007  uint32_t audioChans = txConfig.numAudioChannels;
1008  uint32_t samples = (txConfig.audioPktInterval == PACKET_INTERVAL_125uS) ? 6 : 48;
1009  uint32_t plength = audioChans * samples * 3;
1010 
1011  // audio select
1012  uint32_t aselect = ((uint32_t)txConfig.firstAudioChannel << 16 ) + (audioChans-1);
1013  aselect = (txConfig.channel << 24) + aselect;
1014  uint32_t offset = (stream - NTV2_AUDIO1_STREAM) * 4;
1016 
1017  // num samples
1018  mDevice.WriteRegister(kReg3190_pkt_num_samples + baseAddrPacketizer, samples);
1019 
1020  // audio channels - zero-based (i.e. 0 = 1 channel)
1021  mDevice.WriteRegister(kReg3190_pkt_num_audio_channels + baseAddrPacketizer, audioChans);
1022 
1023  // payload length
1024  mDevice.WriteRegister(kReg3190_pkt_payload_len + baseAddrPacketizer, plength);
1025 
1026  // payloadType
1027  mDevice.WriteRegister(kReg3190_pkt_payload_type + baseAddrPacketizer, txConfig.payloadType);
1028 
1029  // ssrc
1030  mDevice.WriteRegister(kReg3190_pkt_ssrc + baseAddrPacketizer, txConfig.ssrc);
1031  }
1032  else if (StreamType(stream) == ANC_STREAM)
1033  {
1034  uint32_t channel = (uint32_t)(stream-NTV2_ANC1_STREAM);
1035 
1036  // Setup the anc inserter params, these are static values that don't change from frame to frame
1037  mDevice.AncInsertSetIPParams(channel, channel+4, txConfig.payloadType, txConfig.ssrc);
1038 
1039  // for anc streams we tuck away these values
1040  // payloadType
1042 
1043  // ssrc
1045  }
1046 
1047  return true;
1048 }
1049 
1050 
1051 bool CNTV2Config2110::SetFramerStream(const eSFP sfp, const NTV2Stream stream, const tx_2110Config & txConfig)
1052 {
1053  // get frame address
1054  uint32_t baseAddrFramer = GetFramerAddress(sfp, stream);
1055 
1056  // select channel
1057  SelectTxFramerChannel(stream, baseAddrFramer);
1058 
1059  // setup framer
1060  // hold off access while we update channel regs
1061  AcquireFramerControlAccess(baseAddrFramer);
1062 
1063  uint32_t val = (txConfig.tos << 8) | txConfig.ttl;
1064  WriteChannelRegister(kRegFramer_ip_hdr_media + baseAddrFramer, val);
1065 
1066  int index = (int)sfp;
1067  // dest ip address
1068  uint32_t destIp = AJANetwork::aja_inet_addr(txConfig.remoteIP[index].c_str());
1069  destIp = NTV2EndianSwap32(destIp);
1070  WriteChannelRegister(kRegFramer_dst_ip + baseAddrFramer,destIp);
1071 
1072  // source port
1073  WriteChannelRegister(kRegFramer_udp_src_port + baseAddrFramer,txConfig.localPort[index]);
1074 
1075  // dest port
1076  WriteChannelRegister(kRegFramer_udp_dst_port + baseAddrFramer,txConfig.remotePort[index]);
1077 
1078  // MAC address
1079  uint32_t hi;
1080  uint32_t lo;
1081  bool rv = GetMACAddress(sfp, stream, txConfig.remoteIP[index], hi, lo);
1082  if (!rv) return false;
1083  WriteChannelRegister(kRegFramer_dest_mac_lo + baseAddrFramer,lo);
1084  WriteChannelRegister(kRegFramer_dest_mac_hi + baseAddrFramer,hi);
1085 
1086  // enable register updates
1087  ReleaseFramerControlAccess(baseAddrFramer);
1088 
1089  // end framer setup
1090  return true;
1091 }
1092 
1093 
1095 {
1096  uint32_t baseAddrPacketizer;
1097 
1098  GetFramerStream(SFP_1, stream, txConfig);
1099  GetFramerStream(SFP_2, stream, txConfig);
1100  txConfig.videoSamples = GetSampling(SFP_1, stream);
1101 
1102  uint32_t val;
1103  if (StreamType(stream) == VIDEO_STREAM)
1104  {
1105  // select video packetizer
1106  baseAddrPacketizer = GetPacketizerAddress(stream, GetSampling(SFP_1, stream));
1107 
1108  // payloadType
1109  mDevice.ReadRegister(kReg4175_pkt_payload_type + baseAddrPacketizer, val);
1110  txConfig.payloadType = (uint16_t)val;
1111 
1112  // SSRC
1113  mDevice.ReadRegister(kReg4175_pkt_ssrc + baseAddrPacketizer, txConfig.ssrc);
1114 
1115  // Video format
1116  GetTxFormat(VideoStreamToChannel(stream), txConfig.videoFormat);
1117  }
1118  else if (StreamType(stream) == AUDIO_STREAM)
1119  {
1120  // select audio packetizer
1121  baseAddrPacketizer = GetPacketizerAddress(stream, GetSampling(SFP_1, stream));
1122 
1123  // audio - payloadType
1124  mDevice.ReadRegister(kReg3190_pkt_payload_type + baseAddrPacketizer, val);
1125  txConfig.payloadType = (uint16_t)val;
1126 
1127  // ssrc
1128  mDevice.ReadRegister(kReg3190_pkt_ssrc + baseAddrPacketizer, txConfig.ssrc);
1129 
1130  // audio select
1131  uint32_t offset = Get2110TxStreamIndex(stream) * 4;
1132  uint32_t aselect;
1134 
1135  txConfig.firstAudioChannel = (aselect >> 16) & 0xff;
1136  txConfig.numAudioChannels = (aselect & 0xff) + 1;
1137 
1138  // packet interval
1139  uint32_t samples;
1140  mDevice.ReadRegister(kReg3190_pkt_num_samples + baseAddrPacketizer, samples);
1141  txConfig.audioPktInterval = (samples == 6) ? PACKET_INTERVAL_125uS : PACKET_INTERVAL_1mS;
1142  }
1143  else if (StreamType(stream) == ANC_STREAM)
1144  {
1145  uint32_t regOffset = (uint32_t)(stream-NTV2_ANC1_STREAM);
1146 
1147  // payloadType
1149  txConfig.payloadType = (uint16_t)val;
1150 
1151  // ssrc
1153  }
1154 
1155  return true;
1156 }
1157 
1158 void CNTV2Config2110::GetFramerStream(const eSFP sfp, const NTV2Stream stream, tx_2110Config & txConfig)
1159 {
1160  int index = (int)sfp;
1161 
1162  // get frame address
1163  uint32_t baseAddrFramer = GetFramerAddress(sfp, stream);
1164 
1165  // Select channel
1166  SelectTxFramerChannel(stream, baseAddrFramer);
1167 
1168  uint32_t val;
1169  ReadChannelRegister(kRegFramer_ip_hdr_media + baseAddrFramer,&val);
1170  txConfig.ttl = val & 0xff;
1171  txConfig.tos = (val & 0xff00) >> 8;
1172 
1173  // dest ip address
1174  ReadChannelRegister(kRegFramer_dst_ip + baseAddrFramer,&val);
1175  struct in_addr in;
1176  in.s_addr = NTV2EndianSwap32(val);
1177  char * ip = AJANetwork::aja_inet_ntoa(in);
1178  txConfig.remoteIP[index] = ip;
1179 
1180  // source port
1181  ReadChannelRegister(kRegFramer_udp_src_port + baseAddrFramer,&txConfig.localPort[index]);
1182 
1183  // dest port
1184  ReadChannelRegister(kRegFramer_udp_dst_port + baseAddrFramer,&txConfig.remotePort[index]);
1185 }
1186 
1187 bool CNTV2Config2110::SetTxStreamEnable(const NTV2Stream stream, bool enableSfp1, bool enableSfp2)
1188 {
1189  if (enableSfp1 && (GetSFPActive(SFP_1) == false))
1190  {
1192  return false;
1193  }
1194 
1195  if (enableSfp2 && (GetSFPActive(SFP_2) == false))
1196  {
1198  return false;
1199  }
1200 
1201  EnableFramerStream(SFP_1, stream, enableSfp1);
1202  EnableFramerStream(SFP_2, stream, enableSfp2);
1203  SetArbiter(SFP_1, stream, enableSfp1);
1204  SetArbiter(SFP_2, stream, enableSfp2);
1205 
1206  // Generate and push the SDP
1207  GenSDP(enableSfp1, enableSfp2, stream);
1208 
1209  if ((StreamType(stream) == VIDEO_STREAM) || (StreamType(stream) == AUDIO_STREAM))
1210  {
1211  // ** Packetizer
1212  uint32_t packetizerBaseAddr = GetPacketizerAddress(stream, GetSampling(SFP_1, stream));
1213 
1214  if (enableSfp1 || enableSfp2)
1215  {
1216  // enable
1217  mDevice.WriteRegister(kReg4175_pkt_ctrl + packetizerBaseAddr, 0x00);
1218  mDevice.WriteRegister(kReg4175_pkt_ctrl + packetizerBaseAddr, 0x80);
1219  mDevice.WriteRegister(kReg4175_pkt_ctrl + packetizerBaseAddr, 0x81);
1220  }
1221  else
1222  {
1223  // disable
1224  mDevice.WriteRegister(kReg4175_pkt_ctrl + packetizerBaseAddr, 0x00);
1225  }
1226  }
1227 
1228  return true;
1229 }
1230 
1231 void CNTV2Config2110::EnableFramerStream(const eSFP sfp, const NTV2Stream stream, bool enable)
1232 {
1233  // ** Framer
1234  // get frame address
1235  uint32_t baseAddrFramer = GetFramerAddress(sfp, stream);
1236 
1237  // select channel
1238  SelectTxFramerChannel(stream, baseAddrFramer);
1239 
1240  // hold off access while we update channel regs
1241  AcquireFramerControlAccess(baseAddrFramer);
1242 
1243  if (enable)
1244  {
1245  uint32_t localIp;
1246  if (sfp == SFP_1)
1247  {
1249  }
1250  else
1251  {
1253  }
1254 
1255  WriteChannelRegister(kRegFramer_src_ip + baseAddrFramer, NTV2EndianSwap32(localIp));
1256 
1257  // enable
1258  WriteChannelRegister(kRegFramer_chan_ctrl + baseAddrFramer, 0x01); // enables tx over mac1/mac2
1259  }
1260  else
1261  {
1262  // disable
1263  WriteChannelRegister(kRegFramer_chan_ctrl + baseAddrFramer, 0x0); // disables channel
1264  }
1265 
1266  // enable register updates
1267  ReleaseFramerControlAccess(baseAddrFramer);
1268 
1269  // ** Framer end
1270 }
1271 
1272 bool CNTV2Config2110::GetTxStreamEnable(const NTV2Stream stream, bool & sfp1Enabled, bool & sfp2Enabled)
1273 {
1274  GetArbiter(SFP_1, stream, sfp1Enabled);
1275  GetArbiter(SFP_2, stream, sfp2Enabled);
1276  return true;
1277 }
1278 
1280 {
1281  uint32_t val = ((uint32_t)id[0] << 24) | ((uint32_t)id[1] << 16) | ((uint32_t)id[2] << 8) | ((uint32_t)id[3] << 0);
1283  val = ((uint32_t)id[4] << 24) | ((uint32_t)id[5] << 16) | ((uint32_t)id[6] << 8) | ((uint32_t)id[7] << 0);
1285  return true;
1286 }
1287 
1289 {
1290  uint32_t val;
1292  id[0] = val >> 24;
1293  id[1] = val >> 16;
1294  id[2] = val >> 8;
1295  id[3] = val >> 0;
1297  id[4] = val >> 24;
1298  id[5] = val >> 16;
1299  id[6] = val >> 8;
1300  id[7] = val >> 0;
1301  return true;
1302 }
1303 
1304 bool CNTV2Config2110::SetPTPDomain(const uint8_t domain)
1305 {
1306  mDevice.WriteRegister(kRegPll_swptp_Domain + SAREK_PLL, (uint32_t)domain);
1307  return true;
1308 }
1309 
1310 bool CNTV2Config2110::GetPTPDomain(uint8_t &domain)
1311 {
1312  uint32_t val;
1314  domain = val;
1315  return true;
1316 }
1317 
1319 {
1320  uint32_t val = 0;
1321 
1323  ptpStatus.PTP_gmId[0] = val >> 24;
1324  ptpStatus.PTP_gmId[1] = val >> 16;
1325  ptpStatus.PTP_gmId[2] = val >> 8;
1326  ptpStatus.PTP_gmId[3] = val >> 0;
1327 
1329  ptpStatus.PTP_gmId[4] = val >> 24;
1330  ptpStatus.PTP_gmId[5] = val >> 16;
1331  ptpStatus.PTP_gmId[6] = val >> 8;
1332  ptpStatus.PTP_gmId[7] = val >> 0;
1333 
1335  ptpStatus.PTP_masterId[0] = val >> 24;
1336  ptpStatus.PTP_masterId[1] = val >> 16;
1337  ptpStatus.PTP_masterId[2] = val >> 8;
1338  ptpStatus.PTP_masterId[3] = val >> 0;
1339 
1341  ptpStatus.PTP_masterId[4] = val >> 24;
1342  ptpStatus.PTP_masterId[5] = val >> 16;
1343  ptpStatus.PTP_masterId[6] = val >> 8;
1344  ptpStatus.PTP_masterId[7] = val >> 0;
1345 
1347  ptpStatus.PTP_domain = val;
1348 
1350  ptpStatus.PTP_LockedState = (PTPLockStatus)val;
1351 
1352  return true;
1353 }
1354 
1355 bool CNTV2Config2110::Set4KModeEnable(const bool enable)
1356 {
1357  if (!mDevice.IsMBSystemReady())
1358  {
1360  return false;
1361  }
1362 
1363  uint32_t val;
1365  if (enable)
1366  val |= BIT(0);
1367  else
1368  val &= ~BIT(0);
1369 
1371 
1372  return true;
1373 }
1374 
1376 {
1377  uint32_t val;
1379 
1380  enable = val & 0x01;
1381  return true;
1382 }
1383 
1385 {
1386  if (!mDevice.IsMBSystemReady())
1387  {
1389  return false;
1390  }
1391 
1392  uint32_t val;
1394  if (enable)
1395  val |= BIT(4);
1396  else
1397  val &= ~BIT(4);
1398 
1400 
1401  return true;
1402 }
1403 
1405 {
1406  uint32_t val;
1408 
1409  enable = val & 0x10;
1410  return true;
1411 }
1412 
1413 bool CNTV2Config2110::SetIPServicesControl(const bool enable, const bool forceReconfig)
1414 {
1415  uint32_t val = 0;
1416  if (enable)
1417  val = 1;
1418 
1419  if (forceReconfig)
1420  val |= BIT(1);
1421 
1423 
1424  return true;
1425 }
1426 
1427 bool CNTV2Config2110::GetIPServicesControl(bool & enable, bool & forceReconfig)
1428 {
1429  uint32_t val;
1431 
1432  if (val & BIT(0))
1433  enable = true;
1434  else
1435  enable = false;
1436 
1437  if (val & BIT(1))
1438  forceReconfig = true;
1439  else
1440  forceReconfig = false;
1441 
1442  return true;
1443 }
1444 
1445 bool CNTV2Config2110::SetIGMPDisable(const eSFP sfp, const bool disable)
1446 {
1447  uint32_t val = (disable) ? 1 : 0;
1448  if (sfp == SFP_1 )
1449  {
1451  }
1452  else
1453  {
1455  }
1456  return true;
1457 }
1458 
1459 bool CNTV2Config2110::GetIGMPDisable(const eSFP sfp, bool & disabled)
1460 {
1461  uint32_t val;
1462  if (sfp == SFP_1 )
1463  {
1465  }
1466  else
1467  {
1469  }
1470 
1471  disabled = (val == 1) ? true : false;
1472 
1473  return true;
1474 }
1475 
1477 {
1478  uint32_t mbversion;
1479  switch (version)
1480  {
1481  case eIGMPVersion_2:
1482  mbversion = 2;
1483  break;
1484  case eIGMPVersion_3:
1485  mbversion = 3;
1486  break;
1487  default:
1489  return false;
1490  }
1491  return CNTV2MBController::SetIGMPVersion(mbversion);
1492 }
1493 
1495 {
1496  uint32_t version32;
1497  bool rv = mDevice.ReadRegister(SAREK_REGS + kRegSarekIGMPVersion, version32);
1498  version = (version32 == 2) ? eIGMPVersion_2 : eIGMPVersion_3;
1499  return rv;
1500 }
1501 
1503 //
1504 //
1505 //
1507 
1509 {
1510  uint32_t offset = 0;
1511 
1512  switch (stream)
1513  {
1514  case NTV2_VIDEO1_STREAM:
1515  offset = 0x00;
1516  break;
1517  case NTV2_VIDEO2_STREAM:
1518  offset = 0x20;
1519  break;
1520  case NTV2_VIDEO3_STREAM:
1521  offset = 0x40;
1522  break;
1523  case NTV2_VIDEO4_STREAM:
1524  offset = 0x60;
1525  break;
1526  case NTV2_AUDIO1_STREAM:
1527  offset = 0x10;
1528  break;
1529  case NTV2_AUDIO2_STREAM:
1530  offset = 0x30;
1531  break;
1532  case NTV2_AUDIO3_STREAM:
1533  offset = 0x50;
1534  break;
1535  case NTV2_AUDIO4_STREAM:
1536  offset = 0x70;
1537  break;
1538  case NTV2_ANC1_STREAM:
1539  offset = 0x80;
1540  break;
1541  case NTV2_ANC2_STREAM:
1542  offset = 0x90;
1543  break;
1544  case NTV2_ANC3_STREAM:
1545  offset = 0xA0;
1546  break;
1547  case NTV2_ANC4_STREAM:
1548  offset = 0xB0;
1549  break;
1550 
1551  default:
1552  break;
1553  }
1554 
1555  if (sfp == SFP_1)
1556  return SAREK_2110_DECAPSULATOR_0 + offset;
1557  else
1558  return SAREK_2110_DECAPSULATOR_1 + offset;
1559 }
1560 
1562 {
1563  uint32_t basePacketizer = 0;
1564 
1565  // Only video and audio streams have depacketizers
1566  if (StreamType(stream) == VIDEO_STREAM)
1567  {
1568  basePacketizer = videoDepacketizers[stream-NTV2_VIDEO1_STREAM];
1569  }
1570  else if (StreamType(stream) == AUDIO_STREAM)
1571  {
1572  basePacketizer = audioDepacketizers[stream-NTV2_AUDIO1_STREAM];
1573  }
1574 
1575  return basePacketizer;
1576 }
1577 
1578 uint32_t CNTV2Config2110::GetFramerAddress(const eSFP sfp, const NTV2Stream stream)
1579 {
1580  if (sfp == SFP_2)
1581  {
1582  if (StreamType(stream) == VIDEO_STREAM)
1584  else
1586  }
1587  else
1588  {
1589  if (StreamType(stream) == VIDEO_STREAM)
1591  else
1593  }
1594 }
1595 
1596 void CNTV2Config2110::SelectTxFramerChannel(const NTV2Stream stream, const uint32_t baseAddrFramer)
1597 {
1598  // select channel
1599  uint32_t index = Get2110TxStreamIndex(stream);
1600  SetChannel(kRegFramer_channel_access + baseAddrFramer, index);
1601 }
1602 
1603 uint32_t CNTV2Config2110::GetPacketizerAddress(const NTV2Stream stream, const VPIDSampling sampling)
1604 {
1605  uint32_t basePacketizer = 0;
1606 
1607  // Only video and audio streams have packetizers
1608  if (StreamType(stream) == VIDEO_STREAM)
1609  {
1610  if ((sampling == VPIDSampling_GBR_444) &&
1613  basePacketizer = videoRGB12Packetizers[stream-NTV2_VIDEO1_STREAM];
1614  else
1615  basePacketizer = videoPacketizers[stream-NTV2_VIDEO1_STREAM];
1616 
1617  uint32_t index = Get2110TxStreamIndex(stream);
1618  mDevice.WriteRegister(kReg4175_pkt_chan_num + basePacketizer, index);
1619  }
1620  else if (StreamType(stream) == AUDIO_STREAM)
1621  {
1622  basePacketizer = audioPacketizers[stream-NTV2_AUDIO1_STREAM];
1623  uint32_t index = Get2110TxStreamIndex(stream);
1624  mDevice.WriteRegister(kReg3190_pkt_chan_num + basePacketizer, index);
1625  }
1626 
1627  return basePacketizer;
1628 }
1629 
1630 bool CNTV2Config2110::ConfigurePTP (const eSFP sfp, const std::string localIPAddress)
1631 {
1632  uint32_t macLo;
1633  uint32_t macHi;
1634 
1635  // get primaray mac address
1636  uint32_t macAddressRegister = SAREK_REGS + kRegSarekMAC;
1637  if (sfp != SFP_1)
1638  {
1639  macAddressRegister += 2;
1640  }
1641  mDevice.ReadRegister(macAddressRegister, macHi);
1642  macAddressRegister++;
1643  mDevice.ReadRegister(macAddressRegister, macLo);
1644 
1645  uint32_t alignedMACHi = macHi >> 16;
1646  uint32_t alignedMACLo = (macLo >> 16) | ( (macHi & 0xffff) << 16);
1647 
1648  uint32_t addr = AJANetwork::aja_inet_addr(localIPAddress.c_str());
1649  addr = NTV2EndianSwap32(addr);
1650 
1651  // configure pll
1654 
1658  uint32_t val;
1660  if (val == 0)
1662  else
1665 
1666  //WriteChannelRegister(kRegPll_PTP_LclClkIdLo + SAREK_PLL, (0xfe << 24) | ((macHi & 0x000000ff) << 16) | (macLo >> 16));
1667  //WriteChannelRegister(kRegPll_PTP_LclClkIdHi + SAREK_PLL, (macHi & 0xffffff00) | 0xff);
1668 
1669  return true;
1670 }
1671 
1673 {
1674  return GetSFPInfo(sfp, data);
1675 }
1676 
1678 {
1679  uint32_t val;
1681  uint32_t val2;
1683 
1684  if (sfp == SFP_2)
1685  {
1686  sfpStatus.SFP_linkUp = (val & LINK_B_UP) ? true : false;
1687  sfpStatus.SFP_present = (val2 & SFP_2_NOT_PRESENT) ? false : true;
1688  sfpStatus.SFP_rxLoss = (val2 & SFP_2_RX_LOS) ? true : false;
1689  sfpStatus.SFP_txFault = (val2 & SFP_2_TX_FAULT) ? true : false;
1690  }
1691  else
1692  {
1693  sfpStatus.SFP_linkUp = (val & LINK_A_UP) ? true : false;
1694  sfpStatus.SFP_present = (val2 & SFP_1_NOT_PRESENT) ? false : true;
1695  sfpStatus.SFP_rxLoss = (val2 & SFP_1_RX_LOS) ? true : false;
1696  sfpStatus.SFP_txFault = (val2 & SFP_1_TX_FAULT) ? true : false;
1697  }
1698 
1699  return true;
1700 }
1701 
1703 {
1705 }
1706 
1708 {
1709  NTV2IpError error = mIpErrorCode;
1711  return error;
1712 }
1713 
1714 void CNTV2Config2110::AcquireFramerControlAccess(const uint32_t baseAddr)
1715 {
1716  WriteChannelRegister(kRegFramer_control + baseAddr, 0x00);
1717  uint32_t val;
1718  mDevice.ReadRegister(kRegFramer_status + baseAddr, val);
1719  while (val & BIT(1))
1720  {
1721  // Wait
1722  AJATime::Sleep(10);
1723 
1724  mDevice.ReadRegister(kRegFramer_status + baseAddr, val);
1725  }
1726 }
1727 
1728 void CNTV2Config2110::ReleaseFramerControlAccess(const uint32_t baseAddr)
1729 {
1730  WriteChannelRegister(kRegFramer_control + baseAddr, 0x02);
1731 }
1732 
1734 {
1735  // this stream number is a core 'channel' number
1736  uint32_t index = 0;
1737  switch (stream)
1738  {
1739  case NTV2_VIDEO1_STREAM:
1740  case NTV2_VIDEO2_STREAM:
1741  case NTV2_VIDEO3_STREAM:
1742  case NTV2_VIDEO4_STREAM:
1743  index = (uint32_t)(stream-NTV2_VIDEO1_STREAM);
1744  break;
1745 
1746  case NTV2_AUDIO1_STREAM:
1747  case NTV2_AUDIO2_STREAM:
1748  case NTV2_AUDIO3_STREAM:
1749  case NTV2_AUDIO4_STREAM:
1750  case NTV2_ANC1_STREAM:
1751  case NTV2_ANC2_STREAM:
1752  case NTV2_ANC3_STREAM:
1753  case NTV2_ANC4_STREAM:
1754  index = (uint32_t)(stream-NTV2_AUDIO1_STREAM);
1755  break;
1756 
1757  case NTV2_VIDEO4K_STREAM:
1758  default:
1759  break;
1760  }
1761  return index;
1762 }
1763 
1764 bool CNTV2Config2110::GetMACAddress(const eSFP port, const NTV2Stream stream, string remoteIP, uint32_t & hi, uint32_t & lo)
1765 {
1766  uint32_t destIp = AJANetwork::aja_inet_addr(remoteIP.c_str());
1767  destIp = NTV2EndianSwap32(destIp);
1768 
1769  uint32_t mac;
1770  MACAddr macaddr;
1771 
1772  // is remote address muticast?
1773  uint8_t ip0 = (destIp & 0xff000000)>> 24;
1774  if (ip0 >= 224 && ip0 <= 239)
1775  {
1776  // multicast - generate MAC
1777  mac = destIp & 0x7fffff; // lower 23 bits
1778 
1779  macaddr.mac[0] = 0x01;
1780  macaddr.mac[1] = 0x00;
1781  macaddr.mac[2] = 0x5e;
1782  macaddr.mac[3] = mac >> 16;
1783  macaddr.mac[4] = (mac & 0xffff) >> 8;
1784  macaddr.mac[5] = mac & 0xff;
1785  }
1786  else
1787  {
1788  // unicast - get MAC from ARP
1789  string macAddr;
1790  bool rv;
1791  // is destination on the same subnet?
1792  IPVNetConfig nc;
1793  GetNetworkConfiguration(port, nc);
1794  if ( (destIp & nc.ipc_subnet) != (nc.ipc_ip & nc.ipc_subnet))
1795  {
1796  struct in_addr addr;
1797  addr.s_addr = NTV2EndianSwap32(nc.ipc_gateway);
1798  string gateIp = AJANetwork::aja_inet_ntoa(addr);
1799  rv = GetRemoteMAC(gateIp, port, stream, macAddr);
1800  }
1801  else
1802  {
1803  rv = GetRemoteMAC(remoteIP, port, stream, macAddr);
1804  }
1805  if (!rv)
1806  {
1807  SetTxStreamEnable(stream, false);
1809  return false;
1810  }
1811 
1812  istringstream ss(macAddr);
1813  string token;
1814  int i=0;
1815  while (i < 6)
1816  {
1817  getline (ss, token, ':');
1818  macaddr.mac[i++] = (uint8_t)strtoul(token.c_str(), NULL, 16);
1819  }
1820  }
1821 
1822  hi = macaddr.mac[0] << 8;
1823  hi += macaddr.mac[1];
1824 
1825  lo = macaddr.mac[2] << 24;
1826  lo += macaddr.mac[3] << 16;
1827  lo += macaddr.mac[4] << 8;
1828  lo += macaddr.mac[5];
1829 
1830  return true;
1831 }
1832 
1833 string CNTV2Config2110::GetSDPUrl(const eSFP sfp, const NTV2Stream stream)
1834 {
1835  string localIPAddress, subnetMask, gateway;
1836  string preAmble = "http://";
1837  string namePre = "tx";
1838  string namePost;
1839 
1840  GetNetworkConfiguration(sfp, localIPAddress, subnetMask, gateway);
1841 
1842  switch (stream)
1843  {
1844  case NTV2_VIDEO1_STREAM: namePost = "video1.sdp"; break;
1845  case NTV2_VIDEO2_STREAM: namePost = "video2.sdp"; break;
1846  case NTV2_VIDEO3_STREAM: namePost = "video3.sdp"; break;
1847  case NTV2_VIDEO4_STREAM: namePost = "video4.sdp"; break;
1848  case NTV2_AUDIO1_STREAM: namePost = "audio1.sdp"; break;
1849  case NTV2_AUDIO2_STREAM: namePost = "audio2.sdp"; break;
1850  case NTV2_AUDIO3_STREAM: namePost = "audio3.sdp"; break;
1851  case NTV2_AUDIO4_STREAM: namePost = "audio4.sdp"; break;
1852  case NTV2_ANC1_STREAM: namePost = "anc1.sdp"; break;
1853  case NTV2_ANC2_STREAM: namePost = "anc2.sdp"; break;
1854  case NTV2_ANC3_STREAM: namePost = "anc3.sdp"; break;
1855  case NTV2_ANC4_STREAM: namePost = "anc4.sdp"; break;
1856  case NTV2_VIDEO4K_STREAM: namePost = "video4K.sdp"; break;
1857 
1858  default: namePost = ""; break;
1859  }
1860 
1861  return preAmble + localIPAddress + "/" + namePre + namePost;
1862 }
1863 
1864 string CNTV2Config2110::GetGeneratedSDP(bool enabledSfp1, bool enabledSfp2, const NTV2Stream stream)
1865 {
1866  GenSDP(enabledSfp1, enabledSfp2, stream, false);
1867  return txsdp.str();
1868 }
1869 
1870 string CNTV2Config2110::To_String(int val)
1871 {
1872  ostringstream oss;
1873  oss << val;
1874  return oss.str();
1875 }
1876 
1877 bool CNTV2Config2110::GenSDP(const bool enableSfp1, const bool enableSfp2,
1878  const NTV2Stream stream, bool pushit)
1879 {
1880  stringstream & sdp = txsdp;
1881 
1882  sdp.str("");
1883  sdp.clear();
1884 
1885  // protocol version
1886  sdp << "v=0" << endl;
1887 
1888  // username session-id version network-type address-type address
1889  sdp << "o=- ";
1890 
1891  uint64_t t = GetNTPTimestamp();
1892  sdp << To_String((int)t);
1893 
1894  sdp << " 0 IN IP4 ";
1895 
1896  uint32_t val;
1897  // o is required but for multi SDP's we will just assume the originator is SFP_1
1898  if (!enableSfp1 && (StreamType(stream) != VIDEO_4K_STREAM))
1900  else
1902 
1903  struct in_addr addr;
1904  addr.s_addr = val;
1905  string localIPAddress = AJANetwork::aja_inet_ntoa(addr);
1906  sdp << localIPAddress << endl;
1907 
1908  // session name
1909  sdp << "s=AJA KonaIP 2110" << endl;
1910 
1911  // time the session is active
1912  sdp << "t=0 0" <<endl;
1913 
1914  // PTP
1915  PTPStatus ptpStatus;
1916  GetPTPStatus(ptpStatus);
1917 
1918  char gmInfo[32];
1919  sprintf(gmInfo, "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X:%d",
1920  ptpStatus.PTP_gmId[0], ptpStatus.PTP_gmId[1], ptpStatus.PTP_gmId[2], ptpStatus.PTP_gmId[3],
1921  ptpStatus.PTP_gmId[4], ptpStatus.PTP_gmId[5], ptpStatus.PTP_gmId[6], ptpStatus.PTP_gmId[7], ptpStatus.PTP_domain);
1922 
1923 
1924  if (StreamType(stream) == VIDEO_STREAM)
1925  {
1926  GenVideoStreamSDP(sdp, enableSfp1, enableSfp2, stream, &gmInfo[0]);
1927  }
1928  else if (StreamType(stream) == VIDEO_4K_STREAM)
1929  {
1930  GenVideoStreamMultiSDPInfo(sdp, &gmInfo[0]);
1931  }
1932  else if (StreamType(stream) == AUDIO_STREAM)
1933  {
1934  GenAudioStreamSDP(sdp, enableSfp1, enableSfp2, stream, &gmInfo[0]);
1935  }
1936  else if (StreamType(stream) == ANC_STREAM)
1937  {
1938  GenAncStreamSDP(sdp, enableSfp1, enableSfp2, stream, &gmInfo[0]);
1939  }
1940 
1941  //cout << "SDP --------------- " << stream << endl << sdp.str() << endl;
1942 
1943  bool rv = true;
1944 
1945  if (pushit)
1946  {
1947  string filename = "tx";
1948 
1949  switch (stream)
1950  {
1951  case NTV2_VIDEO1_STREAM: filename += "video1.sdp"; break;
1952  case NTV2_VIDEO2_STREAM: filename += "video2.sdp"; break;
1953  case NTV2_VIDEO3_STREAM: filename += "video3.sdp"; break;
1954  case NTV2_VIDEO4_STREAM: filename += "video4.sdp"; break;
1955  case NTV2_AUDIO1_STREAM: filename += "audio1.sdp"; break;
1956  case NTV2_AUDIO2_STREAM: filename += "audio2.sdp"; break;
1957  case NTV2_AUDIO3_STREAM: filename += "audio3.sdp"; break;
1958  case NTV2_AUDIO4_STREAM: filename += "audio4.sdp"; break;
1959  case NTV2_ANC1_STREAM: filename += "anc1.sdp"; break;
1960  case NTV2_ANC2_STREAM: filename += "anc2.sdp"; break;
1961  case NTV2_ANC3_STREAM: filename += "anc3.sdp"; break;
1962  case NTV2_ANC4_STREAM: filename += "anc4.sdp"; break;
1963  case NTV2_VIDEO4K_STREAM: filename += "video4K.sdp"; break;
1964  default: filename += ""; break;
1965  }
1966  rv = PushSDP(filename,sdp);
1967  }
1968 
1969  return rv;
1970 }
1971 
1972 bool CNTV2Config2110::GenVideoStreamSDP(stringstream &sdp, const bool enableSfp1,
1973  const bool enableSfp2, const NTV2Stream stream, char *gmInfo)
1974 {
1975  bool isDash7 = enableSfp1 && enableSfp2;
1976  if (isDash7)
1977  {
1978  sdp << "a=group:DUP 1 2" << endl;
1979  }
1980  if (enableSfp1)
1981  {
1982  GenVideoStreamSDPInfo(sdp, SFP_1, stream, gmInfo);
1983  sdp << "a=mid:" << (isDash7?"1":"VID") << endl;
1984  }
1985  if (enableSfp2)
1986  {
1987  GenVideoStreamSDPInfo(sdp, SFP_2, stream, gmInfo);
1988  sdp << "a=mid:" << (isDash7?"2":"VID") << endl;
1989  }
1990  return true;
1991 }
1992 
1993 bool CNTV2Config2110::GenVideoStreamSDPInfo(stringstream & sdp, const eSFP sfp, const NTV2Stream stream, char* gmInfo)
1994 {
1995  tx_2110Config config;
1996  GetTxStreamConfiguration(stream, config);
1997 
1998  uint32_t baseAddrPacketizer = GetPacketizerAddress(stream, GetSampling(sfp, stream));
1999 
2000  uint32_t width;
2001  mDevice.ReadRegister(kReg4175_pkt_width + baseAddrPacketizer, width);
2002 
2003  uint32_t height;
2004  mDevice.ReadRegister(kReg4175_pkt_height + baseAddrPacketizer, height);
2005 
2006  uint32_t ilace;
2007  mDevice.ReadRegister(kReg4175_pkt_interlace_ctrl + baseAddrPacketizer, ilace);
2008 
2009  if (ilace == 1)
2010  {
2011  height *= 2;
2012  }
2013 
2014  NTV2VideoFormat vfmt;
2015  GetTxFormat(VideoStreamToChannel(stream), vfmt);
2017  string rateString = rateToString(frate);
2018 
2019  // media name
2020  sdp << "m=video ";
2021  if (sfp == SFP_2)
2022  sdp << To_String(config.remotePort[1]);
2023  else
2024  sdp << To_String(config.remotePort[0]);
2025 
2026  sdp << " RTP/AVP ";
2027  sdp << To_String(config.payloadType) << endl;
2028 
2029  // connection information
2030  sdp << "c=IN IP4 ";
2031  if (sfp == SFP_2)
2032  sdp << config.remoteIP[1];
2033  else
2034  sdp << config.remoteIP[0];
2035  sdp << "/" << To_String(config.ttl) << endl;
2036 
2037  // source information
2038  sdp << "a=source-filter: incl IN IP4 ";
2039  uint32_t val;
2040 
2041  if (sfp == SFP_2)
2042  {
2043  sdp << config.remoteIP[1];
2045  }
2046  else
2047  {
2048  sdp << config.remoteIP[0];
2050  }
2051 
2052  struct in_addr addr;
2053  addr.s_addr = val;
2054  string localIPAddress = AJANetwork::aja_inet_ntoa(addr);
2055  sdp << ' ' << localIPAddress << endl;
2056 
2057  // rtpmap
2058  sdp << "a=rtpmap:";
2059  sdp << To_String(config.payloadType);
2060  sdp << " raw/90000" << endl;
2061 
2062  //fmtp
2063  sdp << "a=fmtp:";
2064  sdp << To_String(config.payloadType);
2065  if (config.videoSamples == VPIDSampling_GBR_444)
2066  sdp << " sampling=RGB; width=";
2067  else
2068  sdp << " sampling=YCbCr-4:2:2; width=";
2069 
2070  sdp << To_String(width);
2071  sdp << "; height=";
2072  sdp << To_String(height);
2073  sdp << "; exactframerate=";
2074  sdp << rateString;
2075  sdp << "; depth=10; TCS=SDR; colorimetry=";
2076  sdp << ((NTV2_IS_SD_VIDEO_FORMAT(vfmt)) ? "BT601" : "BT709");
2077  sdp << "; PM=2110GPM; SSN=ST2110-20:2017; TP=2110TPN; ";
2079  {
2080  sdp << "interlace; ";
2081  }
2082  else if (NTV2_IS_PSF_VIDEO_FORMAT(vfmt))
2083  {
2084  sdp << "interlace segmented";
2085  }
2086  sdp << endl;
2087 
2088  // PTP
2089  sdp << "a=ts-refclk:ptp=IEEE1588-2008:" << gmInfo << endl;
2090  sdp << "a=mediaclk:direct=0" << endl;
2091 
2092  return true;
2093 }
2094 
2095 
2096 bool CNTV2Config2110::GenVideoStreamMultiSDPInfo(stringstream & sdp, char* gmInfo)
2097 {
2098  uint32_t quadSwapOut;
2099  NTV2Stream stream;
2100 
2101  // Read virtual to see if we are to quad swap the outputs
2103 
2104  sdp << "a=group:MULTI-2SI 1 2 3 4 " << endl;
2105 
2106  // generate SDP's for all 4 video streams
2107  for (int i=0; i<4; i++)
2108  {
2109  if (quadSwapOut != 0)
2110  {
2111  switch (i)
2112  {
2113  case 0: stream = NTV2_VIDEO3_STREAM; break;
2114  case 1: stream = NTV2_VIDEO4_STREAM; break;
2115  case 2: stream = NTV2_VIDEO1_STREAM; break;
2116  case 3: stream = NTV2_VIDEO2_STREAM; break;
2117  }
2118  }
2119  else
2120  stream = (NTV2Stream)i;
2121 
2122  bool enabledA;
2123  bool enabledB;
2124  // See which steam is enabled, the code is written in such a way so that
2125  // if neither SFP1 or SFP2 is enabled it will use data from SFP1
2126  GetTxStreamEnable(stream, enabledA, enabledB);
2127 
2128  tx_2110Config config;
2129  GetTxStreamConfiguration(stream, config);
2130 
2131  uint32_t baseAddrPacketizer = GetPacketizerAddress(stream, GetSampling(SFP_1, stream));
2132 
2133  uint32_t width;
2134  mDevice.ReadRegister(kReg4175_pkt_width + baseAddrPacketizer, width);
2135 
2136  uint32_t height;
2137  mDevice.ReadRegister(kReg4175_pkt_height + baseAddrPacketizer, height);
2138 
2139  uint32_t ilace;
2140  mDevice.ReadRegister(kReg4175_pkt_interlace_ctrl + baseAddrPacketizer, ilace);
2141 
2142  if (ilace == 1)
2143  {
2144  height *= 2;
2145  }
2146 
2147  NTV2VideoFormat vfmt;
2148  GetTxFormat(VideoStreamToChannel(stream), vfmt);
2150  string rateString = rateToString(frate);
2151 
2152  // media name
2153  sdp << "m=video ";
2154  if (enabledB)
2155  sdp << To_String(config.remotePort[1]);
2156  else
2157  sdp << To_String(config.remotePort[0]);
2158 
2159  sdp << " RTP/AVP ";
2160  sdp << To_String(config.payloadType) << endl;
2161 
2162  // dest information
2163  sdp << "c=IN IP4 ";
2164  if (enabledB)
2165  sdp << config.remoteIP[1];
2166  else
2167  sdp << config.remoteIP[0];
2168  sdp << "/" << To_String(config.ttl) << endl;
2169 
2170  // source information
2171  sdp << "a=source-filter: incl IN IP4 ";
2172  uint32_t val;
2173 
2174  if (enabledB)
2175  {
2176  sdp << config.remoteIP[1];
2178  }
2179  else
2180  {
2181  sdp << config.remoteIP[0];
2183  }
2184 
2185  struct in_addr addr;
2186  addr.s_addr = val;
2187  string localIPAddress = AJANetwork::aja_inet_ntoa(addr);
2188  sdp << ' ' << localIPAddress << endl;
2189 
2190  // rtpmap
2191  sdp << "a=rtpmap:";
2192  sdp << To_String(config.payloadType);
2193  sdp << " raw/90000" << endl;
2194 
2195  //fmtp
2196  sdp << "a=fmtp:";
2197  sdp << To_String(config.payloadType);
2198  sdp << " sampling=YCbCr-4:2:2; width=";
2199  sdp << To_String(width);
2200  sdp << "; height=";
2201  sdp << To_String(height);
2202  sdp << "; exactframerate=";
2203  sdp << rateString;
2204  sdp << "; depth=10; TCS=SDR; colorimetry=";
2205  sdp << ((NTV2_IS_SD_VIDEO_FORMAT(vfmt)) ? "BT601" : "BT709");
2206  sdp << "; PM=2110GPM; SSN=ST2110-20:2017; TP=2110TPN; ";
2208  {
2209  sdp << "interlace; ";
2210  }
2211  else if (NTV2_IS_PSF_VIDEO_FORMAT(vfmt))
2212  {
2213  sdp << "interlace segmented";
2214  }
2215  sdp << endl;
2216 
2217  // PTP
2218  sdp << "a=ts-refclk:ptp=IEEE1588-2008:" << gmInfo << endl;
2219  sdp << "a=mediaclk:direct=0" << endl;
2220  sdp << "a=mid:" << i+1 << endl;
2221  }
2222 
2223  return true;
2224 }
2225 
2226 
2227 bool CNTV2Config2110::GenAudioStreamSDP(stringstream &sdp, const bool enableSfp1,
2228  const bool enableSfp2, const NTV2Stream stream, char *gmInfo)
2229 {
2230  bool isDash7 = enableSfp1 && enableSfp2;
2231  if (isDash7)
2232  {
2233  sdp << "a=group:DUP 1 2" << endl;
2234  }
2235  if (enableSfp1)
2236  {
2237  GenAudioStreamSDPInfo(sdp, SFP_1, stream, gmInfo);
2238  sdp << "a=mid:" << (isDash7?"1":"VID") << endl;
2239  }
2240  if (enableSfp2)
2241  {
2242  GenAudioStreamSDPInfo(sdp, SFP_2, stream, gmInfo);
2243  sdp << "a=mid:" << (isDash7?"2":"VID") << endl;
2244  }
2245  return true;
2246 }
2247 
2248 bool CNTV2Config2110::GenAudioStreamSDPInfo(stringstream & sdp, const eSFP sfp, const NTV2Stream stream, char* gmInfo)
2249 {
2250  tx_2110Config config;
2251  GetTxStreamConfiguration(stream, config);
2252 
2253  // media name
2254  sdp << "m=audio ";
2255  if (sfp == SFP_2)
2256  sdp << To_String(config.remotePort[1]);
2257  else
2258  sdp << To_String(config.remotePort[0]);
2259 
2260  sdp << " RTP/AVP ";
2261  sdp << To_String(config.payloadType) << endl;
2262 
2263  // connection information
2264  sdp << "c=IN IP4 ";
2265  if (sfp == SFP_2)
2266  sdp << config.remoteIP[1];
2267  else
2268  sdp << config.remoteIP[0];
2269 
2270  sdp << "/" << To_String(config.ttl) << endl;
2271 
2272  // source information
2273  sdp << "a=source-filter: incl IN IP4 ";
2274  uint32_t val;
2275 
2276  if (sfp == SFP_2)
2277  {
2278  sdp << config.remoteIP[1];
2280  }
2281  else
2282  {
2283  sdp << config.remoteIP[0];
2285  }
2286 
2287  struct in_addr addr;
2288  addr.s_addr = val;
2289  string localIPAddress = AJANetwork::aja_inet_ntoa(addr);
2290  sdp << ' ' << localIPAddress << endl;
2291 
2292  // rtpmap
2293  sdp << "a=rtpmap:";
2294  sdp << To_String(config.payloadType);
2295  sdp << " L24/48000/";
2296  sdp << To_String(config.numAudioChannels) << endl;
2297 
2298  //fmtp
2299  sdp << "a=fmtp:";
2300  sdp << To_String(config.payloadType);
2301  sdp << " channel-order=SMPTE2110.(";
2302  switch (config.numAudioChannels)
2303  {
2304  case 2:
2305  sdp << "ST)";
2306  break;
2307  case 4:
2308  sdp << "SGRP)";
2309  break;
2310  case 8:
2311  default:
2312  sdp << "SGRP,SGRP)";
2313  break;
2314  case 12:
2315  sdp << "SGRP,SGRP,SGRP)";
2316  break;
2317  case 16:
2318  sdp << "SGRP,SGRP,SGRP,SGRP)";
2319  break;
2320  }
2321  sdp << endl;
2322 
2323  if (config. audioPktInterval == PACKET_INTERVAL_125uS)
2324  {
2325  sdp << "a=ptime:0.125" << endl;
2326  }
2327  else
2328  {
2329  sdp << "a=ptime:1.000" << endl;
2330  }
2331 
2332  sdp << "a=ts-refclk:ptp=IEEE1588-2008:" << gmInfo << endl;
2333  sdp << "a=mediaclk:direct=0" << endl;
2334 
2335  return true;
2336 }
2337 
2338 bool CNTV2Config2110::GenAncStreamSDP(stringstream &sdp, const bool enableSfp1,
2339  const bool enableSfp2, const NTV2Stream stream, char *gmInfo)
2340 {
2341  bool isDash7 = enableSfp1 && enableSfp2;
2342  if (isDash7)
2343  {
2344  sdp << "a=group:DUP 1 2" << endl;
2345  }
2346  if (enableSfp1)
2347  {
2348  GenAncStreamSDPInfo(sdp, SFP_1, stream, gmInfo);
2349  sdp << "a=mid:" << (isDash7?"1":"VID") << endl;
2350  }
2351  if (enableSfp2)
2352  {
2353  GenAncStreamSDPInfo(sdp, SFP_2, stream, gmInfo);
2354  sdp << "a=mid:" << (isDash7?"2":"VID") << endl;
2355  }
2356  return true;
2357 }
2358 
2359 bool CNTV2Config2110::GenAncStreamSDPInfo(stringstream & sdp, const eSFP sfp, const NTV2Stream stream, char* gmInfo)
2360 {
2361  tx_2110Config config;
2362  GetTxStreamConfiguration(stream, config);
2363 
2364  // media name
2365  sdp << "m=video ";
2366  if (sfp == SFP_2)
2367  sdp << To_String(config.remotePort[1]);
2368  else
2369  sdp << To_String(config.remotePort[0]);
2370 
2371  sdp << " RTP/AVP ";
2372  sdp << To_String(config.payloadType) << endl;
2373 
2374  // connection information
2375  sdp << "c=IN IP4 ";
2376  if (sfp == SFP_2)
2377  sdp << config.remoteIP[1];
2378  else
2379  sdp << config.remoteIP[0];
2380  sdp << "/" << To_String(config.ttl) << endl;
2381 
2382  // source information
2383  sdp << "a=source-filter: incl IN IP4 ";
2384  uint32_t val;
2385 
2386  if (sfp == SFP_2)
2387  {
2388  sdp << config.remoteIP[1];
2390  }
2391  else
2392  {
2393  sdp << config.remoteIP[0];
2395  }
2396 
2397  struct in_addr addr;
2398  addr.s_addr = val;
2399  string localIPAddress = AJANetwork::aja_inet_ntoa(addr);
2400  sdp << ' ' << localIPAddress << endl;
2401 
2402  // rtpmap
2403  sdp << "a=rtpmap:";
2404  sdp << To_String(config.payloadType);
2405  sdp << " smpte291/90000" << endl;
2406 
2407  // PTP
2408  sdp << "a=ts-refclk:ptp=IEEE1588-2008:" << gmInfo << endl;
2409  sdp << "a=mediaclk:direct=0" << endl;
2410 
2411  return true;
2412 }
2413 
2414 
2416 {
2418 
2419  switch (stream)
2420  {
2421  case NTV2_VIDEO1_STREAM:
2422  case NTV2_VIDEO2_STREAM:
2423  case NTV2_VIDEO3_STREAM:
2424  case NTV2_VIDEO4_STREAM:
2425  type = VIDEO_STREAM;
2426  break;
2427  case NTV2_AUDIO1_STREAM:
2428  case NTV2_AUDIO2_STREAM:
2429  case NTV2_AUDIO3_STREAM:
2430  case NTV2_AUDIO4_STREAM:
2431  type = AUDIO_STREAM;
2432  break;
2433  case NTV2_ANC1_STREAM:
2434  case NTV2_ANC2_STREAM:
2435  case NTV2_ANC3_STREAM:
2436  case NTV2_ANC4_STREAM:
2437  type = ANC_STREAM;
2438  break;
2439 
2440  case NTV2_VIDEO4K_STREAM:
2441  type = VIDEO_4K_STREAM;
2442  break;
2443 
2444  default:
2445  type = INVALID_STREAM;
2446  break;
2447  }
2448  return type;
2449 }
2450 
2452 {
2453  NTV2Channel channel;
2454  switch (stream)
2455  {
2456  case NTV2_VIDEO1_STREAM: channel = NTV2_CHANNEL1; break;
2457  case NTV2_VIDEO2_STREAM: channel = NTV2_CHANNEL2; break;
2458  case NTV2_VIDEO3_STREAM: channel = NTV2_CHANNEL3; break;
2459  case NTV2_VIDEO4_STREAM: channel = NTV2_CHANNEL4; break;
2460  default: channel = NTV2_CHANNEL_INVALID; break;
2461  }
2462  return channel;
2463 }
2464 
2465 
2466 bool CNTV2Config2110::GetActualSDP(std::string url, std::string & sdp)
2467 {
2468  return GetSDP(url, sdp);
2469 }
2470 
2471 
2472 int CNTV2Config2110::getDescriptionValue(int startLine, string type, string & value)
2473 {
2474  for (unsigned i(startLine); i < sdpLines.size(); i++)
2475  {
2476  string line = sdpLines[i];
2477  size_t pos = line.find(type);
2478  if (pos != string::npos)
2479  {
2480  value = line.substr(pos + type.size() + 1);
2481  return i;
2482  }
2483  }
2484  return -1; // not found
2485 }
2486 
2487 string CNTV2Config2110::getVideoDescriptionValue(string type)
2488 {
2489  vector<string>::iterator it;
2490  for (it = tokens.begin(); it != tokens.end(); it++)
2491  {
2492  string line = *it;
2493  size_t pos = line.find(type);
2494  if (pos != string::npos)
2495  {
2496  line = line.substr(pos + type.size());
2497  line.erase(remove(line.begin(), line.end(), ';'), line.end());
2498  return line;
2499  }
2500  }
2501  string result;
2502  return result; // not found
2503 }
2504 
2505 vector<string> CNTV2Config2110::split(const char *str, char delim)
2506 {
2507  vector<string> result;
2508  do
2509  {
2510  const char * begin = str;
2511  while(*str != delim && *str)
2512  {
2513  str++;
2514  }
2515  result.push_back(string(begin, str));
2516  } while (0 != *str++);
2517  return result;
2518 }
2519 
2521 {
2522  if (sdp.empty())
2523  {
2525  return false;
2526  }
2527 
2528  // remove any carriage returns
2529  sdp.erase(remove(sdp.begin(), sdp.end(), '\r'), sdp.end());
2530 
2531  // break into a vector of lines and then into tokenw
2532  sdpLines.clear();
2533  stringstream ss(sdp);
2534  string to;
2535 
2536  while(getline(ss,to,'\n'))
2537  {
2538  sdpLines.push_back(to);
2539  }
2540 
2541  // rudimentary check it is an sdp file
2542  int index;
2543  string value;
2544 
2545  // is this really an SDP
2546  index = getDescriptionValue(0,"v=",value);
2547  if (index == -1)
2548  {
2550  return false;
2551  }
2552 
2553  // make sure this is a multi-2si sdp
2554  index = getDescriptionValue(index,"a=group",value);
2555  if (index == -1)
2556  {
2558  return false;
2559  }
2560 
2561  tokens = split(value.c_str(), ' ');
2562  if (!((tokens.size() != 5) && (tokens[0] == "MULTI-2SI")))
2563  {
2565  return false;
2566  }
2567 
2568  // fill in RX struct for each stream
2569  for (int i=0; i<4; i++)
2570  {
2571  uint32_t rxMatch = 0;
2572  int rv;
2573 
2574  rxConfig.rx2110Config[i].sourceIP = "0.0.0.0";
2575 
2576  index = getDescriptionValue(index,"m=video",value);
2577  if (index == -1)
2578  {
2579  // does not contain video
2581  return false;
2582  }
2583  tokens = split(value.c_str(), ' ');
2584  if ((tokens.size() >= 1) && !tokens[0].empty())
2585  {
2586  rxConfig.rx2110Config[i].destPort = atoi(tokens[0].c_str());
2587  rxMatch |= RX_MATCH_2110_DEST_PORT;
2588  }
2589  if ((tokens.size() >= 3) && !tokens[2].empty())
2590  {
2591  rxConfig.rx2110Config[i].payloadType = atoi(tokens[2].c_str());
2592  rxMatch |= RX_MATCH_2110_PAYLOAD;
2593  }
2594 
2595  rv = getDescriptionValue(index,"c=IN",value);
2596  if (rv >= index)
2597  {
2598  tokens = split(value.c_str(), ' ');
2599  if (tokens.size() >= 2)
2600  {
2601  tokens = split(tokens[1].c_str(), '/');
2602  if ((tokens.size() >= 1) && !tokens[0].empty())
2603  {
2604  rxConfig.rx2110Config[i].destIP = tokens[0];
2605  rxMatch |= RX_MATCH_2110_DEST_IP;
2606  }
2607  }
2608  }
2609 
2610  //if there is a source-filter attribute, it overrides the o= source attribute
2611  rv = getDescriptionValue(index,"a=source-filter:",value);
2612  if (rv > index)
2613  {
2614  tokens = split(value.c_str(), ' ');
2615  if (tokens.size() >= 5 && !tokens[4].empty())
2616  {
2617  rxConfig.rx2110Config[i].sourceIP = tokens[4];
2618  rxMatch |= RX_MATCH_2110_SOURCE_IP;
2619  }
2620  }
2621 
2622  rv = getDescriptionValue(index,"a=rtpmap",value);
2623  if (rv > index)
2624  {
2625  tokens = split(value.c_str(), ' ');
2626  if ((tokens.size() >= 1) && !tokens[0].empty())
2627  {
2628  rxConfig.rx2110Config[i].payloadType = atoi(tokens[0].c_str());
2629  rxMatch |= RX_MATCH_2110_PAYLOAD;
2630  }
2631  }
2632 
2633  rv = getDescriptionValue(index,"a=fmtp",value);
2634  if (rv > index)
2635  {
2636  tokens = split(value.c_str(), ' ');
2637  string sampling = getVideoDescriptionValue("sampling=");
2638  if (sampling == "YCbCr-4:2:2")
2639  {
2641  }
2642  string width = getVideoDescriptionValue("width=");
2643  string height = getVideoDescriptionValue("height=");
2644  string rate = getVideoDescriptionValue("exactframerate=");
2645  bool interlace = false;
2646  bool segmented = false;
2647  vector<string>::iterator it;
2648 
2649  for (it = tokens.begin(); it != tokens.end(); it++)
2650  {
2651  // For interlace, we can get one of the following tokens:
2652  // interlace
2653  // interlace;
2654  // interlace=1
2655  // interlace segmented
2656 
2657  if (*it == "interlace")
2658  {
2659  interlace=true;
2660  continue;
2661  }
2662 
2663  if (it->substr(0,10) == "interlace;")
2664  {
2665  interlace=true;
2666  continue;
2667  }
2668  if (it->substr(0,11) == "interlace=1")
2669  {
2670  interlace=true;
2671  continue;
2672  }
2673  if ((it->substr( 0, 9 ) == "segmented") && interlace)
2674  {
2675  interlace=false;
2676  segmented=true;
2677  break;
2678  }
2679  }
2680  int w = atoi(width.c_str());
2681  int h = atoi(height.c_str());
2682  NTV2FrameRate r = stringToRate(rate);
2683  NTV2VideoFormat vf = ::GetFirstMatchingVideoFormat(r, h, w, interlace, segmented, false /* no level B */);
2684  rxConfig.rx2110Config[i].videoFormat = vf;
2685  }
2686  rxConfig.rx2110Config[i].rxMatch = rxMatch;
2687  index++;
2688  }
2689 
2690  return true;
2691 }
2692 
2693 
2695 {
2696  if (sdp.empty())
2697  {
2699  return false;
2700  }
2701 
2702  // remove any carriage returns
2703  sdp.erase(remove(sdp.begin(), sdp.end(), '\r'), sdp.end());
2704 
2705  // break into a vector of lines and then into tokenw
2706  sdpLines.clear();
2707  stringstream ss(sdp);
2708  string to;
2709 
2710  while(getline(ss,to,'\n'))
2711  {
2712  sdpLines.push_back(to);
2713  }
2714 
2715  // rudimentary check it is an sdp file
2716  int index;
2717  string value;
2718 
2719  // is this really an SDP
2720  index = getDescriptionValue(0,"v=",value);
2721  if (index == -1)
2722  {
2724  return false;
2725  }
2726 
2727  // originator
2728  index = getDescriptionValue(index,"o=",value);
2729  if (index == -1)
2730  {
2732  return false;
2733  }
2734 
2735  uint32_t rxMatch = 0;
2736 
2737  tokens = split(value.c_str(), ' ');
2738  if ((tokens.size() >= 6) && (tokens[3] == "IN") && (tokens[4] == "IP4"))
2739  {
2740  if (!tokens[5].empty())
2741  {
2742  rxConfig.sourceIP = tokens[5];
2743  rxMatch |= RX_MATCH_2110_SOURCE_IP;
2744  }
2745  }
2746 
2747  int rv = getDescriptionValue(0,"c=IN",value);
2748  if (rv >= index)
2749  {
2750  tokens = split(value.c_str(), ' ');
2751  if (tokens.size() >= 2)
2752  {
2753  tokens = split(tokens[1].c_str(), '/');
2754  if ((tokens.size() >= 1) && !tokens[0].empty())
2755  {
2756  rxConfig.destIP = tokens[0];
2757  rxMatch |= RX_MATCH_2110_DEST_IP;
2758  }
2759  }
2760  }
2761 
2762  index = getDescriptionValue(index,"m=video",value);
2763  if (index == -1)
2764  {
2765  // does not contain video
2767  return false;
2768  }
2769  tokens = split(value.c_str(), ' ');
2770  if ((tokens.size() >= 1) && !tokens[0].empty())
2771  {
2772  rxConfig.destPort = atoi(tokens[0].c_str());
2773  rxMatch |= RX_MATCH_2110_DEST_PORT;
2774  }
2775  if ((tokens.size() >= 3) && !tokens[2].empty())
2776  {
2777  rxConfig.payloadType = atoi(tokens[2].c_str());
2778  rxMatch |= RX_MATCH_2110_PAYLOAD;
2779  }
2780 
2781  rv = getDescriptionValue(index,"c=IN",value);
2782  if (rv >= index)
2783  {
2784  // this overwrites if found before
2785  tokens = split(value.c_str(), ' ');
2786  if (tokens.size() >= 2)
2787  {
2788  tokens = split(tokens[1].c_str(), '/');
2789  if ((tokens.size() >= 1) && !tokens[0].empty())
2790  {
2791  rxConfig.destIP = tokens[0];
2792  rxMatch |= RX_MATCH_2110_DEST_IP;
2793  }
2794  }
2795  }
2796 
2797  // if there is a source-filter attribute, it overrides the o= source attribute
2798  rv = getDescriptionValue(index,"a=source-filter:",value);
2799  if (rv > index)
2800  {
2801  tokens = split(value.c_str(), ' ');
2802  if (tokens.size() >= 5 && !tokens[4].empty())
2803  {
2804  rxConfig.sourceIP = tokens[4];
2805  rxMatch |= RX_MATCH_2110_SOURCE_IP;
2806  }
2807  }
2808 
2809  rv = getDescriptionValue(index,"a=rtpmap",value);
2810  if (rv > index)
2811  {
2812  tokens = split(value.c_str(), ' ');
2813  if ((tokens.size() >= 1) && !tokens[0].empty())
2814  {
2815  rxConfig.payloadType = atoi(tokens[0].c_str());
2816  rxMatch |= RX_MATCH_2110_PAYLOAD;
2817  }
2818  }
2819 
2820  rv = getDescriptionValue(index,"a=fmtp",value);
2821  if (rv > index)
2822  {
2823  tokens = split(value.c_str(), ' ');
2824  string sampling = getVideoDescriptionValue("sampling=");
2825  if (sampling == "YCbCr-4:2:2")
2826  {
2828  }
2829  string width = getVideoDescriptionValue("width=");
2830  string height = getVideoDescriptionValue("height=");
2831  string rate = getVideoDescriptionValue("exactframerate=");
2832  bool interlace = false;
2833  bool segmented = false;
2834  vector<string>::iterator it;
2835  for (it = tokens.begin(); it != tokens.end(); it++)
2836  {
2837  // For interlace, we can get one of the following tokens:
2838  // interlace
2839  // interlace;
2840  // interlace=1
2841  // interlace segmented
2842 
2843  if (*it == "interlace")
2844  {
2845  interlace=true;
2846  continue;
2847  }
2848 
2849  if (it->substr(0,10) == "interlace;")
2850  {
2851  interlace=true;
2852  continue;
2853  }
2854  if (it->substr(0,11) == "interlace=1")
2855  {
2856  interlace=true;
2857  continue;
2858  }
2859  if ((it->substr( 0, 9 ) == "segmented") && interlace)
2860  {
2861  interlace=false;
2862  segmented=true;
2863  break;
2864  }
2865  }
2866  int w = atoi(width.c_str());
2867  int h = atoi(height.c_str());
2868  NTV2FrameRate r = stringToRate(rate);
2869  NTV2VideoFormat vf = ::GetFirstMatchingVideoFormat(r, h, w, interlace, segmented, false /* no level B */);
2870  rxConfig.videoFormat = vf;
2871  }
2872  rxConfig.rxMatch = rxMatch;
2873  return true;
2874 }
2875 
2876 
2878 {
2879  if (sdp.empty())
2880  {
2882  return false;
2883  }
2884 
2885  uint32_t rxMatch = 0;
2886 
2887  // remove any carriage returns
2888  sdp.erase(remove(sdp.begin(), sdp.end(), '\r'), sdp.end());
2889 
2890  // break into a vector of lines and then into tokenw
2891 
2892  sdpLines.clear();
2893  stringstream ss(sdp);
2894  string to;
2895 
2896  while(getline(ss,to,'\n'))
2897  {
2898  sdpLines.push_back(to);
2899  }
2900 
2901  // rudimentary check it is an sdp file
2902  int index;
2903  string value;
2904 
2905  // is this really an SDP
2906  index = getDescriptionValue(0,"v=",value);
2907  if (index == -1)
2908  {
2910  return false;
2911  }
2912 
2913  // originator
2914  index = getDescriptionValue(index,"o=",value);
2915  if (index == -1)
2916  {
2918  return false;
2919  }
2920 
2921  tokens = split(value.c_str(), ' ');
2922  if ((tokens.size() >= 6) && (tokens[3] == "IN") && (tokens[4] == "IP4"))
2923  {
2924  if (!tokens[5].empty())
2925  {
2926  rxConfig.sourceIP = tokens[5];
2927  rxMatch |= RX_MATCH_2110_SOURCE_IP;
2928  }
2929  }
2930 
2931  int rv = getDescriptionValue(0,"c=IN",value);
2932  if (rv >= index)
2933  {
2934  tokens = split(value.c_str(), ' ');
2935  if (tokens.size() >= 2)
2936  {
2937  tokens = split(tokens[1].c_str(), '/');
2938  if ((tokens.size() >= 1) && !tokens[0].empty())
2939  {
2940  rxConfig.destIP = tokens[0];
2941  rxMatch |= RX_MATCH_2110_DEST_IP;
2942  }
2943  }
2944  }
2945 
2946  // audio stream
2947  index = getDescriptionValue(index,"m=audio",value);
2948  if (index == -1)
2949  {
2950  // does not contain audio
2952  return false;
2953  }
2954 
2955  tokens = split(value.c_str(), ' ');
2956  if ((tokens.size() >= 1) && !tokens[0].empty())
2957  {
2958  rxConfig.destPort = atoi(tokens[0].c_str());
2959  rxMatch |= RX_MATCH_2110_DEST_PORT;
2960  }
2961 
2962  if ((tokens.size() >= 3) && !tokens[2].empty())
2963  {
2964  rxConfig.payloadType = atoi(tokens[2].c_str());
2965  rxMatch |= RX_MATCH_2110_PAYLOAD;
2966  }
2967 
2968  rv = getDescriptionValue(index,"c=IN",value);
2969  if (rv >= index)
2970  {
2971  // this overwrites if found before
2972  tokens = split(value.c_str(), ' ');
2973  if ((tokens.size() >= 2))
2974  {
2975  tokens = split(tokens[1].c_str(), '/');
2976  if ((tokens.size() >= 1)&& !tokens[0].empty())
2977  {
2978  rxConfig.destIP = tokens[0];
2979  rxMatch |= RX_MATCH_2110_DEST_IP;
2980  }
2981  }
2982  }
2983 
2984  // if there is a source-filter attribute, it overrides the o= source attribute
2985  rv = getDescriptionValue(index,"a=source-filter:",value);
2986  if (rv > index)
2987  {
2988  tokens = split(value.c_str(), ' ');
2989  if (tokens.size() >= 5 && !tokens[4].empty())
2990  {
2991  rxConfig.sourceIP = tokens[4];
2992  rxMatch |= RX_MATCH_2110_SOURCE_IP;
2993  }
2994  }
2995 
2996  rv = getDescriptionValue(index,"a=rtpmap",value);
2997  if (rv > index)
2998  {
2999  tokens = split(value.c_str(), ' ');
3000  if ((tokens.size() >= 1)&& !tokens[0].empty())
3001  {
3002  rxConfig.payloadType = atoi(tokens[0].c_str());
3003  rxMatch |= RX_MATCH_2110_PAYLOAD;
3004  }
3005  if ((tokens.size() >= 2))
3006  {
3007  tokens = split(tokens[1].c_str(), '/');
3008  if ((tokens.size() >= 3) && !tokens[2].empty())
3009  {
3010  rxConfig.numAudioChannels = atoi(tokens[2].c_str());
3011  }
3012  }
3013  }
3014 
3015  rv = getDescriptionValue(index,"a=ptime",value);
3016  if (rv > index)
3017  {
3018  tokens = split(value.c_str(), ' ');
3019  if ((tokens.size() >= 1)&& !tokens[0].empty())
3020  {
3021  tokens = split(tokens[0].c_str(), '.');
3022  if (tokens.size() >= 2)
3023  {
3024  if ((atoi(tokens[0].c_str()) == 1) && (atoi(tokens[1].c_str()) == 0))
3026  else if ((atoi(tokens[0].c_str()) == 0) && (atoi(tokens[1].c_str()) == 125))
3028  }
3029  }
3030  }
3031 
3032  rxConfig.rxMatch = rxMatch;
3033  return true;
3034 }
3035 
3036 
3038 {
3039  if (sdp.empty())
3040  {
3042  return false;
3043  }
3044 
3045  // remove any carriage returns
3046  sdp.erase(remove(sdp.begin(), sdp.end(), '\r'), sdp.end());
3047 
3048  // break into a vector of lines and then into tokenw
3049  sdpLines.clear();
3050  stringstream ss(sdp);
3051  string to;
3052 
3053  while(getline(ss,to,'\n'))
3054  {
3055  sdpLines.push_back(to);
3056  }
3057 
3058  // rudimentary check it is an sdp file
3059  int index;
3060  string value;
3061 
3062  // is this really an SDP
3063  index = getDescriptionValue(0,"v=",value);
3064  if (index == -1)
3065  {
3067  return false;
3068  }
3069 
3070  // originator
3071  index = getDescriptionValue(index,"o=",value);
3072  if (index == -1)
3073  {
3075  return false;
3076  }
3077 
3078  uint32_t rxMatch = 0;
3079 
3080  tokens = split(value.c_str(), ' ');
3081  if ((tokens.size() >= 6) && (tokens[3] == "IN") && (tokens[4] == "IP4"))
3082  {
3083  if (!tokens[5].empty())
3084  {
3085  rxConfig.sourceIP = tokens[5];
3086  rxMatch |= RX_MATCH_2110_SOURCE_IP;
3087  }
3088  }
3089 
3090  int rv = getDescriptionValue(0,"c=IN",value);
3091  if (rv >= index)
3092  {
3093  tokens = split(value.c_str(), ' ');
3094  if (tokens.size() >= 2)
3095  {
3096  tokens = split(tokens[1].c_str(), '/');
3097  if ((tokens.size() >= 1) && !tokens[0].empty())
3098  {
3099  rxConfig.destIP = tokens[0];
3100  rxMatch |= RX_MATCH_2110_DEST_IP;
3101  }
3102  }
3103  }
3104 
3105  index = getDescriptionValue(index,"m=video",value);
3106  if (index == -1)
3107  {
3108  // does not contain video
3110  return false;
3111  }
3112  tokens = split(value.c_str(), ' ');
3113  if ((tokens.size() >= 1) && !tokens[0].empty())
3114  {
3115  rxConfig.destPort = atoi(tokens[0].c_str());
3116  rxMatch |= RX_MATCH_2110_DEST_PORT;
3117  }
3118  if ((tokens.size() >= 3) && !tokens[2].empty())
3119  {
3120  rxConfig.payloadType = atoi(tokens[2].c_str());
3121  rxMatch |= RX_MATCH_2110_PAYLOAD;
3122  }
3123 
3124  rv = getDescriptionValue(index,"c=IN",value);
3125  if (rv >= index)
3126  {
3127  // this overwrites if found before
3128  tokens = split(value.c_str(), ' ');
3129  if (tokens.size() >= 2)
3130  {
3131  tokens = split(tokens[1].c_str(), '/');
3132  if ((tokens.size() >= 1) && !tokens[0].empty())
3133  {
3134  rxConfig.destIP = tokens[0];
3135  rxMatch |= RX_MATCH_2110_DEST_IP;
3136  }
3137  }
3138  }
3139 
3140  // if there is a source-filter attribute, it overrides the o= source attribute
3141  rv = getDescriptionValue(index,"a=source-filter:",value);
3142  if (rv > index)
3143  {
3144  tokens = split(value.c_str(), ' ');
3145  if (tokens.size() >= 5 && !tokens[4].empty())
3146  {
3147  rxConfig.sourceIP = tokens[4];
3148  rxMatch |= RX_MATCH_2110_SOURCE_IP;
3149  }
3150  }
3151 
3152  rv = getDescriptionValue(index,"a=rtpmap",value);
3153  if (rv > index)
3154  {
3155  tokens = split(value.c_str(), ' ');
3156  if ((tokens.size() >= 1) && !tokens[0].empty())
3157  {
3158  rxConfig.payloadType = atoi(tokens[0].c_str());
3159  rxMatch |= RX_MATCH_2110_PAYLOAD;
3160  }
3161  }
3162 
3163  rxConfig.rxMatch = rxMatch;
3164  return true;
3165 }
3166 
3167 
3168 std::string CNTV2Config2110::rateToString(NTV2FrameRate rate)
3169 {
3170  string rateString;
3171  switch (rate)
3172  {
3173  default:
3174  case NTV2_FRAMERATE_UNKNOWN :
3175  rateString = "00";
3176  break;
3177  case NTV2_FRAMERATE_6000 :
3178  rateString = "60";
3179  break;
3180  case NTV2_FRAMERATE_5994 :
3181  rateString = "60000/1001";
3182  break;
3183  case NTV2_FRAMERATE_3000 :
3184  rateString = "30";
3185  break;
3186  case NTV2_FRAMERATE_2997 :
3187  rateString = "30000/1001";
3188  break;
3189  case NTV2_FRAMERATE_2500 :
3190  rateString = "25";
3191  break;
3192  case NTV2_FRAMERATE_2400 :
3193  rateString = "24";
3194  break;
3195  case NTV2_FRAMERATE_2398 :
3196  rateString = "24000/1001";
3197  break;
3198  case NTV2_FRAMERATE_5000 :
3199  rateString = "50";
3200  break;
3201  case NTV2_FRAMERATE_4800 :
3202  rateString = "48";
3203  break;
3204  case NTV2_FRAMERATE_4795 :
3205  rateString = "48000/1001";
3206  break;
3207  case NTV2_FRAMERATE_12000 :
3208  rateString = "120";
3209  break;
3210  case NTV2_FRAMERATE_11988 :
3211  rateString = "120000/1001";
3212  break;
3213  case NTV2_FRAMERATE_1500 :
3214  rateString = "15";
3215  break;
3216  case NTV2_FRAMERATE_1498 :
3217  rateString = "1500/1001";
3218  break;
3219  }
3220  return rateString;
3221 }
3222 
3223 NTV2FrameRate CNTV2Config2110::stringToRate(std::string rateString)
3224 {
3225  NTV2FrameRate rate;
3226  if (rateString == "60")
3227  rate = NTV2_FRAMERATE_6000;
3228  else if (rateString == "60000/1001")
3229  rate = NTV2_FRAMERATE_5994;
3230  else if (rateString == "30")
3231  rate = NTV2_FRAMERATE_3000;
3232  else if (rateString == "30000/1001")
3233  rate = NTV2_FRAMERATE_2997;
3234  else if (rateString == "25")
3235  rate = NTV2_FRAMERATE_2500;
3236  else if (rateString == "24")
3237  rate = NTV2_FRAMERATE_2400;
3238  else if (rateString == "24000/1001")
3239  rate = NTV2_FRAMERATE_2398;
3240  else if (rateString == "50")
3241  rate = NTV2_FRAMERATE_5000;
3242  else if (rateString == "48")
3243  rate = NTV2_FRAMERATE_4800;
3244  else if (rateString == "48000/1001")
3245  rate = NTV2_FRAMERATE_4795;
3246  else if (rateString == "120")
3247  rate = NTV2_FRAMERATE_12000;
3248  else if (rateString == "120000/1001")
3249  rate = NTV2_FRAMERATE_11988;
3250  else if (rateString == "15")
3251  rate = NTV2_FRAMERATE_1500;
3252  else if (rateString == "1500/1001")
3253  rate = NTV2_FRAMERATE_1498;
3254  else
3255  rate = NTV2_FRAMERATE_UNKNOWN;
3256  return rate;
3257 }
3258 
3259 void CNTV2Config2110::SetArbiter(const eSFP sfp, const NTV2Stream stream, bool enable)
3260 {
3261  uint32_t reg;
3262  if (StreamType(stream) == VIDEO_STREAM)
3263  {
3265  }
3266  else
3267  {
3269  }
3270  uint32_t val;
3271  mDevice.ReadRegister(reg, val);
3272 
3273  uint32_t bit = (1 << Get2110TxStreamIndex(stream)) << (int(sfp) * 16);
3274  if ((GetSampling(sfp, stream) == VPIDSampling_GBR_444) &&
3277  bit = bit << 4;
3278 
3279  if (enable)
3280  val |= bit;
3281  else
3282  val &= ~bit;
3283 
3284  mDevice.WriteRegister(reg, val);
3285 }
3286 
3287 void CNTV2Config2110::GetArbiter(const eSFP sfp, NTV2Stream stream, bool & enable)
3288 {
3289  uint32_t reg;
3290  if (StreamType(stream) == VIDEO_STREAM)
3291  {
3293  }
3294  else
3295  {
3297  }
3298  uint32_t val;
3299  mDevice.ReadRegister(reg, val);
3300 
3301  uint32_t bit = (1 << Get2110TxStreamIndex(stream)) << (int(sfp) * 16);
3302  if ((GetSampling(sfp, stream) == VPIDSampling_GBR_444) &&
3305  bit = bit << 4;
3306 
3307  enable = (val & bit);
3308 }
3309 
3310 void CNTV2Config2110::SetSampling(const eSFP sfp, const NTV2Stream stream, const VPIDSampling sampling)
3311 {
3312  if (StreamType(stream) == VIDEO_STREAM)
3313  {
3314  uint32_t samp = sampling;
3315  uint32_t mask = 0;
3316 
3317  switch (stream)
3318  {
3319  case NTV2_VIDEO4_STREAM:
3320  mask = 0xffff0fff;
3321  samp = samp << 12;
3322  break;
3323 
3324  case NTV2_VIDEO3_STREAM:
3325  mask = 0xfffff0ff;
3326  samp = samp << 8;
3327  break;
3328 
3329  case NTV2_VIDEO2_STREAM:
3330  mask = 0xffffff0f;
3331  samp = samp << 4;
3332  break;
3333 
3334  default:
3335  case NTV2_VIDEO1_STREAM:
3336  mask = 0xfffffff0;
3337  break;
3338  }
3339 
3340  if (sfp == SFP_2)
3341  {
3342  mask = mask << 16;
3343  mask |= 0xffff;
3344  samp = samp << 16;
3345  }
3346 
3347  uint32_t val;
3349  val &= mask;
3350  val |= samp;
3352  }
3353 }
3354 
3356 {
3358 
3359  if (StreamType(stream) == VIDEO_STREAM)
3360  {
3361  uint32_t val;
3363 
3364  if (sfp == SFP_2)
3365  val = val >> 16;
3366 
3367  switch (stream)
3368  {
3369  case NTV2_VIDEO4_STREAM:
3370  val = val >> 12;
3371  break;
3372 
3373  case NTV2_VIDEO3_STREAM:
3374  val = val >> 8;
3375  break;
3376 
3377  case NTV2_VIDEO2_STREAM:
3378  val = val >> 4;
3379  break;
3380 
3381  default:
3382  case NTV2_VIDEO1_STREAM:
3383  break;
3384 
3385  }
3386  sampling = (VPIDSampling)(val &= 0x0000000f);
3387  }
3388 
3389  return sampling;
3390 }
3391 
3392 bool CNTV2Config2110::SetLLDPInfo(std::string sysname)
3393 {
3394  return CNTV2MBController::SetLLDPInfo(sysname);
3395 }
3396 
3397 bool CNTV2Config2110::GetLLDPInfo(std::string &chassisId0, std::string &portId0,
3398  std::string &chassisId1, std::string &portId1)
3399 {
3400  return CNTV2MBController::GetLLDPInfo(chassisId0, portId0, chassisId1, portId1);
3401 }
3402 
3404 {
3406 }
3407 
CNTV2Config2110::ResetPacketizerStream
void ResetPacketizerStream(const NTV2Stream stream)
Definition: ntv2config2110.cpp:407
rx_2110Config::ssrc
uint32_t ssrc
Specifies the SSRC identifier (if RX_MATCH_2110_SSRC set)
Definition: ntv2config2110.h:281
SFPStatus::SFP_rxLoss
bool SFP_rxLoss
Definition: ntv2mbcontroller.h:76
kRegArb_audio
#define kRegArb_audio
Definition: ntv2registers2110.h:336
NTV2IpErrCannotGetMacAddress
@ NTV2IpErrCannotGetMacAddress
Definition: ntv2enums.h:4279
CNTV2MBController::SetIGMPGroup
void SetIGMPGroup(eSFP port, NTV2Stream stream, uint32_t mcast_addr, uint32_t src_addr, bool enable)
Definition: ntv2mbcontroller.cpp:380
CNTV2Config2110::Get4KModeEnable
bool Get4KModeEnable(bool &enable)
Definition: ntv2config2110.cpp:1375
SAREK_4175_RX_DEPACKETIZER_3
#define SAREK_4175_RX_DEPACKETIZER_3
Definition: ntv2registers2110.h:30
kRegTxNtv2VideoDecode1
#define kRegTxNtv2VideoDecode1
Definition: ntv2registers2110.h:366
kReg4175_pkt_chan_num
#define kReg4175_pkt_chan_num
Definition: ntv2registers2110.h:72
SAREK_2110_DECAPSULATOR_1
#define SAREK_2110_DECAPSULATOR_1
Definition: ntv2registers2110.h:44
eSFP
eSFP
Definition: ntv2mbcontroller.h:38
SAREK_4175_RX_DEPACKETIZER_4
#define SAREK_4175_RX_DEPACKETIZER_4
Definition: ntv2registers2110.h:31
rx_2110Config::operator!=
bool operator!=(const rx_2110Config &other)
Definition: ntv2config2110.cpp:113
IPVNetConfig::ipc_ip
uint32_t ipc_ip
Definition: ntv2mbcontroller.h:123
CNTV2Config2110::ExtractRxVideoConfigFromSDP
bool ExtractRxVideoConfigFromSDP(std::string sdp, rx_2110Config &rxConfig)
Definition: ntv2config2110.cpp:2694
NTV2_IS_SD_VIDEO_FORMAT
#define NTV2_IS_SD_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:730
kReg4175_pkt_ssrc
#define kReg4175_pkt_ssrc
Definition: ntv2registers2110.h:69
kRegRxNtv2VideoDecode1
#define kRegRxNtv2VideoDecode1
Definition: ntv2registers2110.h:362
CNTV2MailBox::getFeatures
uint32_t getFeatures()
Definition: ntv2mailbox.cpp:406
CNTV2Config2110::GenVideoStreamSDPInfo
bool GenVideoStreamSDPInfo(std::stringstream &sdp, const eSFP sfp, const NTV2Stream stream, char *gmInfo)
Definition: ntv2config2110.cpp:1993
kRegSarekSFPStatus
#define kRegSarekSFPStatus
Definition: ntv2registersmb.h:108
SAREK_3190_RX_DEPACKETIZER_4
#define SAREK_3190_RX_DEPACKETIZER_4
Definition: ntv2registers2110.h:36
SAREK_4175_TX_PACKETIZER_1
#define SAREK_4175_TX_PACKETIZER_1
Definition: ntv2registers2110.h:13
kRegPll_swptp_Domain
#define kRegPll_swptp_Domain
Definition: ntv2registersmb.h:445
CNTV2Config2110::GetIPServicesControl
bool GetIPServicesControl(bool &enable, bool &forceReconfig)
Definition: ntv2config2110.cpp:1427
kRegSarekMAC
#define kRegSarekMAC
Definition: ntv2registersmb.h:89
eIGMPVersion_t
eIGMPVersion_t
Definition: ntv2mbcontroller.h:56
NTV2_CHANNEL2
@ NTV2_CHANNEL2
Specifies channel or Frame Store 2 (or the 2nd item).
Definition: ntv2enums.h:1337
SAREK_REGS2
#define SAREK_REGS2
Definition: ntv2registersmb.h:58
kRegFramer_src_ip
#define kRegFramer_src_ip
Definition: ntv2registers2110.h:158
PLL_CONFIG_PTP
#define PLL_CONFIG_PTP
Definition: ntv2registersmb.h:43
tx_2110Config::localPort
uint32_t localPort[2]
Specifies the local (source) port number.
Definition: ntv2config2110.h:246
CNTV2MailBox::SetChannel
void SetChannel(ULWord channelOffset, ULWord channelNumber)
Definition: ntv2mailbox.cpp:251
CNTV2Config2110::GetIGMPDisable
bool GetIGMPDisable(const eSFP sfp, bool &disabled)
Definition: ntv2config2110.cpp:1459
CNTV2MailBox::mDevice
CNTV2Card & mDevice
Definition: ntv2mailbox.h:79
kReg3190_pkt_payload_type
#define kReg3190_pkt_payload_type
Definition: ntv2registers2110.h:117
CNTV2Config2110::SetPTPDomain
bool SetPTPDomain(const uint8_t domain)
Definition: ntv2config2110.cpp:1304
SAREK_4175_TX_PACKETIZER_RGB12_4
#define SAREK_4175_TX_PACKETIZER_RGB12_4
Definition: ntv2registers2110.h:21
kRegPll_swptp_MasterIdHi
#define kRegPll_swptp_MasterIdHi
Definition: ntv2registersmb.h:450
NTV2IpErrSFP2NotConfigured
@ NTV2IpErrSFP2NotConfigured
Definition: ntv2enums.h:4277
CNTV2Config2110::SetRxStreamEnable
bool SetRxStreamEnable(const eSFP sfp, const NTV2Stream stream, bool enable)
Definition: ntv2config2110.cpp:651
CNTV2MacDriverInterface::ReadRegister
virtual bool ReadRegister(const ULWord inRegNum, ULWord &outValue, const ULWord inMask=0xFFFFFFFF, const ULWord inShift=0)
Reads all or part of the 32-bit contents of a specific register (real or virtual) on the AJA device....
Definition: ntv2macdriverinterface.cpp:389
NTV2FormatDescriptor
Describes a video frame for a given video standard or format and pixel format, including the total nu...
Definition: ntv2formatdescriptor.h:41
CNTV2MBController::UnsetIGMPGroup
void UnsetIGMPGroup(eSFP port, NTV2Stream stream)
Definition: ntv2mbcontroller.cpp:395
RX_MATCH_2110_PAYLOAD
#define RX_MATCH_2110_PAYLOAD
Definition: ntv2registersmb.h:28
NTV2_FRAMERATE_1500
@ NTV2_FRAMERATE_1500
15 frames per second
Definition: ntv2enums.h:415
kReg4175_depkt_rx_byte_cnt
#define kReg4175_depkt_rx_byte_cnt
Definition: ntv2registers2110.h:98
NTV2_FRAMERATE_6000
@ NTV2_FRAMERATE_6000
60 frames per second
Definition: ntv2enums.h:402
kRegArb_video
#define kRegArb_video
Definition: ntv2registers2110.h:335
NULL
#define NULL
Definition: ntv2caption608types.h:19
kRegPll_swptp_MasterIdLo
#define kRegPll_swptp_MasterIdLo
Definition: ntv2registersmb.h:451
kRegFramer_control
#define kRegFramer_control
Definition: ntv2registers2110.h:139
NTV2_VIDEO_FORMAT_HAS_PROGRESSIVE_PICTURE
#define NTV2_VIDEO_FORMAT_HAS_PROGRESSIVE_PICTURE(__f__)
Definition: ntv2enums.h:1031
GetNTV2FrameGeometryFromVideoFormat
NTV2FrameGeometry GetNTV2FrameGeometryFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:2545
NTV2Channel
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
Definition: ntv2enums.h:1334
tx_2110Config::videoFormat
NTV2VideoFormat videoFormat
Definition: ntv2config2110.h:253
kRegDecap_match_udp_src_port
#define kRegDecap_match_udp_src_port
Definition: ntv2registers2110.h:175
aja::split
void split(const std::string &str, const char delim, std::vector< std::string > &elems)
Definition: common.cpp:350
rx_2110Config::videoSamples
VPIDSampling videoSamples
Definition: ntv2config2110.h:285
CNTV2Config2110::~CNTV2Config2110
~CNTV2Config2110()
Definition: ntv2config2110.cpp:161
CNTV2MBController::GetRemoteMAC
bool GetRemoteMAC(std::string remote_IPAddress, eSFP port, NTV2Stream stream, std::string &MACaddress)
Definition: ntv2mbcontroller.cpp:189
NTV2_FRAMERATE_2997
@ NTV2_FRAMERATE_2997
Fractional rate of 30,000 frames per 1,001 seconds.
Definition: ntv2enums.h:406
GetNTV2FrameRateFromVideoFormat
NTV2FrameRate GetNTV2FrameRateFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:3530
SAREK_PLL
#define SAREK_PLL
Definition: ntv2registersmb.h:57
ANC_STREAM
@ ANC_STREAM
Anc data.
Definition: ntv2enums.h:1412
kRegPll_swptp_GrandMasterIdLo
#define kRegPll_swptp_GrandMasterIdLo
Definition: ntv2registersmb.h:449
NTV2IpErrSDPEmpty
@ NTV2IpErrSDPEmpty
Definition: ntv2enums.h:4297
kRegSarekIGMPVersion
#define kRegSarekIGMPVersion
Definition: ntv2registersmb.h:82
SAREK_3190_TX_PACKETIZER_2
#define SAREK_3190_TX_PACKETIZER_2
Definition: ntv2registers2110.h:25
kRegDecap_match_src_ip
#define kRegDecap_match_src_ip
Definition: ntv2registers2110.h:173
systemtime.h
Declares the AJATime class.
tx_2110Config::ssrc
uint32_t ssrc
Definition: ntv2config2110.h:251
kReg3190_depkt_rx_pkt_count
#define kReg3190_depkt_rx_pkt_count
Definition: ntv2registers2110.h:131
CNTV2Config2110::videoDepacketizers
static uint32_t videoDepacketizers[4]
Definition: ntv2config2110.h:412
NTV2_FRAMERATE_12000
@ NTV2_FRAMERATE_12000
120 frames per second
Definition: ntv2enums.h:413
kRegFramer_udp_dst_port
#define kRegFramer_udp_dst_port
Definition: ntv2registers2110.h:161
kRegTxVideoDecode1
#define kRegTxVideoDecode1
Definition: ntv2registers2110.h:342
NTV2_AUDIO3_STREAM
@ NTV2_AUDIO3_STREAM
Definition: ntv2enums.h:1390
CNTV2Config2110::GetSDPUrl
std::string GetSDPUrl(const eSFP sfp, const NTV2Stream stream)
Definition: ntv2config2110.cpp:1833
kRegSarekSampling
#define kRegSarekSampling
Definition: ntv2registersmb.h:88
CNTV2MailBox::ReadChannelRegister
bool ReadChannelRegister(const ULWord inReg, ULWord &outValue, const ULWord inMask=0xFFFFFFFF, const ULWord inShift=0x0)
Definition: ntv2mailbox.cpp:237
DEVICE_ID_KONAIP_2110_RGB12
@ DEVICE_ID_KONAIP_2110_RGB12
See KONA IP.
Definition: ntv2enums.h:71
ntv2endian.h
Defines a number of handy byte-swapping macros.
kRegSarekIP1
#define kRegSarekIP1
Definition: ntv2registersmb.h:94
kRegSarekIP0
#define kRegSarekIP0
Definition: ntv2registersmb.h:93
SAREK_TX0_MASK
#define SAREK_TX0_MASK
Definition: ntv2registersmb.h:208
kRegFramer_ip_hdr_media
#define kRegFramer_ip_hdr_media
Definition: ntv2registers2110.h:156
CNTV2Config2110::GetRxStreamEnable
bool GetRxStreamEnable(const eSFP sfp, const NTV2Stream stream, bool &enabled)
Definition: ntv2config2110.cpp:716
tx_2110Config::payloadType
uint16_t payloadType
Definition: ntv2config2110.h:248
CNTV2MBController::GetLLDPInfo
bool GetLLDPInfo(std::string &chassisId0, std::string &portId0, std::string &chassisId1, std::string &portId1)
Definition: ntv2mbcontroller.cpp:848
kReg4175_depkt_control
#define kReg4175_depkt_control
Definition: ntv2registers2110.h:85
CNTV2Config2110::GetNTPTimestamp
uint64_t GetNTPTimestamp(void)
Definition: ntv2config2110.cpp:3403
NTV2FormatDescriptor::Is2KFormat
bool Is2KFormat(void) const
Definition: ntv2formatdescriptor.cpp:902
CNTV2Config2110::getLastErrorCode
NTV2IpError getLastErrorCode(void)
Definition: ntv2config2110.cpp:1707
PTPStatus::PTP_domain
uint8_t PTP_domain
Definition: ntv2mbcontroller.h:94
NTV2FormatDescriptor::GetRasterHeight
ULWord GetRasterHeight(const bool inVisibleOnly=false) const
Definition: ntv2formatdescriptor.h:176
kRegPll_swptp_LockedState
#define kRegPll_swptp_LockedState
Definition: ntv2registersmb.h:452
tx_2110Config::ttl
uint8_t ttl
Definition: ntv2config2110.h:250
kReg4175_pkt_height
#define kReg4175_pkt_height
Definition: ntv2registers2110.h:64
kRegPll_PTP_EventUdp
#define kRegPll_PTP_EventUdp
Definition: ntv2registersmb.h:405
SFP_2_NOT_PRESENT
#define SFP_2_NOT_PRESENT
Definition: ntv2registersmb.h:238
NTV2IpErrSDPInvalid
@ NTV2IpErrSDPInvalid
Definition: ntv2enums.h:4298
INVALID_STREAM
@ INVALID_STREAM
Definition: ntv2enums.h:1414
CNTV2Config2110::EnableDecapsulatorStream
void EnableDecapsulatorStream(const eSFP sfp, const NTV2Stream stream)
Definition: ntv2config2110.cpp:400
SAREK_4175_RX_DEPACKETIZER_2
#define SAREK_4175_RX_DEPACKETIZER_2
Definition: ntv2registers2110.h:29
SAREK_2110_AUDIO_ANC_FRAMER_1
#define SAREK_2110_AUDIO_ANC_FRAMER_1
Definition: ntv2registers2110.h:41
NTV2_IS_2K_1080_VIDEO_FORMAT
#define NTV2_IS_2K_1080_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:749
CNTV2Config2110::DisableDecapsulatorStream
void DisableDecapsulatorStream(const eSFP sfp, const NTV2Stream stream)
Definition: ntv2config2110.cpp:393
kReg4175_pkt_pix_per_pkt
#define kReg4175_pkt_pix_per_pkt
Definition: ntv2registers2110.h:75
kReg4175_pkt_interlace_ctrl
#define kReg4175_pkt_interlace_ctrl
Definition: ntv2registers2110.h:77
CNTV2Config2110::GetPTPDomain
bool GetPTPDomain(uint8_t &domain)
Definition: ntv2config2110.cpp:1310
kRegFramer_dest_mac_hi
#define kRegFramer_dest_mac_hi
Definition: ntv2registers2110.h:154
CNTV2Config2110::SetupDecapsulatorStream
void SetupDecapsulatorStream(const eSFP sfp, const NTV2Stream stream, const rx_2110Config &rxConfig)
Definition: ntv2config2110.cpp:332
PTPLockStatus
PTPLockStatus
Definition: ntv2mbcontroller.h:81
CNTV2Config2110::SetAudioCombineEnable
bool SetAudioCombineEnable(const bool enable)
Enables or disables the audio combiner.
Definition: ntv2config2110.cpp:1384
NTV2_CHANNEL1
@ NTV2_CHANNEL1
Specifies channel or Frame Store 1 (or the first item).
Definition: ntv2enums.h:1336
CNTV2Config2110::SetIGMPVersion
bool SetIGMPVersion(const eIGMPVersion_t version)
Definition: ntv2config2110.cpp:1476
SAREK_3190_RX_DEPACKETIZER_2
#define SAREK_3190_RX_DEPACKETIZER_2
Definition: ntv2registers2110.h:34
tx_2110Config::videoSamples
VPIDSampling videoSamples
Definition: ntv2config2110.h:254
kReg4175_pkt_payload_type
#define kReg4175_pkt_payload_type
Definition: ntv2registers2110.h:70
kReg4175_pkt_tx_pkt_cnt
#define kReg4175_pkt_tx_pkt_cnt
Definition: ntv2registers2110.h:73
rx_2110Config::destPort
uint32_t destPort
Specifies the destination (target) port number (if RX_MATCH_2110_DEST_PORT set)
Definition: ntv2config2110.h:280
kRegPll_PTP_Match
#define kRegPll_PTP_Match
Definition: ntv2registersmb.h:407
tx_2110Config::operator!=
bool operator!=(const tx_2110Config &other)
Definition: ntv2config2110.cpp:73
rx_2110Config::videoFormat
NTV2VideoFormat videoFormat
Definition: ntv2config2110.h:284
NTV2_FRAMERATE_2500
@ NTV2_FRAMERATE_2500
25 frames per second
Definition: ntv2enums.h:407
NTV2FrameRate
NTV2FrameRate
Identifies a particular video frame rate.
Definition: ntv2enums.h:399
CNTV2Config2110::SetVideoFormatForRxTx
void SetVideoFormatForRxTx(const NTV2Stream stream, const NTV2VideoFormat format, const bool rx)
Definition: ntv2config2110.cpp:509
NTV2_CHANNEL_INVALID
@ NTV2_CHANNEL_INVALID
Definition: ntv2enums.h:1345
NTV2IpErrNotSupported
@ NTV2IpErrNotSupported
Definition: ntv2enums.h:4280
NTV2_FRAMERATE_4800
@ NTV2_FRAMERATE_4800
48 frames per second
Definition: ntv2enums.h:411
NTV2_CHANNEL4
@ NTV2_CHANNEL4
Specifies channel or Frame Store 4 (or the 4th item).
Definition: ntv2enums.h:1339
SAREK_2110_VIDEO_FRAMER_0
#define SAREK_2110_VIDEO_FRAMER_0
Definition: ntv2registers2110.h:38
eIGMPVersion_3
@ eIGMPVersion_3
Definition: ntv2mbcontroller.h:59
rx_2110Config::sourcePort
uint32_t sourcePort
Specifies the source (sender) port number (if RX_MATCH_2110_SOURCE_PORT set)
Definition: ntv2config2110.h:279
NTV2_ANC1_STREAM
@ NTV2_ANC1_STREAM
Definition: ntv2enums.h:1392
NTV2_VIDEO4K_STREAM
@ NTV2_VIDEO4K_STREAM
Definition: ntv2enums.h:1396
NTV2_FRAMERATE_2400
@ NTV2_FRAMERATE_2400
24 frames per second
Definition: ntv2enums.h:408
VPIDSampling_YUV_422
@ VPIDSampling_YUV_422
Definition: ntv2enums.h:4043
kRegPll_PTP_LclMacLo
#define kRegPll_PTP_LclMacLo
Definition: ntv2registersmb.h:399
kRegFramer_udp_src_port
#define kRegFramer_udp_src_port
Definition: ntv2registers2110.h:160
CNTV2Config2110::GetLinkStatus
bool GetLinkStatus(eSFP port, SFPStatus &sfpStatus)
Definition: ntv2config2110.cpp:1677
CNTV2Config2110::GetArbiter
void GetArbiter(const eSFP sfp, const NTV2Stream stream, bool &enable)
Definition: ntv2config2110.cpp:3287
rx_2110Config::vlan
uint16_t vlan
Specifies the VLAN TCI (if RX_MATCH_2110_VLAN set)
Definition: ntv2config2110.h:282
PACKET_INTERVAL_1mS
@ PACKET_INTERVAL_1mS
Definition: ntv2mbcontroller.h:35
SFPStatus::SFP_present
bool SFP_present
Definition: ntv2mbcontroller.h:75
SFP_1
@ SFP_1
Definition: ntv2mbcontroller.h:40
CNTV2Config2110::GetDecapsulatorAddress
static uint32_t GetDecapsulatorAddress(eSFP sfp, NTV2Stream stream)
Definition: ntv2config2110.cpp:1508
VIDEO_STREAM
@ VIDEO_STREAM
Video data.
Definition: ntv2enums.h:1410
SFPStatus
Definition: ntv2mbcontroller.h:73
rx_2110Config::audioPktInterval
eNTV2PacketInterval audioPktInterval
Definition: ntv2config2110.h:287
SAREK_10G_EMAC_1
#define SAREK_10G_EMAC_1
Definition: ntv2registersmb.h:60
CNTV2Config2110::GenAncStreamSDP
bool GenAncStreamSDP(std::stringstream &sdp, const bool enableSfp1, const bool enableSfp2, const NTV2Stream stream, char *gmInfo)
Definition: ntv2config2110.cpp:2338
CNTV2Config2110::SetNetworkConfiguration
bool SetNetworkConfiguration(const eSFP sfp, const IPVNetConfig &netConfig)
Definition: ntv2config2110.cpp:165
CNTV2Config2110::GenAudioStreamSDPInfo
bool GenAudioStreamSDPInfo(std::stringstream &sdp, const eSFP sfp, const NTV2Stream stream, char *gmInfo)
Definition: ntv2config2110.cpp:2248
kRegPll_PTP_LclMacHi
#define kRegPll_PTP_LclMacHi
Definition: ntv2registersmb.h:400
CNTV2Config2110::GetIGMPVersion
bool GetIGMPVersion(eIGMPVersion_t &version)
Definition: ntv2config2110.cpp:1494
CNTV2Config2110::SetLLDPInfo
bool SetLLDPInfo(std::string sysname)
Definition: ntv2config2110.cpp:3392
nlohmann::json_abiNLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON_v3_11_NLOHMANN_JSON_VERSION_PATCH::detail2::begin
begin_tag begin(T &&...)
multiRx_2110Config
Definition: ntv2config2110.h:290
CNTV2Config2110::GetAudioCombineEnable
bool GetAudioCombineEnable(bool &enable)
Answers with the enable/disable state of the audio combiner.
Definition: ntv2config2110.cpp:1404
CNTV2MBController::DisableNetworkInterface
bool DisableNetworkInterface(eSFP port)
Definition: ntv2mbcontroller.cpp:99
SFP_2_RX_LOS
#define SFP_2_RX_LOS
Definition: ntv2registersmb.h:240
AJATime::Sleep
static void Sleep(const int32_t inMilliseconds)
Suspends execution of the current thread for a given number of milliseconds.
Definition: systemtime.cpp:284
kRegSarekNET0
#define kRegSarekNET0
Definition: ntv2registersmb.h:95
kRegDecap_match_ssrc
#define kRegDecap_match_ssrc
Definition: ntv2registers2110.h:178
CNTV2Config2110::SetTxStreamConfiguration
bool SetTxStreamConfiguration(const NTV2Stream stream, const tx_2110Config &txConfig)
Definition: ntv2config2110.cpp:857
NTV2Standard
NTV2Standard
Identifies a particular video standard.
Definition: ntv2enums.h:156
NTV2IpErrInvalidChannel
@ NTV2IpErrInvalidChannel
Definition: ntv2enums.h:4268
rx_2110Config::payloadType
uint16_t payloadType
Definition: ntv2config2110.h:283
CNTV2MBController::SetIGMPVersion
bool SetIGMPVersion(uint32_t version)
Definition: ntv2mbcontroller.cpp:149
SFP_1_TX_FAULT
#define SFP_1_TX_FAULT
Definition: ntv2registersmb.h:236
CNTV2Config2110::videoPacketizers
static uint32_t videoPacketizers[4]
Definition: ntv2config2110.h:408
NTV2_FRAMERATE_2398
@ NTV2_FRAMERATE_2398
Fractional rate of 24,000 frames per 1,001 seconds.
Definition: ntv2enums.h:409
PTPStatus::PTP_LockedState
PTPLockStatus PTP_LockedState
Definition: ntv2mbcontroller.h:95
NTV2_ANC4_STREAM
@ NTV2_ANC4_STREAM
Definition: ntv2enums.h:1395
NTV2IpErrNone
@ NTV2IpErrNone
Definition: ntv2enums.h:4267
CNTV2Config2110::GetTxPacketCount
bool GetTxPacketCount(NTV2Stream stream, uint32_t &packets)
Definition: ntv2config2110.cpp:805
kReg4175_pkt_vid_fmt
#define kReg4175_pkt_vid_fmt
Definition: ntv2registers2110.h:65
kReg3190_depkt_enable
#define kReg3190_depkt_enable
Definition: ntv2registers2110.h:129
tx_2110Config::remoteIP
std::string remoteIP[2]
Specifies remote (destination) IP address.
Definition: ntv2config2110.h:245
CNTV2Config2110::SetFramerStream
bool SetFramerStream(const eSFP sfp, const NTV2Stream stream, const tx_2110Config &txConfig)
Definition: ntv2config2110.cpp:1051
CNTV2MBController::GetSFPActive
bool GetSFPActive(eSFP sfp)
Definition: ntv2mbcontroller.cpp:589
NTV2EndianSwap32
#define NTV2EndianSwap32(__val__)
Definition: ntv2endian.h:19
SAREK_3190_TX_PACKETIZER_0
#define SAREK_3190_TX_PACKETIZER_0
Definition: ntv2registers2110.h:23
kRegRxVideoDecode1
#define kRegRxVideoDecode1
Definition: ntv2registers2110.h:338
NTV2_FRAMERATE_1498
@ NTV2_FRAMERATE_1498
Fractional rate of 15,000 frames per 1,001 seconds.
Definition: ntv2enums.h:416
CNTV2Config2110::GetPacketizerAddress
uint32_t GetPacketizerAddress(const NTV2Stream stream, const VPIDSampling sampling)
Definition: ntv2config2110.cpp:1603
CNTV2Config2110::GetRxPacketCount
bool GetRxPacketCount(const NTV2Stream stream, uint32_t &packets)
Definition: ntv2config2110.cpp:746
LINK_B_UP
#define LINK_B_UP
Definition: ntv2registersmb.h:243
CNTV2Config2110::Get2110TxStreamIndex
static uint32_t Get2110TxStreamIndex(NTV2Stream stream)
Definition: ntv2config2110.cpp:1733
SAREK_RX1_MASK
#define SAREK_RX1_MASK
Definition: ntv2registersmb.h:211
kRegDecap_chan_enable
#define kRegDecap_chan_enable
Definition: ntv2registers2110.h:171
SAREK_TX1_MASK
#define SAREK_TX1_MASK
Definition: ntv2registersmb.h:210
rx_2110Config::numAudioChannels
uint32_t numAudioChannels
Definition: ntv2config2110.h:286
kRegSarekServices
#define kRegSarekServices
Definition: ntv2registersmb.h:87
kReg4175_pkt_payload_len
#define kReg4175_pkt_payload_len
Definition: ntv2registers2110.h:67
rx_2110Config::operator==
bool operator==(const rx_2110Config &other)
Definition: ntv2config2110.cpp:118
ntv2card.h
Declares the CNTV2Card class.
kRegFramer_src_mac_hi
#define kRegFramer_src_mac_hi
Definition: ntv2registers2110.h:145
CNTV2Card::AncInsertSetIPParams
virtual bool AncInsertSetIPParams(const UWord inSDIOutput, const UWord ancChannel, const ULWord payloadID, const ULWord ssrc)
Configures the Anc inserter IP specific params.
Definition: ntv2anc.cpp:498
tx_2110Config::init
void init()
Definition: ntv2config2110.cpp:54
CNTV2Config2110::SelectTxFramerChannel
void SelectTxFramerChannel(const NTV2Stream stream, const uint32_t baseAddr)
Definition: ntv2config2110.cpp:1596
CNTV2MailBox::WriteChannelRegister
bool WriteChannelRegister(ULWord reg, ULWord value, ULWord mask=0xFFFFFFFF, ULWord shift=0x0)
Definition: ntv2mailbox.cpp:246
kRegDecap_match_sel
#define kRegDecap_match_sel
Definition: ntv2registers2110.h:179
kRegDecap_match_dst_ip
#define kRegDecap_match_dst_ip
Definition: ntv2registers2110.h:174
SAREK_REGS
#define SAREK_REGS
Definition: ntv2registersmb.h:54
CNTV2Config2110::EnableDepacketizerStream
void EnableDepacketizerStream(const NTV2Stream stream)
Definition: ntv2config2110.cpp:379
kRegPll_swptp_GrandMasterIdHi
#define kRegPll_swptp_GrandMasterIdHi
Definition: ntv2registersmb.h:448
NTV2_AUDIO2_STREAM
@ NTV2_AUDIO2_STREAM
Definition: ntv2enums.h:1389
kReg3190_pkt_num_audio_channels
#define kReg3190_pkt_num_audio_channels
Definition: ntv2registers2110.h:114
NTV2_CHANNEL3
@ NTV2_CHANNEL3
Specifies channel or Frame Store 3 (or the 3rd item).
Definition: ntv2enums.h:1338
kReg4175_depkt_rx_pkt_cnt
#define kReg4175_depkt_rx_pkt_cnt
Definition: ntv2registers2110.h:97
CNTV2Config2110::GetRxByteCount
bool GetRxByteCount(const NTV2Stream stream, uint32_t &bytes)
Definition: ntv2config2110.cpp:768
kSarekRegIGMPDisable
#define kSarekRegIGMPDisable
Definition: ntv2registersmb.h:103
CNTV2Config2110::GetTxStreamEnable
bool GetTxStreamEnable(const NTV2Stream stream, bool &sfp1Enabled, bool &sfp2Enabled)
Definition: ntv2config2110.cpp:1272
kRegSarekRxReset
#define kRegSarekRxReset
Definition: ntv2registersmb.h:76
NTV2IpErrInvalidIGMPVersion
@ NTV2IpErrInvalidIGMPVersion
Definition: ntv2enums.h:4278
kReg3190_depkt_config
#define kReg3190_depkt_config
Definition: ntv2registers2110.h:130
SFP_1_NOT_PRESENT
#define SFP_1_NOT_PRESENT
Definition: ntv2registersmb.h:235
CNTV2Config2110::SetupDepacketizerStream
void SetupDepacketizerStream(const NTV2Stream stream, const rx_2110Config &rxConfig)
Definition: ntv2config2110.cpp:487
CNTV2MBController::SetLLDPInfo
bool SetLLDPInfo(std::string sysname)
Definition: ntv2mbcontroller.cpp:913
ntv2utils.h
Declares numerous NTV2 utility functions.
SFPMSAData
Definition: ntv2mbcontroller.h:68
rx_2110Config::sourceIP
std::string sourceIP
Specifies the source (sender) IP address (if RX_MATCH_2110_SOURCE_IP set). If it's in the multiclass ...
Definition: ntv2config2110.h:276
tx_2110Config::channel
NTV2Channel channel
Definition: ntv2config2110.h:252
NTV2_AUDIO1_STREAM
@ NTV2_AUDIO1_STREAM
Definition: ntv2enums.h:1388
CNTV2Config2110::GetActualSDP
bool GetActualSDP(std::string url, std::string &sdp)
Definition: ntv2config2110.cpp:2466
CNTV2Config2110::GenSDP
bool GenSDP(bool enableSfp1, bool enableSfp2, const NTV2Stream stream, bool pushit=(!(0)))
Definition: ntv2config2110.cpp:1877
CNTV2Card
I interrogate and control an AJA video/audio capture/playout device.
Definition: ntv2card.h:28
CNTV2Config2110::GetMACAddress
bool GetMACAddress(const eSFP port, const NTV2Stream stream, std::string remoteIP, uint32_t &hi, uint32_t &lo)
Definition: ntv2config2110.cpp:1764
CNTV2Config2110::ExtractRxAudioConfigFromSDP
bool ExtractRxAudioConfigFromSDP(std::string sdp, rx_2110Config &rxConfig)
Definition: ntv2config2110.cpp:2877
CNTV2Config2110::GetTxByteCount
bool GetTxByteCount(const eSFP sfp, uint64_t &bytes)
Definition: ntv2config2110.cpp:824
NTV2IpErrNotReady
@ NTV2IpErrNotReady
Definition: ntv2enums.h:4274
CNTV2Config2110::GetDepacketizerAddress
uint32_t GetDepacketizerAddress(const NTV2Stream stream)
Definition: ntv2config2110.cpp:1561
kSarekRegIGMPDisable2
#define kSarekRegIGMPDisable2
Definition: ntv2registersmb.h:104
kReg4175_pkt_payload_len_last
#define kReg4175_pkt_payload_len_last
Definition: ntv2registers2110.h:68
kRegPll_swptp_PreferredGmIdLo
#define kRegPll_swptp_PreferredGmIdLo
Definition: ntv2registersmb.h:447
CNTV2Config2110::videoRGB12Packetizers
static uint32_t videoRGB12Packetizers[4]
Definition: ntv2config2110.h:409
kRegFramer_dest_mac_lo
#define kRegFramer_dest_mac_lo
Definition: ntv2registers2110.h:153
kReg10gemac_rx_bytes_lo
#define kReg10gemac_rx_bytes_lo
Definition: ntv2registersmb.h:252
CNTV2DriverInterface::IsMBSystemValid
virtual bool IsMBSystemValid(void)
Definition: ntv2driverinterface.cpp:1326
VPIDSampling
VPIDSampling
Definition: ntv2enums.h:4041
kVRegSwizzle4kOutput
@ kVRegSwizzle4kOutput
Definition: ntv2virtualregisters.h:484
NTV2_FRAMERATE_11988
@ NTV2_FRAMERATE_11988
Fractional rate of 120,000 frames per 1,001 seconds.
Definition: ntv2enums.h:414
CNTV2Config2110::VideoStreamToChannel
NTV2Channel VideoStreamToChannel(const NTV2Stream stream)
Definition: ntv2config2110.cpp:2451
CNTV2Config2110::AcquireFramerControlAccess
void AcquireFramerControlAccess(const uint32_t baseAddr)
Definition: ntv2config2110.cpp:1714
CNTV2Config2110::GetGeneratedSDP
std::string GetGeneratedSDP(bool enabledSfp1, bool enabledSfp2, const NTV2Stream stream)
Definition: ntv2config2110.cpp:1864
tx_2110Config::firstAudioChannel
uint8_t firstAudioChannel
Definition: ntv2config2110.h:256
NTV2_VIDEO4_STREAM
@ NTV2_VIDEO4_STREAM
Definition: ntv2enums.h:1387
rx_2110Config::rxMatch
uint32_t rxMatch
Bitmap of rxMatch criteria used.
Definition: ntv2config2110.h:275
SAREK_2110_VIDEO_FRAMER_1
#define SAREK_2110_VIDEO_FRAMER_1
Definition: ntv2registers2110.h:40
NTV2_IS_PSF_VIDEO_FORMAT
#define NTV2_IS_PSF_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:998
CNTV2MBController::GetSDP
bool GetSDP(std::string url, std::string &sdp)
Definition: ntv2mbcontroller.cpp:725
CNTV2MailBox::mIpErrorCode
NTV2IpError mIpErrorCode
Definition: ntv2mailbox.h:81
SAREK_RX0_MASK
#define SAREK_RX0_MASK
Definition: ntv2registersmb.h:209
NTV2Stream
NTV2Stream
Identifies a specific IP-based data stream.
Definition: ntv2enums.h:1382
kRegTxAncSSRC1
#define kRegTxAncSSRC1
Definition: ntv2registers2110.h:347
CNTV2Config2110::EnableFramerStream
void EnableFramerStream(const eSFP sfp, const NTV2Stream stream, bool enable)
Definition: ntv2config2110.cpp:1231
CNTV2MBController::GetNTPTimestamp
uint64_t GetNTPTimestamp()
Definition: ntv2mbcontroller.cpp:654
kRegFramer_src_mac_lo
#define kRegFramer_src_mac_lo
Definition: ntv2registers2110.h:144
NTV2IpErrSoftwareMismatch
@ NTV2IpErrSoftwareMismatch
Definition: ntv2enums.h:4275
PACKET_INTERVAL_125uS
@ PACKET_INTERVAL_125uS
Definition: ntv2mbcontroller.h:34
CNTV2MBController::PushSDP
bool PushSDP(std::string filename, std::stringstream &sdpstream)
Definition: ntv2mbcontroller.cpp:667
SFPStatus::SFP_txFault
bool SFP_txFault
Definition: ntv2mbcontroller.h:77
SAREK_3190_RX_DEPACKETIZER_3
#define SAREK_3190_RX_DEPACKETIZER_3
Definition: ntv2registers2110.h:35
CNTV2Config2110::SetIGMPDisable
bool SetIGMPDisable(const eSFP sfp, const bool disable)
Disables the automatic (default) joining of multicast groups using IGMP, based on remote IP address f...
Definition: ntv2config2110.cpp:1445
kReg3190_pkt_ssrc
#define kReg3190_pkt_ssrc
Definition: ntv2registers2110.h:118
CNTV2Config2110::GetLLDPInfo
bool GetLLDPInfo(std::string &chassisId0, std::string &portId0, std::string &chassisId1, std::string &portId1)
Definition: ntv2config2110.cpp:3397
CNTV2Config2110::GetPTPPreferredGrandMasterId
bool GetPTPPreferredGrandMasterId(uint8_t(&id)[8])
Definition: ntv2config2110.cpp:1288
NTV2_FORMAT_UNKNOWN
@ NTV2_FORMAT_UNKNOWN
Definition: ntv2enums.h:521
kReg4175_pkt_width
#define kReg4175_pkt_width
Definition: ntv2registers2110.h:63
CNTV2Config2110::GetFramerStream
void GetFramerStream(const eSFP sfp, const NTV2Stream stream, tx_2110Config &txConfig)
Definition: ntv2config2110.cpp:1158
kRegPll_PTP_LclIP
#define kRegPll_PTP_LclIP
Definition: ntv2registersmb.h:401
NTV2StreamType
NTV2StreamType
Identifies the kind of data that can be carried by an IP-based data stream.
Definition: ntv2enums.h:1408
CNTV2Config2110::SetSampling
void SetSampling(const eSFP sfp, const NTV2Stream stream, const VPIDSampling sampling)
Definition: ntv2config2110.cpp:3310
NTV2_FBF_10BIT_YCBCR
@ NTV2_FBF_10BIT_YCBCR
See 10-Bit YCbCr Format.
Definition: ntv2enums.h:213
VIDEO_4K_STREAM
@ VIDEO_4K_STREAM
4K Video stream using 4 streams
Definition: ntv2enums.h:1413
kRegPll_Config
#define kRegPll_Config
Definition: ntv2registersmb.h:378
tx_2110Config::numAudioChannels
uint8_t numAudioChannels
Definition: ntv2config2110.h:255
rx_2110Config
Configures a SMPTE 2110 Receive Channel.
Definition: ntv2config2110.h:264
CNTV2MBController::GetSFPInfo
bool GetSFPInfo(eSFP port, SFPMSAData &sfpdata)
Definition: ntv2mbcontroller.cpp:785
tx_2110Config
Configures a SMPTE 2110 Transmit Channel.
Definition: ntv2config2110.h:234
kReg10gemac_rx_bytes_hi
#define kReg10gemac_rx_bytes_hi
Definition: ntv2registersmb.h:253
PTPStatus
Definition: ntv2mbcontroller.h:90
CNTV2Config2110::StreamType
NTV2StreamType StreamType(const NTV2Stream stream)
Definition: ntv2config2110.cpp:2415
SFP_2
@ SFP_2
Definition: ntv2mbcontroller.h:41
CNTV2Config2110::ResetDepacketizerStream
void ResetDepacketizerStream(const NTV2Stream stream)
Definition: ntv2config2110.cpp:447
CNTV2MBController
Definition: ntv2mbcontroller.h:128
SAREK_3190_RX_DEPACKETIZER_1
#define SAREK_3190_RX_DEPACKETIZER_1
Definition: ntv2registers2110.h:33
NTV2_FRAMERATE_5994
@ NTV2_FRAMERATE_5994
Fractional rate of 60,000 frames per 1,001 seconds.
Definition: ntv2enums.h:404
RX_MATCH_2110_DEST_IP
#define RX_MATCH_2110_DEST_IP
Definition: ntv2registersmb.h:25
SFP_1_RX_LOS
#define SFP_1_RX_LOS
Definition: ntv2registersmb.h:237
CNTV2Config2110::ReleaseFramerControlAccess
void ReleaseFramerControlAccess(const uint32_t baseAddr)
Definition: ntv2config2110.cpp:1728
CNTV2Config2110::SetTxStreamEnable
bool SetTxStreamEnable(const NTV2Stream stream, bool enableSfp1, bool enableSfp2=(0))
Definition: ntv2config2110.cpp:1187
kRegDecap_match_payload
#define kRegDecap_match_payload
Definition: ntv2registers2110.h:177
NTV2_VIDEO2_STREAM
@ NTV2_VIDEO2_STREAM
Definition: ntv2enums.h:1385
CNTV2MBController::SetTxFormat
bool SetTxFormat(NTV2Channel chan, NTV2VideoFormat fmt)
Definition: ntv2mbcontroller.cpp:631
CNTV2Config2110::CNTV2Config2110
CNTV2Config2110(CNTV2Card &device)
Definition: ntv2config2110.cpp:146
tx_2110Config::audioPktInterval
eNTV2PacketInterval audioPktInterval
Definition: ntv2config2110.h:257
IPVNetConfig::ipc_subnet
uint32_t ipc_subnet
Definition: ntv2mbcontroller.h:124
CNTV2Config2110::SetPTPPreferredGrandMasterId
bool SetPTPPreferredGrandMasterId(const uint8_t id[8])
Definition: ntv2config2110.cpp:1279
kRegPll_PTP_MstrIP
#define kRegPll_PTP_MstrIP
Definition: ntv2registersmb.h:403
SFPStatus::SFP_linkUp
bool SFP_linkUp
Definition: ntv2mbcontroller.h:78
kRegSarekGATE0
#define kRegSarekGATE0
Definition: ntv2registersmb.h:97
kRegFramer_status
#define kRegFramer_status
Definition: ntv2registers2110.h:140
NTV2_VIDEO1_STREAM
@ NTV2_VIDEO1_STREAM
Definition: ntv2enums.h:1384
rx_2110Config::init
void init()
Definition: ntv2config2110.cpp:97
CNTV2Config2110::ExtractRxAncConfigFromSDP
bool ExtractRxAncConfigFromSDP(std::string sdp, rx_2110Config &rxConfig)
Definition: ntv2config2110.cpp:3037
CNTV2Config2110::SetArbiter
void SetArbiter(const eSFP sfp, const NTV2Stream stream, bool enable)
Definition: ntv2config2110.cpp:3259
GetFirstMatchingVideoFormat
NTV2VideoFormat GetFirstMatchingVideoFormat(const NTV2FrameRate inFrameRate, const UWord inHeightLines, const UWord inWidthPixels, const bool inIsInterlaced, const bool inIsLevelB, const bool inIsPSF)
Definition: ntv2utils.cpp:1825
CNTV2Config2110::GetSampling
VPIDSampling GetSampling(const eSFP sfp, const NTV2Stream stream)
Definition: ntv2config2110.cpp:3355
kReg10gemac_tx_bytes_hi
#define kReg10gemac_tx_bytes_hi
Definition: ntv2registersmb.h:255
CNTV2Config2110::DisableDepacketizerStream
void DisableDepacketizerStream(const NTV2Stream stream)
Definition: ntv2config2110.cpp:365
kRegTxAncPayload1
#define kRegTxAncPayload1
Definition: ntv2registers2110.h:351
std
Definition: json.hpp:5362
MACAddr
Definition: ntv2mbcontroller.h:63
tx_2110Config::operator==
bool operator==(const tx_2110Config &other)
Definition: ntv2config2110.cpp:78
RESET_MILLISECONDS
#define RESET_MILLISECONDS
Definition: ntv2config2110.cpp:25
CNTV2Config2110::GetTxStreamConfiguration
bool GetTxStreamConfiguration(const NTV2Stream stream, tx_2110Config &txConfig)
Definition: ntv2config2110.cpp:1094
SAREK_2110_DECAPSULATOR_0
#define SAREK_2110_DECAPSULATOR_0
Definition: ntv2registers2110.h:43
NTV2IpError
NTV2IpError
Definition: ntv2enums.h:4265
NTV2_FRAMERATE_UNKNOWN
@ NTV2_FRAMERATE_UNKNOWN
Represents an unknown or invalid frame rate.
Definition: ntv2enums.h:401
IPVNetConfig
Definition: ntv2mbcontroller.h:113
NTV2IpErrSDPNoAudio
@ NTV2IpErrSDPNoAudio
Definition: ntv2enums.h:4301
NTV2VideoFormat
enum _NTV2VideoFormat NTV2VideoFormat
Identifies a particular video format.
RX_MATCH_2110_DEST_PORT
#define RX_MATCH_2110_DEST_PORT
Definition: ntv2registersmb.h:27
SAREK_10G_EMAC_0
#define SAREK_10G_EMAC_0
Definition: ntv2registersmb.h:59
ntv2config2110.h
Declares the CNTV2Config2110 class.
RX_MATCH_2110_SOURCE_IP
#define RX_MATCH_2110_SOURCE_IP
Definition: ntv2registersmb.h:24
kReg3190_pkt_num_samples
#define kReg3190_pkt_num_samples
Definition: ntv2registers2110.h:113
VPIDSampling_GBR_444
@ VPIDSampling_GBR_444
Definition: ntv2enums.h:4045
SFP_2_TX_FAULT
#define SFP_2_TX_FAULT
Definition: ntv2registersmb.h:239
NTV2_ANC3_STREAM
@ NTV2_ANC3_STREAM
Definition: ntv2enums.h:1394
NTV2IpErrSDPNoVideo
@ NTV2IpErrSDPNoVideo
Definition: ntv2enums.h:4300
SAREK_2110_TX_ARBITRATOR
#define SAREK_2110_TX_ARBITRATOR
Definition: ntv2registers2110.h:42
NTV2FrameGeometry
NTV2FrameGeometry
Identifies a particular video frame geometry.
Definition: ntv2enums.h:339
CNTV2Config2110::audioPacketizers
static uint32_t audioPacketizers[4]
Definition: ntv2config2110.h:410
SAREK_2110_AUDIO_STREAMSELECT
#define SAREK_2110_AUDIO_STREAMSELECT
Definition: ntv2registers2110.h:48
kReg4175_pkt_pkts_per_line
#define kReg4175_pkt_pkts_per_line
Definition: ntv2registers2110.h:66
SAREK_4175_TX_PACKETIZER_4
#define SAREK_4175_TX_PACKETIZER_4
Definition: ntv2registers2110.h:16
CNTV2Config2110::Set4KModeEnable
bool Set4KModeEnable(const bool enable)
Definition: ntv2config2110.cpp:1355
CNTV2DriverInterface::GetDeviceID
virtual NTV2DeviceID GetDeviceID(void)
Definition: ntv2driverinterface.cpp:407
kReg4175_pkt_ctrl
#define kReg4175_pkt_ctrl
Definition: ntv2registers2110.h:62
CNTV2MBController::GetTxFormat
bool GetTxFormat(NTV2Channel chan, NTV2VideoFormat &fmt)
Definition: ntv2mbcontroller.cpp:642
CNTV2Config2110::GenVideoStreamSDP
bool GenVideoStreamSDP(std::stringstream &sdp, const bool enableSfp1, const bool enableSfp2, const NTV2Stream stream, char *gmInfo)
Definition: ntv2config2110.cpp:1972
kRegDecap_match_udp_dst_port
#define kRegDecap_match_udp_dst_port
Definition: ntv2registers2110.h:176
kRegSarekLinkStatus
#define kRegSarekLinkStatus
Definition: ntv2registersmb.h:86
CNTV2Config2110::GenAncStreamSDPInfo
bool GenAncStreamSDPInfo(std::stringstream &sdp, const eSFP sfp, const NTV2Stream stream, char *gmInfo)
Definition: ntv2config2110.cpp:2359
NTV2_ANC2_STREAM
@ NTV2_ANC2_STREAM
Definition: ntv2enums.h:1393
kReg3190_pkt_chan_num
#define kReg3190_pkt_chan_num
Definition: ntv2registers2110.h:116
CNTV2MBController::SetMBNetworkConfiguration
bool SetMBNetworkConfiguration(eSFP port, std::string ipaddr, std::string netmask, std::string gateway)
Definition: ntv2mbcontroller.cpp:49
CNTV2Config2110::DisableNetworkInterface
bool DisableNetworkInterface(const eSFP sfp)
Definition: ntv2config2110.cpp:294
CNTV2Config2110::GenAudioStreamSDP
bool GenAudioStreamSDP(std::stringstream &sdp, const bool enableSfp1, const bool enableSfp2, const NTV2Stream stream, char *gmInfo)
Definition: ntv2config2110.cpp:2227
CNTV2MBController::EnableIGMPGroup
void EnableIGMPGroup(eSFP port, NTV2Stream stream, bool enable)
Definition: ntv2mbcontroller.cpp:405
CNTV2Config2110::getLastError
std::string getLastError(void)
Definition: ntv2config2110.cpp:1702
CNTV2Config2110::GenVideoStreamMultiSDPInfo
bool GenVideoStreamMultiSDPInfo(std::stringstream &sdp, char *gmInfo)
Definition: ntv2config2110.cpp:2096
MACAddr::mac
uint8_t mac[6]
Definition: ntv2mbcontroller.h:65
tx_2110Config::remotePort
uint32_t remotePort[2]
Specifies the remote (destination) port number.
Definition: ntv2config2110.h:247
CNTV2Config2110::audioDepacketizers
static uint32_t audioDepacketizers[4]
Definition: ntv2config2110.h:413
NTV2IpErrSFP1NotConfigured
@ NTV2IpErrSFP1NotConfigured
Definition: ntv2enums.h:4276
kRegPll_PTP_MstrMcast
#define kRegPll_PTP_MstrMcast
Definition: ntv2registersmb.h:404
NTV2_FRAMERATE_5000
@ NTV2_FRAMERATE_5000
50 frames per second
Definition: ntv2enums.h:410
NTV2_IS_720P_VIDEO_FORMAT
#define NTV2_IS_720P_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:735
CNTV2Config2110::SetRxStreamConfiguration
bool SetRxStreamConfiguration(const eSFP sfp, const NTV2Stream stream, const rx_2110Config &rxConfig)
Definition: ntv2config2110.cpp:299
SAREK_4175_TX_PACKETIZER_RGB12_2
#define SAREK_4175_TX_PACKETIZER_RGB12_2
Definition: ntv2registers2110.h:19
SAREK_4175_TX_PACKETIZER_2
#define SAREK_4175_TX_PACKETIZER_2
Definition: ntv2registers2110.h:14
SAREK_4175_RX_DEPACKETIZER_1
#define SAREK_4175_RX_DEPACKETIZER_1
Definition: ntv2registers2110.h:28
NTV2_FRAMERATE_4795
@ NTV2_FRAMERATE_4795
Fractional rate of 48,000 frames per 1,001 seconds.
Definition: ntv2enums.h:412
kRegPll_swptp_PreferredGmIdHi
#define kRegPll_swptp_PreferredGmIdHi
Definition: ntv2registersmb.h:446
kRegFramer_chan_ctrl
#define kRegFramer_chan_ctrl
Definition: ntv2registers2110.h:152
NTV2_FRAMERATE_3000
@ NTV2_FRAMERATE_3000
30 frames per second
Definition: ntv2enums.h:405
kRegFramer_channel_access
#define kRegFramer_channel_access
Definition: ntv2registers2110.h:141
PTPStatus::PTP_masterId
uint8_t PTP_masterId[8]
Definition: ntv2mbcontroller.h:93
SAREK_3190_TX_PACKETIZER_3
#define SAREK_3190_TX_PACKETIZER_3
Definition: ntv2registers2110.h:26
LINK_A_UP
#define LINK_A_UP
Definition: ntv2registersmb.h:242
BIT
#define BIT(_x_)
Definition: ajatypes.h:563
CNTV2Config2110::GetPTPStatus
bool GetPTPStatus(PTPStatus &ptpStatus)
Definition: ntv2config2110.cpp:1318
DEVICE_ID_IOIP_2110_RGB12
@ DEVICE_ID_IOIP_2110_RGB12
See Io IP.
Definition: ntv2enums.h:40
NTV2IpErrorEnumToString
std::string NTV2IpErrorEnumToString(const NTV2IpError inIpErrorEnumValue)
Definition: ntv2utils.cpp:7393
multiRx_2110Config::rx2110Config
rx_2110Config rx2110Config[4]
Definition: ntv2config2110.h:292
kReg10gemac_tx_bytes_lo
#define kReg10gemac_tx_bytes_lo
Definition: ntv2registersmb.h:254
SAREK_2110_AUDIO_ANC_FRAMER_0
#define SAREK_2110_AUDIO_ANC_FRAMER_0
Definition: ntv2registers2110.h:39
CNTV2Config2110::ConfigurePTP
bool ConfigurePTP(const eSFP sfp, const std::string localIPAddress)
Definition: ntv2config2110.cpp:1630
CNTV2Config2110::GetSFPMSAData
bool GetSFPMSAData(eSFP port, SFPMSAData &data)
Definition: ntv2config2110.cpp:1672
rx_2110Config::destIP
std::string destIP
Specifies the destination (target) IP address (if RX_MATCH_2110_DEST_IP set)
Definition: ntv2config2110.h:278
IPVNetConfig::ipc_gateway
uint32_t ipc_gateway
Definition: ntv2mbcontroller.h:125
CNTV2Config2110::GetVideoFormatForRxTx
void GetVideoFormatForRxTx(const NTV2Stream stream, NTV2VideoFormat &format, uint32_t &hwFormat, const bool rx)
Definition: ntv2config2110.cpp:548
CNTV2MacDriverInterface::WriteRegister
virtual bool WriteRegister(const ULWord inRegNum, const ULWord inValue, const ULWord inMask=0xFFFFFFFF, const ULWord inShift=0)
Updates or replaces all or part of the 32-bit contents of a specific register (real or virtual) on th...
Definition: ntv2macdriverinterface.cpp:430
eIGMPVersion_2
@ eIGMPVersion_2
Definition: ntv2mbcontroller.h:58
NTV2_VIDEO3_STREAM
@ NTV2_VIDEO3_STREAM
Definition: ntv2enums.h:1386
tx_2110Config::tos
uint8_t tos
Definition: ntv2config2110.h:249
kRegSarekGATE1
#define kRegSarekGATE1
Definition: ntv2registersmb.h:98
CNTV2DriverInterface::IsMBSystemReady
virtual bool IsMBSystemReady(void)
Definition: ntv2driverinterface.cpp:1337
CNTV2Config2110::GetFramerAddress
uint32_t GetFramerAddress(const eSFP sfp, const NTV2Stream stream)
Definition: ntv2config2110.cpp:1578
PTPStatus::PTP_gmId
uint8_t PTP_gmId[8]
Definition: ntv2mbcontroller.h:92
CNTV2Config2110::GetRxStreamConfiguration
bool GetRxStreamConfiguration(const eSFP sfp, const NTV2Stream stream, rx_2110Config &rxConfig)
Definition: ntv2config2110.cpp:572
SAREK_4175_TX_PACKETIZER_3
#define SAREK_4175_TX_PACKETIZER_3
Definition: ntv2registers2110.h:15
SAREK_4175_TX_PACKETIZER_RGB12_3
#define SAREK_4175_TX_PACKETIZER_RGB12_3
Definition: ntv2registers2110.h:20
CNTV2Config2110::SetIPServicesControl
bool SetIPServicesControl(const bool enable, const bool forceReconfig)
Definition: ntv2config2110.cpp:1413
kRegFramer_dst_ip
#define kRegFramer_dst_ip
Definition: ntv2registers2110.h:159
NTV2_AUDIO4_STREAM
@ NTV2_AUDIO4_STREAM
Definition: ntv2enums.h:1391
kRegArb_4KMode
#define kRegArb_4KMode
Definition: ntv2registers2110.h:337
kReg3190_pkt_payload_len
#define kReg3190_pkt_payload_len
Definition: ntv2registers2110.h:115
SAREK_3190_TX_PACKETIZER_1
#define SAREK_3190_TX_PACKETIZER_1
Definition: ntv2registers2110.h:24
kRegSarekNET1
#define kRegSarekNET1
Definition: ntv2registersmb.h:96
PLL_CONFIG_DCO_MODE
#define PLL_CONFIG_DCO_MODE
Definition: ntv2registersmb.h:45
SAREK_4175_TX_PACKETIZER_RGB12_1
#define SAREK_4175_TX_PACKETIZER_RGB12_1
Definition: ntv2registers2110.h:18
CNTV2Config2110::GetNetworkConfiguration
bool GetNetworkConfiguration(const eSFP sfp, IPVNetConfig &netConfig)
Definition: ntv2config2110.cpp:180
AUDIO_STREAM
@ AUDIO_STREAM
Audio data.
Definition: ntv2enums.h:1411