任何人都可以解釋爲什麼以下崩潰與訪問衝突0xFFFFFFFF
在avformat_open_input
?右值的c_str() - 不安全?
std::string u8(const std::wstring& str)
{
return boost::locale::conv::utf_to_utf<char>(str);
}
AVFormatContext* open_input(const std::wstring& filename)
{
AVFormatContext* context = nullptr;
avformat_open_input(&context, u8(filename).c_str(), nullptr, nullptr);
avformat_find_stream_info(context, nullptr);
return context;
}
而以下工作:
AVFormatContext* open_input(const std::wstring& filename)
{
auto u8filename = u8(filename);
AVFormatContext* context = nullptr;
avformat_open_input(&context, u8filename.c_str(), nullptr, nullptr);
avformat_find_stream_info(context, nullptr);
return context;
}
向我們顯示avformat_open_input的定義。 – Tomek 2012-04-12 15:55:56
@Tomek:http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavformat/utils.c;h=2f926bb4e0784b031456fce7b477a7eebac8b440;hb=refs/heads/master#l583 – ronag 2012-04-12 15:59:37
這是什麼u8'的實現看起來像什麼? – 2012-04-12 16:06:04