IDSpeakIPL  v1.9.1
peak::ipl::VideoWriter Class Referencefinal

Writes images to a file in the form of a video. More...

#include <peak_ipl/io/peak_ipl_video_writer.hpp>

Public Member Functions

 VideoWriter ()=default
 
 ~VideoWriter ()
 
 VideoWriter (const VideoWriter &)=delete
 
 VideoWriter (VideoWriter &&other) noexcept
 
VideoWriter & operator= (const VideoWriter &)=delete
 
VideoWriter & operator= (VideoWriter &&other) noexcept
 
void Open (const std::string &fileName, std::shared_ptr< container::IContainer > container, std::shared_ptr< encoder::IEncoder > encoder)
 Open the VideoWriter and sets up a container and an encoder. The file is created upon receiving the first image with Append. More...
 
void Open (const std::string &fileName)
 Open the VideoWriter with AVI container and mjpeg encoder. The file is created upon receiving the first image with Append. More...
 
PEAK_IPL_NO_DISCARD bool IsOpen () const
 Check if the VideoWriter is already open. More...
 
void Close ()
 Close the opened VideoWriter. More...
 
void Append (const Image &image)
 Append an image to the opened video. More...
 
VideoWriter & operator<< (const Image &image)
 Append an image to the opened video. More...
 
PEAK_IPL_NO_DISCARD std::shared_ptr< encoder::IEncoder > Encoder () const
 Get the used encoder. More...
 
PEAK_IPL_NO_DISCARD std::shared_ptr< container::IContainer > Container () const
 Get the used container. More...
 
PEAK_IPL_NO_DISCARD uint64_t NumFramesEncoded () const
 Get the encoded frames in the video stream. More...
 
PEAK_IPL_NO_DISCARD uint64_t NumFramesDropped () const
 Get the dropped frames in the video stream. More...
 
PEAK_IPL_NO_DISCARD uint64_t FileSize () const
 Get the file size of the video in bytes. More...
 
void ResetFrameCounters ()
 Reset compressed and dropped frame counters. More...
 
void SetQueueSize (int32_t queueSize)
 Set the internal queue size of the video writer. More...
 
PEAK_IPL_NO_DISCARD int32_t QueueSize ()
 Get the internal queue size of the video writer. More...
 
PEAK_IPL_NO_DISCARD Range< int32_t > QueueSizeRange ()
 Get the range of the queue size. More...
 
PEAK_IPL_NO_DISCARD int32_t NumBuffersQueued ()
 Get the count of the currently queued buffers, which are waiting to be processed. More...
 
void WaitUntilFrameDone (int32_t timeout_ms)
 Wait until frame processing is done. More...
 
void WaitUntilQueueEmpty (int32_t timeout_ms)
 Wait until the queue is empty. More...
 

Detailed Description

Writes images to a file in the form of a video.

Constructor & Destructor Documentation

◆ VideoWriter() [1/3]

peak::ipl::VideoWriter::VideoWriter ( )
default

◆ ~VideoWriter()

peak::ipl::VideoWriter::~VideoWriter ( )
inline

◆ VideoWriter() [2/3]

peak::ipl::VideoWriter::VideoWriter ( const VideoWriter &  )
delete

◆ VideoWriter() [3/3]

peak::ipl::VideoWriter::VideoWriter ( VideoWriter &&  other)
inlinenoexcept

Member Function Documentation

◆ Append()

void peak::ipl::VideoWriter::Append ( const Image &  image)
inline

Append an image to the opened video.

Remarks
Note that the image dimensions must be divisible by 8 (May be lifted by a later version)
Parameters
[in]imageThe image to append.
Exceptions
InvalidArgumentExceptionArguments passed are invalid
ImageFormatNotSupportedExceptionimage has unsupported pixel format.
BusyExceptionThe internal queue is full. The image won't be added to the video stream.
ExceptionAn internal error has occurred
Since
1.5

◆ Close()

void peak::ipl::VideoWriter::Close ( )
inline

Close the opened VideoWriter.

Exceptions
ExceptionAn internal error has occurred
Since
1.5

◆ Container()

PEAK_IPL_NO_DISCARD std::shared_ptr<container::IContainer> peak::ipl::VideoWriter::Container ( ) const
inline

Get the used container.

Returns
Instance of the container.

◆ Encoder()

PEAK_IPL_NO_DISCARD std::shared_ptr<encoder::IEncoder> peak::ipl::VideoWriter::Encoder ( ) const
inline

Get the used encoder.

Returns
Instance of the encoder.

◆ FileSize()

PEAK_IPL_NO_DISCARD uint64_t peak::ipl::VideoWriter::FileSize ( ) const
inline

Get the file size of the video in bytes.

Returns
File size of the video.

◆ IsOpen()

PEAK_IPL_NO_DISCARD bool peak::ipl::VideoWriter::IsOpen ( ) const
inline

Check if the VideoWriter is already open.

Returns
Boolean if the VideoWriter is already open.
Exceptions
InvalidArgumentExceptionArguments passed are invalid
ExceptionAn internal error has occurred
Since
1.5

◆ NumBuffersQueued()

PEAK_IPL_NO_DISCARD int32_t peak::ipl::VideoWriter::NumBuffersQueued ( )
inline

Get the count of the currently queued buffers, which are waiting to be processed.

Returns
the count of the queued buffers

◆ NumFramesDropped()

PEAK_IPL_NO_DISCARD uint64_t peak::ipl::VideoWriter::NumFramesDropped ( ) const
inline

Get the dropped frames in the video stream.

Returns
Number of dropped frames in the video stream.

◆ NumFramesEncoded()

PEAK_IPL_NO_DISCARD uint64_t peak::ipl::VideoWriter::NumFramesEncoded ( ) const
inline

Get the encoded frames in the video stream.

Returns
Number of encoded frames in the video stream.

◆ Open() [1/2]

void peak::ipl::VideoWriter::Open ( const std::string &  fileName,
std::shared_ptr< container::IContainer >  container,
std::shared_ptr< encoder::IEncoder >  encoder 
)
inline

Open the VideoWriter and sets up a container and an encoder. The file is created upon receiving the first image with Append.

Parameters
[in]fileNameThe filename of the video as an utf-8 encoded string (u8string)
[in]containerThe container of the video.
[in]encoderThe encoder of the video.
Exceptions
InvalidArgumentExceptionArguments passed are invalid
ExceptionAn internal error has occurred
Since
1.5

◆ Open() [2/2]

void peak::ipl::VideoWriter::Open ( const std::string &  fileName)
inline

Open the VideoWriter with AVI container and mjpeg encoder. The file is created upon receiving the first image with Append.

Parameters
[in]fileNameThe filename of the video as an utf-8 encoded string (u8string)
Exceptions
InvalidArgumentExceptionArguments passed are invalid
ExceptionAn internal error has occurred
Since
1.5

◆ operator<<()

VideoWriter& peak::ipl::VideoWriter::operator<< ( const Image &  image)
inline

Append an image to the opened video.

Remarks
Note that the image dimensions must be divisible by 8 (May be lifted by a later version)
Parameters
[in]imageThe image to append.
Exceptions
InvalidArgumentExceptionArguments passed are invalid
ImageFormatNotSupportedExceptionimage has unsupported pixel format.
BusyExceptionThe internal queue is full. The image won't be added to the video stream.
ExceptionAn internal error has occurred
Since
1.5

◆ operator=() [1/2]

VideoWriter& peak::ipl::VideoWriter::operator= ( const VideoWriter &  )
delete

◆ operator=() [2/2]

VideoWriter& peak::ipl::VideoWriter::operator= ( VideoWriter &&  other)
inlinenoexcept

◆ QueueSize()

PEAK_IPL_NO_DISCARD int32_t peak::ipl::VideoWriter::QueueSize ( )
inline

Get the internal queue size of the video writer.

Returns
the internal queue size

◆ QueueSizeRange()

PEAK_IPL_NO_DISCARD Range<int32_t> peak::ipl::VideoWriter::QueueSizeRange ( )
inline

Get the range of the queue size.

Returns
Range<int32_t> with valid values

◆ ResetFrameCounters()

void peak::ipl::VideoWriter::ResetFrameCounters ( )
inline

Reset compressed and dropped frame counters.

◆ SetQueueSize()

void peak::ipl::VideoWriter::SetQueueSize ( int32_t  queueSize)
inline

Set the internal queue size of the video writer.

Parameters
queueSizeinternal queue size to set. See QueueSizeRange() for a range of valid values

◆ WaitUntilFrameDone()

void peak::ipl::VideoWriter::WaitUntilFrameDone ( int32_t  timeout_ms)
inline

Wait until frame processing is done.

Parameters
timeout_msThe timeout in milliseconds.

◆ WaitUntilQueueEmpty()

void peak::ipl::VideoWriter::WaitUntilQueueEmpty ( int32_t  timeout_ms)
inline

Wait until the queue is empty.

Parameters
timeout_msThe timeout in milliseconds.

The documentation for this class was generated from the following file: