Пример #1
0
bool FFmpegImportFileHandle::Init()
{
   //FFmpegLibsInst->LoadLibs(NULL,false); //Loaded at startup or from Prefs now

   if (!FFmpegLibsInst->ValidLibsLoaded()) return false;

   av_log_set_callback(av_log_wx_callback);

   int err = ufile_fopen_input(&mFormatContext, mName);
   if (err < 0)
   {
      wxLogError(wxT("FFmpeg : av_open_input_file() failed for file %s"),mName.c_str());
      return false;
   }

   err = av_find_stream_info(mFormatContext);
   if (err < 0)
   {
      wxLogError(wxT("FFmpeg : av_find_stream_info() failed for file %s"),mName.c_str());
      return false;
   }

   InitCodecs();
   return true;
}
Пример #2
0
bool FFmpegImportFileHandle::Init()
{
   //FFmpegLibsInst->LoadLibs(NULL,false); //Loaded at startup or from Prefs now

   if (!FFmpegLibsInst->ValidLibsLoaded()) return false;

   av_log_set_callback(av_log_wx_callback);

   int err;
   {
      std::unique_ptr<FFmpegContext> tempContext;
      err = ufile_fopen_input(tempContext, mName);
      if (err < 0)
      {
         wxLogError(wxT("FFmpeg : av_open_input_file() failed for file %s"), mName.c_str());
         return false;
      }
      wxASSERT(tempContext.get());
      // Move from unique to shared pointer
      mContext.reset(tempContext.release());
   }
   mFormatContext = mContext->ic_ptr;

   err = avformat_find_stream_info(mFormatContext, NULL);
   if (err < 0)
   {
      wxLogError(wxT("FFmpeg: avformat_find_stream_info() failed for file %s"),mName.c_str());
      return false;
   }

   InitCodecs();
   return true;
}