Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::CA::Ffmpeg_Frame_Sink< Mapper > Class Template Reference

Frame sink that streams PPM frames into ffmpeg. More...

#include <ca-ffmpeg-sink.H>

Collaboration diagram for Aleph::CA::Ffmpeg_Frame_Sink< Mapper >:
[legend]

Public Member Functions

 Ffmpeg_Frame_Sink (std::filesystem::path output, Mapper mapper, Ffmpeg_Options opts={})
 Build an ffmpeg frame sink.
 
 Ffmpeg_Frame_Sink (const Ffmpeg_Frame_Sink &)=delete
 
Ffmpeg_Frame_Sink & operator= (const Ffmpeg_Frame_Sink &)=delete
 
 Ffmpeg_Frame_Sink (Ffmpeg_Frame_Sink &&other) noexcept
 Move-construct a sink, transferring the process handle.
 
 ~Ffmpeg_Frame_Sink ()
 Close ffmpeg best-effort.
 
const std::string & command () const noexcept
 Return the ffmpeg command used by this sink.
 
bool active () const noexcept
 Return true when a live ffmpeg process is attached.
 
template<typename Lattice >
void accept (const std::size_t step, const Lattice &frame)
 Send one frame to ffmpeg, or no-op when inactive.
 
void flush ()
 Flush and close the ffmpeg process if one was started.
 

Private Member Functions

void start ()
 

Private Attributes

std::filesystem::path output_
 
Mapper mapper_
 
Ffmpeg_Options opts_ {}
 
std::string command_
 
FILE * pipe_ = nullptr
 

Detailed Description

template<typename Mapper>
class Aleph::CA::Ffmpeg_Frame_Sink< Mapper >

Frame sink that streams PPM frames into ffmpeg.

Template Parameters
Mapperinvocable state_type -> RGB8.

Definition at line 97 of file ca-ffmpeg-sink.H.

Constructor & Destructor Documentation

◆ Ffmpeg_Frame_Sink() [1/3]

template<typename Mapper >
Aleph::CA::Ffmpeg_Frame_Sink< Mapper >::Ffmpeg_Frame_Sink ( std::filesystem::path  output,
Mapper  mapper,
Ffmpeg_Options  opts = {} 
)
inline

Build an ffmpeg frame sink.

Parameters
[in]outputoutput video path.
[in]mapperstate-to-RGB mapper.
[in]optssink options.

Definition at line 130 of file ca-ffmpeg-sink.H.

◆ Ffmpeg_Frame_Sink() [2/3]

template<typename Mapper >
Aleph::CA::Ffmpeg_Frame_Sink< Mapper >::Ffmpeg_Frame_Sink ( const Ffmpeg_Frame_Sink< Mapper > &  )
delete

◆ Ffmpeg_Frame_Sink() [3/3]

template<typename Mapper >
Aleph::CA::Ffmpeg_Frame_Sink< Mapper >::Ffmpeg_Frame_Sink ( Ffmpeg_Frame_Sink< Mapper > &&  other)
inlinenoexcept

Move-construct a sink, transferring the process handle.

Parameters
[in,out]othersink to move from.

Definition at line 142 of file ca-ffmpeg-sink.H.

References Aleph::blossom_maximum_cardinality_matching().

◆ ~Ffmpeg_Frame_Sink()

Member Function Documentation

◆ accept()

template<typename Mapper >
template<typename Lattice >
void Aleph::CA::Ffmpeg_Frame_Sink< Mapper >::accept ( const std::size_t  step,
const Lattice &  frame 
)
inline

Send one frame to ffmpeg, or no-op when inactive.

Template Parameters
Latticerank-2 lattice type.
Parameters
[in]stepsimulation step, accepted for interface symmetry.
[in]frameframe to encode.

Definition at line 178 of file ca-ffmpeg-sink.H.

References ah_runtime_error_if, Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::Ffmpeg_Frame_Sink< Mapper >::mapper_, Aleph::CA::Ffmpeg_Frame_Sink< Mapper >::pipe_, and Aleph::CA::write_ppm().

◆ active()

template<typename Mapper >
bool Aleph::CA::Ffmpeg_Frame_Sink< Mapper >::active ( ) const
inlinenoexcept

Return true when a live ffmpeg process is attached.

Returns
process state.

Definition at line 167 of file ca-ffmpeg-sink.H.

References Aleph::CA::Ffmpeg_Frame_Sink< Mapper >::pipe_.

◆ command()

template<typename Mapper >
const std::string & Aleph::CA::Ffmpeg_Frame_Sink< Mapper >::command ( ) const
inlinenoexcept

Return the ffmpeg command used by this sink.

Returns
command string.

Definition at line 159 of file ca-ffmpeg-sink.H.

References Aleph::CA::Ffmpeg_Frame_Sink< Mapper >::command_.

◆ flush()

◆ operator=()

◆ start()

Member Data Documentation

◆ command_

◆ mapper_

template<typename Mapper >
Mapper Aleph::CA::Ffmpeg_Frame_Sink< Mapper >::mapper_
private

Definition at line 100 of file ca-ffmpeg-sink.H.

Referenced by Aleph::CA::Ffmpeg_Frame_Sink< Mapper >::accept().

◆ opts_

◆ output_

template<typename Mapper >
std::filesystem::path Aleph::CA::Ffmpeg_Frame_Sink< Mapper >::output_
private

Definition at line 99 of file ca-ffmpeg-sink.H.

Referenced by Aleph::CA::Ffmpeg_Frame_Sink< Mapper >::start().

◆ pipe_


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