5#include "../../global.hpp"
7#include "../_decl/decl_video_device.hpp"
8#include "../_decl/decl_video_image.hpp"
9#include "../_decl/decl_device_control.hpp"
10#include "../_decl/decl_indexed_stream.hpp"
22 auto stream = StreamsOptional(0);
27 switch (stream->AcquisitionInterface())
44 if (playbackMode_ == playbackMode)
47 playbackMode_ = playbackMode;
48 auto stream = StreamsOptional(0);
52 stream->SetAcquisitionInterface(AcquisitionInterfaceForPlaybackMode(playbackMode_));
69 inline StreamBasePtr VideoDevice::CreateStream(
int, StreamType streamType)
const
71 if (streamType != StreamType::Legacy)
76 inline VideoDevice::VideoStream::VideoStream(
const DevicePtr &device)
78 , layout_(Driver::BufferImage::ImageLayout::FromIMGHandle(device->Handle()))
80 static_cast<int>(device->
DigitalIO()->ReadInputGroup(CExports::Video::ImageCountGroup).to_ulong()))
84 inline int VideoDevice::VideoStream::ImageIndex()
const
86 auto digitalIO =
Parent()->DigitalIO();
87 return static_cast<int>(digitalIO->ReadOutputGroup(CExports::Video::CurrentImageIndexGroup).to_ulong());
90 inline void VideoDevice::VideoStream::SetImageIndex(
int index)
92 if (index < 0 || index >= ImageCount())
93 throw std::out_of_range(
"image index out of range");
95 auto digitalIO = Parent()->DigitalIO();
96 digitalIO->WriteOutputGroup(CExports::Video::CurrentImageIndexGroup,
97 std::bitset<32>(
static_cast<std::uint32_t
>(index)));
98 auto result = CExports::Snap(Parent()->
Handle());
100 std::rethrow_exception(CvbException::FromCvbResult(result,
"failed to snap"));
101 std::dynamic_pointer_cast<const VideoDevice>(Parent())->OnImageAcquired();
DeviceControlPtr DeviceControl() const
Gets the DeviceControl interface if present.
Definition detail_device.hpp:157
void * Handle() const noexcept
Classic API device handle.
Definition decl_device.hpp:122
A specific command to send to the driver.
Definition decl_device_control.hpp:19
Digital I/O operations on a device.
Definition decl_digital_io.hpp:19
A stream with a finite number of images, which can also be accessed via an index.
Definition decl_indexed_stream.hpp:20
DevicePtr Parent() const noexcept
Gets the parent device of this stream.
Definition stream_base.hpp:42
Cvb::Driver::PlaybackMode PlaybackMode() const noexcept
Gets how images are delivered by the stream.
Definition detail_video_device.hpp:20
void SetPlaybackMode(Cvb::Driver::PlaybackMode playbackMode)
Sets how images are delivered by the stream.
Definition detail_video_device.hpp:42
Namespace for driver or device related operations.
Definition decl_composite.hpp:28
@ Get
Get information from the device.
Definition driver.hpp:528
PlaybackMode
Defines how frames are acquired by this video device.
Definition driver.hpp:421
@ FrameByFrame
The Stream::Wait() method always returns the next image in the video stream.
Definition driver.hpp:423
@ Stream
Definition driver.hpp:430
std::shared_ptr< DeviceImage > DeviceImagePtr
Convenience shared pointer for DeviceImage.
Definition driver.hpp:61
std::shared_ptr< StreamBase > StreamBasePtr
Convenience shared pointer for StreamBase.
Definition driver.hpp:113
@ Grab2
Ring buffer / queue based acquisition.
Definition driver.hpp:439
@ Grabber
Basic grabber interface for single image acquisition.
Definition driver.hpp:437
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
std::shared_ptr< Device > DevicePtr
Convenience shared pointer for Device.
Definition global.hpp:98
T const_pointer_cast(T... args)