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

◆ can_read()

bool MayaFlux::IO::SoundFileReader::can_read ( const std::string &  filepath) const
overridevirtual

Check if this reader can open the given file.

Parameters
filepathPath to the file.
Returns
True if the file can be read, false otherwise.

Implements MayaFlux::IO::FileReader.

Definition at line 69 of file SoundFileReader.cpp.

70{
71 FFmpegDemuxContext probe;
72 if (!probe.open(resolve_path(filepath)))
73 return false;
74
75 const AVCodec* codec = nullptr;
76 int idx = probe.find_best_stream(AVMEDIA_TYPE_AUDIO,
77 reinterpret_cast<const void**>(&codec));
78 return idx >= 0 && codec != nullptr;
79}
static std::string resolve_path(const std::string &filepath)
Resolve a filepath against the project source root if not found as-is.

References MayaFlux::IO::FFmpegDemuxContext::find_best_stream(), MayaFlux::IO::FFmpegDemuxContext::open(), and MayaFlux::IO::FileReader::resolve_path().

Referenced by load_bounded().

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