MCPcopy Create free account
hub / github.com/IENT/YUView / openInput

Method openInput

YUViewLib/src/ffmpeg/FFmpegVersionHandler.cpp:394–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392}
393
394bool FFmpegVersionHandler::openInput(AVFormatContextWrapper &fmt, QString url)
395{
396 AVFormatContext *f_ctx = nullptr;
397 int ret =
398 this->lib.avformat.avformat_open_input(&f_ctx, url.toStdString().c_str(), nullptr, nullptr);
399 if (ret < 0)
400 {
401 this->log(QString("Error opening file (avformat_open_input). Ret code %1").arg(ret));
402 return false;
403 }
404 if (f_ctx == nullptr)
405 {
406 this->log(QString("Error opening file (avformat_open_input). No format context returned."));
407 return false;
408 }
409
410 // The wrapper will take ownership of this pointer
411 fmt = AVFormatContextWrapper(f_ctx, libVersion);
412
413 ret = lib.avformat.avformat_find_stream_info(fmt.getFormatCtx(), nullptr);
414 if (ret < 0)
415 {
416 this->log(QString("Error opening file (avformat_find_stream_info). Ret code %1").arg(ret));
417 return false;
418 }
419
420 return true;
421}
422
423AVCodecParametersWrapper FFmpegVersionHandler::allocCodecParameters()
424{

Callers 1

Calls 3

logMethod · 0.95
getFormatCtxMethod · 0.80

Tested by

no test coverage detected