diff --git a/FFNvDecoder/FFNvDecoder.cpp b/FFNvDecoder/FFNvDecoder.cpp index 2fa20b6..b17f3bd 100644 --- a/FFNvDecoder/FFNvDecoder.cpp +++ b/FFNvDecoder/FFNvDecoder.cpp @@ -59,14 +59,6 @@ bool FFNvDecoder::init(FFDecConfig& cfg) { m_cfg = cfg; - fstream infile(cfg.uri); - if (infile.is_open()){ - m_bReal = false; - infile.close(); - }else { - m_bReal = true; - } - return init(cfg.uri.c_str(), cfg.gpuid.c_str(),cfg.force_tcp); } @@ -90,6 +82,12 @@ bool FFNvDecoder::init(const char* uri, const char* gpuid, bool force_tcp) return false; } + if (fmt_ctx->iformat && fmt_ctx->iformat->extensions) { + m_bReal = false; + } else { + m_bReal = true; + } + // 查找流信息 if (avformat_find_stream_info(fmt_ctx, nullptr) < 0) { cout << "Cannot find input stream information";