SCPevaluation::SCPevaluation( UserInteraction* _userInteraction, const Objective* const objective_, const DynamicDiscretization* const dynamic_discretization_, const Constraint* const constraint_, BooleanType _isCP ) : AlgorithmicBase( _userInteraction ) { // setup options and loggings for stand-alone instances if ( _userInteraction == 0 ) { setupOptions( ); setupLogging( ); } if( objective_ != 0 ) objective = new Objective( *objective_ ); else objective = 0; if( dynamic_discretization_ != 0 ) dynamicDiscretization = dynamic_discretization_->clone(); else dynamicDiscretization = 0; if( constraint_ != 0 ) constraint = new Constraint( *constraint_ ); else constraint = 0; objectiveValue = 0.0; isCP = _isCP; areSensitivitiesFrozen = BT_FALSE; }
SimulationEnvironment::SimulationEnvironment( double _startTime, double _endTime, Process& _process, Controller& _controller ) : SimulationBlock( BN_SIMULATION_ENVIRONMENT ) { setupOptions( ); setupLogging( ); startTime = _startTime; endTime = _endTime; if ( _process.isDefined( ) == BT_TRUE ) { process = &_process; setStatus( BS_NOT_INITIALIZED ); } else process = 0; if ( _controller.isDefined( ) == BT_TRUE ) controller = &_controller; else controller = 0; nSteps = 0; }
BEGIN_NAMESPACE_ACADO // // PUBLIC MEMBER FUNCTIONS: // MultiObjectiveAlgorithm::MultiObjectiveAlgorithm() :OptimizationAlgorithm(){ m = 0; N = 0; count = 0; totalNumberOfSQPiterations = 0; totalCPUtime = 0; xResults = 0; xaResults = 0; pResults = 0; uResults = 0; wResults = 0; setupOptions( ); }
Controller::Controller( ControlLaw& _controlLaw, Estimator& _estimator, ReferenceTrajectory& _referenceTrajectory ) : SimulationBlock( BN_CONTROLLER ) { setupOptions( ); setupLogging( ); if ( _controlLaw.isDefined( ) == BT_TRUE ) { controlLaw = &_controlLaw; setStatus( BS_NOT_INITIALIZED ); } else controlLaw = 0; if ( _estimator.isDefined( ) == BT_TRUE ) estimator = &_estimator; else estimator = 0; if ( _referenceTrajectory.isDefined( ) == BT_TRUE ) referenceTrajectory = &_referenceTrajectory; else referenceTrajectory = 0; setStatus( BS_NOT_INITIALIZED ); }
void MooseApp::run() { setupOptions(); runInputFile(); executeExecutioner(); }
void MooseApp::run() { Moose::perf_log.push("Full Runtime", "Application"); Moose::perf_log.push("Application Setup", "Setup"); try { setupOptions(); runInputFile(); } catch (std::exception & err) { mooseError(err.what()); } Moose::perf_log.pop("Application Setup", "Setup"); if (!_check_input) executeExecutioner(); else { errorCheck(); // Output to stderr, so it is easier for peacock to get the result Moose::err << "Syntax OK" << std::endl; } Moose::perf_log.pop("Full Runtime", "Application"); }
BEGIN_NAMESPACE_ACADO // IMPLEMENTATION OF PUBLIC MEMBER FUNCTIONS: // ------------------------------------------ EllipsoidalIntegrator::EllipsoidalIntegrator():AlgorithmicBase(){ setupOptions(); }
BandedCPsolver::BandedCPsolver( UserInteraction* _userInteraction ) : AlgorithmicBase( _userInteraction ) { // setup options and loggings for stand-alone instances if ( _userInteraction == 0 ) { setupOptions( ); setupLogging( ); } }
NLPderivativeApproximation::NLPderivativeApproximation( UserInteraction* _userInteraction ) : AlgorithmicBase( _userInteraction ) { // setup options and loggings for stand-alone instances if ( _userInteraction == 0 ) { setupOptions( ); setupLogging( ); } hessianScaling = 1.0; }
DynamicDiscretization::DynamicDiscretization( UserInteraction* _userInteraction ) :AlgorithmicBase( _userInteraction ){ // setup options and loggings for stand-alone instances if ( _userInteraction == 0 ){ setupOptions( ); setupLogging( ); } initializeVariables(); }
DllExport int STDCALL C__hisCallSolver(void* Cptr) { int rc = 1; char buffer[1024]; gamshighs_t* gh; HighsStatus status; gh = (gamshighs_t*)Cptr; assert(gh->gmo != NULL); assert(gh->gev != NULL); gevLogStatPChar(gh->gev, "HiGHS " XQUOTE(HIGHS_VERSION_MAJOR) "." XQUOTE(HIGHS_VERSION_MINOR) "." XQUOTE(HIGHS_VERSION_PATCH) " [date: " HIGHS_COMPILATION_DATE ", git hash: " HIGHS_GITHASH "]\n"); gevLogStatPChar(gh->gev, "Copyright (c) 2019 ERGO-Code under MIT licence terms.\n"); gmoModelStatSet(gh->gmo, gmoModelStat_NoSolutionReturned); gmoSolveStatSet(gh->gmo, gmoSolveStat_SystemErr); /* get the problem into a normal form */ gmoObjStyleSet(gh->gmo, gmoObjType_Fun); gmoObjReformSet(gh->gmo, 1); gmoIndexBaseSet(gh->gmo, 0); gmoSetNRowPerm(gh->gmo); /* hide =N= rows */ gmoMinfSet(gh->gmo, -HIGHS_CONST_INF); gmoPinfSet(gh->gmo, HIGHS_CONST_INF); if( setupOptions(gh) ) goto TERMINATE; if( setupProblem(gh) ) goto TERMINATE; gevTimeSetStart(gh->gev); /* solve the problem */ status = gh->highs->run(); /* pass solution, status, etc back to GMO */ if( processSolve(gh, status) ) goto TERMINATE; rc = 0; TERMINATE: delete gh->lp; gh->lp = NULL; delete gh->highs; gh->highs= NULL; delete gh->options; gh->options = NULL; return rc; }
BEGIN_NAMESPACE_ACADO // // PUBLIC MEMBER FUNCTIONS: // BandedCPsolver::BandedCPsolver( ) : AlgorithmicBase( ) { setupOptions( ); setupLogging( ); }
void Scenario::setupOptions(int argc, char **argv, boost::program_options::options_description &options, boost::program_options::variables_map &variables) { boost::program_options::options_description local("Scenario " + d->m_name); setupOptions(local, variables); if (variables.empty()) options.add(local); else d->m_options = variables; }
void MooseApp::run() { Moose::perf_log.push("Full Runtime", "Application"); Moose::perf_log.push("Application Setup", "Setup"); setupOptions(); runInputFile(); Moose::perf_log.pop("Application Setup", "Setup"); executeExecutioner(); Moose::perf_log.pop("Full Runtime", "Application"); }
BEGIN_NAMESPACE_ACADO // // PUBLIC MEMBER FUNCTIONS: // ExportModule::ExportModule( ) : UserInteraction( ) { setupOptions( ); commonHeaderName = "acado.h"; }
BEGIN_NAMESPACE_ACADO // // PUBLIC MEMBER FUNCTIONS: // NLPderivativeApproximation::NLPderivativeApproximation( ) : AlgorithmicBase( ) { setupOptions( ); setupLogging( ); hessianScaling = 1.0; }
QMirClientClientIntegration::QMirClientClientIntegration() : QPlatformIntegration() , mNativeInterface(new QMirClientNativeInterface) , mFontDb(new QGenericUnixFontDatabase) , mServices(new QMirClientPlatformServices) , mClipboard(new QMirClientClipboard) , mScaleFactor(1.0) { setupOptions(); setupDescription(); // Create new application instance mInstance = u_application_instance_new_from_description_with_options(mDesc, mOptions); if (mInstance == nullptr) qFatal("QMirClientClientIntegration: connection to Mir server failed. Check that a Mir server is\n" "running, and the correct socket is being used and is accessible. The shell may have\n" "rejected the incoming connection, so check its log file"); mNativeInterface->setMirConnection(u_application_instance_get_mir_connection(mInstance)); // Create default screen. mScreen = new QMirClientScreen(u_application_instance_get_mir_connection(mInstance)); screenAdded(mScreen); // Initialize input. if (qEnvironmentVariableIsEmpty("QTUBUNTU_NO_INPUT")) { mInput = new QMirClientInput(this); mInputContext = QPlatformInputContextFactory::create(); } else { mInput = nullptr; mInputContext = nullptr; } // compute the scale factor const int defaultGridUnit = 8; int gridUnit = defaultGridUnit; QByteArray gridUnitString = qgetenv("GRID_UNIT_PX"); if (!gridUnitString.isEmpty()) { bool ok; gridUnit = gridUnitString.toInt(&ok); if (!ok) { gridUnit = defaultGridUnit; } } mScaleFactor = static_cast<qreal>(gridUnit) / defaultGridUnit; }
void QPrintDialogPrivate::init() { Q_Q(QPrintDialog); numCopies = 1; if (_qt_print_dialog_creator) (*_qt_print_dialog_creator)(q); setupDestination(); setupPrinterSettings(); setupPaper(); setupOptions(); setPrinter(printer, true); q->installEventFilter(q); }
MultiObjectiveAlgorithm::MultiObjectiveAlgorithm( const OCP& ocp_ ) :OptimizationAlgorithm( ocp_ ){ m = ocp->getNumberOfMayerTerms(); N = 0; count = 0; totalNumberOfSQPiterations = 0; totalCPUtime = 0; xResults = 0; xaResults = 0; pResults = 0; uResults = 0; wResults = 0; setupOptions( ); }
BEGIN_NAMESPACE_ACADO // // PUBLIC MEMBER FUNCTIONS: // DynamicDiscretization::DynamicDiscretization() :AlgorithmicBase( ){ setupOptions( ); setupLogging( ); initializeVariables(); }
BEGIN_NAMESPACE_ACADO // // PUBLIC MEMBER FUNCTIONS: // Controller::Controller( ) : SimulationBlock( BN_CONTROLLER ) { setupOptions( ); setupLogging( ); controlLaw = 0; estimator = 0; referenceTrajectory = 0; setStatus( BS_NOT_INITIALIZED ); }
BEGIN_NAMESPACE_ACADO // // PUBLIC MEMBER FUNCTIONS: // NLPsolver::NLPsolver( UserInteraction* _userInteraction ) : AlgorithmicBase( _userInteraction ) { // setup options and loggings for stand-alone instances if ( _userInteraction == 0 ) { setupOptions( ); setupLogging( ); } numberOfSteps = 0; }
BEGIN_NAMESPACE_ACADO SimulationEnvironment::SimulationEnvironment( ) : SimulationBlock( BN_SIMULATION_ENVIRONMENT ) { setupOptions( ); setupLogging( ); startTime = 0.0; endTime = 0.0; process = 0; controller = 0; nSteps = 0; setStatus( BS_NOT_INITIALIZED ); }
BEGIN_NAMESPACE_ACADO // // PUBLIC MEMBER FUNCTIONS: // SCPevaluation::SCPevaluation( ) : AlgorithmicBase( ) { setupOptions( ); setupLogging( ); objective = 0; dynamicDiscretization = 0; constraint = 0; objectiveValue = 0.0; isCP = BT_FALSE; areSensitivitiesFrozen = BT_FALSE; }
Properties::Properties(QWidget *parent) : QDialog(parent) { setWindowTitle(QString(PropellerIdeGuiKey)+tr(" Properties")); configSettings(); setupFolders(); setupOptions(); setupHighlight(); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); QVBoxLayout *layout = new QVBoxLayout(this); layout->addWidget(&tabWidget); layout->addWidget(buttonBox); setLayout(layout); setWindowFlags(Qt::Tool); resize(500,260); }
EllipsoidalIntegrator::EllipsoidalIntegrator( const DifferentialEquation &rhs_, const int &N_ ):AlgorithmicBase(){ ASSERT( rhs_.isODE( ) == BT_TRUE ); setupOptions(); init( rhs_, N_ ); }
BEGIN_NAMESPACE_ACADO // // PUBLIC MEMBER FUNCTIONS: // Integrator::Integrator( ) :AlgorithmicBase( ){ // RHS: // -------- rhs = 0; m = 0; ma = 0; mdx = 0; md = 0; mn = 0; mu = 0; mui = 0; mp = 0; mpi = 0; mw = 0; transition = 0; // SETTINGS: // --------- h = (double*)calloc(1,sizeof(double)); h[0] = 0.001 ; hmin = 0.000001 ; hmax = 1.0e10 ; tune = 0.5 ; TOL = 0.000001 ; // INTERNAL INDEX LISTS: // --------------------- diff_index = 0; ddiff_index = 0; alg_index = 0; control_index = 0; parameter_index = 0; int_control_index = 0; int_parameter_index = 0; disturbance_index = 0; time_index = 0; // OTHERS: // ------- count = 0 ; count2 = 0 ; count3 = 0 ; maxNumberOfSteps = 1000; // PRINT-LEVEL: // ------------ PrintLevel = LOW; // SEED DIMENSIONS: // ---------------- nFDirs = 0; nBDirs = 0; nFDirs2 = 0; nBDirs2 = 0; // THE STATE OF AGGREGATION: // ------------------------- soa = SOA_UNFROZEN; setupOptions( ); setupLogging( ); }
/*! class Memcheck */ Memcheck::Memcheck() : ToolObject( "memcheck", VGTOOL::ID_MEMCHECK ) { setupOptions(); }
/* * m e x F u n c t i o n */ void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ) { /* inputs */ SymmetricMatrix *H=0; Matrix *A=0; real_t *g=0, *lb=0, *ub=0, *lbA=0, *ubA=0; HessianType hessianType = HST_UNKNOWN; double *x0=0, *R=0, *R_for=0; double *guessedBounds=0, *guessedConstraints=0; int H_idx=-1, g_idx=-1, A_idx=-1, lb_idx=-1, ub_idx=-1, lbA_idx=-1, ubA_idx=-1; int options_idx=-1, x0_idx=-1, auxInput_idx=-1; /* Setup default options */ Options options; options.printLevel = PL_LOW; #ifdef __DEBUG__ options.printLevel = PL_HIGH; #endif #ifdef __SUPPRESSANYOUTPUT__ options.printLevel = PL_NONE; #endif /* dimensions */ uint_t nV=0, nC=0, nP=0; BooleanType isSimplyBoundedQp = BT_FALSE; /* sparse matrix indices and values */ sparse_int_t *Hir=0, *Hjc=0, *Air=0, *Ajc=0; real_t *Hv=0, *Av=0; /* I) CONSISTENCY CHECKS: */ /* 1a) Ensure that qpOASES is called with a feasible number of input arguments. */ if ( ( nrhs < 4 ) || ( nrhs > 9 ) ) { myMexErrMsgTxt( "ERROR (qpOASES): Invalid number of input arguments!\nType 'help qpOASES' for further information." ); return; } /* 2) Check for proper number of output arguments. */ if ( nlhs > 6 ) { myMexErrMsgTxt( "ERROR (qpOASES): At most six output arguments are allowed: \n [x,fval,exitflag,iter,lambda,auxOutput]!" ); return; } if ( nlhs < 1 ) { myMexErrMsgTxt( "ERROR (qpOASES): At least one output argument is required: [x,...]!" ); return; } /* II) PREPARE RESPECTIVE QPOASES FUNCTION CALL: */ /* Choose between QProblem and QProblemB object and assign the corresponding * indices of the input pointer array in to order to access QP data correctly. */ g_idx = 1; if ( mxIsEmpty(prhs[0]) == 1 ) { H_idx = -1; nV = (int_t)mxGetM( prhs[ g_idx ] ); /* if Hessian is empty, row number of gradient vector */ } else { H_idx = 0; nV = (int_t)mxGetM( prhs[ H_idx ] ); /* row number of Hessian matrix */ } nP = (int_t)mxGetN( prhs[ g_idx ] ); /* number of columns of the gradient matrix (vectors series have to be stored columnwise!) */ if ( nrhs <= 6 ) isSimplyBoundedQp = BT_TRUE; else isSimplyBoundedQp = BT_FALSE; /* 0) Check whether options are specified .*/ if ( isSimplyBoundedQp == BT_TRUE ) { if ( ( nrhs >= 5 ) && ( !mxIsEmpty(prhs[4]) ) && ( mxIsStruct(prhs[4]) ) ) options_idx = 4; } else { /* Consistency check */ if ( ( !mxIsEmpty(prhs[4]) ) && ( mxIsStruct(prhs[4]) ) ) { myMexErrMsgTxt( "ERROR (qpOASES): Fifth input argument must not be a struct when solving QP with general constraints!\nType 'help qpOASES' for further information." ); return; } if ( ( nrhs >= 8 ) && ( !mxIsEmpty(prhs[7]) ) && ( mxIsStruct(prhs[7]) ) ) options_idx = 7; } // Is the third argument constraint Matrix A? int_t numberOfColumns = (int_t)mxGetN(prhs[2]); /* 1) Simply bounded QP. */ if ( ( isSimplyBoundedQp == BT_TRUE ) || ( ( numberOfColumns == 1 ) && ( nV != 1 ) ) ) { lb_idx = 2; ub_idx = 3; if ( ( nrhs >= 6 ) && ( !mxIsEmpty(prhs[5]) ) ) { /* auxInput specified */ if ( mxIsStruct(prhs[5]) ) { auxInput_idx = 5; x0_idx = -1; } else { auxInput_idx = -1; x0_idx = 5; } } else { auxInput_idx = -1; x0_idx = -1; } } else { A_idx = 2; /* If constraint matrix is empty, use a QProblemB object! */ if ( mxIsEmpty( prhs[ A_idx ] ) ) { lb_idx = 3; ub_idx = 4; nC = 0; } else { lb_idx = 3; ub_idx = 4; lbA_idx = 5; ubA_idx = 6; nC = (int_t)mxGetM( prhs[ A_idx ] ); /* row number of constraint matrix */ } if ( ( nrhs >= 9 ) && ( !mxIsEmpty(prhs[8]) ) ) { /* auxInput specified */ if ( mxIsStruct(prhs[8]) ) { auxInput_idx = 8; x0_idx = -1; } else { auxInput_idx = -1; x0_idx = 8; } } else { auxInput_idx = -1; x0_idx = -1; } } /* ensure that data is given in real_t precision */ if ( ( ( H_idx >= 0 ) && ( mxIsDouble( prhs[ H_idx ] ) == 0 ) ) || ( mxIsDouble( prhs[ g_idx ] ) == 0 ) ) { myMexErrMsgTxt( "ERROR (qpOASES): All data has to be provided in double precision!" ); return; } /* check if supplied data contains 'NaN' or 'Inf' */ if (containsNaNorInf( prhs,H_idx, 0 ) == BT_TRUE) return; if (containsNaNorInf( prhs,g_idx, 0 ) == BT_TRUE) return; if (containsNaNorInf( prhs,lb_idx, 1 ) == BT_TRUE) return; if (containsNaNorInf( prhs,ub_idx, 1 ) == BT_TRUE) return; /* Check inputs dimensions and assign pointers to inputs. */ if ( ( H_idx >= 0 ) && ( ( mxGetN( prhs[ H_idx ] ) != nV ) || ( mxGetM( prhs[ H_idx ] ) != nV ) ) ) { char msg[MAX_STRING_LENGTH]; snprintf(msg, MAX_STRING_LENGTH, "ERROR (qpOASES): Hessian matrix dimension mismatch (%ld != %d)!", (long int)mxGetN(prhs[H_idx]), (int)nV); myMexErrMsgTxt(msg); return; } if ( nC > 0 ) { /* ensure that data is given in real_t precision */ if ( mxIsDouble( prhs[ A_idx ] ) == 0 ) { myMexErrMsgTxt( "ERROR (qpOASES): All data has to be provided in real_t precision!" ); return; } /* Check inputs dimensions and assign pointers to inputs. */ if ( mxGetN( prhs[ A_idx ] ) != nV ) { char msg[MAX_STRING_LENGTH]; snprintf(msg, MAX_STRING_LENGTH, "ERROR (qpOASES): Constraint matrix input dimension mismatch (%ld != %d)!", (long int)mxGetN(prhs[A_idx]), (int)nV); myMexErrMsgTxt(msg); return; } if (containsNaNorInf(prhs,A_idx, 0 ) == BT_TRUE) return; if (containsNaNorInf(prhs,lbA_idx, 1 ) == BT_TRUE) return; if (containsNaNorInf(prhs,ubA_idx, 1 ) == BT_TRUE) return; } /* check dimensions and copy auxInputs */ if ( smartDimensionCheck( &g,nV,nP, BT_FALSE,prhs,g_idx ) != SUCCESSFUL_RETURN ) return; if ( smartDimensionCheck( &lb,nV,nP, BT_TRUE,prhs,lb_idx ) != SUCCESSFUL_RETURN ) return; if ( smartDimensionCheck( &ub,nV,nP, BT_TRUE,prhs,ub_idx ) != SUCCESSFUL_RETURN ) return; if ( smartDimensionCheck( &x0,nV,1, BT_TRUE,prhs,x0_idx ) != SUCCESSFUL_RETURN ) return; if ( nC > 0 ) { if ( smartDimensionCheck( &lbA,nC,nP, BT_TRUE,prhs,lbA_idx ) != SUCCESSFUL_RETURN ) return; if ( smartDimensionCheck( &ubA,nC,nP, BT_TRUE,prhs,ubA_idx ) != SUCCESSFUL_RETURN ) return; } if ( auxInput_idx >= 0 ) setupAuxiliaryInputs( prhs[auxInput_idx],nV,nC, &hessianType,&x0,&guessedBounds,&guessedConstraints,&R_for ); /* convert Cholesky factor to C storage format */ if ( R_for != 0 ) { R = new real_t[nV*nV]; convertFortranToC( R_for, nV,nV, R ); } /* III) ACTUALLY PERFORM QPOASES FUNCTION CALL: */ int_t nWSRin = 5*(nV+nC); real_t maxCpuTimeIn = -1.0; if ( options_idx > 0 ) setupOptions( &options,prhs[options_idx],nWSRin,maxCpuTimeIn ); /* make a deep-copy of the user-specified Hessian matrix (possibly sparse) */ if ( H_idx >= 0 ) setupHessianMatrix( prhs[H_idx],nV, &H,&Hir,&Hjc,&Hv ); /* make a deep-copy of the user-specified constraint matrix (possibly sparse) */ if ( ( nC > 0 ) && ( A_idx >= 0 ) ) setupConstraintMatrix( prhs[A_idx],nV,nC, &A,&Air,&Ajc,&Av ); allocateOutputs( nlhs,plhs,nV,nC,nP ); if ( nC == 0 ) { /* Call qpOASES (using QProblemB class). */ QProblemB_qpOASES( nV,hessianType, nP, H,g, lb,ub, nWSRin,maxCpuTimeIn, x0,&options, nlhs,plhs, guessedBounds,R ); if (R != 0) delete R; if (H != 0) delete H; if (Hv != 0) delete[] Hv; if (Hjc != 0) delete[] Hjc; if (Hir != 0) delete[] Hir; return; } else { if ( A == 0 ) { myMexErrMsgTxt( "ERROR (qpOASES): Internal interface error related to constraint matrix!" ); return; } /* Call qpOASES (using QProblem class). */ QProblem_qpOASES( nV,nC,hessianType, nP, H,g,A, lb,ub,lbA,ubA, nWSRin,maxCpuTimeIn, x0,&options, nlhs,plhs, guessedBounds,guessedConstraints,R ); if (R != 0) delete R; if (A != 0) delete A; if (H != 0) delete H; if (Av != 0) delete[] Av; if (Ajc != 0) delete[] Ajc; if (Air != 0) delete[] Air; if (Hv != 0) delete[] Hv; if (Hjc != 0) delete[] Hjc; if (Hir != 0) delete[] Hir; return; } }
bool Capture::init() { if (mVideoDevice.empty()) { sgct::MessageHandler::instance()->print(sgct::MessageHandler::NOTIFY_ERROR, "No video device specified!\n"); cleanup(); return false; } initFFmpeg(); setupOptions(); // -------------------------------------------------- //check out https://ffmpeg.org/ffmpeg-devices.html // -------------------------------------------------- AVInputFormat * iformat; std::string inputName; #ifdef __WIN32__ iformat = av_find_input_format("dshow"); inputName = "video=" + mVideoDevice; #elif defined __APPLE__ iformat = av_find_input_format("avfoundation"); inputName = mVideoDevice; #else //linux NOT-Tested iformat = av_find_input_format("video4linux2"); inputName = mVideoDevice; #endif if (avformat_open_input(&mFMTContext, inputName.c_str(), iformat, &mOptions) < 0) { sgct::MessageHandler::instance()->print(sgct::MessageHandler::NOTIFY_ERROR, "Could not open capture input!\n"); cleanup(); return false; } /* retrieve stream information */ if (avformat_find_stream_info(mFMTContext, nullptr) < 0) { sgct::MessageHandler::instance()->print(sgct::MessageHandler::NOTIFY_ERROR, "Could not find stream information!\n"); cleanup(); return false; } if (!initVideoStream()) { cleanup(); return false; } //dump format info to console av_dump_format(mFMTContext, 0, inputName.c_str(), 0); if (mVideoCodecContext) { if (!allocateVideoDecoderData(mVideoCodecContext->pix_fmt)) { cleanup(); return false; } } /* initialize packet, set data to nullptr, let the demuxer fill it */ av_init_packet(&mPkt); mPkt.data = nullptr; mPkt.size = 0; //success mInited = true; return true; }