Commit ea3854171c67f63b7689666b61b0d275420b5102

Authored by Hu Chunming
1 parent 6d6c8a18

视频流判断优化

Showing 1 changed file with 6 additions and 8 deletions
FFNvDecoder/FFNvDecoder.cpp
... ... @@ -59,14 +59,6 @@ bool FFNvDecoder::init(FFDecConfig& cfg)
59 59 {
60 60 m_cfg = cfg;
61 61  
62   - fstream infile(cfg.uri);
63   - if (infile.is_open()){
64   - m_bReal = false;
65   - infile.close();
66   - }else {
67   - m_bReal = true;
68   - }
69   -
70 62 return init(cfg.uri.c_str(), cfg.gpuid.c_str(),cfg.force_tcp);
71 63 }
72 64  
... ... @@ -90,6 +82,12 @@ bool FFNvDecoder::init(const char* uri, const char* gpuid, bool force_tcp)
90 82 return false;
91 83 }
92 84  
  85 + if (fmt_ctx->iformat && fmt_ctx->iformat->extensions) {
  86 + m_bReal = false;
  87 + } else {
  88 + m_bReal = true;
  89 + }
  90 +
93 91 // 查找流信息
94 92 if (avformat_find_stream_info(fmt_ctx, nullptr) < 0) {
95 93 cout << "Cannot find input stream information";
... ...