configGenerator_build.cpp 20.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/*
 * copyright (c) 2014 Matthew Oliver
 *
 * This file is part of ShiftMediaProject.
 *
 * ShiftMediaProject is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * ShiftMediaProject is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with ShiftMediaProject; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */
 
M
Matt Oliver 已提交
21 22 23 24
#include "configGenerator.h"

#include <algorithm>

25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
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.
84
    fastToggleConfigValue( "d3d11va", true );
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
    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 );
132
    fastToggleConfigValue( "CoTaskMemFree", true );
133 134 135
    fastToggleConfigValue( "cpunop", true );
    fastToggleConfigValue( "CryptGenRandom", true );
    fastToggleConfigValue( "direct_h", true );
136
    fastToggleConfigValue( "d3d11_h", true );
137 138 139 140
    fastToggleConfigValue( "dxva_h", true );
    fastToggleConfigValue( "ebp_available", true );
    fastToggleConfigValue( "ebx_available", true );
    fastToggleConfigValue( "fast_clz", true );
141
    fastToggleConfigValue( "flt_lim", true );
142
    fastToggleConfigValue( "getaddrinfo", true );
143
    fastToggleConfigValue( "getopt", false );
144 145 146 147 148 149 150 151 152 153 154 155 156
    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 );
157
    fastToggleConfigValue( "local_aligned_32", true );
158 159 160 161 162
    fastToggleConfigValue( "local_aligned_16", true );
    fastToggleConfigValue( "local_aligned_8", true );
    fastToggleConfigValue( "malloc_h", true );
    fastToggleConfigValue( "MapViewOfFile", true );
    fastToggleConfigValue( "MemoryBarrier", true );
163
    fastToggleConfigValue( "mm_empty", true );
164 165 166 167
    fastToggleConfigValue( "PeekNamedPipe", true );
    fastToggleConfigValue( "rdtsc", true );
    fastToggleConfigValue( "rsync_contimeout", true );
    fastToggleConfigValue( "SetConsoleTextAttribute", true );
168
    fastToggleConfigValue( "SetConsoleCtrlHandler", true );
169 170
    fastToggleConfigValue( "setmode", true );
    fastToggleConfigValue( "Sleep", true );
171
    fastToggleConfigValue( "CONDITION_VARIABLE_Ptr", true );
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
    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( "windows_h", true );
    fastToggleConfigValue( "winsock2_h", true );
    fastToggleConfigValue( "wglgetprocaddress", true );

    fastToggleConfigValue( "dos_paths", true );
187
    fastToggleConfigValue( "dxva2api_cobj", true );
188
    fastToggleConfigValue( "dxva2_lib", true );
189 190 191 192 193 194 195

    fastToggleConfigValue( "aligned_stack", true );
    fastToggleConfigValue( "pragma_deprecated", true );
    fastToggleConfigValue( "inline_asm", true );
    fastToggleConfigValue( "frame_thread_encoder", true );
    fastToggleConfigValue( "xmm_clobbers", true );

196 197 198
    fastToggleConfigValue( "xlib", false ); //enabled by default but is linux only so we force disable
    fastToggleConfigValue( "qtkit", false );
    fastToggleConfigValue( "avfoundation", false );
199 200 201 202

    //Additional (must be explicitly disabled)
    fastToggleConfigValue( "dct", true );
    fastToggleConfigValue( "dwt", true );
203
    fastToggleConfigValue( "error_resilience", true );
204 205 206
    fastToggleConfigValue( "faan", true );
    fastToggleConfigValue( "faandct", true );
    fastToggleConfigValue( "faanidct", true );
207
    fastToggleConfigValue( "fast_unaligned", true );
208 209 210 211 212 213
    fastToggleConfigValue( "lsp", true );
    fastToggleConfigValue( "lzo", true );
    fastToggleConfigValue( "mdct", true );
    fastToggleConfigValue( "network", true );
    fastToggleConfigValue( "rdft", true );
    fastToggleConfigValue( "fft", true );
214 215 216 217 218 219 220
    fastToggleConfigValue( "pixelutils", true );

    fastToggleConfigValue( "bzlib", true );
    fastToggleConfigValue( "iconv", true );
    fastToggleConfigValue( "lzma", true );
    fastToggleConfigValue( "sdl", true );
    fastToggleConfigValue( "zlib", true );
