|
MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
|
FFmpeg device reader for live camera input with background decode. More...
#include <CameraReader.hpp>
Collaboration diagram for MayaFlux::IO::CameraReader:Public Member Functions | |
| CameraReader () | |
| ~CameraReader () | |
| CameraReader (const CameraReader &)=delete | |
| CameraReader & | operator= (const CameraReader &)=delete |
| CameraReader (CameraReader &&)=delete | |
| CameraReader & | operator= (CameraReader &&)=delete |
| bool | open (const CameraConfig &config) |
| Open a camera device using the supplied config. | |
| void | close () |
| Release codec, demux, and scratch buffer resources. | |
| bool | is_open () const |
| True if the device is open and codec is ready. | |
| std::shared_ptr< Kakshya::CameraContainer > | create_container () const |
| Create a CameraContainer sized to the negotiated device resolution. | |
| bool | pull_frame (const std::shared_ptr< Kakshya::CameraContainer > &container) |
| Decode one frame from the device into the container's m_data[0]. | |
| uint32_t | width () const |
| Negotiated output width in pixels. | |
| uint32_t | height () const |
| Negotiated output height in pixels. | |
| double | frame_rate () const |
| Negotiated frame rate in fps. | |
| void | set_container (const std::shared_ptr< Kakshya::CameraContainer > &container) |
| Store a weak reference to the container for IOService dispatch. | |
| void | pull_frame_all () |
| Signal the background decode thread to pull one frame. | |
| const std::string & | last_error () const |
| Last error string, empty if no error. | |
| void | setup_io_service (uint64_t reader_id) |
| Setup an IOService for this reader with the given reader_id. | |
Private Member Functions | |
| void | start_decode_thread () |
| void | stop_decode_thread () |
| void | decode_thread_func () |
Private Attributes | |
| std::shared_ptr< FFmpegDemuxContext > | m_demux |
| std::shared_ptr< VideoStreamContext > | m_video |
| std::shared_mutex | m_ctx_mutex |
| std::vector< uint8_t > | m_sws_buf |
| std::string | m_last_error |
| std::weak_ptr< Kakshya::CameraContainer > | m_container_ref |
| std::shared_ptr< Registry::Service::IOService > | m_standalone_service |
| uint64_t | m_standalone_reader_id {} |
| bool | m_owns_service {} |
| bool | m_scaler_ready {} |
| std::thread | m_decode_thread |
| std::mutex | m_decode_mutex |
| std::condition_variable | m_decode_cv |
| std::atomic< bool > | m_decode_stop { false } |
| std::atomic< bool > | m_decode_active { false } |
| std::atomic< bool > | m_frame_requested { false } |
FFmpeg device reader for live camera input with background decode.
Owns the FFmpeg demux and video codec contexts for a single camera device. Decodes frames on a dedicated thread signalled by IOService::request_frame, writing RGBA pixels directly into CameraContainer::mutable_frame_ptr() and marking the container READY. The graphics thread is never blocked by device I/O.
Two integration paths:
Unlike VideoFileReader there is no ring buffer, no seek, and no batch decode — the device is a live unbounded source. One frame is pulled per process cycle, demand-driven by CameraContainer::process_default().
Definition at line 71 of file CameraReader.hpp.