0
私は、メディアファイルのMIMEタイプを取得するためにlibavformatを使用する必要がある、Arch Linux上で動作するC++アプリケーションで動作します。現在、次の行を使用しています:libavformat:形式を取得するC++のMIMEタイプ
std::string path = "/path/to/file.extension";
av_register_all();
AVFormatContext* pFormatCtx = avformat_alloc_context();
avformat_open_input(&pFormatCtx, path.c_str(), NULL, NULL);
avformat_find_stream_info(pFormatCtx, NULL);
std::string mimeType(pFormatCtx->iformat->mime_type);
これで、* .mkv(Matroska)ファイルで期待通りに動作します。期待されるカンマ区切りのmimeType文字列 "video/x-matroska、..."を返します。しかし、* .mp4や* .aviのような他のファイルフォーマットでは、iformat-> mime_typeは常にNULLを返します。
他のコンテナフォーマットのMimeタイプを取得するにはどうすればよいですか?