221 222 223 224

    return true;
}

M
Matt Oliver 已提交
225 226 227 228 229 230 231 232
void configGenerator::buildFixedValues( DefaultValuesList & mFixedValues )
{
    mFixedValues.clear( );
    mFixedValues["$(c_escape $FFMPEG_CONFIGURATION)"] = "";
    mFixedValues["$(c_escape $LIBAV_CONFIGURATION)"] = "";
    mFixedValues["$(c_escape $license)"] = "lgpl";
    mFixedValues["$(eval c_escape $datadir)"] = ".";
    mFixedValues["$(c_escape ${cc_ident:-Unknown compiler})"] = "msvc";
233
    mFixedValues["$_restrict"] = "__restrict";
M
Matt Oliver 已提交
234 235 236
    mFixedValues["${extern_prefix}"] = "";
    mFixedValues["$build_suffix"] = "";
    mFixedValues["$SLIBSUF"] = "";
237
    mFixedValues["$sws_max_filter_size"] = "256";
M
Matt Oliver 已提交
238 239 240 241 242 243 244 245 246 247 248
}

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";
249
    mReplaceValues["EXTERN_PREFIX"] = "#if defined(__x86_64) || defined(_M_X64)\n\
M
Matt Oliver 已提交
250 251 252 253
#   define EXTERN_PREFIX \"\"\n\
#else\n\
#   define EXTERN_PREFIX \"_\"\n\
#endif";
254
    mReplaceValues["EXTERN_ASM"] = "#if defined(__x86_64) || defined(_M_X64)\n\
M
Matt Oliver 已提交
255 256 257 258
#   define EXTERN_ASM\n\
#else\n\
#   define EXTERN_ASM _\n\
#endif";
259
    mReplaceValues["SLIBSUF"] = "#if defined(_USRDLL) || defined(_WINDLL)\n\
M
Matt Oliver 已提交
260 261 262 263 264
#   define SLIBSUF \".dll\"\n\
#else\n\
#   define SLIBSUF \".lib\"\n\
#endif";

265
    mReplaceValues["ARCH_X86_32"] = "#if defined(__x86_64) || defined(_M_X64)\n\
M
Matt Oliver 已提交
266 267 268 269
#   define ARCH_X86_32 0\n\
#else\n\
#   define ARCH_X86_32 1\n\
#endif";
270
    mReplaceValues["ARCH_X86_64"] = "#if defined(__x86_64) || defined(_M_X64)\n\
M
Matt Oliver 已提交
271 272 273 274
#   define ARCH_X86_64 1\n\
#else\n\
#   define ARCH_X86_64 0\n\
#endif";
275
    mReplaceValues["CONFIG_SHARED"] = "#if defined(_USRDLL) || defined(_WINDLL)\n\
M
Matt Oliver 已提交
276 277 278 279
#   define CONFIG_SHARED 1\n\
#else\n\
#   define CONFIG_SHARED 0\n\
#endif";
280
    mReplaceValues["CONFIG_STATIC"] = "#if defined(_USRDLL) || defined(_WINDLL)\n\
M
Matt Oliver 已提交
281 282 283 284
#   define CONFIG_STATIC 0\n\
#else\n\
#   define CONFIG_STATIC 1\n\
#endif";
285
    mReplaceValues["HAVE_ALIGNED_STACK"] = "#if defined(__x86_64) || defined(_M_X64)\n\
M
Matt Oliver 已提交
286 287 288 289
#   define HAVE_ALIGNED_STACK 1\n\
#else\n\
#   define HAVE_ALIGNED_STACK 0\n\
#endif";
290
    mReplaceValues["HAVE_FAST_64BIT"] = "#if defined(__x86_64) || defined(_M_X64)\n\
M
Matt Oliver 已提交
291 292 293 294
#   define HAVE_FAST_64BIT 1\n\
#else\n\
#   define HAVE_FAST_64BIT 0\n\
#endif";
295
    mReplaceValues["HAVE_INLINE_ASM"] = "#if defined(__INTEL_COMPILER)\n\
M
Matt Oliver 已提交
296 297 298 299
#   define HAVE_INLINE_ASM 1\n\
#else\n\
#   define HAVE_INLINE_ASM 0\n\
#endif";
300 301 302 303 304 305
    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";

