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

◆ open()

bool MayaFlux::IO::FFmpegDemuxContext::open ( const std::string &  filepath)

Open a media file and probe stream information.

Parameters
filepathAbsolute or relative path to the media file.
Returns
True on success; false sets internal error string.

Definition at line 36 of file FFmpegDemuxContext.cpp.

37{
38 close();
40
41 if (avformat_open_input(&format_context, filepath.c_str(), nullptr, nullptr) < 0) {
42 m_last_error = "avformat_open_input failed: " + filepath;
43 return false;
44 }
45
46 if (avformat_find_stream_info(format_context, nullptr) < 0) {
47 avformat_close_input(&format_context);
48 m_last_error = "avformat_find_stream_info failed: " + filepath;
49 return false;
50 }
51
52 return true;
53}
AVFormatContext * format_context
Owned; freed in destructor.
void close()
Close the format context and release all demux resources.
static void init_ffmpeg()
Initialise FFmpeg logging level once per process.

References close(), format_context, init_ffmpeg(), and m_last_error.

Referenced by MayaFlux::IO::SoundFileReader::can_read().

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