CVB++ 15.0
Loading...
Searching...
No Matches
detail_gendc_descriptor.hpp
1#pragma once
2
3#include "../_decl/decl_gendc_descriptor.hpp"
4#include "../../_cexports/c_driver.h"
5
6#include "../../global.hpp"
7#include "../../composite.hpp"
8#include "../../utilities/system_info.hpp"
9
10#include <numeric>
11
12namespace Cvb
13{
14
15 CVB_BEGIN_INLINE_NS
16
17 namespace Driver
18 {
19 namespace Detail
20 {
21 template <typename T>
22 T GetPartInfo(void *handle, CExports::CVDGNDCPartInfoCmd cmd, std::size_t componentIdx, std::size_t partIdx)
23 {
24 return Internal::DoResCallValueOut<T>([&](T &value) {
25 size_t valueSize = sizeof(T);
26 return CVB_CALL_CAPI(CVDGNDCGetPartInfo(handle, cmd, valueSize, &value, componentIdx, partIdx));
27 });
28 }
29
30 template <typename T>
31 void SetPartInfo(void *handle, CExports::CVDGNDCPartInfoCmd cmd, std::size_t componentIdx, std::size_t partIdx,
32 const T &value)
33 {
34 return Internal::DoResCall([&]() {
35 size_t valueSize = sizeof(T);
36 return CVB_CALL_CAPI(CVDGNDCSetPartInfo(handle, cmd, valueSize, &value, componentIdx, partIdx));
37 });
38 }
39
40 template <typename T>
41 T GetComponentInfo(void *handle, CExports::CVDGNDCComponentInfoCmd cmd, std::size_t componentIdx)
42 {
43 return Internal::DoResCallValueOut<T>([&](T &value) {
44 size_t valueSize = sizeof(T);
45 return CVB_CALL_CAPI(CVDGNDCGetComponentInfo(handle, cmd, valueSize, &value, componentIdx));
46 });
47 }
48
49 template <typename T>
50 void SetComponentInfo(void *handle, CExports::CVDGNDCComponentInfoCmd cmd, std::size_t componentIdx,
51 const T &value)
52 {
53 return Internal::DoResCall([&]() {
54 size_t valueSize = sizeof(T);
55 return CVB_CALL_CAPI(CVDGNDCSetComponentInfo(handle, cmd, valueSize, &value, componentIdx));
56 });
57 }
58
59 template <typename T>
60 T GetHeaderInfo(void *handle, CExports::CVDGNDCHeaderInfoCmd cmd)
61 {
62 return Internal::DoResCallValueOut<T>([&](T &value) {
63 size_t valueSize = sizeof(T);
64 return CVB_CALL_CAPI(CVDGNDCGetHeaderInfo(handle, cmd, valueSize, &value));
65 });
66 }
67
68 template <typename T>
69 void SetHeaderInfo(void *handle, CExports::CVDGNDCHeaderInfoCmd cmd, T &value)
70 {
71 return Internal::DoResCall([&]() {
72 size_t valueSize = sizeof(T);
73 return CVB_CALL_CAPI(CVDGNDCSetHeaderInfo(handle, cmd, valueSize, &value));
74 });
75 }
76 } // namespace Detail
77
78 inline GenDcDescriptorPartConfig::GenDcDescriptorPartConfig(GenDCPartType partType, Cvb::PfncFormat pfncFormat,
79 std::uint16_t flowId, std::uint64_t flowOffset,
80 std::uint64_t dataSize)
81 : PartType{partType}
82 , Format{pfncFormat}
83 , FlowId{flowId}
84 , FlowOffset{flowOffset}
85 , DataSize{dataSize}
86 {
87 }
88
89 inline GenDcDescriptorMetadataPartConfig::GenDcDescriptorMetadataPartConfig(GenDCPartType partType,
90 std::uint16_t flowId,
91 std::uint64_t flowOffset,
92 std::uint64_t dataSize)
93 : GenDcDescriptorPartConfig{partType, PfncFormat::Data8, flowId, flowOffset, dataSize}
94 {
95 if ((static_cast<std::underlying_type_t<GenDCPartType>>(partType)
96 & static_cast<std::underlying_type_t<GenDCPartType>>(GenDCPartType::_TypeGenericPartMetadata))
97 == 0)
98 throw std::runtime_error("GenDcDescriptorMetadataPart must contain a metadata part type");
99 }
100
101 inline GenDcDescriptorMetadataComponentConfig::GenDcDescriptorMetadataComponentConfig(
103 : GenDcDescriptorComponentConfig{ComponentId::Metadata, PfncFormat::Data8}
104 {
105 std::transform(parts.begin(), parts.end(), std::back_inserter(Parts),
106 [](const auto &part) { return static_cast<GenDcDescriptorPartConfig>(part); });
107 }
108
109 inline GenDcPart::GenDcPart(void *handle, size_t componentIdx, size_t partIdx)
110 : handle_{handle}
111 , componentIdx_{componentIdx}
112 , partIdx_{partIdx}
113 {
114 }
115
117 {
118 return Detail::GetPartInfo<std::uint64_t>(handle_, CExports::CVDGNDCPI_PartOffset, componentIdx_, partIdx_);
119 }
120
122 {
123 return Detail::GetPartInfo<GenDCPartType>(handle_, CExports::CVDGNDCPI_HeaderType, componentIdx_, partIdx_);
124 }
125
127 {
128 return Detail::GetPartInfo<GenDcPartFlags>(handle_, CExports::CVDGNDCPI_FlagsValue, componentIdx_, partIdx_);
129 }
130
132 {
133 return Detail::GetPartInfo<std::uint32_t>(handle_, CExports::CVDGNDCPI_HeaderSize, componentIdx_, partIdx_);
134 }
135
137 {
138 return Detail::GetPartInfo<PfncFormat>(handle_, CExports::CVDGNDCPI_Format, componentIdx_, partIdx_);
139 }
140
142 {
143 return Detail::GetPartInfo<std::uint16_t>(handle_, CExports::CVDGNDCPI_FlowId, componentIdx_, partIdx_);
144 }
145
147 {
148 return Detail::GetPartInfo<std::size_t>(handle_, CExports::CVDGNDCPI_FlowOffset, componentIdx_, partIdx_);
149 }
150
152 {
153 return Detail::GetPartInfo<std::size_t>(handle_, CExports::CVDGNDCPI_DataOffset, componentIdx_, partIdx_);
154 }
155
157 {
158 return Detail::GetPartInfo<std::size_t>(handle_, CExports::CVDGNDCPI_DataSize, componentIdx_, partIdx_);
159 }
160
162 {
163 Detail::SetPartInfo(handle_, CExports::CVDGNDCPI_FlagsValue, componentIdx_, partIdx_, flags);
164 }
165
167 {
168 Detail::SetPartInfo(handle_, CExports::CVDGNDCPI_DataOffset, componentIdx_, partIdx_, offset);
169 }
170
172 {
173 Detail::SetPartInfo(handle_, CExports::CVDGNDCPI_DataSize, componentIdx_, partIdx_, size);
174 }
175
177 {
178 return Detail::GetPartInfo<std::uint64_t>(handle_, CExports::CVDGNDC1DPI_Size, componentIdx_, partIdx_);
179 }
180
182 {
183 return Detail::GetPartInfo<std::uint16_t>(handle_, CExports::CVDGNDC1DPI_Padding, componentIdx_, partIdx_);
184 }
185
187 {
188 Detail::SetPartInfo(handle_, CExports::CVDGNDC1DPI_Size, componentIdx_, partIdx_, size);
189 }
190
192 {
193 Detail::SetPartInfo(handle_, CExports::CVDGNDC1DPI_Padding, componentIdx_, partIdx_, padding);
194 }
195
196 inline GenDcPartMetadata::GenDcPartMetadata(void *handle, size_t componentIdx, size_t partIdx)
197 : GenDcPart{handle, componentIdx, partIdx}
198 {
199 }
200
202 {
203 return Detail::GetPartInfo<std::uint64_t>(handle_, CExports::CVDGNCDC1DPI_InfoTypeSpecific, componentIdx_,
204 partIdx_);
205 }
206
208 {
209 Detail::SetPartInfo(handle_, CExports::CVDGNCDC1DPI_InfoTypeSpecific, componentIdx_, partIdx_, id);
210 }
211
212 inline GenDcPartMetadataGenICamChunk::GenDcPartMetadataGenICamChunk(void *handle, size_t componentIdx,
213 size_t partIdx)
214 : GenDcPartMetadata{handle, componentIdx, partIdx}
215 {
216 }
217
219 {
220 return Detail::GetPartInfo<std::uint64_t>(handle_, CExports::CVDGNCDC1DPI_InfoTypeSpecific, componentIdx_,
221 partIdx_);
222 }
223
225 {
226 Detail::SetPartInfo(handle_, CExports::CVDGNCDC1DPI_InfoTypeSpecific, componentIdx_, partIdx_, id);
227 }
228
229 inline GenDcPartMetadataGenICamXML::GenDcPartMetadataGenICamXML(void *handle, size_t componentIdx, size_t partIdx)
230 : GenDcPartMetadata{handle, componentIdx, partIdx}
231 {
232 }
233
235 {
236 return Detail::GetPartInfo<std::uint64_t>(handle_, CExports::CVDGNDC1DPI_Size, componentIdx_, partIdx_);
237 }
238
240 {
241 return Detail::GetPartInfo<std::uint16_t>(handle_, CExports::CVDGNDC1DPI_Padding, componentIdx_, partIdx_);
242 }
243
245 {
246 Detail::SetPartInfo(handle_, CExports::CVDGNDC1DPI_Size, componentIdx_, partIdx_, size);
247 }
248
250 {
251 Detail::SetPartInfo(handle_, CExports::CVDGNDC1DPI_Padding, componentIdx_, partIdx_, padding);
252 }
253
254 inline GenDcPart1D::GenDcPart1D(void *handle, size_t componentIdx, size_t partIdx)
255 : GenDcPart{handle, componentIdx, partIdx}
256 {
257 }
258
260 {
261 return Detail::GetPartInfo<std::uint32_t>(handle_, CExports::CVDGNDC2DPI_SizeX, componentIdx_, partIdx_);
262 }
263
265 {
266 return Detail::GetPartInfo<std::uint32_t>(handle_, CExports::CVDGNDC2DPI_SizeY, componentIdx_, partIdx_);
267 }
268
270 {
271 return Detail::GetPartInfo<std::uint16_t>(handle_, CExports::CVDGNDC2DPI_PaddingX, componentIdx_, partIdx_);
272 }
273
275 {
276 return Detail::GetPartInfo<std::uint16_t>(handle_, CExports::CVDGNDC2DPI_PaddingY, componentIdx_, partIdx_);
277 }
278
280 {
281 Detail::SetPartInfo(handle_, CExports::CVDGNDC2DPI_SizeX, componentIdx_, partIdx_, size);
282 }
283
285 {
286 Detail::SetPartInfo(handle_, CExports::CVDGNDC2DPI_SizeY, componentIdx_, partIdx_, size);
287 }
288
290 {
291 Detail::SetPartInfo(handle_, CExports::CVDGNDC2DPI_PaddingX, componentIdx_, partIdx_, padding);
292 }
293
295 {
296 Detail::SetPartInfo(handle_, CExports::CVDGNDC2DPI_PaddingY, componentIdx_, partIdx_, padding);
297 }
298
299 inline GenDcPart2D::GenDcPart2D(void *handle, size_t componentIdx, size_t partIdx)
300 : GenDcPart{handle, componentIdx, partIdx}
301 {
302 }
303
305 {
306 return Detail::GetPartInfo<std::uint32_t>(handle_, CExports::CVDGNDCH264PI_SizeX, componentIdx_, partIdx_);
307 }
308
310 {
311 return Detail::GetPartInfo<std::uint32_t>(handle_, CExports::CVDGNDCH264PI_SizeY, componentIdx_, partIdx_);
312 }
313
315 {
316 return Detail::GetPartInfo<std::uint16_t>(handle_, CExports::CVDGNDCH264PI_PaddingX, componentIdx_, partIdx_);
317 }
318
320 {
321 return Detail::GetPartInfo<std::uint16_t>(handle_, CExports::CVDGNDCH264PI_PaddingY, componentIdx_, partIdx_);
322 }
323
325 {
326 return Detail::GetPartInfo<std::uint8_t>(handle_, CExports::CVDGNDCH264PI_ProfileIDC, componentIdx_, partIdx_);
327 }
328
330 {
331 return Detail::GetPartInfo<H264Flags>(handle_, CExports::CVDGNDCH264PI_H264Flags, componentIdx_, partIdx_);
332 }
333
335 {
336 return Detail::GetPartInfo<std::uint8_t>(handle_, CExports::CVDGNDCH264PI_LevelIDC, componentIdx_, partIdx_);
337 }
338
340 {
341 return Detail::GetPartInfo<std::uint16_t>(handle_, CExports::CVDGNDCH264PI_SpropInterleavingDepth, componentIdx_,
342 partIdx_);
343 }
345 {
346 return Detail::GetPartInfo<std::uint16_t>(handle_, CExports::CVDGNDCH264PI_SpropMaxDonDiff, componentIdx_,
347 partIdx_);
348 }
349
351 {
352 return Detail::GetPartInfo<std::uint32_t>(handle_, CExports::CVDGNDCH264PI_SpropDeintBufReq, componentIdx_,
353 partIdx_);
354 }
355
357 {
358 return Detail::GetPartInfo<std::uint32_t>(handle_, CExports::CVDGNDCH264PI_SpropInitBufTime, componentIdx_,
359 partIdx_);
360 }
361
363 {
364 Detail::SetPartInfo(handle_, CExports::CVDGNDCH264PI_SizeX, componentIdx_, partIdx_, size);
365 }
366
368 {
369 Detail::SetPartInfo(handle_, CExports::CVDGNDCH264PI_SizeY, componentIdx_, partIdx_, size);
370 }
371
373 {
374 Detail::SetPartInfo(handle_, CExports::CVDGNDCH264PI_PaddingX, componentIdx_, partIdx_, padding);
375 }
376
378 {
379 Detail::SetPartInfo(handle_, CExports::CVDGNDCH264PI_PaddingY, componentIdx_, partIdx_, padding);
380 }
381
383 {
384 Detail::SetPartInfo(handle_, CExports::CVDGNDCH264PI_ProfileIDC, componentIdx_, partIdx_, profile);
385 }
386
388 {
389 Detail::SetPartInfo(handle_, CExports::CVDGNDCH264PI_H264Flags, componentIdx_, partIdx_, flags);
390 }
391
393 {
394 Detail::SetPartInfo(handle_, CExports::CVDGNDCH264PI_LevelIDC, componentIdx_, partIdx_, level);
395 }
396
398 {
399 Detail::SetPartInfo(handle_, CExports::CVDGNDCH264PI_SpropInterleavingDepth, componentIdx_, partIdx_, depth);
400 }
401
403 {
404 Detail::SetPartInfo(handle_, CExports::CVDGNDCH264PI_SpropMaxDonDiff, componentIdx_, partIdx_, diff);
405 }
406
408 {
409 Detail::SetPartInfo(handle_, CExports::CVDGNDCH264PI_SpropDeintBufReq, componentIdx_, partIdx_, req);
410 }
411
413 {
414 Detail::SetPartInfo(handle_, CExports::CVDGNDCH264PI_SpropInitBufTime, componentIdx_, partIdx_, time);
415 }
416
417 inline GenDcPartH264::GenDcPartH264(void *handle, size_t componentIdx, size_t partIdx)
418 : GenDcPart2D{handle, componentIdx, partIdx}
419 {
420 }
421
422 inline GenDcComponent::GenDcComponent(void *handle, size_t componentIdx)
423 : handle_{handle}
424 , componentIdx_{componentIdx}
425 {
426 const auto partCount =
427 Detail::GetComponentInfo<std::uint16_t>(handle_, CExports::CVDGNDCCMPI_PartCount, componentIdx_);
428 for (std::size_t idx = 0; idx < partCount; ++idx)
429 {
430 const auto type =
431 Detail::GetPartInfo<GenDCPartType>(handle_, CExports::CVDGNDCPI_HeaderType, componentIdx_, idx);
432 switch (type)
433 {
435 parts_.push_back(GenDcPartMetadataGenICamChunk{handle_, componentIdx_, idx});
436 break;
438 parts_.push_back(GenDcPartMetadataGenICamXML{handle_, componentIdx_, idx});
439 break;
440 case GenDCPartType::Type1D:
441 parts_.push_back(GenDcPart1D{handle_, componentIdx_, idx});
442 break;
444 // fallthrough
446 // fallthrough
448 parts_.push_back(GenDcPart2D{handle_, componentIdx_, idx});
449 break;
451 parts_.push_back(GenDcPartH264{handle_, componentIdx_, idx});
452 break;
453 default:
454 parts_.push_back(GenDcPart{handle_, componentIdx_, idx});
455 break;
456 }
457 }
458 }
459
461 {
462 return Detail::GetComponentInfo<std::uint64_t>(handle_, CExports::CVDGNDCCMPI_ComponentOffset, componentIdx_);
463 }
464
466 {
467 return Detail::GetComponentInfo<GenDcComponentFlags>(handle_, CExports::CVDGNDCCMPI_FlagsValue, componentIdx_);
468 }
469
471 {
472 return Detail::GetComponentInfo<std::uint32_t>(handle_, CExports::CVDGNDCCMPI_HeaderSize, componentIdx_);
473 }
474
476 {
477 return Detail::GetComponentInfo<std::uint16_t>(handle_, CExports::CVDGNDCCMPI_GroupId, componentIdx_);
478 }
479
481 {
482 return Detail::GetComponentInfo<std::uint16_t>(handle_, CExports::CVDGNDCCMPI_SourceId, componentIdx_);
483 }
484
486 {
487 return Detail::GetComponentInfo<std::uint16_t>(handle_, CExports::CVDGNDCCMPI_RegionId, componentIdx_);
488 }
489
491 {
492 return Detail::GetComponentInfo<std::uint32_t>(handle_, CExports::CVDGNDCCMPI_RegionOffsetX, componentIdx_);
493 }
494
496 {
497 return Detail::GetComponentInfo<std::uint32_t>(handle_, CExports::CVDGNDCCMPI_RegionOffsetY, componentIdx_);
498 }
499
501 {
502 return Detail::GetComponentInfo<std::uint64_t>(handle_, CExports::CVDGNDCCMPI_Timestamp, componentIdx_);
503 }
504
506 {
507 return static_cast<ComponentId>(
508 Detail::GetComponentInfo<std::uint64_t>(handle_, CExports::CVDGNDCCMPI_TypeId, componentIdx_));
509 }
510
512 {
513 return Detail::GetComponentInfo<PfncFormat>(handle_, CExports::CVDGNDCCMPI_Format, componentIdx_);
514 }
515
517 {
518 return parts_;
519 }
520
522 {
523 return parts_;
524 }
525
527 {
528 return Detail::SetComponentInfo(handle_, CExports::CVDGNDCCMPI_FlagsValue, componentIdx_, flags);
529 }
530
532 {
533 return Detail::SetComponentInfo(handle_, CExports::CVDGNDCCMPI_GroupId, componentIdx_, id);
534 }
535
537 {
538 return Detail::SetComponentInfo(handle_, CExports::CVDGNDCCMPI_SourceId, componentIdx_, id);
539 }
540
542 {
543 return Detail::SetComponentInfo(handle_, CExports::CVDGNDCCMPI_RegionId, componentIdx_, id);
544 }
545
547 {
548 return Detail::SetComponentInfo(handle_, CExports::CVDGNDCCMPI_RegionOffsetX, componentIdx_, offset);
549 }
550
552 {
553 return Detail::SetComponentInfo(handle_, CExports::CVDGNDCCMPI_RegionOffsetY, componentIdx_, offset);
554 }
555
557 {
558 return Detail::SetComponentInfo(handle_, CExports::CVDGNDCCMPI_Timestamp, componentIdx_, timestamp);
559 }
560
561 inline GenDcDescriptor::GenDcDescriptor(HandleGuard<GenDcDescriptor> &&guard)
562 : handle_(std::move(guard))
563 , components_{}
564 {
565 const auto componentCount = Detail::GetHeaderInfo<std::uint32_t>(Handle(), CExports::CVDGNDCCNTI_ComponentCount);
566 for (std::size_t idx = 0; idx < componentCount; ++idx)
567 components_.push_back(GenDcComponent{Handle(), idx});
568 }
569
570 inline std::unique_ptr<GenDcDescriptor> GenDcDescriptor::FromHandle(HandleGuard<GenDcDescriptor> &&guard)
571 {
572 if (!guard.Handle())
573 throw std::runtime_error("handle must not be null");
574
575 return std::unique_ptr<GenDcDescriptor>{new GenDcDescriptor{std::move(guard)}};
576 }
577
579 {
580 return {Detail::GetHeaderInfo<std::uint8_t>(Handle(), CExports::CVDGNDCCNTI_VersionMajor),
581 Detail::GetHeaderInfo<std::uint8_t>(Handle(), CExports::CVDGNDCCNTI_VersionMinor),
582 Detail::GetHeaderInfo<std::uint8_t>(Handle(), CExports::CVDGNDCCNTI_VersionSubMinor)};
583 }
584
586 {
587 return Detail::GetHeaderInfo<GenDcDescriptorFlag>(Handle(), CExports::CVDGNDCCNTI_FlagsValue);
588 }
589
591 {
592 return Detail::GetHeaderInfo<std::uint32_t>(Handle(), CExports::CVDGNDCCNTI_HeaderSize);
593 }
594
596 {
597 return Detail::GetHeaderInfo<std::uint64_t>(Handle(), CExports::CVDGNDCCNTI_ContainerId);
598 }
599
601 {
602 return Detail::GetHeaderInfo<GenDcDescriptorVariableField>(Handle(), CExports::CVDGNDCCNTI_VariableFields);
603 }
604
606 {
607 return Detail::GetHeaderInfo<std::uint64_t>(Handle(), CExports::CVDGNDCCNTI_DataSize);
608 }
609
611 {
612 return Detail::GetHeaderInfo<std::int64_t>(Handle(), CExports::CVDGNDCCNTI_DataOffset);
613 }
614
616 {
617 return Detail::GetHeaderInfo<std::uint32_t>(Handle(), CExports::CVDGNDCCNTI_DescriptorSize);
618 }
619
621 {
622 return components_;
623 }
624
626 {
627 return components_;
628 }
629
631 {
632 size_t maxFlowIdx = 0;
633 for (const auto &component : GetComponents())
634 {
635 for (const auto &part : component.GetParts())
636 {
637 auto flowIdx = visit([](const GenDcPart &part) -> size_t { return part.GetFlowId(); }, part);
638
639 maxFlowIdx = std::max(maxFlowIdx, flowIdx);
640 }
641 }
642 return maxFlowIdx+1;
643 }
644
646 {
647 Detail::SetHeaderInfo(Handle(), CExports::CVDGNDCCNTI_FlagsValue, flags);
648 }
649
651 {
652 Detail::SetHeaderInfo(Handle(), CExports::CVDGNDCCNTI_ContainerId, id);
653 }
654
656 {
657 Detail::SetHeaderInfo(Handle(), CExports::CVDGNDCCNTI_VariableFields, fields);
658 }
659
661 {
662 Detail::SetHeaderInfo(Handle(), CExports::CVDGNDCCNTI_DataSize, size);
663 }
664
665 inline void *GenDcDescriptor::Handle() const noexcept
666 {
667 return handle_.Handle();
668 }
669
671 {
672 return Internal::DoResCallValueOut<std::size_t>(
673 [&](std::size_t &value) { return CVB_CALL_CAPI(CVDGNDCSerialize(Handle(), value, nullptr)); });
674 }
675
676 inline void GenDcDescriptor::Serialize(std::uint8_t *buffer, std::size_t size) const
677 {
678 return Internal::DoResCall([&]() { return CVB_CALL_CAPI(CVDGNDCSerialize(Handle(), size, buffer)); });
679 }
680
682 {
683 const std::size_t serializedSize = GetSerializedSize();
684 std::vector<std::uint8_t> buffer(serializedSize);
685 Serialize(buffer.data(), buffer.size());
686 return buffer;
687 }
688
690 {
691 if (descriptorConfig.Components.size() > std::numeric_limits<CExports::cvbuint32_t>::max())
692 throw std::invalid_argument("Descriptor has more components than allowed in a GenDC container");
693
694 const auto partCount =
695 std::accumulate(descriptorConfig.Components.begin(), descriptorConfig.Components.end(), size_t{0},
696 [](size_t count, const auto &component) { return count + component.Parts.size(); });
698 parts.reserve(partCount);
700 for (const auto &component : descriptorConfig.Components)
701 {
702 if (component.Parts.size() > std::numeric_limits<CExports::cvbuint16_t>::max())
703 throw std::invalid_argument("Component has more parts than allowed in a GenDC container");
704
705 size_t startOffset = parts.size();
706 for (const auto &part : component.Parts)
707 {
708 parts.push_back(CExports::CVDGenDCPartConfig{
709 static_cast<CExports::cvbuint16_t>(part.PartType),
710 static_cast<CExports::cvbuint32_t>(part.Format),
711 part.FlowId,
712 part.FlowOffset,
713 part.DataSize,
714 });
715 }
716 components.push_back(CExports::CVDGenDCComponentConfig{
717 static_cast<CExports::cvbuint32_t>(component.TypeId), static_cast<CExports::cvbuint32_t>(component.Format),
718 static_cast<CExports::cvbuint16_t>(component.Parts.size()), parts.data() + startOffset});
719 }
720
721 CExports::CVDGenDCDescriptorConfig config{static_cast<CExports::cvbuint32_t>(components.size()),
722 components.data()};
723
724 return Internal::DoResCallObjectOut<GenDcDescriptor>(
725 [&](void *&handle) { return CVB_CALL_CAPI(CVDGNDCCreateDescriptor(config, handle)); });
726 }
727
728 } // namespace Driver
729
730
732 {
733 if (!CExports::CVDCanGenDCDescriptorProvider(Handle()))
734 throw std::runtime_error("Composite does not represent a GenDC container");
735
736 return Internal::DoResCallObjectOut<Driver::GenDcDescriptor>(
737 [this](CExports::CVDGNDCDESCRIPTOR &handle) { return CVB_CALL_CAPI(CVDGNDCPGetDescriptor(Handle(), handle)); });
738 }
739
740 CVB_END_INLINE_NS
741
742} // namespace Cvb
T accumulate(T... args)
T back_inserter(T... args)
void * Handle() const noexcept
Classic API node handle.
Definition decl_composite.hpp:95
std::unique_ptr< Driver::GenDcDescriptor > GenDCFinalDescriptor() const
If this Composite represents a GenDC container, returns the GenDC final descriptor.
Definition detail_gendc_descriptor.hpp:731
Class for a GenDC component descriptor.
Definition decl_gendc_descriptor.hpp:535
std::uint64_t GetTimestamp() const
Return the timestamp of this GenDC component's generation.
Definition detail_gendc_descriptor.hpp:500
std::uint32_t GetHeaderSize() const
Return the size of this GenDC component descriptor.
Definition detail_gendc_descriptor.hpp:470
void SetTimestamp(std::uint64_t timestamp)
Set the timestamp of this GenDC component's generation.
Definition detail_gendc_descriptor.hpp:556
std::uint16_t GetRegionId() const
Return the Source ID of this GenDC component.
Definition detail_gendc_descriptor.hpp:485
ComponentId GetTypeId() const
Return the type identifier of this GenDC component.
Definition detail_gendc_descriptor.hpp:505
const std::vector< GenDCPartVariant > & GetParts() const
Return the part descriptors of this GenDC component.
Definition detail_gendc_descriptor.hpp:516
std::uint32_t GetRegionOffsetX() const
Return the X Offset of this GenDC component's region.
Definition detail_gendc_descriptor.hpp:490
std::size_t GetOffset() const
Return the offset of this component descriptor in the GenDC descriptor.
Definition detail_gendc_descriptor.hpp:460
PfncFormat GetFormat() const
Return the format of the whole GenDC component (including all its parts).
Definition detail_gendc_descriptor.hpp:511
void SetSourceId(std::uint16_t id)
Set the Source ID of this GenDC component.
Definition detail_gendc_descriptor.hpp:536
void SetFlags(GenDcComponentFlags flags)
Set the flags of this GenDC component.
Definition detail_gendc_descriptor.hpp:526
std::uint16_t GetGroupId() const
Return the Group ID of this GenDC component.
Definition detail_gendc_descriptor.hpp:475
GenDcComponentFlags GetFlags() const
Return the flags of this GenDC component.
Definition detail_gendc_descriptor.hpp:465
std::uint32_t GetRegionOffsetY() const
Return the Y Offset of this GenDC component's region.
Definition detail_gendc_descriptor.hpp:495
std::uint16_t GetSourceId() const
Return the Source ID of this GenDC component.
Definition detail_gendc_descriptor.hpp:480
void SetRegionOffsetX(std::uint32_t offset)
Set the X Offset of this GenDC component's region.
Definition detail_gendc_descriptor.hpp:546
void SetRegionId(std::uint16_t id)
Set the Source ID of this GenDC component.
Definition detail_gendc_descriptor.hpp:541
void SetRegionOffsetY(std::uint32_t offset)
Set the Y Offset of this GenDC component's region.
Definition detail_gendc_descriptor.hpp:551
void SetGroupId(std::uint16_t id)
Set the Group ID of this GenDC component.
Definition detail_gendc_descriptor.hpp:531
std::uint32_t GetHeaderSize() const
Return the size of this GenDC container descriptor.
Definition detail_gendc_descriptor.hpp:590
std::size_t GetSerializedSize() const
Get the size in bytes of this GenDC descriptor when serialized.
Definition detail_gendc_descriptor.hpp:670
const std::vector< GenDcComponent > & GetComponents() const
Return the component descriptors of this GenDC container.
Definition detail_gendc_descriptor.hpp:620
GenDcDescriptorFlag GetFlags() const
Return the flags of this GenDC container.
Definition detail_gendc_descriptor.hpp:585
void SetVariableFields(GenDcDescriptorVariableField fields)
Set the flags identifying the variable fields of this GenDC container.
Definition detail_gendc_descriptor.hpp:655
void SetContainerId(std::uint64_t id)
Set the identifier of GenDC container.
Definition detail_gendc_descriptor.hpp:650
std::vector< std::uint8_t > Serialize() const
Serialize this GenDC descriptor into a new buffer.
Definition detail_gendc_descriptor.hpp:681
std::uint64_t GetDataSize() const
Return the size of the GenDC data.
Definition detail_gendc_descriptor.hpp:605
std::uint64_t GetContainerId() const
Return the identifier of GenDC container.
Definition detail_gendc_descriptor.hpp:595
void SetFlags(GenDcDescriptorFlag flags)
Set the flags of this GenDC container.
Definition detail_gendc_descriptor.hpp:645
void SetDataSize(std::uint32_t size)
Set the size of the GenDC data.
Definition detail_gendc_descriptor.hpp:660
GenDcDescriptorVariableField GetVariableFields() const
Return the flags identifying the variable fields of this GenDC container.
Definition detail_gendc_descriptor.hpp:600
std::int64_t GetDataOffset() const
Return the offset of the GenDC data.
Definition detail_gendc_descriptor.hpp:610
static std::unique_ptr< GenDcDescriptor > FromHandle(HandleGuard< GenDcDescriptor > &&guard)
Creates a GenDC descriptor from a classic API handle.
Definition detail_gendc_descriptor.hpp:570
std::uint32_t GetDescriptorSize() const
Return the size of the GenDC container descriptor.
Definition detail_gendc_descriptor.hpp:615
void * Handle() const noexcept
Return the Handle to the internal resource.
Definition detail_gendc_descriptor.hpp:665
Version GetVersion() const
Return the GenDC descriptor standards version.
Definition detail_gendc_descriptor.hpp:578
size_t CalculateFlowCount() const
Return the count of flows the container is transported in.
Definition detail_gendc_descriptor.hpp:630
static std::unique_ptr< GenDcDescriptor > Create(const GenDcDescriptorConfig &descriptorConfig)
Create a GenDC descriptor.
Definition detail_gendc_descriptor.hpp:689
void SetPadding(std::uint16_t padding)
Set the padding of this GenDC 1D part.
Definition detail_gendc_descriptor.hpp:249
std::uint16_t GetPadding() const
Return the padding of this GenDC 1D part.
Definition detail_gendc_descriptor.hpp:239
void SetSize(std::uint64_t size)
Set the size of the GenDC 1D part.
Definition detail_gendc_descriptor.hpp:244
std::uint64_t GetSize() const
Return the size of the GenDC 1D part.
Definition detail_gendc_descriptor.hpp:234
Class for a GenDC 2D part descriptor.
Definition decl_gendc_descriptor.hpp:299
virtual void SetSizeY(std::uint32_t size)
Set the Y size of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:284
virtual std::uint32_t GetSizeY() const
Return the Y size of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:264
virtual std::uint16_t GetPaddingY() const
Return the Y padding of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:274
virtual void SetPaddingX(std::uint16_t padding)
Set the X padding of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:289
virtual void SetSizeX(std::uint32_t size)
Set the X size of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:279
virtual std::uint16_t GetPaddingX() const
Return the X padding of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:269
virtual std::uint32_t GetSizeX() const
Return the X size of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:259
virtual void SetPaddingY(std::uint16_t padding)
Set the Y padding of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:294
std::uint8_t GetLevelIDC() const
Return the level_idc sequence parameter of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:334
void SetSpropMaxDonDiff(std::uint16_t diff)
Set the sprop-max-don-diff of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:402
void SetSizeY(std::uint32_t size) override
Set the Y size of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:367
std::uint32_t GetSizeY() const override
Return the Y size of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:309
std::uint16_t GetSpropMaxDonDiff() const
Return the sprop-max-don-diff of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:344
void SetPaddingX(std::uint16_t padding) override
Set the X padding of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:372
std::uint16_t GetSpropInterleavingDepth() const
Return the sprop-interleaving-depth of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:339
void SetSpropInitBufTime(std::uint32_t time)
Set the sprop-init-buf-time of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:412
std::uint8_t GetProfileIDC() const
Return the profile_idc of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:324
void SetSizeX(std::uint32_t size) override
Set the X size of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:362
void SetH264Flags(H264Flags flags)
Set the Flags of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:387
std::uint16_t GetPaddingY() const
Return the Y padding of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:319
void SetProfileIDC(std::uint8_t profile)
Set the profile_idc of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:382
void SetSpropInterleavingDepth(std::uint16_t depth)
Set the sprop-interleaving-depth of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:397
void SetLevelIDC(std::uint8_t level)
Set the level_idc sequence parameter of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:392
std::uint32_t GetSizeX() const override
Return the X size of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:304
std::uint16_t GetPaddingX() const override
Return the X padding of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:314
void SetSpropDeintBufReq(std::uint32_t req)
Set the sprop-deint-buf-req of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:407
std::uint32_t GetSpropDeintBufReq() const
Return the sprop-deint-buf-req of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:350
void SetPaddingY(std::uint16_t padding) override
Set the Y padding of the GenDC 2D part.
Definition detail_gendc_descriptor.hpp:377
H264Flags GetH264Flags() const
Return the Flags of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:329
std::uint32_t GetSpropInitBufTime() const
Return the sprop-init-buf-time of the GenDC H.264 part.
Definition detail_gendc_descriptor.hpp:356
Class for a generic GenDC part descriptor.
Definition decl_gendc_descriptor.hpp:72
void SetDataOffset(std::size_t offset)
Set the Data offset of this GenDC part.
Definition detail_gendc_descriptor.hpp:166
std::uint32_t GetHeaderSize() const
Return the size of this GenDC part descriptor.
Definition detail_gendc_descriptor.hpp:131
void SetFlags(GenDcPartFlags flags)
Set the flags of this GenDC part.
Definition detail_gendc_descriptor.hpp:161
std::size_t GetDataOffset() const
Return the Data offset of this GenDC part.
Definition detail_gendc_descriptor.hpp:151
std::uint16_t GetFlowId() const
Return the Flow ID of this GenDC part.
Definition detail_gendc_descriptor.hpp:141
std::size_t GetOffset() const
Return the offset of this part descriptor in the GenDC descriptor.
Definition detail_gendc_descriptor.hpp:116
PfncFormat GetFormat() const
Return the data format of this GenDC part.
Definition detail_gendc_descriptor.hpp:136
GenDCPartType GetType() const
Return the type of this GenDC part descriptor.
Definition detail_gendc_descriptor.hpp:121
std::size_t GetDataSize() const
Return the Data size of this GenDC part.
Definition detail_gendc_descriptor.hpp:156
GenDcPartFlags GetFlags() const
Return the flags of this GenDC part.
Definition detail_gendc_descriptor.hpp:126
void SetDataSize(std::size_t size)
Set the Data size of this GenDC part.
Definition detail_gendc_descriptor.hpp:171
std::size_t GetFlowOffset() const
Return the Flow offset of this GenDC part.
Definition detail_gendc_descriptor.hpp:146
std::uint64_t GetGenICamLayoutId() const
Return the Layout ID of this GenDC metadata chunk part.
Definition detail_gendc_descriptor.hpp:201
void SetGenICamLayoutId(std::uint64_t id)
Set the Layout ID of this GenDC metadata chunk part.
Definition detail_gendc_descriptor.hpp:207
std::uint64_t GetGenICamLayoutId() const
Return the Layout ID of this GenDC metadata XML part.
Definition detail_gendc_descriptor.hpp:218
void SetGenICamLayoutId(std::uint64_t id)
Set the Layout ID of this GenDC metadata XML part.
Definition detail_gendc_descriptor.hpp:224
Class for a generic GenDC metadata part descriptor.
Definition decl_gendc_descriptor.hpp:171
void SetPadding(std::uint16_t padding)
Set the padding of this GenDC metadata part.
Definition detail_gendc_descriptor.hpp:191
std::uint16_t GetPadding() const
Return the padding of this GenDC metadata part.
Definition detail_gendc_descriptor.hpp:181
void SetSize(std::uint64_t size)
Set the size of the GenDC metadata part.
Definition detail_gendc_descriptor.hpp:186
std::uint64_t GetSize() const
Return the size of the GenDC metadata part.
Definition detail_gendc_descriptor.hpp:176
T max(T... args)
T move(T... args)
Namespace for driver or device related operations.
Definition decl_composite.hpp:27
ComponentId
Component type identifier,.
Definition driver.hpp:609
@ Metadata
Metadata component.
Definition driver.hpp:629
GenDcDescriptorVariableField
Flags specifying which type of data information might vary during the Container reception.
Definition driver.hpp:652
@ Format
If True, the Components' Format might change. This bit can only be set in a prefetch Descriptor.
Definition driver.hpp:662
@ DataSize
If True, the DataSize of the Components' Parts might become smaller.
Definition driver.hpp:654
H264Flags
Flags specifying the characteristics and format of the H.264 Part.
Definition driver.hpp:690
GenDCPartType
Part Type Header format identifier,.
Definition driver.hpp:581
@ TypeMetadataGenICamXML
GenICam Metadata XML.
Definition driver.hpp:594
@ TypeJPEG
JPEG compressed Image.
Definition driver.hpp:600
@ Type2D
Rectangular uncompressed image (monochrome or none planar color).
Definition driver.hpp:598
@ TypeMetadataGenICamChunk
GenICam Chunk Metadata.
Definition driver.hpp:592
@ TypeH264
H.264 compressed Image.
Definition driver.hpp:604
@ TypeJPEG2000
JPEG 2000 compressed Image.
Definition driver.hpp:602
GenDcDescriptorFlag
Flags specifying the characteristics and format of the Container.
Definition driver.hpp:641
GenDcPartFlags
Flags specifying the characteristics and format of the Part.
Definition driver.hpp:681
GenDcComponentFlags
Flags specifying the characteristics and format of the Component.
Definition driver.hpp:673
PfncFormat
GenICam Pixel Format Naming Convention (PFNC) format values.
Definition pfnc_format.hpp:34
@ Data8
Binary 8-bit data.
Definition pfnc_format.hpp:1006
Root namespace for the Image Manager interface.
Definition version.hpp:11
Configuration class for a GenDC descriptor.
Definition decl_gendc_descriptor.hpp:65
std::vector< GenDcDescriptorComponentConfig > Components
Configurations of the GenDC components in this GenDC descriptor.
Definition decl_gendc_descriptor.hpp:67
Class representing a Semantic Version in Major.Minor.SubMinor format.
Definition version.hpp:14
T transform(T... args)