M
Matt Oliver 已提交
306 307 308 309 310 311 312
    //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";
313
        mReplaceValues[sName] = "#define " + sName + " HAVE_INLINE_ASM";
M
Matt Oliver 已提交
314
    }
315

316
    //Sanity checks for inline asm (Needed as some code only checks availability and not inline_asm)
317
    mReplaceValues["HAVE_EBP_AVAILABLE"] = "#if HAVE_INLINE_ASM && !defined(_DEBUG)\n\
318 319 320 321
#   define HAVE_EBP_AVAILABLE 1\n\
#else\n\
#   define HAVE_EBP_AVAILABLE 0\n\
#endif";
322
    mReplaceValues["HAVE_EBX_AVAILABLE"] = "#if HAVE_INLINE_ASM && !defined(_DEBUG)\n\
323 324 325 326
#   define HAVE_EBX_AVAILABLE 1\n\
#else\n\
#   define HAVE_EBX_AVAILABLE 0\n\
#endif";
M
Matt Oliver 已提交
327 328 329 330

    //Add to config.asm only list
    mASMReplaceValues["ARCH_X86_32"] = "%ifidn __OUTPUT_FORMAT__,x64\n\
%define ARCH_X86_32 0\n\
331 332
%elifidn __OUTPUT_FORMAT__,win64\n\
%define ARCH_X86_32 0\n\
M
Matt Oliver 已提交
333 334 335 336 337 338
%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\
339 340
%elifidn __OUTPUT_FORMAT__,win64\n\
%define ARCH_X86_64 1\n\
M
Matt Oliver 已提交
341 342 343 344 345
%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\
346 347
%elifidn __OUTPUT_FORMAT__,win64\n\
%define HAVE_ALIGNED_STACK 1\n\
M
Matt Oliver 已提交
348 349 350 351 352
%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\
353 354
%elifidn __OUTPUT_FORMAT__,win64\n\
%define HAVE_FAST_64BIT 1\n\
M
Matt Oliver 已提交
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369
%elifidn __OUTPUT_FORMAT__,win32\n\
%define HAVE_FAST_64BIT 0\n\
%endif";
}

void configGenerator::buildReservedValues( vector<string> & vReservedItems )
{
    vReservedItems.resize(0);
    //The following are reserved values that are automatically handled and can not be set explicitly
    vReservedItems.push_back( "x86_32" );
    vReservedItems.push_back( "x86_64" );
    vReservedItems.push_back( "xmm_clobbers" );
    vReservedItems.push_back( "shared" );
    vReservedItems.push_back( "static" );
    vReservedItems.push_back( "aligned_stack" );
370
    vReservedItems.push_back( "fast_64bit" );
371
    vReservedItems.push_back( "mm_empty" );
372 373
    vReservedItems.push_back( "ebp_available" );
    vReservedItems.push_back( "ebx_available" );
374
    vReservedItems.push_back( "debug" );
M
Matt Oliver 已提交
375 376 377 378 379 380 381 382
}

void configGenerator::buildAdditionalDependencies( DependencyList & mAdditionalDependencies )
{
    mAdditionalDependencies.clear( );
    mAdditionalDependencies["capCreateCaptureWindow"] = true;
    mAdditionalDependencies["CreateDIBSection"] = false;
    mAdditionalDependencies["dv1394"] = false;
383
    mAdditionalDependencies["DXVA_PicParams_HEVC"] = true;
M
Matt Oliver 已提交
384 385 386
    mAdditionalDependencies["dxva2api_h"] = true;
    mAdditionalDependencies["jack_jack_h"] = false;
    mAdditionalDependencies["IBaseFilter"] = true;
387
    mAdditionalDependencies["ID3D11VideoDecoder"] = true;
M
Matt Oliver 已提交
388 389 390 391
    mAdditionalDependencies["libcrystalhd_libcrystalhd_if_h"] = false;
    mAdditionalDependencies["linux_fb_h"] = false;
    mAdditionalDependencies["linux_videodev_h"] = false;
    mAdditionalDependencies["linux_videodev2_h"] = false;
392
    mAdditionalDependencies["DXVA2_ConfigPictureDecode"] = true;
M
Matt Oliver 已提交
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424
    mAdditionalDependencies["snd_pcm_htimestamp"] = false;
    mAdditionalDependencies["va_va_h"] = false;
    mAdditionalDependencies["vdpau_vdpau_h"] = false;
    mAdditionalDependencies["vdpau_vdpau_x11_h"] = false;
    mAdditionalDependencies["vfwcap_defines"] = true;
    mAdditionalDependencies["VideoDecodeAcceleration_VDADecoder_h"] = false;
    mAdditionalDependencies["X11_extensions_Xvlib_h"] = false;
    mAdditionalDependencies["X11_extensions_XvMClib_h"] = false;
}

