3

誰かがでアクセス違反で次がクラッシュする理由を説明できます0xFFFFFFFFavformat_open_input

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;
}
4

1 に答える 1

1

の結果は、が返さu8(filename).c_str()れるまで使用できるはずです。avformat_open_inputそれはおそらくあなたがそれを与えたポインタを保存し、そしてそれを中に使用しているでしょうavformat_find_stream_info

これらのavformat関数またはその実装のドキュメントを投稿して、実際にそれが行われているかどうかを確認してください。


avformat_open_input何か悪いことをしているようには見えません。プログラムの早い段階で未定義の動作が発生しているのではないかと思います。valgrindや静的分析などのツールを使用してみて、それで何かがわかるかどうかを確認してください。

于 2012-04-12T15:58:53.340 に答える