示例#1
0
int main(int _argc, char *_argv[])
{
	char **argv;
	int argc;

	installSigHandler();

#ifdef _WIN32
	getUtf8CommandLine(&argc, &argv);
#else
	argv = _argv;
	argc = _argc;
#endif

	ADM_initBaseDir(isPortableMode(argc, argv));

#if defined(_WIN32) && (ADM_UI_TYPE_BUILD == ADM_UI_GTK || ADM_UI_TYPE_BUILD == ADM_UI_QT4)
	// redirect output before registering exception handler so error dumps are captured
	redirectStdoutToFile();
#endif

#if !defined(NDEBUG) && defined(FIND_LEAKS)
	new_progname = argv[0];
#endif

	int exitVal = startAvidemux(argc, argv);

#ifdef _WIN32
	freeUtf8CommandLine(argc, argv);
#endif

	uninstallSigHandler();

	return exitVal;
}
示例#2
0
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;
}
示例#3
0
/**
    \fn main
*/
int main(int argc, char *argv[])
{
#if defined(_WIN32)
	redirectStdoutToFile();
#endif

#if !defined(NDEBUG) && defined(FIND_LEAKS)
	new_progname = argv[0];
#endif

    installSigHandler();

    bool portableMode=isPortableMode(argc,argv);
    printf("*************************\n");
    printf("  Avidemux v" 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, 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)");
#endif

	printf("\n");

#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

	
	
#ifndef __APPLE__
    ADM_InitMemcpy();
#endif
	atexit(onexit);

#ifdef _WIN32
    win32_netInit();
#endif

#if 0
    // Hook our UI...
    InitFactory();
    InitCoreToolkit();
    initFileSelector();
#endif

	// Load .avidemuxrc
    quotaInit();


    ADM_initBaseDir(portableMode);
    // Init jobs
    ADMJob::jobInit();
    jobRun(argc,argv);

	uninstallSigHandler();

    printf("Normal exit\n");
    return 0;
}
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{
    LPWSTR lpCmdLineW = GetCommandLineW();
    int argc;
    LPWSTR * argvw = CommandLineToArgvW(lpCmdLineW, &argc);

    assert(argc != 0);
    
    std::vector<char*> argv_vec(argc);

    for (int c=0; c<argc; ++c)
    {
        int buf_size = WideCharToMultiByte(CP_ACP, 0, argvw[c], -1, argv_vec[c], 0, NULL, NULL);
        argv_vec[c] = new char[buf_size];
        WideCharToMultiByte(CP_ACP, 0, argvw[c], -1, argv_vec[c], buf_size, NULL, NULL);
    }

    char ** argv = (char**)&argv_vec[0];
    
#else
    int main( int argc, char **argv )
        {
#endif

    try
    {
        USER_DATA_SUBDIR = "QuantiCode/" + APP_NAME + "/";


#ifdef _WIN32        
        Win32Exception::install_handler();
        Win32Exception::set_dump_location(getOrCreateUserDataDir(), APP_NAME.c_str());
#endif
        
        redirectStdoutToFile();

        s_params.loadParameters("config_client.xml");
        s_params.loadParameters("config_common.xml");
        s_params.loadParameters("config_server.xml");
        
        s_params.loadParameters(getUserConfigFile(true), CONFIG_SUPERSECTION);

        s_log.open(getOrCreateUserDataDir(), "client");
        s_log << "Version " << g_version << "\n";

#ifdef _WIN32
        if(s_params.get<bool>("client.intro.enable"))
        {
            IntroTask intro(hInstance, nCmdShow);
            intro.run();
        }
#endif        

        s_app.init(argc, argv, APP_NAME, "client");      
        MainMenu main_menu;
        s_app.run(&main_menu);

    } catch (Exception & e)
    {
#ifdef _WIN32


        // show fatal error
        MessageBox( NULL, 
                     e.getTotalErrorString().c_str(),
                    "Fatal Error", 
                    MB_OK | MB_ICONERROR | MB_TASKMODAL );
#endif
        e.addHistory("main()");
        s_log << Log::error << e << "\n";

    } catch (CEGUI::Exception & e)
    {
#ifdef _WIN32
        // show msgbox for cegui exception
        MessageBox( NULL, 
                    e.getMessage().c_str(),
                    "GUI - Fatal Error", 
                    MB_OK | MB_ICONERROR | MB_TASKMODAL );
#endif
	     s_log << "CEGUI Exception occured:" << e.getMessage().c_str() << "\n";
    } 
#ifdef _WIN32
    catch (const Win32Exception & e) 
    {
        std::stringstream err;
        err << e.what() << " (code " << std::hex << e.code()
            << ") at " << e.where() << std::endl << std::endl 
            << "A memory dump has been created and stored at: " << std::endl
            << Win32Exception::get_dump_location() << "\n";

        // show msgbox for win32 exception
        MessageBox( NULL, 
                    err.str().c_str(),
                    "Win32 - Exception", 
                    MB_OK | MB_ICONERROR | MB_TASKMODAL );
    }
#endif


#ifdef _WIN32
    for (int c=0; c<argc; ++c)
    {
        delete[] argv_vec[c];
    }
#endif
    

    return 0;
}