void configGenerator::buildOptimisedDisables( OptimisedConfigList & mOptimisedDisables )
{
    //This used is to return prioritised version of different config options
    //  For instance If enabling the decoder from an passed in library that is better than the inbuilt one 
    //  then simply disable the inbuilt so as to avoid unnecessary compilation
    //This may have issues should a user not want to disable these but currently there are static compilation errors 
    //  that will occur as several of these overlapping decoder/encoders have similar named methods that cause link errors.

    mOptimisedDisables.clear( );
    //From trac.ffmpeg.org/wiki/GuidelinesHighQualityAudio
    //Dolby Digital: ac3
    //Dolby Digital Plus: eac3
    //MP2: libtwolame, mp2
    //Windows Media Audio 1: wmav1
    //Windows Media Audio 2: wmav2
    //LC-AAC: libfdk_aac, libfaac, aac, libvo_aacenc
    //HE-AAC: libfdk_aac, libaacplus
    //Vorbis: libvorbis, vorbis
    //MP3: libmp3lame, libshine
    //Opus: libopus
    //libopus >= libvorbis >= libfdk_aac > libmp3lame > libfaac >= eac3/ac3 > aac > libtwolame > vorbis > mp2 > wmav2/wmav1 > libvo_aacenc
    
425
    //*****Encoder optimization is currently ignored as people may want to compare encoders. The commandline should be used to disable unwanted encoders*****//
M
Matt Oliver 已提交
426 427 428 429 430 431 432 433 434 435 436
    
    //mOptimisedDisables["LIBTWOLAME_ENCODER"].push_back( "MP2_ENCODER" );
    //mOptimisedDisables["LIBFDK_AAC_ENCODER"].push_back( "LIBFAAC_ENCODER" );
    //mOptimisedDisables["LIBFDK_AAC_ENCODER"].push_back( "AAC_ENCODER" );
    //mOptimisedDisables["LIBFDK_AAC_ENCODER"].push_back( "LIBVO_AACENC_ENCODER" );
    //mOptimisedDisables["LIBFDK_AAC_ENCODER"].push_back( "LIBAACPLUS_ENCODER" );
    //mOptimisedDisables["LIBFAAC_ENCODER"].push_back( "AAC_ENCODER" );
    //mOptimisedDisables["LIBFAAC_ENCODER"].push_back( "LIBVO_AACENC_ENCODER" );
    //mOptimisedDisables["AAC_ENCODER"].push_back( "LIBVO_AACENC_ENCODER" );
    //mOptimisedDisables["LIBVORBIS_ENCODER"].push_back( "VORBIS_ENCODER" );
    //mOptimisedDisables["LIBMP3LAME_ENCODER"].push_back( "LIBSHINE_ENCODER" );
437 438 439
    //mOptimisedDisables["LIBOPENJPEG_ENCODER"].push_back( "JPEG2000_ENCODER" );//???
    //mOptimisedDisables["LIBUTVIDEO_ENCODER"].push_back( "UTVIDEO_ENCODER" );//???
    //mOptimisedDisables["LIBWAVPACK_ENCODER"].push_back( "WAVPACK_ENCODER" );//???
M
Matt Oliver 已提交
440 441 442 443 444 445 446 447 448 449 450

    mOptimisedDisables["LIBGSM_DECODER"].push_back( "GSM_DECODER" );//???
    mOptimisedDisables["LIBGSM_MS_DECODER"].push_back( "GSM_MS_DECODER" );//???
    mOptimisedDisables["LIBNUT_MUXER"].push_back( "NUT_MUXER" );
    mOptimisedDisables["LIBNUT_DEMUXER"].push_back( "NUT_DEMUXER" );
    mOptimisedDisables["LIBOPENCORE_AMRNB_DECODER"].push_back( "AMRNB_DECODER" );//???
    mOptimisedDisables["LIBOPENCORE_AMRWB_DECODER"].push_back( "AMRWB_DECODER" );//???
    mOptimisedDisables["LIBOPENJPEG_DECODER"].push_back( "JPEG2000_DECODER" );//???
    mOptimisedDisables["LIBSCHROEDINGER_DECODER"].push_back( "DIRAC_DECODER" );
    mOptimisedDisables["LIBSTAGEFRIGHT_H264_DECODER"].push_back( "H264_DECODER" );
    mOptimisedDisables["LIBUTVIDEO_DECODER"].push_back( "UTVIDEO_DECODER" );//???
451
    mOptimisedDisables["VP8_DECODER"].push_back( "LIBVPX_VP8_DECODER" );//Inbuilt native decoder is apparently faster
M
Matt Oliver 已提交
452
    mOptimisedDisables["VP9_DECODER"].push_back( "LIBVPX_VP9_DECODER" );
453
    mOptimisedDisables["OPUS_DECODER"].push_back( "LIBOPUS_DECODER" );//??? Not sure which is better
454 455 456 457 458 459 460 461 462 463 464 465
}

