Пример #1
0
void COsmo4AppView::Shutdown()
{
//	MessageBox("Osmo4 shutdown request", "");
	if (m_pTimer) {
		m_pTimer->Cancel();
		delete m_pTimer;
		m_pTimer = NULL;
	}
#ifndef GPAC_GUI_ONLY
	if (m_term) {
		GF_Terminal *t = m_term;
		m_term = NULL;
		gf_term_del(t);
	}
	if (m_Logs) {
		fclose(m_Logs);
		m_Logs = NULL;
	}
    if (m_user.config) {
		gf_cfg_del(m_user.config);
		m_user.config = NULL;
	}
	if (m_user.modules) {
		gf_modules_del(m_user.modules);
		m_user.modules = NULL;
	}
#endif
//	MessageBox("Osmo4 shutdown OK", "");
}
Пример #2
0
//-------------------------------
void CNativeWrapper::Shutdown()
{
	debug_log("shutdown");
	if (m_term)
		gf_term_disconnect(m_term);
	if (m_mx)
		gf_mx_del(m_mx);
	m_mx = NULL;
#ifndef GPAC_GUI_ONLY
	if (m_term) {
		GF_Terminal *t = m_term;
		m_term = NULL;
		gf_term_del(t);
	}
	if (m_user.config) {
		gf_cfg_del(m_user.config);
		m_user.config = NULL;
	}
	if (m_user.modules) {
		gf_modules_del(m_user.modules);
		m_user.modules = NULL;
	}
#endif
	m_term = NULL;
	gf_sys_close();
	debug_log("shutdown end");
}
Пример #3
0
wxGPACPanel::~wxGPACPanel()
{
	if (m_pService) delete m_pService;
	if (m_term) gf_term_del(m_term);
	if (m_user.modules) gf_modules_del(m_user.modules);
	if (m_user.config) gf_cfg_del(m_user.config);
}
Пример #4
0
Bool player(char *fn)
{
	Bool ret = GF_FALSE;
	GF_Err e;
	GF_User user;
	GF_Terminal *term = NULL;
	GF_Config *cfg_file;
	memset(&user, 0, sizeof(user));
	cfg_file = gf_cfg_init(NULL, NULL);
	user.modules = gf_modules_new(NULL, cfg_file);
	e = manually_register_opengl_shared_module(user.modules);
	if (e != GF_OK) goto exit;
	set_cfg_option(cfg_file, "Video:DriverName=" OPENGL_SHARED_MODULE_NAME_STR);
	user.config = cfg_file;
	user.opaque = &user;
	user.EventProc = event_proc;
	term = gf_term_new(&user);
	if (!term) goto exit;

	gf_term_connect(term, fn);
	while (!connected) gf_sleep(1);
	while ( connected) {
		gf_term_process_step(term);
		check_keyboard(term);
	}
	ret = GF_TRUE;

exit:
	gf_term_disconnect(term);
	gf_term_del(term);
	gf_modules_del(user.modules);
	gf_cfg_del(cfg_file);

	return ret;
}
Пример #5
0
static Bool player_foreach(int argc, char **argv)
{
	int i;
	GF_User user;
	GF_Terminal *term;
	GF_Config *cfg_file;
	cfg_file = gf_cfg_init("GPAC.cfg", NULL);
	user.modules = gf_modules_new(NULL, cfg_file);
	user.config = cfg_file;
	user.EventProc = GPAC_EventProc;
	term = gf_term_new(&user);
	if (!term)
		return GF_FALSE;

	for (i=0; i<argc; ++i) {
		Bool res = play_pause_seek_gettime(term, argv[i]);
		if (res == GF_FALSE) {
			fprintf(stderr, "Failure with input %d: \"%s\"\n", i, argv[i]);
			return GF_FALSE;
		}
	}

	gf_term_disconnect(term);
	gf_term_del(term);
	gf_modules_del(user.modules);
	gf_cfg_del(cfg_file);

	return GF_TRUE;
}
Пример #6
0
void CGPAXPlugin::UnloadTerm()
{
	if (m_term) {
		GF_Terminal *a_term = m_term;
		m_term = NULL;
		gf_term_del(a_term);
	}
	if (m_user.modules) gf_modules_del(m_user.modules);
	if (m_user.config) gf_cfg_del(m_user.config);
	memset(&m_user, 0, sizeof(m_user));
}
Пример #7
0
int Osmo4::ExitInstance() 
{
	if (m_term) gf_term_del(m_term);
	if (m_user.modules) gf_modules_del(m_user.modules);
	if (m_user.config) gf_cfg_del(m_user.config);
	gf_sys_close();
	/*last instance*/
	if (m_hMutex) {
		CloseHandle(m_hMutex);
		static_gpac_hwnd = NULL;
	}
	if (m_logs) fclose(m_logs);
	return CWinApp::ExitInstance();
}
Пример #8
0
void CGPAXPlugin::UnloadTerm()
{
	if (m_term) {
		GF_Terminal *a_term = m_term;
		m_term = NULL;
		gf_term_del(a_term);
	}
	if (m_user.modules) gf_modules_del(m_user.modules);
	if (m_user.config) gf_cfg_del(m_user.config);
	if (m_pLogs) 
		fclose(m_pLogs);
	m_pLogs = NULL;
	gf_log_set_callback(NULL, NULL);
	memset(&m_user, 0, sizeof(m_user));
	gf_sys_close();
}
Пример #9
0
int WINAPI WinMain(HINSTANCE hInstance,
				   HINSTANCE hPrevInstance,
#ifdef _WIN32_WCE
				   LPWSTR lpCmdLine,
#else
				   LPSTR lpCmdLine,
#endif
				   int nShowCmd
) {
	MSG 	msg;
#ifdef _WIN32_WCE
	TCHAR wzExePath[GF_MAX_PATH];
#endif

	HWND 	hwndOld = NULL;
	const char *str;
	Bool initial_launch = 0;

	if (hwndOld = FindWindow(_T("Osmophone"), NULL))
	{
		SetForegroundWindow(hwndOld);
		return 0;
	}

	memset(&user, 0, sizeof(GF_User));
	term = NULL;

	g_hinst = hInstance;

	screen_w = GetSystemMetrics(SM_CXSCREEN);
	screen_h = GetSystemMetrics(SM_CYSCREEN);

	/*are we in low res or high res*/
	RawFrameBufferInfo Info;
	HDC DC = GetDC(NULL);
	ExtEscape(DC, GETRAWFRAMEBUFFER, 0, NULL, sizeof(RawFrameBufferInfo), (char*)&Info);
	ReleaseDC(NULL,DC);
	if (Info.pFramePointer) {
		recompute_res(Info.cxPixels, Info.cyPixels);
	} else {
		recompute_res(screen_w, screen_h);
	}



#ifdef _WIN32_WCE
	TCHAR      szBuf[MAX_PATH];
	SystemParametersInfo(SPI_GETPLATFORMTYPE, MAX_PATH, szBuf, 0);
	if (! lstrcmp(szBuf, __TEXT("PocketPC"))) is_ppc = 1;
	else if (! lstrcmp(szBuf, __TEXT("Palm PC2"))) is_ppc = 1;
#endif


	user.config = gf_cfg_init(NULL, &initial_launch);
	if (!user.config) {
		MessageBox(NULL, _T("Couldn't locate GPAC config file"), _T("Fatal Error"), MB_OK);
		return 0;
	}

    str = gf_cfg_get_key(user.config, "Compositor", "ScreenWidth");
	if (str) screen_w = atoi(str);
    str = gf_cfg_get_key(user.config, "Compositor", "ScreenHeight");
	if (str) screen_h = atoi(str);
	disp_w = screen_w;
#ifdef _WIN32_WCE
	disp_h = screen_h - menu_h /*- caption_h*/;
#else
	disp_h = screen_h;
#endif

	str = gf_cfg_get_key(user.config, "General", "ModulesDirectory");
	if (!str) {
		gf_cfg_del(user.config);
		MessageBox(NULL, _T("Couldn't locate GPAC plugins"), _T("Fatal Error"), MB_OK);
		return 0;
	}

	gf_sys_init(0);
	user.modules = gf_modules_new(str, user.config);
	if (!gf_modules_get_count(user.modules)) {
		MessageBox(GetForegroundWindow(), _T("No modules found"), _T("GPAC Init Error"), MB_OK);
		gf_modules_del(user.modules);
		gf_cfg_del(user.config);
		memset(&user, 0, sizeof(GF_User));
		gf_sys_close();
		return 0;
	}

	/*first launch, register all files ext*/
	if (initial_launch) {
		/*FFMPEG registration - FFMPEG DLLs compiled with CEGCC cannot be loaded directly under WM 6.1
		cf http://cegcc.sourceforge.net/docs/faq.html#DllDoesNotWorkWithWindowsMobile6.1
		*/
		HKEY hKey = NULL;
		DWORD dwSize;
		DWORD dwValue;
		RegCreateKeyEx(HKEY_LOCAL_MACHINE, _T("System\\Loader\\LoadModuleLow"), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, &dwSize);
		dwSize = 4; dwValue = 1;
		LONG res = RegSetValueEx(hKey, _T("avcodec-52.dll"), NULL, REG_DWORD, (unsigned char *)&dwValue, dwSize);
		res = RegSetValueEx(hKey, _T("avformat-52.dll"), NULL, REG_DWORD, (unsigned char *)&dwValue, dwSize);
		res = RegSetValueEx(hKey, _T("avutil-50.dll"), NULL, REG_DWORD, (unsigned char *)&dwValue, dwSize);
		res = RegSetValueEx(hKey, _T("swscale-0.dll"), NULL, REG_DWORD, (unsigned char *)&dwValue, dwSize);
		RegCloseKey(hKey);

		u32 i;
		for (i=0; i<gf_modules_get_count(user.modules); i++) {
			GF_InputService *ifce = (GF_InputService *) gf_modules_load_interface(user.modules, i, GF_NET_CLIENT_INTERFACE);
			if (!ifce) continue;
			if (ifce) {
				ifce->CanHandleURL(ifce, "test.test");
				gf_modules_close_interface((GF_BaseInterface *)ifce);
			}
		}
		MessageBox(NULL, _T("Thank you for installing GPAC"), _T("Initial setup done"), MB_OK);
	}

	str = gf_cfg_get_key(user.config, "General", "Loop");
	loop = (!str || !stricmp(str, "yes")) ? 1 : 0;

	str = gf_cfg_get_key(user.config, "SAXLoader", "Progressive");
	use_svg_prog = (str && !strcmp(str, "yes")) ? 1 : 0;

	str = gf_cfg_get_key(user.config, "General", "RTIRefreshPeriod");
	if (str) {
		rti_update_time_ms = atoi(str);
	} else {
		gf_cfg_set_key(user.config, "General", "RTIRefreshPeriod", "200");
	}

	str = gf_cfg_get_key(user.config, "General", "ShowStatusBar");
	show_status = (str && !strcmp(str, "yes")) ? 1 : 0;


#ifdef _WIN32_WCE
	if (is_ppc) GXOpenInput();
#endif

	if (InitInstance(nShowCmd)) {
		SetForegroundWindow(g_hwnd);
		show_taskbar(0);

		force_2d_gl = gf_term_get_option(term, GF_OPT_USE_OPENGL);

		while (GetMessage(&msg, NULL, 0,0) == TRUE) {
			TranslateMessage (&msg);
			DispatchMessage (&msg);

			if (playlist_act) {
				switch_playlist(playlist_act-1);
				playlist_act = 0;
			}
		}
		show_taskbar(1);
	}
#ifdef _WIN32_WCE
	if (is_ppc) GXCloseInput();
#endif

	/*and destroy*/
	if (term) gf_term_del(term);
	if (user.modules) gf_modules_del(user.modules);
	if (user.config) gf_cfg_del(user.config);

	if (backlight_off) set_backlight_state(0);

	gf_sys_close();
	if (log_file) fclose(log_file);
	return 0;
}