警告
TorchAudio 的 C++ API 是一项原型功能。 不保证 API/ABI 向后兼容性。
注意
顶级命名空间已从 torchaudio 更改为 torio。
StreamReader 已重命名为 StreamingMediaDecoder。
torio::io::StreamingMediaDecoder¶
StreamingMediaDecoder 是 Python 等效实现所使用的实现,并提供类似的接口。
在处理自定义 I/O(例如内存数据)时,可以使用 StreamingMediaDecoderCustomIO 类。
这两个类都定义了相同的方法,因此它们的用法也相同。
构造函数¶
StreamingMediaDecoder¶
-
class StreamingMediaDecoder¶
逐块获取并解码音频/视频流。
未命名组
private: int drain();
//////////////////////////////////////////////////////////////////////////// 检索 //////////////////////////////////////////////////////////////////////////// public: / /
/ 如果可用,从每个输出流中弹出一个块。std::vector<std::optional<Chunk>> pop_chunks();
/
/
警告
doxygenfunction:无法在来自目录 cpp/xml 的项目"libtorio"的 doxygen xml 输出中解析函数"torio::io::StreamingMediaDecoder::StreamingMediaDecoder",其参数为 (const std::string&, const std::optional<std::string>&, const c10::optional<OptionDict>&)。 潜在匹配项:
- StreamingMediaDecoder(const std::string &src, const std::optional<std::string> &format = std::nullopt, const std::optional<OptionDict> &option = std::nullopt)
StreamingMediaDecoderCustomIO¶
警告
doxygenclass:无法在来自目录 cpp/xml 的项目"libtorio"的 doxygen xml 输出中找到类"torio::io::StreamingMediaDecoderCustomIO"。
警告
doxygenfunction:无法在目录 cpp/xml 中项目“libtorio”的 doxygen XML 输出中找到函数"torio::io::StreamingMediaDecoderCustomIO::StreamingMediaDecoderCustomIO"。
查询方法¶
find_best_audio_stream¶
-
int64_t torio::io::StreamingMediaDecoder::find_best_audio_stream() const¶
使用 ffmpeg 的启发式方法查找合适的音频流。
如果成功,则返回最佳流的索引(>=0)。否则返回一个负值。
find_best_video_stream¶
-
int64_t torio::io::StreamingMediaDecoder::find_best_video_stream() const¶
使用 ffmpeg 的启发式方法查找合适的视频流。
如果成功,将返回最佳流的索引(0>=);否则返回负值。
get_metadata¶
-
OptionDict torio::io::StreamingMediaDecoder::get_metadata() const¶
获取源媒体的元数据。
num_src_streams¶
-
int64_t torio::io::StreamingMediaDecoder::num_src_streams() const¶
获取输入媒体中找到的源流数量。
源流不仅包含音频/视频流,还包括字幕及其他内容。
get_src_stream_info¶
警告
doxygenfunction:无法在目录 cpp/xml 中项目“libtorio”的 doxygen XML 输出中找到函数"torio::io::StreamingMediaDecoder::get_src_stream_info"。
num_out_streams¶
警告
doxygenfunction:无法在目录 cpp/xml 中项目“libtorio”的 doxygen xml 输出中找到函数"torio::io::StreamingMediaDecoder::num_out_streams"。
get_out_stream_info¶
警告
doxygenfunction:无法在目录 cpp/xml 中项目“libtorio”的 doxygen xml 输出中找到函数"torio::io::StreamingMediaDecoder::get_out_stream_info"。
is_buffer_ready¶
警告
doxygenfunction:无法在目录 cpp/xml 中项目“libtorio”的 doxygen xml 输出中找到函数"torio::io::StreamingMediaDecoder::is_buffer_ready"。
配置方法¶
add_audio_stream¶
警告
doxygenfunction:无法在目录 cpp/xml 中项目“libtorio”的 doxygen XML 输出中找到函数"torio::io::StreamingMediaDecoder::add_audio_stream"。
add_video_stream¶
警告
doxygenfunction:无法在目录 cpp/xml 中项目“libtorio”的 doxygen XML 输出中找到函数"torio::io::StreamingMediaDecoder::add_video_stream"。
remove_stream¶
警告
doxygenfunction:无法在目录 cpp/xml 中项目“libtorio”的 doxygen xml 输出中找到函数"torio::io::StreamingMediaDecoder::remove_stream"。
流方法¶
搜索¶
警告
doxygenfunction:无法在目录 cpp/xml 中项目“libtorio”的 doxygen XML 输出中找到函数"torio::io::StreamingMediaDecoder::seek"。
process_packet¶
警告
doxygenfunction:无法在目录 cpp/xml 中项目“libtorio”的 doxygen XML 输出中找到函数"torio::io::StreamingMediaDecoder::process_packet"。
process_packet_block¶
警告
doxygenfunction:无法在目录 cpp/xml 中项目“libtorio”的 doxygen XML 输出中找到函数"torio::io::StreamingMediaDecoder::process_packet_block"。
process_all_packets¶
警告
doxygenfunction:无法在目录 cpp/xml 中项目“libtorio”的 doxygen XML 输出中找到函数"torio::io::StreamingMediaDecoder::process_all_packets"。
fill_buffer¶
警告
doxygenfunction:无法在目录 cpp/xml 中项目“libtorio”的 doxygen xml 输出中找到函数"torio::io::StreamingMediaDecoder::fill_buffer"。
检索方法¶
pop_chunks¶
警告
doxygenfunction:无法在目录 cpp/xml 中项目“libtorio”的 doxygen XML 输出中找到函数"torio::io::StreamingMediaDecoder::pop_chunks"。
支持结构¶
块¶
警告
doxygenstruct:无法在目录 cpp/xml 中项目“libtorio”的 doxygen xml 输出中找到类"torio::io::Chunk"。
SrcStreaminfo¶
OutputStreaminfo¶
警告
doxygenstruct:无法在目录 cpp/xml 中项目“libtorio”的 doxygen xml 输出中找到类"torio::io::OutputStreamInfo"。