void configGenerator::buildForcedEnables( string sOptionLower, vector<string> & vForceEnable )
{
    if( sOptionLower.compare( "fontconfig" ) == 0 )
    {
        vForceEnable.push_back( "libfontconfig" );
    }
    else if( sOptionLower.compare( "dxva2" ) == 0 )
    {
        vForceEnable.push_back( "dxva2_lib" );
    }
466 467 468 469
    else if( sOptionLower.compare( "libcdio" ) == 0 )
    {
        vForceEnable.push_back( "cdio_paranoia_paranoia_h" );
    }
470 471 472 473
    else if( sOptionLower.compare( "libmfx" ) == 0 )
    {
        vForceEnable.push_back( "qsv" );
    }
474 475
    else if( sOptionLower.compare( "gnutls" ) == 0 )
    {
476
        vForceEnable.push_back( "nettle" );//deprecated
477
        vForceEnable.push_back( "gcrypt" );
478
        vForceEnable.push_back( "gmp" );
479
    }
480 481 482 483
    else if( sOptionLower.compare( "dcadec" ) == 0 )
    {
        vForceEnable.push_back( "struct_dcadec_exss_info_matrix_encoding" );
    }
484 485 486 487 488 489 490 491 492 493 494 495
}

void configGenerator::buildForcedDisables( string sOptionLower, vector<string> & vForceDisable )
{
    if( sOptionLower.compare( "fontconfig" ) == 0 )
    {
        vForceDisable.push_back( "libfontconfig" );
    }
    else if( sOptionLower.compare( "dxva2" ) == 0 )
    {
        vForceDisable.push_back( "dxva2_lib" );
    }
496 497 498 499
    else if( sOptionLower.compare( "libcdio" ) == 0 )
    {
        vForceDisable.push_back( "cdio_paranoia_paranoia_h" );
    }
500 501 502 503
    else if( sOptionLower.compare( "libmfx" ) == 0 )
    {
        vForceDisable.push_back( "qsv" );
    }
504 505
    else if( sOptionLower.compare( "gnutls" ) == 0 )
    {
506
        vForceDisable.push_back( "nettle" );//deprecated
507
        vForceDisable.push_back( "gcrypt" );
508
        vForceDisable.push_back( "gmp" );
509
    }
510 511 512 513 514 515 516 517 518 519
}

void configGenerator::buildObjects( const string & sTag, vector<string> & vObjects )
{
    if( sTag.compare( "COMPAT_OBJS" ) == 0 )
    {
        vObjects.push_back( "msvcrt/snprintf" ); //msvc only provides _snprintf which does not conform to snprintf standard
        vObjects.push_back( "strtod" ); //msvc contains a strtod but it does not handle NaN's correctly
        vObjects.push_back( "getopt" );
    }
520 521 522 523 524 525 526
    else if( sTag.compare( "EMMS_OBJS__yes_" ) == 0 )
    {
        if( this->getConfigOption( "MMX_EXTERNAL" )->m_sValue.compare( "1" ) == 0 )
        {
            vObjects.push_back( "x86/emms" ); //yasm emms is not required in 32b but is for 64bit unless with icl
        }
    }
M
Matt Oliver 已提交
527
}