MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ close()

void MayaFlux::IO::VideoFileReader::close ( )
overridevirtual

Close the currently open file.

Implements MayaFlux::IO::FileReader.

Definition at line 117 of file VideoFileReader.cpp.

118{
120 m_container_ref.reset();
121
122 std::unique_lock ctx_lock(m_context_mutex);
123
124 if (m_audio) {
125 m_audio->close();
126 m_audio.reset();
127 }
128 if (m_video) {
129 m_video->close();
130 m_video.reset();
131 }
132 if (m_demux) {
133 m_demux->close();
134 m_demux.reset();
135 }
136
137 m_audio_container.reset();
138 m_sws_buf.clear();
139 m_sws_buf.shrink_to_fit();
140
141 {
142 std::lock_guard lock(m_metadata_mutex);
143 m_cached_metadata.reset();
144 m_cached_regions.clear();
145 }
146
147 m_decode_head.store(0);
148 clear_error();
149
150 if (m_owns_io_service) {
152 .unregister_service<Registry::Service::IOService>();
153 m_io_service.reset();
154 m_owns_io_service = false;
155 }
156}
std::vector< FileRegion > m_cached_regions
std::vector< uint8_t > m_sws_buf
One-frame sws scratch buffer (padded linesize, reused by decode thread).
std::weak_ptr< Kakshya::VideoFileContainer > m_container_ref
std::shared_ptr< FFmpegDemuxContext > m_demux
std::shared_ptr< Registry::Service::IOService > m_io_service
std::shared_ptr< VideoStreamContext > m_video
std::shared_ptr< AudioStreamContext > m_audio
std::optional< FileMetadata > m_cached_metadata
std::shared_ptr< Kakshya::SoundFileContainer > m_audio_container
std::atomic< uint64_t > m_decode_head
static BackendRegistry & instance()
Get the global registry instance.
void unregister_service()
Unregister a service.

References clear_error(), MayaFlux::Registry::BackendRegistry::instance(), m_audio, m_audio_container, m_cached_metadata, m_cached_regions, m_container_ref, m_context_mutex, m_decode_head, m_demux, m_io_service, m_metadata_mutex, m_owns_io_service, m_sws_buf, m_video, stop_decode_thread(), and MayaFlux::Registry::BackendRegistry::unregister_service().

Referenced by open(), and ~VideoFileReader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: