|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Directory-backed sink for CA frames. More...
#include <ca-frame-stream.H>
Public Member Functions | |
| Directory_Frame_Sink (Frame_Stream_Options opts) | |
| Build a frame sink. | |
| const Frame_Stream_Options & | options () const noexcept |
| Return the immutable sink options. | |
| const Array< std::pair< std::size_t, std::filesystem::path > > & | written_frames () const noexcept |
| Return the frame files written so far. | |
| template<typename Lattice > | |
| void | accept (std::size_t step, const Lattice &frame) |
| Accept a frame and write it if it passes the stride filter. | |
| void | flush () const |
| Write the optional manifest. | |
| std::string | montage_command_hint (const std::string &output_file="ca.mp4", unsigned fps=24) const |
| Return an ffmpeg command hint for the current frame sequence. | |
Private Member Functions | |
| std::filesystem::path | frame_path (std::size_t step) const |
| template<typename Lattice > | |
| void | write_one (std::ostream &out, const Lattice &frame) const |
Private Attributes | |
| Frame_Stream_Options | opts_ |
| Array< std::pair< std::size_t, std::filesystem::path > > | written_ |
Directory-backed sink for CA frames.
The sink is format-agnostic: accept(step, frame) picks the exporter configured in Frame_Stream_Options. A CSV manifest is kept in memory and written on flush(); it lists step, format and path for every frame.
Definition at line 298 of file ca-frame-stream.H.
|
inlineexplicit |
Build a frame sink.
The destination directory is created immediately.
| [in] | opts | sink options. |
| std::domain_error | if stride == 0. |
| std::runtime_error | if the directory cannot be created. |
Definition at line 348 of file ca-frame-stream.H.
References ah_domain_error_if, ah_runtime_error_if, Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::Frame_Stream_Options::directory, opts_, and Aleph::CA::Frame_Stream_Options::stride.
Accept a frame and write it if it passes the stride filter.
| Lattice | 2D lattice type. |
| [in] | step | simulation step. |
| [in] | frame | frame to export. |
| std::runtime_error | on file or exporter failure. |
Definition at line 384 of file ca-frame-stream.H.
References ah_runtime_error_if, Aleph::Array< T >::append(), Aleph::blossom_maximum_cardinality_matching(), frame_path(), opts_, out, Aleph::CA::Frame_Stream_Options::stride, write_one(), and written_.
|
inline |
Write the optional manifest.
The manifest is a CSV file named manifest.csv with columns step,format,path.
| std::runtime_error | on write failure. |
Definition at line 408 of file ca-frame-stream.H.
References ah_runtime_error_if, Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::Frame_Stream_Options::directory, Aleph::CA::Frame_Stream_Options::format, Aleph::CA::ca_frame_stream_detail::format_name(), opts_, out, Aleph::CA::Frame_Stream_Options::write_manifest, and written_.
|
inlineprivate |
Definition at line 303 of file ca-frame-stream.H.
References Aleph::CA::Frame_Stream_Options::directory, Aleph::CA::ca_frame_stream_detail::extension(), Aleph::CA::Frame_Stream_Options::format, opts_, Aleph::CA::ca_frame_stream_detail::padded_step(), Aleph::CA::Frame_Stream_Options::prefix, and Aleph::CA::Frame_Stream_Options::zero_pad.
Referenced by accept().
|
inline |
Return an ffmpeg command hint for the current frame sequence.
The command is only a string; Aleph-w does not execute external encoders. It is meaningful for image formats (PGM/PPM).
| [in] | output_file | video filename to place in the command. |
| [in] | fps | frames per second. |
Definition at line 449 of file ca-frame-stream.H.
References Aleph::blossom_maximum_cardinality_matching(), cmd, Aleph::CA::Frame_Stream_Options::directory, Aleph::CA::ca_frame_stream_detail::extension(), Aleph::CA::Frame_Stream_Options::format, opts_, Aleph::CA::Frame_Stream_Options::prefix, and Aleph::CA::Frame_Stream_Options::zero_pad.
|
inlinenoexcept |
Return the immutable sink options.
Definition at line 360 of file ca-frame-stream.H.
References opts_.
|
inlineprivate |
Definition at line 311 of file ca-frame-stream.H.
References Aleph::CA::CSV, Aleph::CA::Frame_Stream_Options::csv_options, Aleph::CA::Frame_Stream_Options::format, Aleph::CA::JSON, Aleph::CA::Frame_Stream_Options::json_options, Aleph::CA::Frame_Stream_Options::netpbm_options, opts_, out, Aleph::CA::PGM, Aleph::CA::PPM, Aleph::CA::render_lattice_tikz(), Aleph::CA::RLE, Aleph::CA::Frame_Stream_Options::rle_options, Aleph::CA::TikZ, Aleph::CA::Frame_Stream_Options::tikz_options, Aleph::CA::write_csv(), Aleph::CA::write_json(), Aleph::CA::write_pgm(), Aleph::CA::write_ppm(), and Aleph::CA::write_rle().
Referenced by accept().
|
inlinenoexcept |
Return the frame files written so far.
(step, path) entries. Definition at line 368 of file ca-frame-stream.H.
References written_.
|
private |
Definition at line 300 of file ca-frame-stream.H.
Referenced by Directory_Frame_Sink(), accept(), flush(), frame_path(), montage_command_hint(), options(), and write_one().
|
private |
Definition at line 301 of file ca-frame-stream.H.
Referenced by accept(), flush(), and written_frames().