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

◆ find_best_stream()

int MayaFlux::IO::FFmpegDemuxContext::find_best_stream ( int  media_type,
const void **  out_codec = nullptr 
) const

Find the best stream of the requested media type.

Parameters
media_typeAVMediaType value (AVMEDIA_TYPE_AUDIO, AVMEDIA_TYPE_VIDEO, …)
out_codecReceives a pointer to the matched codec (may be nullptr if caller does not need it).
Returns
Stream index ≥ 0 on success, negative on failure.

Definition at line 100 of file FFmpegDemuxContext.cpp.

101{
102 if (!format_context)
103 return -1;
104
105 const AVCodec* codec = nullptr;
106 int idx = av_find_best_stream(
108 static_cast<AVMediaType>(media_type),
109 -1, -1,
110 &codec,
111 0);
112
113 if (out_codec)
114 *out_codec = codec;
115
116 return idx;
117}
AVFormatContext * format_context
Owned; freed in destructor.

References format_context.

Referenced by MayaFlux::IO::SoundFileReader::can_read(), MayaFlux::IO::AudioStreamContext::open(), MayaFlux::IO::VideoStreamContext::open(), and MayaFlux::IO::VideoStreamContext::open_device().

+ Here is the caller graph for this function: