bool initAudio () { if (!isInit) { initSdl (); } if (!isInitAudio) { if (SDL_InitSubSystem (SDL_INIT_AUDIO) != 0) { errLog << "SDL error: " << SDL_GetError () << nl; return false; } isInitAudio = true; } return true; }
/* ** Mandala entry point. */ int main() { Sdl *sdl = initSdl(); Window *window = initWindow(); Color *color = initColor(); Mandala *mandala = initMandala(); while (checkUserInput(sdl, color, mandala) == 0) { drawBackground(sdl, color); drawMandala(sdl, color, mandala, window); SDL_RenderPresent(sdl->renderer); mandala->myTable += mandala->myStep; } freeAllTheThings(sdl, window, mandala, color); return 0; }
/** \fn DIA_Preferences \brief Handle preference dialog */ uint8_t DIA_Preferences(void) { uint32_t olddevice,newdevice; uint32_t use_odml=0; uint32_t render; uint32_t useTray=0; uint32_t useMaster=0; uint32_t useAutoIndex=0; uint32_t useSwap=0; uint32_t useNuv=0; uint32_t lavcThreads=0; uint32_t encodePriority=2; uint32_t indexPriority=2; uint32_t playbackPriority=0; uint32_t downmix; uint32_t mpeg_no_limit=0; uint32_t msglevel=2; uint32_t mixer=0; char *alsaDevice=NULL; uint32_t autovbr=0; uint32_t autoindex=0; uint32_t autounpack=0; uint32_t alternate_mp3_tag=1; uint32_t pp_type=3; uint32_t pp_value=5; uint32_t hzd,vzd,dring; uint32_t capsMMX,capsMMXEXT,caps3DNOW,caps3DNOWEXT,capsSSE,capsSSE2,capsSSE3,capsSSSE3,capsAll; uint32_t useGlobalGlyph=0; char *globalGlyphName=NULL; olddevice=newdevice=AVDM_getCurrentDevice(); // Default pp if(!prefs->get(DEFAULT_POSTPROC_TYPE,&pp_type)) pp_type=3; if(!prefs->get(DEFAULT_POSTPROC_VALUE,&pp_value)) pp_value=3; #define DOME(x,y) y=!!(pp_type & x) DOME(1,hzd); DOME(2,vzd); DOME(4,dring); // Cpu caps #define CPU_CAPS(x) if(CpuCaps::myCpuMask & ADM_CPUCAP_##x) caps##x=1; else caps##x=0; if(CpuCaps::myCpuMask==ADM_CPUCAP_ALL) capsAll=1; else capsAll=0; CPU_CAPS(MMX); CPU_CAPS(MMXEXT); CPU_CAPS(3DNOW); CPU_CAPS(3DNOWEXT); CPU_CAPS(SSE); CPU_CAPS(SSE2); CPU_CAPS(SSE3); CPU_CAPS(SSSE3); // Alsa #ifdef ALSA_SUPPORT if( prefs->get(DEVICE_AUDIO_ALSA_DEVICE, &alsaDevice) != RC_OK ) alsaDevice = ADM_strdup("plughw:0,0"); #endif // autovbr prefs->get(FEATURE_AUTO_BUILDMAP,&autovbr); // autoindex prefs->get(FEATURE_AUTO_REBUILDINDEX,&autoindex); // Global glyph prefs->get(FEATURE_GLOBAL_GLYPH_ACTIVE,&useGlobalGlyph); prefs->get(FEATURE_GLOBAL_GLYPH_NAME,&globalGlyphName); // autoindex prefs->get(FEATURE_AUTO_UNPACK,&autounpack); // Alternate mp3 tag (haali) prefs->get(FEATURE_ALTERNATE_MP3_TAG,&alternate_mp3_tag); // Video renderer if(prefs->get(DEVICE_VIDEODEVICE,&render)!=RC_OK) { render=(uint32_t)RENDER_GTK; } // SysTray if(!prefs->get(FEATURE_USE_SYSTRAY,&useTray)) useTray=0; // Accept mpeg for DVD when fq!=48 kHz if(!prefs->get(FEATURE_MPEG_NO_LIMIT,&mpeg_no_limit)) mpeg_no_limit=0; // Multithreads prefs->get(FEATURE_THREADING_LAVC, &lavcThreads); // Encoding priority if(!prefs->get(PRIORITY_ENCODING, &encodePriority)) encodePriority=2; // Indexing / unpacking priority if(!prefs->get(PRIORITY_INDEXING, &indexPriority)) indexPriority=2; // Playback priority if(!prefs->get(PRIORITY_PLAYBACK, &playbackPriority)) playbackPriority=0; // Open DML (Gmv) if(!prefs->get(FEATURE_USE_ODML, &use_odml)) use_odml=0; #if defined(ALSA_SUPPORT) || defined (OSS_SUPPORT) // Master or PCM for audio if(!prefs->get(FEATURE_AUDIOBAR_USES_MASTER, &useMaster)) useMaster=0; #endif // Autoindex files if(!prefs->get(FEATURE_TRYAUTOIDX, &useAutoIndex)) useAutoIndex=0; // SWAP A&B if A>B if(!prefs->get(FEATURE_SWAP_IF_A_GREATER_THAN_B, &useSwap)) useSwap=0; // No nuv sync if(!prefs->get(FEATURE_DISABLE_NUV_RESYNC, &useNuv)) useNuv=0; // Get level of message verbosity prefs->get(MESSAGE_LEVEL,&msglevel); // Downmix default if(prefs->get(DOWNMIXING_PROLOGIC,&downmix)!=RC_OK) { downmix=0; } olddevice=newdevice=AVDM_getCurrentDevice(); // Audio device /************************ Build diaelems ****************************************/ diaElemToggle useSysTray(&useTray,QT_TR_NOOP("_Use systray while encoding")); diaElemToggle allowAnyMpeg(&mpeg_no_limit,QT_TR_NOOP("_Accept non-standard audio frequency for DVD")); diaElemToggle openDml(&use_odml,QT_TR_NOOP("Create _OpenDML files")); diaElemToggle autoIndex(&useAutoIndex,QT_TR_NOOP("Automatically _index MPEG files")); diaElemToggle autoSwap(&useSwap,QT_TR_NOOP("Automatically _swap A and B if A>B")); diaElemToggle nuvAudio(&useNuv,QT_TR_NOOP("_Disable NUV audio sync")); diaElemToggle togAutoVbr(&autovbr,QT_TR_NOOP("Automatically _build VBR map")); diaElemToggle togAutoIndex(&autoindex,QT_TR_NOOP("Automatically _rebuild index")); diaElemToggle togAutoUnpack(&autounpack,QT_TR_NOOP("Automatically remove _packed bitstream")); diaElemFrame frameSimd(QT_TR_NOOP("SIMD")); diaElemToggle capsToggleAll(&capsAll,QT_TR_NOOP("Enable all SIMD")); diaElemToggle capsToggleMMX(&capsMMX, QT_TR_NOOP("Enable MMX")); diaElemToggle capsToggleMMXEXT(&capsMMXEXT, QT_TR_NOOP("Enable MMXEXT")); diaElemToggle capsToggle3DNOW(&caps3DNOW, QT_TR_NOOP("Enable 3DNOW")); diaElemToggle capsToggle3DNOWEXT(&caps3DNOWEXT, QT_TR_NOOP("Enable 3DNOWEXT")); diaElemToggle capsToggleSSE(&capsSSE, QT_TR_NOOP("Enable SSE")); diaElemToggle capsToggleSSE2(&capsSSE2, QT_TR_NOOP("Enable SSE2")); diaElemToggle capsToggleSSE3(&capsSSE3, QT_TR_NOOP("Enable SSE3")); diaElemToggle capsToggleSSSE3(&capsSSSE3, QT_TR_NOOP("Enable SSSE3")); capsToggleAll.link(0, &capsToggleMMX); capsToggleAll.link(0, &capsToggleMMXEXT); capsToggleAll.link(0, &capsToggle3DNOW); capsToggleAll.link(0, &capsToggle3DNOWEXT); capsToggleAll.link(0, &capsToggleSSE); capsToggleAll.link(0, &capsToggleSSE2); capsToggleAll.link(0, &capsToggleSSE3); capsToggleAll.link(0, &capsToggleSSSE3); frameSimd.swallow(&capsToggleAll); frameSimd.swallow(&capsToggleMMX); frameSimd.swallow(&capsToggleMMXEXT); frameSimd.swallow(&capsToggle3DNOW); frameSimd.swallow(&capsToggle3DNOWEXT); frameSimd.swallow(&capsToggleSSE); frameSimd.swallow(&capsToggleSSE2); frameSimd.swallow(&capsToggleSSE3); frameSimd.swallow(&capsToggleSSSE3); diaElemThreadCount lavcThreadCount(&lavcThreads, QT_TR_NOOP("_lavc threads:")); diaElemFrame frameThread(QT_TR_NOOP("Multi-threading")); frameThread.swallow(&lavcThreadCount); diaMenuEntry priorityEntries[] = { {0, QT_TR_NOOP("High"),NULL} ,{1, QT_TR_NOOP("Above normal"),NULL} ,{2, QT_TR_NOOP("Normal"),NULL} ,{3, QT_TR_NOOP("Below normal"),NULL} ,{4, QT_TR_NOOP("Low"),NULL} }; diaElemMenu menuEncodePriority(&encodePriority,QT_TR_NOOP("_Encoding priority:"), sizeof(priorityEntries)/sizeof(diaMenuEntry), priorityEntries,""); diaElemMenu menuIndexPriority(&indexPriority,QT_TR_NOOP("_Indexing/unpacking priority:"), sizeof(priorityEntries)/sizeof(diaMenuEntry), priorityEntries,""); diaElemMenu menuPlaybackPriority(&playbackPriority,QT_TR_NOOP("_Playback priority:"), sizeof(priorityEntries)/sizeof(diaMenuEntry), priorityEntries,""); diaElemFrame framePriority(QT_TR_NOOP("Prioritisation")); framePriority.swallow(&menuEncodePriority); framePriority.swallow(&menuIndexPriority); framePriority.swallow(&menuPlaybackPriority); diaElemToggle togTagMp3(&alternate_mp3_tag,QT_TR_NOOP("_Use alternative tag for MP3 in .mp4")); diaMenuEntry videoMode[]={ {RENDER_GTK, getNativeRendererDesc(), NULL} #if ADM_UI_TYPE_BUILD == ADM_UI_QT4 && defined(USE_OPENGL) ,{RENDER_QT_OPENGL, QT_TR_NOOP("Qt (OpenGL)"), NULL} #endif #ifdef USE_XV ,{RENDER_XV, QT_TR_NOOP("XVideo (best)"),NULL} #endif #ifdef USE_SDL #ifdef __WIN32 ,{RENDER_SDL, QT_TR_NOOP("SDL (MS Windows GDI)"),NULL} ,{RENDER_DIRECTX, QT_TR_NOOP("SDL (MS Windows DirectX)"),NULL} #else ,{RENDER_SDL, QT_TR_NOOP("SDL (good)"),NULL} #endif #endif }; diaElemMenu menuVideoMode(&render,QT_TR_NOOP("Video _display:"), sizeof(videoMode)/sizeof(diaMenuEntry),videoMode,""); diaMenuEntry msgEntries[]={ {0, QT_TR_NOOP("No alerts"),NULL} ,{1, QT_TR_NOOP("Display only error alerts"),NULL} ,{2, QT_TR_NOOP("Display all alerts"),NULL} }; diaElemMenu menuMessage(&msglevel,QT_TR_NOOP("_Message level:"), sizeof(msgEntries)/sizeof(diaMenuEntry),msgEntries,""); #if defined(ALSA_SUPPORT) || defined (OSS_SUPPORT) diaMenuEntry volumeEntries[]={ {0, QT_TR_NOOP("PCM"),NULL} ,{1, QT_TR_NOOP("Master"),NULL}}; diaElemMenu menuVolume(&useMaster,QT_TR_NOOP("_Volume control:"), sizeof(volumeEntries)/sizeof(diaMenuEntry),volumeEntries,""); #endif diaMenuEntry mixerEntries[]={ {0, QT_TR_NOOP("No downmixing"),NULL} ,{1, QT_TR_NOOP("Stereo"),NULL} ,{2, QT_TR_NOOP("Pro Logic"),NULL} ,{3, QT_TR_NOOP("Pro Logic II"),NULL} }; diaElemMenu menuMixer(&downmix,QT_TR_NOOP("_Local playback downmixing:"), sizeof(mixerEntries)/sizeof(diaMenuEntry),mixerEntries,""); //*********** AV_ //***AV uint32_t nbAudioDevice=ADM_av_getNbDevices(); diaMenuEntryDynamic *audioDeviceItems[nbAudioDevice+1]; audioDeviceItems[0]=new diaMenuEntryDynamic(0,"Dummy","Dummy"); for(int i=0;i<nbAudioDevice;i++) { const char *name; uint32_t major,minor,patch; ADM_av_getDeviceInfo(i, &name, &major,&minor,&patch); audioDeviceItems[i+1]=new diaMenuEntryDynamic(i+1,name,name); } diaElemMenuDynamic menuAudio(&newdevice,QT_TR_NOOP("_AudioDevice"), nbAudioDevice+1, audioDeviceItems,NULL); // default Post proc diaElemToggle fhzd(&hzd,QT_TR_NOOP("_Horizontal deblocking")); diaElemToggle fvzd(&vzd,QT_TR_NOOP("_Vertical deblocking")); diaElemToggle fdring(&dring,QT_TR_NOOP("De_ringing")); diaElemUInteger postProcStrength(&pp_value,QT_TR_NOOP("_Strength:"),0,5); diaElemFrame framePP(QT_TR_NOOP("Default Postprocessing")); framePP.swallow(&fhzd); framePP.swallow(&fvzd); framePP.swallow(&fdring); framePP.swallow(&postProcStrength); diaElemToggle togGlobalGlyph(&useGlobalGlyph, QT_TR_NOOP("Use _Global GlyphSet")); diaElemFile entryGLyphPath(0,&globalGlyphName,QT_TR_NOOP("Gl_yphSet:"), NULL, QT_TR_NOOP("Select GlyphSet file")); togGlobalGlyph.link(1, &entryGLyphPath); /* User Interface */ diaElem *diaUser[]={&useSysTray,&menuMessage}; diaElemTabs tabUser(QT_TR_NOOP("User Interface"),2,diaUser); /* Automation */ diaElem *diaAuto[]={&autoSwap,&togAutoVbr,&togAutoIndex,&togAutoUnpack,&autoIndex,}; diaElemTabs tabAuto(QT_TR_NOOP("Automation"),5,diaAuto); /* Input */ diaElem *diaInput[]={&nuvAudio}; diaElemTabs tabInput(QT_TR_NOOP("Input"),1,(diaElem **)diaInput); /* Output */ diaElem *diaOutput[]={&openDml,&allowAnyMpeg,&togTagMp3}; diaElemTabs tabOutput(QT_TR_NOOP("Output"),3,(diaElem **)diaOutput); /* Audio */ diaElem *diaAudio[]={&menuMixer,&menuAudio}; diaElemTabs tabAudio(QT_TR_NOOP("Audio"),2,(diaElem **)diaAudio); /* Video */ diaElem *diaVideo[]={&menuVideoMode,&framePP}; diaElemTabs tabVideo(QT_TR_NOOP("Video"),2,(diaElem **)diaVideo); /* CPU tab */ diaElem *diaCpu[]={&frameSimd}; diaElemTabs tabCpu(QT_TR_NOOP("CPU"),1,(diaElem **)diaCpu); /* Threading tab */ diaElem *diaThreading[]={&frameThread, &framePriority}; diaElemTabs tabThreading(QT_TR_NOOP("Threading"),2,(diaElem **)diaThreading); /* Global Glyph tab */ diaElem *diaGlyph[]={&togGlobalGlyph,&entryGLyphPath}; diaElemTabs tabGlyph(QT_TR_NOOP("Global GlyphSet"),2,(diaElem **)diaGlyph); // SET diaElemTabs *tabs[]={&tabUser,&tabAuto,&tabInput,&tabOutput,&tabAudio,&tabVideo,&tabCpu,&tabThreading,&tabGlyph}; if( diaFactoryRunTabs(QT_TR_NOOP("Preferences"),9,tabs)) { // cpu caps if(capsAll) { CpuCaps::myCpuMask=ADM_CPUCAP_ALL; }else { CpuCaps::myCpuMask=0; #undef CPU_CAPS #define CPU_CAPS(x) if(caps##x) CpuCaps::myCpuMask|= ADM_CPUCAP_##x; CPU_CAPS(MMX); CPU_CAPS(MMXEXT); CPU_CAPS(3DNOW); CPU_CAPS(3DNOWEXT); CPU_CAPS(SSE); CPU_CAPS(SSE2); CPU_CAPS(SSE3); CPU_CAPS(SSSE3); } prefs->set(FEATURE_CPU_CAPS,CpuCaps::myCpuMask); // Glyphs prefs->set(FEATURE_GLOBAL_GLYPH_ACTIVE,useGlobalGlyph); prefs->set(FEATURE_GLOBAL_GLYPH_NAME,globalGlyphName); // Postproc #undef DOME #define DOME(x,y) if(y) pp_type |=x; pp_type=0; DOME(1,hzd); DOME(2,vzd); DOME(4,dring); prefs->set(DEFAULT_POSTPROC_TYPE,pp_type); prefs->set(DEFAULT_POSTPROC_VALUE,pp_value); // prefs->set(FEATURE_AUTO_UNPACK,autounpack); // autovbr prefs->set(FEATURE_AUTO_BUILDMAP,autovbr); // autoindex prefs->set(FEATURE_AUTO_REBUILDINDEX,autoindex); // Alsa #ifdef ALSA_SUPPORT if(alsaDevice) { prefs->set(DEVICE_AUDIO_ALSA_DEVICE, alsaDevice); ADM_dealloc(alsaDevice); alsaDevice=NULL; } #endif // Device if(olddevice!=newdevice) { AVDM_switch((AUDIO_DEVICE)newdevice); } // Downmixing (default) prefs->set(DOWNMIXING_PROLOGIC,downmix); #if defined(ALSA_SUPPORT) || defined (OSS_SUPPORT) // Master or PCM prefs->set(FEATURE_AUDIOBAR_USES_MASTER, useMaster); #endif // allow non std audio fq for dvd prefs->set(FEATURE_MPEG_NO_LIMIT, mpeg_no_limit); // Video render prefs->set(DEVICE_VIDEODEVICE,render); // Odml prefs->set(FEATURE_USE_ODML, use_odml); // number of threads prefs->set(FEATURE_THREADING_LAVC, lavcThreads); // Encoding priority prefs->set(PRIORITY_ENCODING, encodePriority); // Indexing / unpacking priority prefs->set(PRIORITY_INDEXING, indexPriority); // Playback priority prefs->set(PRIORITY_PLAYBACK, playbackPriority); // Auto index mpeg prefs->set(FEATURE_TRYAUTOIDX, useAutoIndex); // Auto swap A/B prefs->set(FEATURE_SWAP_IF_A_GREATER_THAN_B, useSwap); // prefs->set(MESSAGE_LEVEL,msglevel); // Disable nuv sync prefs->set(FEATURE_DISABLE_NUV_RESYNC, useNuv); // Use tray while encoding prefs->set(FEATURE_USE_SYSTRAY,useTray); // Alternate mp3 tag (haali) prefs->set(FEATURE_ALTERNATE_MP3_TAG,alternate_mp3_tag); #if defined(__WIN32) && defined(USE_SDL) // Initialise SDL again as driver may have changed initSdl(render); #endif } for(int i=0;i<nbAudioDevice+1;i++) { delete audioDeviceItems[i]; } ADM_dealloc(globalGlyphName); return 1; }
int main(int argc, char *argv[]) { #if defined(__WIN32) && defined(USE_SDL) redirectStdoutToFile(); #endif #if defined(ADM_DEBUG) && defined(FIND_LEAKS) new_progname = argv[0]; #endif #ifndef __MINGW32__ // thx smurf uk :) installSigHandler(); #endif printf("*************************\n"); printf(" Avidemux v" VERSION); if(ADM_SUBVERSION) { printf(" (r%04u)", ADM_SUBVERSION); } printf("\n*************************\n"); printf(" http://www.avidemux.org\n"); printf(" Code : Mean, JSC, Gruntster \n"); printf(" GFX : Nestor Di , [email protected]\n"); printf(" Design : Jakub Misak\n"); printf(" FreeBSD : Anish Mistry, [email protected]\n"); printf(" Audio : Mihail Zenkov\n"); printf(" MacOsX : Kuisathaverat\n"); printf(" Win32 : Gruntster\n\n"); #ifdef __GNUC__ printf("Compiler: GCC %s\n", __VERSION__); #endif printf("Build Target: "); #if defined(__WIN32) printf("Microsoft Windows"); #elif defined(__APPLE__) printf("Apple"); #else printf("Linux"); #endif #if defined(ADM_CPU_X86_32) printf(" (x86)"); #elif defined(ADM_CPU_X86_64) printf(" (x86-64)"); #elif defined(ADM_CPU_PPC) printf(" (PowerPC)"); #endif printf("\n"); char uiDesc[15]; getUIDescription(uiDesc); printf("User Interface: %s\n", uiDesc); #ifdef __WIN32 char version[250]; if (getWindowsVersion(version)) printf("Operating System: %s\n", version); #endif #if defined(__USE_LARGEFILE) && defined(__USE_LARGEFILE64) printf("\nLarge file available: %d offset\n", __USE_FILE_OFFSET64); #endif // Start counting memory ADM_memStatInit(); ADM_InitMemcpy(); printf("\nInitialising prefs\n"); initPrefs(); prefs->load(); CpuCaps::init(); #ifdef USE_SDL uint32_t videoDevice = RENDER_LAST; prefs->get(DEVICE_VIDEODEVICE, &videoDevice); initSdl(videoDevice); #endif atexit(onexit); #ifdef __MINGW32__ win32_netInit(); #endif UI_Init(argc,argv); AUDMEncoder_initDither(); // Hook our UI... InitFactory(); InitCoreToolkit(); initFileSelector(); // Load .avidemuxrc quotaInit(); video_body = new ADM_Composer; #ifdef HAVE_ENCODER registerVideoFilters(); #endif //***************Plugins ********************* // Load system wide audio decoder plugin #ifdef _WIN32 const char *startDir=""; const char *pluginDir="plugins"; #else const char *pluginDir="ADM_plugins"; #ifdef __APPLE__ const char *startDir="../lib"; #else const char *startDir="lib"; #endif #endif char *adPlugins = ADM_getInstallRelativePath(startDir,pluginDir,"audioDecoder"); char *vfPlugins = ADM_getInstallRelativePath(startDir,pluginDir,"videoFilter"); char *avPlugins = ADM_getInstallRelativePath(startDir,pluginDir,"audioDevices"); char *aePlugins = ADM_getInstallRelativePath(startDir,pluginDir,"audioEncoders"); ADM_ad_loadPlugins(adPlugins); delete [] adPlugins; ADM_vf_loadPlugins(vfPlugins); delete [] vfPlugins; ADM_av_loadPlugins(avPlugins); delete [] avPlugins; ADM_ae_loadPlugins(aePlugins); delete [] aePlugins; // load local audio decoder plugins adPlugins=ADM_getHomeRelativePath("plugins","audioDecoder"); ADM_ad_loadPlugins(adPlugins); delete [] adPlugins; // load local video filter plugins vfPlugins=ADM_getHomeRelativePath("plugins","videoFilter"); ADM_vf_loadPlugins(vfPlugins); delete [] vfPlugins; // load encoder plugins... loadPlugins(); //***************Plugins ********************* if(!initGUI()) { printf("\n Fatal : could not init GUI\n"); exit(-1); } ADM_lavInit(); #ifdef HAVE_AUDIO AVDM_audioInit(); #endif if(SpidermonkeyInit() == true) printf("Spidermonkey initialized.\n"); else ADM_assert(0); #ifdef __MINGW32__ __try1(exceptionHandler); #endif UI_RunApp(); #ifdef __MINGW32__ __except1(exceptionHandler); #endif printf("Normal exit\n"); return 0; }
/** \fn DIA_Preferences \brief Handle preference dialog */ uint8_t DIA_Preferences(void) { uint32_t olddevice,newdevice; bool use_odml=0; uint32_t autosplit=0; uint32_t render; bool useTray=0; bool useSwap=0; uint32_t lavcThreads=0; uint32_t encodePriority=2; uint32_t indexPriority=2; uint32_t playbackPriority=0; uint32_t downmix; bool mpeg_no_limit=0; uint32_t msglevel=2; uint32_t mixer=0; char *alsaDevice=NULL; bool balternate_mp3_tag=true; uint32_t pp_type=3; uint32_t pp_value=5; bool bvdpau=false; bool hzd,vzd,dring; bool capsMMX,capsMMXEXT,caps3DNOW,caps3DNOWEXT,capsSSE,capsSSE2,capsSSE3,capsSSSE3,capsAll; bool hasOpenGl=false; bool askPortAvisynth=false; uint32_t defaultPortAvisynth = 9999; #ifdef USE_OPENGL prefs->get(FEATURES_ENABLE_OPENGL,&hasOpenGl); #endif olddevice=newdevice=AVDM_getCurrentDevice(); // Default pp if(!prefs->get(DEFAULT_POSTPROC_TYPE,&pp_type)) pp_type=3; if(!prefs->get(DEFAULT_POSTPROC_VALUE,&pp_value)) pp_value=3; #define DOME(x,y) y=!!(pp_type & x) DOME(1,hzd); DOME(2,vzd); DOME(4,dring); // Cpu caps #define CPU_CAPS(x) if(CpuCaps::myCpuMask & ADM_CPUCAP_##x) caps##x=1; else caps##x=0; if(CpuCaps::myCpuMask==ADM_CPUCAP_ALL) capsAll=1; else capsAll=0; CPU_CAPS(MMX); CPU_CAPS(MMXEXT); CPU_CAPS(3DNOW); CPU_CAPS(3DNOWEXT); CPU_CAPS(SSE); CPU_CAPS(SSE2); CPU_CAPS(SSE3); CPU_CAPS(SSSE3); //Avisynth if(!prefs->get(AVISYNTH_AVISYNTH_ALWAYS_ASK, &askPortAvisynth)) { ADM_info("Always ask not set\n"); askPortAvisynth=0; } if(!prefs->get(AVISYNTH_AVISYNTH_DEFAULTPORT, &defaultPortAvisynth)) { printf("Port not set\n"); defaultPortAvisynth=9999; } ADM_info("Avisynth port: %d\n",defaultPortAvisynth); // Alsa #ifdef ALSA_SUPPORT if( prefs->get(DEVICE_AUDIO_ALSA_DEVICE, &alsaDevice) != RC_OK ) alsaDevice = ADM_strdup("plughw:0,0"); #endif // vdpau prefs->get(FEATURES_VDPAU,&bvdpau); // Alternate mp3 tag (haali) prefs->get(FEATURES_ALTERNATE_MP3_TAG,&balternate_mp3_tag); // Video renderer if(prefs->get(VIDEODEVICE,&render)!=RC_OK) { render=(uint32_t)RENDER_GTK; } // SysTray if(!prefs->get(FEATURES_USE_SYSTRAY,&useTray)) useTray=0; // Accept mpeg for DVD when fq!=48 kHz if(!prefs->get(FEATURES_MPEG_NO_LIMIT,&mpeg_no_limit)) mpeg_no_limit=0; // Multithreads prefs->get(FEATURES_THREADING_LAVC, &lavcThreads); // Encoding priority if(!prefs->get(PRIORITY_ENCODING, &encodePriority)) encodePriority=2; // Indexing / unpacking priority if(!prefs->get(PRIORITY_INDEXING, &indexPriority)) indexPriority=2; // Playback priority if(!prefs->get(PRIORITY_PLAYBACK, &playbackPriority)) playbackPriority=0; // VCD/SVCD split point if(!prefs->get(MPEGSPLIT_AUTOSPLIT, &autosplit)) autosplit=690; // Open DML (Gmv) if(!prefs->get(FEATURES_USE_ODML, &use_odml)) use_odml=0; #if defined(ALSA_SUPPORT) || defined (OSS_SUPPORT) // Master or PCM for audio if(!prefs->get(FEATURES_AUDIOBAR_USES_MASTER, &useMaster)) useMaster=0; #endif // SWAP A&B if A>B if(!prefs->get(FEATURES_SWAP_IF_A_GREATER_THAN_B, &useSwap)) useSwap=0; // Get level of message verbosity prefs->get(MESSAGE_LEVEL,&msglevel); // Downmix default if(prefs->get(DEFAULT_DOWNMIXING,&downmix)!=RC_OK) { downmix=0; } olddevice=newdevice=AVDM_getCurrentDevice(); // Audio device /************************ Build diaelems ****************************************/ diaElemToggle useVdpau(&bvdpau,QT_TR_NOOP("Decode video using VDPAU")); diaElemToggle useOpenGl(&hasOpenGl,QT_TR_NOOP("Enable openGl support")); #ifndef USE_OPENGL //useOpenGl.enable(0); #endif diaElemToggle useSysTray(&useTray,QT_TR_NOOP("_Use systray while encoding")); diaElemToggle allowAnyMpeg(&mpeg_no_limit,QT_TR_NOOP("_Accept non-standard audio frequency for DVD")); diaElemToggle openDml(&use_odml,QT_TR_NOOP("Create _OpenDML files")); diaElemFrame frameSimd(QT_TR_NOOP("SIMD")); diaElemToggle capsToggleAll(&capsAll,QT_TR_NOOP("Enable all SIMD")); diaElemToggle capsToggleMMX(&capsMMX, QT_TR_NOOP("Enable MMX")); diaElemToggle capsToggleMMXEXT(&capsMMXEXT, QT_TR_NOOP("Enable MMXEXT")); diaElemToggle capsToggle3DNOW(&caps3DNOW, QT_TR_NOOP("Enable 3DNOW")); diaElemToggle capsToggle3DNOWEXT(&caps3DNOWEXT, QT_TR_NOOP("Enable 3DNOWEXT")); diaElemToggle capsToggleSSE(&capsSSE, QT_TR_NOOP("Enable SSE")); diaElemToggle capsToggleSSE2(&capsSSE2, QT_TR_NOOP("Enable SSE2")); diaElemToggle capsToggleSSE3(&capsSSE3, QT_TR_NOOP("Enable SSE3")); diaElemToggle capsToggleSSSE3(&capsSSSE3, QT_TR_NOOP("Enable SSSE3")); capsToggleAll.link(0, &capsToggleMMX); capsToggleAll.link(0, &capsToggleMMXEXT); capsToggleAll.link(0, &capsToggle3DNOW); capsToggleAll.link(0, &capsToggle3DNOWEXT); capsToggleAll.link(0, &capsToggleSSE); capsToggleAll.link(0, &capsToggleSSE2); capsToggleAll.link(0, &capsToggleSSE3); capsToggleAll.link(0, &capsToggleSSSE3); frameSimd.swallow(&capsToggleAll); frameSimd.swallow(&capsToggleMMX); frameSimd.swallow(&capsToggleMMXEXT); frameSimd.swallow(&capsToggle3DNOW); frameSimd.swallow(&capsToggle3DNOWEXT); frameSimd.swallow(&capsToggleSSE); frameSimd.swallow(&capsToggleSSE2); frameSimd.swallow(&capsToggleSSE3); frameSimd.swallow(&capsToggleSSSE3); diaElemThreadCount lavcThreadCount(&lavcThreads, QT_TR_NOOP("_lavc threads:")); diaElemFrame frameThread(QT_TR_NOOP("Multi-threading")); frameThread.swallow(&lavcThreadCount); diaMenuEntry priorityEntries[] = { {0, QT_TR_NOOP("High"),NULL} ,{1, QT_TR_NOOP("Above normal"),NULL} ,{2, QT_TR_NOOP("Normal"),NULL} ,{3, QT_TR_NOOP("Below normal"),NULL} ,{4, QT_TR_NOOP("Low"),NULL} }; diaElemMenu menuEncodePriority(&encodePriority,QT_TR_NOOP("_Encoding priority:"), sizeof(priorityEntries)/sizeof(diaMenuEntry), priorityEntries,""); diaElemMenu menuIndexPriority(&indexPriority,QT_TR_NOOP("_Indexing/unpacking priority:"), sizeof(priorityEntries)/sizeof(diaMenuEntry), priorityEntries,""); diaElemMenu menuPlaybackPriority(&playbackPriority,QT_TR_NOOP("_Playback priority:"), sizeof(priorityEntries)/sizeof(diaMenuEntry), priorityEntries,""); diaElemFrame framePriority(QT_TR_NOOP("Prioritisation")); framePriority.swallow(&menuEncodePriority); framePriority.swallow(&menuIndexPriority); framePriority.swallow(&menuPlaybackPriority); diaElemUInteger autoSplit(&autosplit,QT_TR_NOOP("_Split MPEG files every (MB):"),10,4096); diaElemToggle togTagMp3(&balternate_mp3_tag,QT_TR_NOOP("_Use alternative tag for MP3 in .mp4")); diaMenuEntry videoMode[]={ {RENDER_GTK, getNativeRendererDesc(), NULL} #ifdef USE_XV ,{RENDER_XV, QT_TR_NOOP("XVideo (best)"),NULL} #endif #ifdef USE_VDPAU ,{RENDER_VDPAU, QT_TR_NOOP("VDPAU (best)"),NULL} #endif #ifdef USE_OPENGL ,{RENDER_QTOPENGL, QT_TR_NOOP("OpenGL (best)"),NULL} #endif #ifdef USE_SDL #ifdef _WIN32 ,{RENDER_SDL, QT_TR_NOOP("MS Windows GDI (SDL)"),NULL} ,{RENDER_DIRECTX, QT_TR_NOOP("MS Windows DirectX (SDL)"),NULL} #else ,{RENDER_SDL, QT_TR_NOOP("SDL (good)"),NULL} #endif #endif }; diaElemMenu menuVideoMode(&render,QT_TR_NOOP("Video _display:"), sizeof(videoMode)/sizeof(diaMenuEntry),videoMode,""); diaMenuEntry msgEntries[]={ {0, QT_TR_NOOP("No alerts"),NULL} ,{1, QT_TR_NOOP("Display only error alerts"),NULL} ,{2, QT_TR_NOOP("Display all alerts"),NULL} }; diaElemMenu menuMessage(&msglevel,QT_TR_NOOP("_Message level:"), sizeof(msgEntries)/sizeof(diaMenuEntry),msgEntries,""); #if defined(ALSA_SUPPORT) || defined (OSS_SUPPORT) diaMenuEntry volumeEntries[]={ {0, QT_TR_NOOP("PCM"),NULL} ,{1, QT_TR_NOOP("Master"),NULL}}; diaElemMenu menuVolume(&useMaster,QT_TR_NOOP("_Volume control:"), sizeof(volumeEntries)/sizeof(diaMenuEntry),volumeEntries,""); #endif diaMenuEntry mixerEntries[]={ {0, QT_TR_NOOP("No downmixing"),NULL} ,{1, QT_TR_NOOP("Stereo"),NULL} ,{2, QT_TR_NOOP("Pro Logic"),NULL} ,{3, QT_TR_NOOP("Pro Logic II"),NULL} }; diaElemMenu menuMixer(&downmix,QT_TR_NOOP("_Local playback downmixing:"), sizeof(mixerEntries)/sizeof(diaMenuEntry),mixerEntries,""); //*********** AV_ //***AV uint32_t nbAudioDevice=ADM_av_getNbDevices(); diaMenuEntryDynamic **audioDeviceItems=new diaMenuEntryDynamic *[nbAudioDevice+1]; audioDeviceItems[0]=new diaMenuEntryDynamic(0,"Dummy","Dummy"); for(int i=0;i<nbAudioDevice;i++) { const char *name; uint32_t major,minor,patch; ADM_av_getDeviceInfo(i, &name, &major,&minor,&patch); audioDeviceItems[i+1]=new diaMenuEntryDynamic(i+1,name,name); } diaElemMenuDynamic menuAudio(&newdevice,QT_TR_NOOP("_AudioDevice"), nbAudioDevice+1, audioDeviceItems,NULL); // default Post proc diaElemToggle fhzd(&hzd,QT_TR_NOOP("_Horizontal deblocking")); diaElemToggle fvzd(&vzd,QT_TR_NOOP("_Vertical deblocking")); diaElemToggle fdring(&dring,QT_TR_NOOP("De_ringing")); diaElemUInteger postProcStrength(&pp_value,QT_TR_NOOP("_Strength:"),0,5); diaElemFrame framePP(QT_TR_NOOP("Default Postprocessing")); framePP.swallow(&fhzd); framePP.swallow(&fvzd); framePP.swallow(&fdring); framePP.swallow(&postProcStrength); /* User Interface */ diaElem *diaUser[]={&useSysTray,&menuMessage}; diaElemTabs tabUser(QT_TR_NOOP("User Interface"),2,diaUser); /* Automation */ /* Output */ diaElem *diaOutput[]={&autoSplit,&openDml,&allowAnyMpeg,&togTagMp3}; diaElemTabs tabOutput(QT_TR_NOOP("Output"),4,(diaElem **)diaOutput); /* Audio */ #if 0 //defined(ALSA_SUPPORT) diaElem *diaAudio[]={&menuMixer,&menuVolume,&menuAudio,&entryAlsaDevice}; diaElemTabs tabAudio(QT_TR_NOOP("Audio"),4,(diaElem **)diaAudio); //#elif defined(OSS_SUPPORT) diaElem *diaAudio[]={&menuMixer,&menuVolume,&menuAudio}; diaElemTabs tabAudio(QT_TR_NOOP("Audio"),3,(diaElem **)diaAudio); #endif #if 1 diaElem *diaAudio[]={&menuMixer,&menuAudio}; diaElemTabs tabAudio(QT_TR_NOOP("Audio"),2,(diaElem **)diaAudio); #endif /* Video */ diaElem *diaVideo[]={&menuVideoMode,&framePP,&useVdpau,&useOpenGl}; diaElemTabs tabVideo(QT_TR_NOOP("Video"),4,(diaElem **)diaVideo); /* CPU tab */ diaElem *diaCpu[]={&frameSimd}; diaElemTabs tabCpu(QT_TR_NOOP("CPU"),1,(diaElem **)diaCpu); /* Threading tab */ diaElem *diaThreading[]={&frameThread, &framePriority}; diaElemTabs tabThreading(QT_TR_NOOP("Threading"),2,(diaElem **)diaThreading); /* Avisynth tab */ diaElemToggle togAskAvisynthPort(&askPortAvisynth,"_Always ask which port to use"); diaElemUInteger uintDefaultPortAvisynth(&defaultPortAvisynth,"Default port to use",1024,65535); diaElem *diaAvisynth[]={&togAskAvisynthPort, &uintDefaultPortAvisynth}; diaElemTabs tabAvisynth("Avisynth",2,(diaElem **)diaAvisynth); /* Global Glyph tab */ // SET diaElemTabs *tabs[]={&tabUser,&tabOutput,&tabAudio,&tabVideo,&tabCpu,&tabThreading, &tabAvisynth}; if( diaFactoryRunTabs(QT_TR_NOOP("Preferences"),7,tabs)) { // #ifdef USE_OPENGL prefs->set(FEATURES_ENABLE_OPENGL,hasOpenGl); #endif // cpu caps if(capsAll) { CpuCaps::myCpuMask=ADM_CPUCAP_ALL; }else { CpuCaps::myCpuMask=0; #undef CPU_CAPS #define CPU_CAPS(x) if(caps##x) CpuCaps::myCpuMask|= ADM_CPUCAP_##x; CPU_CAPS(MMX); CPU_CAPS(MMXEXT); CPU_CAPS(3DNOW); CPU_CAPS(3DNOWEXT); CPU_CAPS(SSE); CPU_CAPS(SSE2); CPU_CAPS(SSE3); CPU_CAPS(SSSE3); } prefs->set(FEATURES_CPU_CAPS,CpuCaps::myCpuMask); // Postproc #undef DOME #define DOME(x,y) if(y) pp_type |=x; pp_type=0; DOME(1,hzd); DOME(2,vzd); DOME(4,dring); prefs->set(DEFAULT_POSTPROC_TYPE,pp_type); prefs->set(DEFAULT_POSTPROC_VALUE,pp_value); // Alsa #ifdef ALSA_SUPPORT if(alsaDevice) { prefs->set(DEVICE_AUDIO_ALSA_DEVICE, alsaDevice); ADM_dealloc(alsaDevice); alsaDevice=NULL; } #endif // Device //printf("[AudioDevice] Old : %d, new :%d\n",olddevice,newdevice); if(olddevice!=newdevice) { AVDM_switch((AUDIO_DEVICE)newdevice); // Change current device AVDM_audioSave(); // Save it in prefs AVDM_audioInit(); // Respawn } // Downmixing (default) prefs->set(DEFAULT_DOWNMIXING,downmix); #if defined(ALSA_SUPPORT) || defined (OSS_SUPPORT) // Master or PCM prefs->set(FEATURES_AUDIOBAR_USES_MASTER, useMaster); #endif // allow non std audio fq for dvd prefs->set(FEATURES_MPEG_NO_LIMIT, mpeg_no_limit); // Video render prefs->set(VIDEODEVICE,render); // Odml prefs->set(FEATURES_USE_ODML, use_odml); // Split prefs->set(MPEGSPLIT_AUTOSPLIT, autosplit); // number of threads prefs->set(FEATURES_THREADING_LAVC, lavcThreads); // Encoding priority prefs->set(PRIORITY_ENCODING, encodePriority); // Indexing / unpacking priority prefs->set(PRIORITY_INDEXING, indexPriority); // Playback priority prefs->set(PRIORITY_PLAYBACK, playbackPriority); // Auto swap A/B prefs->set(FEATURES_SWAP_IF_A_GREATER_THAN_B, useSwap); // prefs->set(MESSAGE_LEVEL,msglevel); // Use tray while encoding prefs->set(FEATURES_USE_SYSTRAY,useTray); // VDPAU prefs->set(FEATURES_VDPAU,bvdpau); // Alternate mp3 tag (haali) prefs->set(FEATURES_ALTERNATE_MP3_TAG,balternate_mp3_tag); // Avisynth prefs->set(AVISYNTH_AVISYNTH_DEFAULTPORT,defaultPortAvisynth); prefs->set(AVISYNTH_AVISYNTH_ALWAYS_ASK, askPortAvisynth); #if defined(_WIN32) && defined(USE_SDL) // Initialise SDL again as driver may have changed initSdl(render); #endif } for(int i=0;i<nbAudioDevice+1;i++) { delete audioDeviceItems[i]; } delete [] audioDeviceItems; return 1; }
int startAvidemux(int argc, char *argv[]) { printf("*************************\n"); printf(" Avidemux v"ADM_VERSION); #if defined( ADM_SUBVERSION ) #define MKSTRING(x) x printf(" (%s) .", MKSTRING(ADM_SUBVERSION)); #endif printf("\n*************************\n"); printf(" http://www.avidemux.org\n"); printf(" Code : Mean, JSC, Grant Pedersen\n"); printf(" GFX : Nestor Di, [email protected]\n"); printf(" Design : Jakub Misak\n"); printf(" FreeBSD : Anish Mistry, [email protected]\n"); printf(" Audio : Mihail Zenkov\n"); printf(" Mac OS X : Kuisathaverat, Harry van der Wolf\n"); printf(" Win32 : Grant Pedersen\n\n"); #ifdef __GNUC__ printf("Compiler: GCC %s\n", __VERSION__); #endif printf("Build Target: "); #if defined(_WIN32) printf("Microsoft Windows"); #elif defined(__APPLE__) printf("Apple"); #else printf("Linux"); #endif #if defined(ADM_CPU_X86_32) printf(" (x86)"); #elif defined(ADM_CPU_X86_64) printf(" (x86-64)"); #endif char uiDesc[15]; getUIDescription(uiDesc); printf("\nUser Interface: %s\n", uiDesc); #ifdef _WIN32 char version[250]; if (getWindowsVersion(version)) printf("Operating System: %s\n", version); #endif #if defined(__USE_LARGEFILE) && defined(__USE_LARGEFILE64) printf("\nLarge file available: %d offset\n", __USE_FILE_OFFSET64); #endif printf("Time: %s\n", ADM_epochToString(ADM_getSecondsSinceEpoch())); for(int i = 0; i < argc; i++) { printf("%d: %s\n", i, argv[i]); } #ifndef __APPLE__ ADM_InitMemcpy(); #endif printf("\nInitialising prefs\n"); initPrefs(); if(false==prefs->load()) // no prefs, set some sane default { setPrefsDefault(); } CpuCaps::init(); atexit(onexit); #ifdef _WIN32 win32_netInit(); #endif video_body = new ADM_Composer; UI_Init(argc, argv); AUDMEncoder_initDither(); // Hook our UI... InitFactory(); InitCoreToolkit(); initFileSelector(); // Load .avidemuxrc quotaInit(); ADM_lavFormatInit(); //***************Plugins ********************* // Load system wide audio decoder plugin #ifdef __APPLE__ const char *startDir="../lib"; #else const char *startDir=ADM_RELATIVE_LIB_DIR; #endif char *adPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "audioDecoder"); char *avPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "audioDevices"); char *aePlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "audioEncoders"); char *dmPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "demuxers"); char *mxPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "muxers"); char *vePlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "videoEncoders"); char *vdPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "videoDecoders"); char *vfPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "videoFilters"); char *sePlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "scriptEngines"); //***************Plugins ********************* if(!initGUI(initialiseScriptEngines(sePlugins, video_body,getUISpecifSubfolder()))) { printf("\n Fatal : could not init GUI\n"); exit(-1); } delete [] sePlugins; #if defined( USE_VDPAU) #if (ADM_UI_TYPE_BUILD!=ADM_UI_CLI) printf("Probing for VDPAU...\n"); if(vdpauProbe()==true) printf("VDPAU available\n"); else printf("VDPAU not available\n"); #else printf("Cannot use VDPAU in cli mode %d,%d\n",ADM_UI_TYPE_BUILD,ADM_UI_CLI); #endif #endif #if defined( USE_XVBA) #if (ADM_UI_TYPE_BUILD!=ADM_UI_CLI) printf("Probing for XVBA...\n"); if(xvbaProbe()==true) printf("XVBA available\n"); else printf("XVBA not available\n"); #else printf("Cannot use XVBA in cli mode %d,%d\n",ADM_UI_TYPE_BUILD,ADM_UI_CLI); #endif #endif #if defined( USE_LIBVA) #if (ADM_UI_TYPE_BUILD!=ADM_UI_CLI) printf("Probing for LIBVA...\n"); if(libvaProbe()==true) printf("LIBVA available\n"); else printf("LIBVA not available\n"); #else printf("Cannot use LIBVA in cli mode %d,%d\n",ADM_UI_TYPE_BUILD,ADM_UI_CLI); #endif #endif #ifdef USE_SDL char *drv=NULL; printf("Probing for SDL...\n"); std::string sdlDriver=std::string("dummy"); if(prefs->get(FEATURES_SDLDRIVER,&drv)) { if(drv) { if(strlen(drv)) { sdlDriver=std::string(drv); } ADM_dezalloc(drv); } } printf("Calling initSDL with driver=%s\n",sdlDriver.c_str()); initSdl(sdlDriver); #endif // ADM_mx_loadPlugins(mxPlugins); delete [] mxPlugins; ADM_ad_loadPlugins(adPlugins); delete [] adPlugins; ADM_av_loadPlugins(avPlugins); delete [] avPlugins; ADM_ae_loadPlugins(aePlugins); delete [] aePlugins; ADM_dm_loadPlugins(dmPlugins); delete [] dmPlugins; ADM_ve6_loadPlugins(vePlugins,getUISpecifSubfolder()); delete [] vePlugins; ADM_vf_loadPlugins(vfPlugins,getUISpecifSubfolder()); delete [] vfPlugins; ADM_vd6_loadPlugins(vdPlugins); delete [] vdPlugins; // load local audio decoder plugins adPlugins=ADM_getHomeRelativePath("plugins6","audioDecoder"); ADM_ad_loadPlugins(adPlugins); delete [] adPlugins; // load local video filter plugins vfPlugins=ADM_getHomeRelativePath("plugins6","videoFilter"); ADM_vf_loadPlugins(vfPlugins,getUISpecifSubfolder()); delete [] vfPlugins; ADM_lavInit(); AVDM_audioInit(); UI_RunApp(); cleanUp(); printf("Normal exit\n"); return 0; }
int startAvidemux(int argc, char *argv[]) { printf("*************************\n"); printf(" Avidemux v" VERSION); if(ADM_SUBVERSION) { printf(" (r%04u)", ADM_SUBVERSION); } printf("\n*************************\n"); printf(" http://www.avidemux.org\n"); printf(" Code : Mean, JSC, Grant Pedersen\n"); printf(" GFX : Nestor Di, [email protected]\n"); printf(" Design : Jakub Misak\n"); printf(" FreeBSD : Anish Mistry, [email protected]\n"); printf(" Audio : Mihail Zenkov\n"); printf(" Mac OS X : Kuisathaverat, Harry van der Wolf\n"); printf(" Win32 : Grant Pedersen\n\n"); printf("Compiler: "); #if defined(__GNUC__) printf("GCC %s", __VERSION__); #elif defined(_MSC_VER) printf("Microsoft Visual C++ %d.%d", _MSC_VER / 100, _MSC_VER % 100); #else printf("Unknown"); #endif printf("\nBuild Target: "); #if defined(_WIN32) printf("Microsoft Windows"); #elif defined(__APPLE__) printf("Apple"); #else printf("Linux"); #endif #if defined(ADM_CPU_X86_32) printf(" (x86)"); #elif defined(ADM_CPU_X86_64) printf(" (x86-64)"); #endif char uiDesc[15]; getUIDescription(uiDesc); printf("\nUser Interface: %s\n", uiDesc); #ifdef _WIN32 char version[250]; if (getWindowsVersion(version)) printf("Operating System: %s\n", version); #endif #if defined(__USE_LARGEFILE) && defined(__USE_LARGEFILE64) printf("\nLarge file available: %d offset\n", __USE_FILE_OFFSET64); #endif printf("Time: %s\n", ADM_epochToString(ADM_getSecondsSinceEpoch())); for(int i = 0; i < argc; i++) { printf("%d: %s\n", i, argv[i]); } // Start counting memory ADM_memStatInit(); #ifndef __APPLE__ ADM_InitMemcpy(); #endif printf("\nInitialising prefs\n"); initPrefs(); if(false==prefs->load()) // no prefs, set some sane default { setPrefsDefault(); } CpuCaps::init(); #ifdef USE_SDL uint32_t videoDevice = RENDER_LAST; prefs->get(VIDEODEVICE, &videoDevice); initSdl(videoDevice); #endif atexit(onexit); #ifdef _WIN32 win32_netInit(); #endif IPluginManager *pluginManager = new PluginManager(); pluginManager->loadAll(); UI_SetPluginManager(pluginManager); video_body = new ADM_Composer(pluginManager); UI_Init(argc, argv); AUDMEncoder_initDither(); // Hook our UI... InitFactory(); InitCoreToolkit(); initFileSelector(); // Load .avidemuxrc quotaInit(); ADM_lavFormatInit(); //***************Plugins ********************* // Load system wide audio decoder plugin #ifdef __APPLE__ const char *startDir="../lib"; #else const char *startDir=ADM_RELATIVE_LIB_DIR; #endif char *adPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "audioDecoder"); char *avPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "audioDevices"); char *aePlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "audioEncoders"); char *dmPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "demuxers"); char *vdPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "videoDecoders"); char *vfPlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "videoFilters"); char *sePlugins = ADM_getInstallRelativePath(startDir, ADM_PLUGIN_DIR, "scriptEngines"); ADM_ad_loadPlugins(adPlugins); delete [] adPlugins; ADM_av_loadPlugins(avPlugins); delete [] avPlugins; ADM_ae_loadPlugins(aePlugins); delete [] aePlugins; ADM_dm_loadPlugins(dmPlugins); delete [] dmPlugins; ADM_vf_loadPlugins(vfPlugins); delete [] vfPlugins; ADM_vd6_loadPlugins(vdPlugins); delete [] vdPlugins; // load local audio decoder plugins adPlugins=ADM_getHomeRelativePath("plugins6","audioDecoder"); ADM_ad_loadPlugins(adPlugins); delete [] adPlugins; // load local video filter plugins vfPlugins=ADM_getHomeRelativePath("plugins6","videoFilter"); ADM_vf_loadPlugins(vfPlugins); delete [] vfPlugins; //***************Plugins ********************* if(!initGUI(initialiseScriptEngines(sePlugins, video_body, pluginManager), pluginManager)) { printf("\n Fatal : could not init GUI\n"); exit(-1); } delete [] sePlugins; ADM_lavInit(); AVDM_audioInit(); #if defined( USE_VDPAU) #if (ADM_UI_TYPE_BUILD!=ADM_UI_CLI) printf("Probing for VDPAU...\n"); if(vdpauProbe()==true) printf("VDPAU available\n"); else printf("VDPAU not available\n"); #else printf("Cannot use VDPAU in cli mode %d,%d\n",ADM_UI_TYPE_BUILD,ADM_UI_CLI); #endif #endif // Init jobs ADM_jobInit(); UI_RunApp(); cleanUp(); delete pluginManager; printf("Normal exit\n"); return 0; }
/** \fn DIA_Preferences \brief Handle preference dialog */ uint8_t DIA_Preferences(void) { uint32_t olddevice,newdevice; uint32_t lavcodec_mpeg=0; uint32_t use_odml=0; uint32_t autosplit=0; uint32_t render; uint32_t useTray=0; uint32_t useMaster=0; uint32_t useAutoIndex=0; uint32_t useSwap=0; uint32_t useNuv=0; uint32_t lavcThreads=0,x264Threads=0,xvidThreads=0; uint32_t encodePriority=2; uint32_t indexPriority=2; uint32_t playbackPriority=0; uint32_t downmix; uint32_t mpeg_no_limit=0; uint32_t msglevel=2; uint32_t activeXfilter=0; uint32_t mixer=0; char *filterPath=NULL; char *alsaDevice=NULL; uint32_t autovbr=0; uint32_t autoindex=0; uint32_t autounpack=0; uint32_t alternate_mp3_tag=1; uint32_t pp_type=3; uint32_t pp_value=5; uint32_t hzd,vzd,dring; uint32_t capsMMX,capsMMXEXT,caps3DNOW,caps3DNOWEXT,capsSSE,capsSSE2,capsSSE3,capsSSSE3,capsAll; uint32_t useGlobalGlyph=0; char *globalGlyphName=NULL; olddevice=newdevice=AVDM_getCurrentDevice(); // Default pp if(!prefs->get(DEFAULT_POSTPROC_TYPE,&pp_type)) pp_type=3; if(!prefs->get(DEFAULT_POSTPROC_VALUE,&pp_value)) pp_value=3; #define DOME(x,y) y=!!(pp_type & x) DOME(1,hzd); DOME(2,vzd); DOME(4,dring); // Cpu caps #define CPU_CAPS(x) if(CpuCaps::myCpuMask & ADM_CPU_##x) caps##x=1; else caps##x=0; if(CpuCaps::myCpuMask==ADM_CPU_ALL) capsAll=1; else capsAll=0; CPU_CAPS(MMX); CPU_CAPS(MMXEXT); CPU_CAPS(3DNOW); CPU_CAPS(3DNOWEXT); CPU_CAPS(SSE); CPU_CAPS(SSE2); CPU_CAPS(SSE3); CPU_CAPS(SSSE3); // Alsa #ifdef ALSA_SUPPORT if( prefs->get(DEVICE_AUDIO_ALSA_DEVICE, &alsaDevice) != RC_OK ) alsaDevice = ADM_strdup("plughw:0,0"); #endif // autovbr prefs->get(FEATURE_AUTO_BUILDMAP,&autovbr); // autoindex prefs->get(FEATURE_AUTO_REBUILDINDEX,&autoindex); // Global glyph prefs->get(FEATURE_GLOBAL_GLYPH_ACTIVE,&useGlobalGlyph); prefs->get(FEATURE_GLOBAL_GLYPH_NAME,&globalGlyphName); // autoindex prefs->get(FEATURE_AUTO_UNPACK,&autounpack); // Alternate mp3 tag (haali) prefs->get(FEATURE_ALTERNATE_MP3_TAG,&alternate_mp3_tag); // Video renderer if(prefs->get(DEVICE_VIDEODEVICE,&render)!=RC_OK) { render=(uint32_t)RENDER_GTK; } // SysTray if(!prefs->get(FEATURE_USE_SYSTRAY,&useTray)) useTray=0; // Accept mpeg for DVD when fq!=48 kHz if(!prefs->get(FEATURE_MPEG_NO_LIMIT,&mpeg_no_limit)) mpeg_no_limit=0; // Multithreads prefs->get(FEATURE_THREADING_LAVC, &lavcThreads); prefs->get(FEATURE_THREADING_X264, &x264Threads); prefs->get(FEATURE_THREADING_XVID, &xvidThreads); // Encoding priority if(!prefs->get(PRIORITY_ENCODING, &encodePriority)) encodePriority=2; // Indexing / unpacking priority if(!prefs->get(PRIORITY_INDEXING, &indexPriority)) indexPriority=2; // Playback priority if(!prefs->get(PRIORITY_PLAYBACK, &playbackPriority)) playbackPriority=0; // VCD/SVCD split point if(!prefs->get(SETTINGS_MPEGSPLIT, &autosplit)) autosplit=690; if(!prefs->get(FEATURE_USE_LAVCODEC_MPEG, &lavcodec_mpeg)) lavcodec_mpeg=0; // Open DML (Gmv) if(!prefs->get(FEATURE_USE_ODML, &use_odml)) use_odml=0; #if defined(ALSA_SUPPORT) || defined (OSS_SUPPORT) // Master or PCM for audio if(!prefs->get(FEATURE_AUDIOBAR_USES_MASTER, &useMaster)) useMaster=0; #endif // Autoindex files if(!prefs->get(FEATURE_TRYAUTOIDX, &useAutoIndex)) useAutoIndex=0; // SWAP A&B if A>B if(!prefs->get(FEATURE_SWAP_IF_A_GREATER_THAN_B, &useSwap)) useSwap=0; // No nuv sync if(!prefs->get(FEATURE_DISABLE_NUV_RESYNC, &useNuv)) useNuv=0; // Get level of message verbosity prefs->get(MESSAGE_LEVEL,&msglevel); // External filter prefs->get(FILTERS_AUTOLOAD_ACTIVE,&activeXfilter); // Downmix default if(prefs->get(DOWNMIXING_PROLOGIC,&downmix)!=RC_OK) { downmix=0; } olddevice=newdevice=AVDM_getCurrentDevice(); // Audio device /************************ Build diaelems ****************************************/ diaElemToggle useSysTray(&useTray,QT_TR_NOOP("_Use systray while encoding")); diaElemToggle allowAnyMpeg(&mpeg_no_limit,QT_TR_NOOP("_Accept non-standard audio frequency for DVD")); diaElemToggle useLavcodec(&lavcodec_mpeg,QT_TR_NOOP("_Use libavcodec MPEG-2 decoder")); diaElemToggle openDml(&use_odml,QT_TR_NOOP("Create _OpenDML files")); diaElemToggle autoIndex(&useAutoIndex,QT_TR_NOOP("Automatically _index MPEG files")); diaElemToggle autoSwap(&useSwap,QT_TR_NOOP("Automatically _swap A and B if A>B")); diaElemToggle nuvAudio(&useNuv,QT_TR_NOOP("_Disable NUV audio sync")); diaElemToggle togAutoVbr(&autovbr,QT_TR_NOOP("Automatically _build VBR map")); diaElemToggle togAutoIndex(&autoindex,QT_TR_NOOP("Automatically _rebuild index")); diaElemToggle togAutoUnpack(&autounpack,QT_TR_NOOP("Automatically remove _packed bitstream")); diaElemFrame frameSimd(QT_TR_NOOP("SIMD")); diaElemToggle capsToggleAll(&capsAll,QT_TR_NOOP("Enable all SIMD")); diaElemToggle capsToggleMMX(&capsMMX, QT_TR_NOOP("Enable MMX")); diaElemToggle capsToggleMMXEXT(&capsMMXEXT, QT_TR_NOOP("Enable MMXEXT")); diaElemToggle capsToggle3DNOW(&caps3DNOW, QT_TR_NOOP("Enable 3DNOW")); diaElemToggle capsToggle3DNOWEXT(&caps3DNOWEXT, QT_TR_NOOP("Enable 3DNOWEXT")); diaElemToggle capsToggleSSE(&capsSSE, QT_TR_NOOP("Enable SSE")); diaElemToggle capsToggleSSE2(&capsSSE2, QT_TR_NOOP("Enable SSE2")); diaElemToggle capsToggleSSE3(&capsSSE3, QT_TR_NOOP("Enable SSE3")); diaElemToggle capsToggleSSSE3(&capsSSSE3, QT_TR_NOOP("Enable SSSE3")); capsToggleAll.link(0, &capsToggleMMX); capsToggleAll.link(0, &capsToggleMMXEXT); capsToggleAll.link(0, &capsToggle3DNOW); capsToggleAll.link(0, &capsToggle3DNOWEXT); capsToggleAll.link(0, &capsToggleSSE); capsToggleAll.link(0, &capsToggleSSE2); capsToggleAll.link(0, &capsToggleSSE3); capsToggleAll.link(0, &capsToggleSSSE3); frameSimd.swallow(&capsToggleAll); frameSimd.swallow(&capsToggleMMX); frameSimd.swallow(&capsToggleMMXEXT); frameSimd.swallow(&capsToggle3DNOW); frameSimd.swallow(&capsToggle3DNOWEXT); frameSimd.swallow(&capsToggleSSE); frameSimd.swallow(&capsToggleSSE2); frameSimd.swallow(&capsToggleSSE3); frameSimd.swallow(&capsToggleSSSE3); diaElemThreadCount lavcThreadCount(&lavcThreads, QT_TR_NOOP("_lavc threads:")); diaElemThreadCount x264ThreadCount(&x264Threads, QT_TR_NOOP("_x264 threads:")); diaElemThreadCount xvidThreadCount(&xvidThreads, QT_TR_NOOP("X_vid threads:")); diaElemFrame frameThread(QT_TR_NOOP("Multi-threading")); frameThread.swallow(&lavcThreadCount); frameThread.swallow(&x264ThreadCount); frameThread.swallow(&xvidThreadCount); diaMenuEntry priorityEntries[] = { {0, QT_TR_NOOP("High"),NULL} ,{1, QT_TR_NOOP("Above normal"),NULL} ,{2, QT_TR_NOOP("Normal"),NULL} ,{3, QT_TR_NOOP("Below normal"),NULL} ,{4, QT_TR_NOOP("Low"),NULL} }; diaElemMenu menuEncodePriority(&encodePriority,QT_TR_NOOP("_Encoding priority:"), sizeof(priorityEntries)/sizeof(diaMenuEntry), priorityEntries,""); diaElemMenu menuIndexPriority(&indexPriority,QT_TR_NOOP("_Indexing/unpacking priority:"), sizeof(priorityEntries)/sizeof(diaMenuEntry), priorityEntries,""); diaElemMenu menuPlaybackPriority(&playbackPriority,QT_TR_NOOP("_Playback priority:"), sizeof(priorityEntries)/sizeof(diaMenuEntry), priorityEntries,""); diaElemFrame framePriority(QT_TR_NOOP("Prioritisation")); framePriority.swallow(&menuEncodePriority); framePriority.swallow(&menuIndexPriority); framePriority.swallow(&menuPlaybackPriority); diaElemUInteger autoSplit(&autosplit,QT_TR_NOOP("_Split MPEG files every (MB):"),10,4096); diaElemToggle togTagMp3(&alternate_mp3_tag,QT_TR_NOOP("_Use alternative tag for MP3 in .mp4")); diaMenuEntry videoMode[]={ {RENDER_GTK, QT_TR_NOOP("GTK+ (slow)"),NULL} #ifdef USE_XV ,{RENDER_XV, QT_TR_NOOP("XVideo (best)"),NULL} #endif #ifdef USE_SDL #ifdef ADM_WIN32 ,{RENDER_SDL, QT_TR_NOOP("SDL (GDI)"),NULL} ,{RENDER_DIRECTX, QT_TR_NOOP("SDL (DirectX)"),NULL} #else ,{RENDER_SDL, QT_TR_NOOP("SDL (good)"),NULL} #endif #endif }; diaElemMenu menuVideoMode(&render,QT_TR_NOOP("Video _display:"), sizeof(videoMode)/sizeof(diaMenuEntry),videoMode,""); diaMenuEntry msgEntries[]={ {0, QT_TR_NOOP("No alerts"),NULL} ,{1, QT_TR_NOOP("Display only error alerts"),NULL} ,{2, QT_TR_NOOP("Display all alerts"),NULL} }; diaElemMenu menuMessage(&msglevel,QT_TR_NOOP("_Message level:"), sizeof(msgEntries)/sizeof(diaMenuEntry),msgEntries,""); #if defined(ALSA_SUPPORT) || defined (OSS_SUPPORT) diaMenuEntry volumeEntries[]={ {0, QT_TR_NOOP("PCM"),NULL} ,{1, QT_TR_NOOP("Master"),NULL}}; diaElemMenu menuVolume(&useMaster,QT_TR_NOOP("_Volume control:"), sizeof(volumeEntries)/sizeof(diaMenuEntry),volumeEntries,""); #endif diaMenuEntry mixerEntries[]={ {0, QT_TR_NOOP("No downmixing"),NULL} ,{1, QT_TR_NOOP("Stereo"),NULL} ,{2, QT_TR_NOOP("Pro Logic"),NULL} ,{3, QT_TR_NOOP("Pro Logic II"),NULL} }; diaElemMenu menuMixer(&downmix,QT_TR_NOOP("_Local playback downmixing:"), sizeof(mixerEntries)/sizeof(diaMenuEntry),mixerEntries,""); diaMenuEntry audioEntries[] = { #ifdef ALSA_SUPPORT {DEVICE_ALSA, QT_TR_NOOP("ALSA")}, #endif #ifdef USE_ARTS {DEVICE_ARTS, QT_TR_NOOP("aRts")}, #endif #ifdef CONFIG_DARWIN {DEVICE_COREAUDIO, QT_TR_NOOP("Core Audio")}, #endif #ifdef USE_ESD {DEVICE_ESD, QT_TR_NOOP("ESD")}, #endif #ifdef USE_JACK {DEVICE_JACK, QT_TR_NOOP("JACK")}, #endif #ifdef OSS_SUPPORT {DEVICE_OSS, QT_TR_NOOP("OSS")}, #endif #ifdef USE_PULSE_SIMPLE {DEVICE_PULSE_SIMPLE, QT_TR_NOOP("Pulse Audio")}, #endif #if defined(USE_SDL) && !defined(ADM_WIN32) {DEVICE_SDL, QT_TR_NOOP("SDL")}, #endif #ifdef ADM_WIN32 {DEVICE_WIN32, QT_TR_NOOP("Win32")}, #endif {DEVICE_DUMMY, QT_TR_NOOP("None")} }; diaElemMenu menuAudio(&newdevice,QT_TR_NOOP("_Audio output:"), sizeof(audioEntries)/sizeof(diaMenuEntry),audioEntries,""); #ifdef ALSA_SUPPORT diaElemText entryAlsaDevice(&alsaDevice,QT_TR_NOOP("ALSA _device:"),NULL); int z,m; m=sizeof(audioEntries)/sizeof(diaMenuEntry); for(z=0;z<m;z++) { if(audioEntries[z].val==DEVICE_ALSA) menuAudio.link(&(audioEntries[z]),1,&entryAlsaDevice); } #endif // default Post proc diaElemToggle fhzd(&hzd,QT_TR_NOOP("_Horizontal deblocking")); diaElemToggle fvzd(&vzd,QT_TR_NOOP("_Vertical deblocking")); diaElemToggle fdring(&dring,QT_TR_NOOP("De_ringing")); diaElemUInteger postProcStrength(&pp_value,QT_TR_NOOP("_Strength:"),0,5); diaElemFrame framePP(QT_TR_NOOP("Default Postprocessing")); framePP.swallow(&fhzd); framePP.swallow(&fvzd); framePP.swallow(&fdring); framePP.swallow(&postProcStrength); // Filter path if( prefs->get(FILTERS_AUTOLOAD_PATH, &filterPath) != RC_OK ) #ifndef ADM_WIN32 filterPath = ADM_strdup("/tmp"); #else filterPath = ADM_strdup("c:\\"); #endif diaElemDirSelect entryFilterPath(&filterPath,QT_TR_NOOP("_Filter directory:"),QT_TR_NOOP("Select filter directory")); diaElemToggle loadEx(&activeXfilter,QT_TR_NOOP("_Load external filters")); loadEx.link(1, &entryFilterPath); diaElemToggle togGlobalGlyph(&useGlobalGlyph, QT_TR_NOOP("Use _Global GlyphSet")); diaElemFile entryGLyphPath(0,&globalGlyphName,QT_TR_NOOP("Gl_yphSet:"), NULL, QT_TR_NOOP("Select GlyphSet file")); togGlobalGlyph.link(1, &entryGLyphPath); /* User Interface */ diaElem *diaUser[]={&useSysTray,&menuMessage}; diaElemTabs tabUser(QT_TR_NOOP("User Interface"),2,diaUser); /* Automation */ diaElem *diaAuto[]={&autoSwap,&togAutoVbr,&togAutoIndex,&togAutoUnpack,&autoIndex,}; diaElemTabs tabAuto(QT_TR_NOOP("Automation"),5,diaAuto); /* Input */ diaElem *diaInput[]={&nuvAudio,&useLavcodec}; diaElemTabs tabInput(QT_TR_NOOP("Input"),2,(diaElem **)diaInput); /* Output */ diaElem *diaOutput[]={&autoSplit,&openDml,&allowAnyMpeg,&togTagMp3}; diaElemTabs tabOutput(QT_TR_NOOP("Output"),4,(diaElem **)diaOutput); /* Audio */ #if defined(ALSA_SUPPORT) diaElem *diaAudio[]={&menuMixer,&menuVolume,&menuAudio,&entryAlsaDevice}; diaElemTabs tabAudio(QT_TR_NOOP("Audio"),4,(diaElem **)diaAudio); #elif defined(OSS_SUPPORT) diaElem *diaAudio[]={&menuMixer,&menuVolume,&menuAudio}; diaElemTabs tabAudio(QT_TR_NOOP("Audio"),3,(diaElem **)diaAudio); #else diaElem *diaAudio[]={&menuMixer,&menuAudio}; diaElemTabs tabAudio(QT_TR_NOOP("Audio"),2,(diaElem **)diaAudio); #endif /* Video */ diaElem *diaVideo[]={&menuVideoMode,&framePP}; diaElemTabs tabVideo(QT_TR_NOOP("Video"),2,(diaElem **)diaVideo); /* CPU tab */ diaElem *diaCpu[]={&frameSimd}; diaElemTabs tabCpu(QT_TR_NOOP("CPU"),1,(diaElem **)diaCpu); /* Threading tab */ diaElem *diaThreading[]={&frameThread, &framePriority}; diaElemTabs tabThreading(QT_TR_NOOP("Threading"),2,(diaElem **)diaThreading); /* Global Glyph tab */ diaElem *diaGlyph[]={&togGlobalGlyph,&entryGLyphPath}; diaElemTabs tabGlyph(QT_TR_NOOP("Global GlyphSet"),2,(diaElem **)diaGlyph); /* Xfilter tab */ diaElem *diaXFilter[]={&loadEx,&entryFilterPath}; diaElemTabs tabXfilter(QT_TR_NOOP("External Filters"),2,(diaElem **)diaXFilter); // SET diaElemTabs *tabs[]={&tabUser,&tabAuto,&tabInput,&tabOutput,&tabAudio,&tabVideo,&tabCpu,&tabThreading,&tabGlyph,&tabXfilter}; if( diaFactoryRunTabs(QT_TR_NOOP("Preferences"),10,tabs)) { // cpu caps if(capsAll) { CpuCaps::myCpuMask=ADM_CPU_ALL; }else { CpuCaps::myCpuMask=0; #undef CPU_CAPS #define CPU_CAPS(x) if(caps##x) CpuCaps::myCpuMask|= ADM_CPU_##x; CPU_CAPS(MMX); CPU_CAPS(MMXEXT); CPU_CAPS(3DNOW); CPU_CAPS(3DNOWEXT); CPU_CAPS(SSE); CPU_CAPS(SSE2); CPU_CAPS(SSE3); CPU_CAPS(SSSE3); } prefs->set(FEATURE_CPU_CAPS,CpuCaps::myCpuMask); // Glyphs prefs->set(FEATURE_GLOBAL_GLYPH_ACTIVE,useGlobalGlyph); prefs->set(FEATURE_GLOBAL_GLYPH_NAME,globalGlyphName); // Postproc #undef DOME #define DOME(x,y) if(y) pp_type |=x; pp_type=0; DOME(1,hzd); DOME(2,vzd); DOME(4,dring); prefs->set(DEFAULT_POSTPROC_TYPE,pp_type); prefs->set(DEFAULT_POSTPROC_VALUE,pp_value); // prefs->set(FEATURE_AUTO_UNPACK,autounpack); // autovbr prefs->set(FEATURE_AUTO_BUILDMAP,autovbr); // autoindex prefs->set(FEATURE_AUTO_REBUILDINDEX,autoindex); // Alsa #ifdef ALSA_SUPPORT if(alsaDevice) { prefs->set(DEVICE_AUDIO_ALSA_DEVICE, alsaDevice); ADM_dealloc(alsaDevice); alsaDevice=NULL; } #endif // Device if(olddevice!=newdevice) { AVDM_switch((AUDIO_DEVICE)newdevice); } // Downmixing (default) prefs->set(DOWNMIXING_PROLOGIC,downmix); #if defined(ALSA_SUPPORT) || defined (OSS_SUPPORT) // Master or PCM prefs->set(FEATURE_AUDIOBAR_USES_MASTER, useMaster); #endif // allow non std audio fq for dvd prefs->set(FEATURE_MPEG_NO_LIMIT, mpeg_no_limit); // Video render prefs->set(DEVICE_VIDEODEVICE,render); // Mpeg /lavcodec prefs->set(FEATURE_USE_LAVCODEC_MPEG, lavcodec_mpeg); // Odml prefs->set(FEATURE_USE_ODML, use_odml); // Split prefs->set(SETTINGS_MPEGSPLIT, autosplit); // number of threads prefs->set(FEATURE_THREADING_LAVC, lavcThreads); prefs->set(FEATURE_THREADING_X264, x264Threads); prefs->set(FEATURE_THREADING_XVID, xvidThreads); // Encoding priority prefs->set(PRIORITY_ENCODING, encodePriority); // Indexing / unpacking priority prefs->set(PRIORITY_INDEXING, indexPriority); // Playback priority prefs->set(PRIORITY_PLAYBACK, playbackPriority); // Auto index mpeg prefs->set(FEATURE_TRYAUTOIDX, useAutoIndex); // Auto swap A/B prefs->set(FEATURE_SWAP_IF_A_GREATER_THAN_B, useSwap); // Disable nuv sync prefs->set(FEATURE_DISABLE_NUV_RESYNC, useNuv); // Use tray while encoding prefs->set(FEATURE_USE_SYSTRAY,useTray); // Filter directory prefs->set(FILTERS_AUTOLOAD_ACTIVE, activeXfilter); if(filterPath) prefs->set(FILTERS_AUTOLOAD_PATH, filterPath); // Alternate mp3 tag (haali) prefs->set(FEATURE_ALTERNATE_MP3_TAG,alternate_mp3_tag); #if defined(ADM_WIN32) && defined(USE_SDL) // Initialise SDL again as driver may have changed initSdl(); #endif } ADM_dealloc(filterPath); ADM_dealloc(globalGlyphName); return 1; }