Exemplo n.º 1
0
bool obs_startup(const char *locale)
{
	bool success;

	if (obs) {
		blog(LOG_WARNING, "Tried to call obs_startup more than once");
		return false;
	}

	success = obs_init(locale);
	if (!success)
		obs_shutdown();

	return success;
}
Exemplo n.º 2
0
bool obs_startup()
{
	bool success;

	if (obs) {
		blog(LOG_ERROR, "Tried to call obs_startup more than once");
		return false;
	}

	success = obs_init();
	if (!success)
		obs_shutdown();

	return success;
}
Exemplo n.º 3
0
int WINAPI WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdLine,
		int numCmd)
{
	HWND hwnd = NULL;
	base_set_log_handler(do_log);

	try {
		hwnd = CreateTestWindow(instance);
		if (!hwnd)
			throw "Couldn't create main window";

		/* ------------------------------------------------------ */
		/* create OBS */
		CreateOBS(hwnd);

		/* ------------------------------------------------------ */
		/* load module */
		if (obs_load_module("test-input") != 0)
			throw "Couldn't load module";

		/* ------------------------------------------------------ */
		/* create source */
		SourceContext source = obs_source_create(SOURCE_INPUT,
				"random", "some randon source", NULL);
		if (!source)
			throw "Couldn't create random test source";

		/* ------------------------------------------------------ */
		/* create filter */
		SourceContext filter = obs_source_create(SOURCE_FILTER,
				"test", "a nice little green filter", NULL);
		if (!filter)
			throw "Couldn't create test filter";
		obs_source_filter_add(source, filter);

		/* ------------------------------------------------------ */
		/* create scene and add source to scene (twice) */
		SceneContext scene = obs_scene_create("test scene");
		if (!scene)
			throw "Couldn't create scene";

		AddTestItems(scene, source);

		/* ------------------------------------------------------ */
		/* set the scene as the primary draw source and go */
		obs_set_output_source(0, source);

		MSG msg;
		while (GetMessage(&msg, NULL, 0, 0)) {
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}

	} catch (char *error) {
		MessageBoxA(NULL, error, NULL, 0);
	}

	obs_shutdown();

	blog(LOG_INFO, "Number of memory leaks: %llu", bnum_allocs());
	DestroyWindow(hwnd);

	return 0;
}
Exemplo n.º 4
0
	inline ~OBSContext()
	{
		obs_shutdown();
	}