bool DirectorCore::buildProcessMap(void) noexcept { // search existing processes for those we should be managing (not 100% foolproof) process_state_t state; std::set<pid_t> pidlist; const pid_t thispid = posix::getpid(); if(proclist(pidlist) == posix::success_response) { for(pid_t pid : pidlist) { posix::memset(reinterpret_cast<void*>(&state), 0, sizeof(state)); if(procstat(pid, state) && // if get process state works AND (!state.parent_process_id || state.parent_process_id == thispid)) // process has unknown parent process OR director is the parent process for(const std::string& config : getConfigList()) // try each config if(getConfigValue(config, "/Process/Executable") == state.executable) // if the executable matches { m_process_map[config]->add(thispid, pid); // claim this as a managed process posix::memset(reinterpret_cast<void*>(&state), 0, sizeof(state)); // wipe process state for safety for(pid_t childpid : pidlist) if(procstat(childpid, state) && // if get process state works AND state.parent_process_id == pid) // process is a child of this parent pid m_process_map[config]->add(pid, childpid); // claim this as a managed process } } return true; } return false; }
void VideoFFmpegWriter::setVideoPreset( const unsigned int id ) { FFmpegPreset::Presets p; p = getConfigList( _codecName ); _videoPresetName = p.at( id ); }
bool ConfigGenerator::buildDefaultValues() { // configurable options vector<string> vList; if (!getConfigList("PROGRAM_LIST", vList)) { return false; } //Enable all programs vector<string>::iterator vitValues = vList.begin(); for (vitValues; vitValues < vList.end(); vitValues++) { toggleConfigValue(*vitValues, true); } //Enable all libraries vList.resize(0); if (!getConfigList("LIBRARY_LIST", vList)) { return false; } vitValues = vList.begin(); for (vitValues; vitValues < vList.end(); vitValues++) { if (!m_bLibav && vitValues->compare("avresample") != 0) { toggleConfigValue(*vitValues, true); } } //Enable all components vList.resize(0); vector<string> vList2; if (!getConfigList("COMPONENT_LIST", vList)) { return false; } vitValues = vList.begin(); for (vitValues; vitValues < vList.end(); vitValues++) { toggleConfigValue(*vitValues, true); //Get the corresponding list and enable all member elements as well vitValues->resize(vitValues->length() - 1); //Need to remove the s from end transform(vitValues->begin(), vitValues->end(), vitValues->begin(), ::toupper); //Get the specific list vList2.resize(0); getConfigList(*vitValues + "_LIST", vList2); for (vector<string>::iterator vitComponent = vList2.begin(); vitComponent < vList2.end(); vitComponent++) { toggleConfigValue(*vitComponent, true); } } fastToggleConfigValue("runtime_cpudetect", true); fastToggleConfigValue("safe_bitstream_reader", true); fastToggleConfigValue("static", true); fastToggleConfigValue("shared", true); fastToggleConfigValue("swscale_alpha", true); // Enable hwaccels by default. fastToggleConfigValue("d3d11va", true); fastToggleConfigValue("dxva2", true); //Enable x86 hardware architectures fastToggleConfigValue("x86", true); fastToggleConfigValue("i686", true); fastToggleConfigValue("fast_cmov", true); fastToggleConfigValue("x86_32", true); fastToggleConfigValue("x86_64", true); //Enable x86 extensions vList.resize(0); if (!getConfigList("ARCH_EXT_LIST_X86", vList)) { return false; } vitValues = vList.begin(); for (vitValues; vitValues < vList.end(); vitValues++) { fastToggleConfigValue(*vitValues, true); //Also enable _EXTERNAL and _INLINE fastToggleConfigValue(*vitValues + "_EXTERNAL", true); fastToggleConfigValue(*vitValues + "_INLINE", true); } //Default we enable yasm fastToggleConfigValue("yasm", true); //msvc specific options fastToggleConfigValue("w32threads", true); fastToggleConfigValue("atomics_win32", true); //math functions vList.resize(0); if (!getConfigList("MATH_FUNCS", vList)) { return false; } vitValues = vList.begin(); for (vitValues; vitValues < vList.end(); vitValues++) { fastToggleConfigValue(*vitValues, true); } fastToggleConfigValue("access", true); fastToggleConfigValue("aligned_malloc", true); fastToggleConfigValue("closesocket", true); fastToggleConfigValue("CommandLineToArgvW", true); fastToggleConfigValue("CoTaskMemFree", true); fastToggleConfigValue("cpunop", true); fastToggleConfigValue("CryptGenRandom", true); fastToggleConfigValue("direct_h", true); fastToggleConfigValue("d3d11_h", true); fastToggleConfigValue("dxva_h", true); fastToggleConfigValue("ebp_available", true); fastToggleConfigValue("ebx_available", true); fastToggleConfigValue("fast_clz", true); fastToggleConfigValue("flt_lim", true); fastToggleConfigValue("getaddrinfo", true); fastToggleConfigValue("getopt", false); fastToggleConfigValue("GetProcessAffinityMask", true); fastToggleConfigValue("GetProcessMemoryInfo", true); fastToggleConfigValue("GetProcessTimes", true); fastToggleConfigValue("GetSystemTimeAsFileTime", true); fastToggleConfigValue("io_h", true); fastToggleConfigValue("inline_asm_labels", true); //Additional options set for Intel compiler specific inline asm fastToggleConfigValue("inline_asm_nonlocal_labels", false); fastToggleConfigValue("inline_asm_direct_symbol_refs", false); fastToggleConfigValue("inline_asm_non_intel_mnemonic", false); fastToggleConfigValue("isatty", true); fastToggleConfigValue("kbhit", true); fastToggleConfigValue("libc_msvcrt", true); fastToggleConfigValue("local_aligned_32", true); fastToggleConfigValue("local_aligned_16", true); fastToggleConfigValue("local_aligned_8", true); fastToggleConfigValue("malloc_h", true); fastToggleConfigValue("MapViewOfFile", true); fastToggleConfigValue("MemoryBarrier", true); fastToggleConfigValue("mm_empty", true); fastToggleConfigValue("PeekNamedPipe", true); fastToggleConfigValue("rdtsc", true); fastToggleConfigValue("rsync_contimeout", true); fastToggleConfigValue("SetConsoleTextAttribute", true); fastToggleConfigValue("SetConsoleCtrlHandler", true); fastToggleConfigValue("setmode", true); fastToggleConfigValue("Sleep", true); fastToggleConfigValue("CONDITION_VARIABLE_Ptr", true); fastToggleConfigValue("socklen_t", true); fastToggleConfigValue("struct_addrinfo", true); fastToggleConfigValue("struct_group_source_req", true); fastToggleConfigValue("struct_ip_mreq_source", true); fastToggleConfigValue("struct_ipv6_mreq", true); fastToggleConfigValue("struct_pollfd", true); fastToggleConfigValue("struct_sockaddr_in6", true); fastToggleConfigValue("struct_sockaddr_storage", true); fastToggleConfigValue("unistd_h", true); fastToggleConfigValue("VirtualAlloc", true); fastToggleConfigValue("Audioclient_h", true); fastToggleConfigValue("windows_h", true); fastToggleConfigValue("winsock2_h", true); fastToggleConfigValue("wglgetprocaddress", true); fastToggleConfigValue("dos_paths", true); fastToggleConfigValue("dxva2api_cobj", true); fastToggleConfigValue("dxva2_lib", true); fastToggleConfigValue("aligned_stack", true); fastToggleConfigValue("pragma_deprecated", true); fastToggleConfigValue("inline_asm", true); fastToggleConfigValue("frame_thread_encoder", true); fastToggleConfigValue("xmm_clobbers", true); fastToggleConfigValue("xlib", false); //enabled by default but is linux only so we force disable fastToggleConfigValue("qtkit", false); fastToggleConfigValue("avfoundation", false); fastToggleConfigValue("mmal", false); //values that are not correctly handled by configure fastToggleConfigValue("coreimage_filter", false); fastToggleConfigValue("coreimagesrc_filter", false); //Additional (must be explicitly disabled) fastToggleConfigValue("dct", true); fastToggleConfigValue("dwt", true); fastToggleConfigValue("error_resilience", true); fastToggleConfigValue("faan", true); fastToggleConfigValue("faandct", true); fastToggleConfigValue("faanidct", true); fastToggleConfigValue("fast_unaligned", true); fastToggleConfigValue("lsp", true); fastToggleConfigValue("lzo", true); fastToggleConfigValue("mdct", true); fastToggleConfigValue("network", true); fastToggleConfigValue("rdft", true); fastToggleConfigValue("fft", true); fastToggleConfigValue("pixelutils", true); fastToggleConfigValue("bzlib", true); fastToggleConfigValue("iconv", true); fastToggleConfigValue("lzma", true); fastToggleConfigValue("schannel", true); fastToggleConfigValue("sdl", true); fastToggleConfigValue("zlib", true); return true; }
void ConfigGenerator::buildReplaceValues(DefaultValuesList & mReplaceValues, DefaultValuesList & mASMReplaceValues) { mReplaceValues.clear(); //Add to config.h only list mReplaceValues["CC_IDENT"] = "#if defined(__INTEL_COMPILER)\n\ # define CC_IDENT \"icl\"\n\ #else\n\ # define CC_IDENT \"msvc\"\n\ #endif"; mReplaceValues["EXTERN_PREFIX"] = "#if defined(__x86_64) || defined(_M_X64)\n\ # define EXTERN_PREFIX \"\"\n\ #else\n\ # define EXTERN_PREFIX \"_\"\n\ #endif"; mReplaceValues["EXTERN_ASM"] = "#if defined(__x86_64) || defined(_M_X64)\n\ # define EXTERN_ASM\n\ #else\n\ # define EXTERN_ASM _\n\ #endif"; mReplaceValues["SLIBSUF"] = "#if defined(_USRDLL) || defined(_WINDLL)\n\ # define SLIBSUF \".dll\"\n\ #else\n\ # define SLIBSUF \".lib\"\n\ #endif"; mReplaceValues["ARCH_X86_32"] = "#if defined(__x86_64) || defined(_M_X64)\n\ # define ARCH_X86_32 0\n\ #else\n\ # define ARCH_X86_32 1\n\ #endif"; mReplaceValues["ARCH_X86_64"] = "#if defined(__x86_64) || defined(_M_X64)\n\ # define ARCH_X86_64 1\n\ #else\n\ # define ARCH_X86_64 0\n\ #endif"; mReplaceValues["CONFIG_SHARED"] = "#if defined(_USRDLL) || defined(_WINDLL)\n\ # define CONFIG_SHARED 1\n\ #else\n\ # define CONFIG_SHARED 0\n\ #endif"; mReplaceValues["CONFIG_STATIC"] = "#if defined(_USRDLL) || defined(_WINDLL)\n\ # define CONFIG_STATIC 0\n\ #else\n\ # define CONFIG_STATIC 1\n\ #endif"; mReplaceValues["HAVE_ALIGNED_STACK"] = "#if defined(__x86_64) || defined(_M_X64)\n\ # define HAVE_ALIGNED_STACK 1\n\ #else\n\ # define HAVE_ALIGNED_STACK 0\n\ #endif"; mReplaceValues["HAVE_FAST_64BIT"] = "#if defined(__x86_64) || defined(_M_X64)\n\ # define HAVE_FAST_64BIT 1\n\ #else\n\ # define HAVE_FAST_64BIT 0\n\ #endif"; mReplaceValues["HAVE_INLINE_ASM"] = "#if defined(__INTEL_COMPILER)\n\ # define HAVE_INLINE_ASM 1\n\ #else\n\ # define HAVE_INLINE_ASM 0\n\ #endif"; mReplaceValues["HAVE_MM_EMPTY"] = "#if defined(__INTEL_COMPILER) || ARCH_X86_32\n\ # define HAVE_MM_EMPTY 1\n\ #else\n\ # define HAVE_MM_EMPTY 0\n\ #endif"; mReplaceValues["HAVE_STRUCT_POLLFD"] = "#if !defined(_WIN32_WINNT) || _WIN32_WINNT >= 0x0600\n\ # define HAVE_STRUCT_POLLFD 1\n\ #else\n\ # define HAVE_STRUCT_POLLFD 0\n\ #endif"; mReplaceValues["CONFIG_VP9_D3D11VA_HWACCEL"] = "#include <sdkddkver.h>\n\ #if defined(NTDDI_WIN10_TH2)\n\ # define CONFIG_VP9_D3D11VA_HWACCEL 1\n\ #else\n\ # define CONFIG_VP9_D3D11VA_HWACCEL 0\n\ #endif"; mReplaceValues["CONFIG_VP9_DXVA2_HWACCEL"] = "#include <sdkddkver.h>\n\ #if defined(NTDDI_WIN10_TH2)\n\ # define CONFIG_VP9_DXVA2_HWACCEL 1\n\ #else\n\ # define CONFIG_VP9_DXVA2_HWACCEL 0\n\ #endif"; //Build replace values for all inline asm vector<string> vInlineList; getConfigList("ARCH_EXT_LIST", vInlineList); for (vector<string>::iterator vitIt = vInlineList.begin(); vitIt < vInlineList.end(); vitIt++) { transform(vitIt->begin(), vitIt->end(), vitIt->begin(), ::toupper); string sName = "HAVE_" + *vitIt + "_INLINE"; mReplaceValues[sName] = "#define " + sName + " HAVE_INLINE_ASM"; } //Sanity checks for inline asm (Needed as some code only checks availability and not inline_asm) mReplaceValues["HAVE_EBP_AVAILABLE"] = "#if HAVE_INLINE_ASM && !defined(_DEBUG)\n\ # define HAVE_EBP_AVAILABLE 1\n\ #else\n\ # define HAVE_EBP_AVAILABLE 0\n\ #endif"; mReplaceValues["HAVE_EBX_AVAILABLE"] = "#if HAVE_INLINE_ASM && !defined(_DEBUG)\n\ # define HAVE_EBX_AVAILABLE 1\n\ #else\n\ # define HAVE_EBX_AVAILABLE 0\n\ #endif"; //Add to config.asm only list mASMReplaceValues["ARCH_X86_32"] = "%ifidn __OUTPUT_FORMAT__,x64\n\ %define ARCH_X86_32 0\n\ %elifidn __OUTPUT_FORMAT__,win64\n\ %define ARCH_X86_32 0\n\ %elifidn __OUTPUT_FORMAT__,win32\n\ %define ARCH_X86_32 1\n\ %define PREFIX\n\ %endif"; mASMReplaceValues["ARCH_X86_64"] = "%ifidn __OUTPUT_FORMAT__,x64\n\ %define ARCH_X86_64 1\n\ %elifidn __OUTPUT_FORMAT__,win64\n\ %define ARCH_X86_64 1\n\ %elifidn __OUTPUT_FORMAT__,win32\n\ %define ARCH_X86_64 0\n\ %endif"; mASMReplaceValues["HAVE_ALIGNED_STACK"] = "%ifidn __OUTPUT_FORMAT__,x64\n\ %define HAVE_ALIGNED_STACK 1\n\ %elifidn __OUTPUT_FORMAT__,win64\n\ %define HAVE_ALIGNED_STACK 1\n\ %elifidn __OUTPUT_FORMAT__,win32\n\ %define HAVE_ALIGNED_STACK 0\n\ %endif"; mASMReplaceValues["HAVE_FAST_64BIT"] = "%ifidn __OUTPUT_FORMAT__,x64\n\ %define HAVE_FAST_64BIT 1\n\ %elifidn __OUTPUT_FORMAT__,win64\n\ %define HAVE_FAST_64BIT 1\n\ %elifidn __OUTPUT_FORMAT__,win32\n\ %define HAVE_FAST_64BIT 0\n\ %endif"; }