示例#1
0
文件: obs.c 项目: kmdtukl/obs-studio
bool obs_reset_video(struct obs_video_info *ovi)
{
	if (!obs) return false;

	/* don't allow changing of video settings if active. */
	if (obs->video.video && video_output_active(obs->video.video))
		return false;

	struct obs_core_video *video = &obs->video;

	/* align to multiple-of-two and SSE alignment sizes */
	ovi->output_width  &= 0xFFFFFFFC;
	ovi->output_height &= 0xFFFFFFFE;

	stop_video();
	obs_free_video();

	if (!ovi) {
		obs_free_graphics();
		return true;
	}

	if (!video->graphics && !obs_init_graphics(ovi))
		return false;

	return obs_init_video(ovi);
}
示例#2
0
文件: obs.c 项目: Ceropean/obs-studio
bool obs_reset_video(struct obs_video_info *ovi)
{
	struct obs_video *video = &obs->video;

	obs_free_video();

	if (!ovi) {
		obs_free_graphics();
		return true;
	}

	if (!video->graphics && !obs_init_graphics(ovi))
		return false;

	return obs_init_video(ovi);
}
示例#3
0
文件: obs.c 项目: Lexsus/obs-studio
int obs_reset_video(struct obs_video_info *ovi)
{
	if (!obs) return OBS_VIDEO_FAIL;

	/* don't allow changing of video settings if active. */
	if (obs->video.video && video_output_active(obs->video.video))
		return OBS_VIDEO_CURRENTLY_ACTIVE;

	if (!size_valid(ovi->output_width, ovi->output_height) ||
	    !size_valid(ovi->base_width,   ovi->base_height))
		return OBS_VIDEO_INVALID_PARAM;

	struct obs_core_video *video = &obs->video;

	stop_video();
	obs_free_video();

	if (!ovi) {
		obs_free_graphics();
		return OBS_VIDEO_SUCCESS;
	}

	/* align to multiple-of-two and SSE alignment sizes */
	ovi->output_width  &= 0xFFFFFFFC;
	ovi->output_height &= 0xFFFFFFFE;

	if (!video->graphics) {
		int errorcode = obs_init_graphics(ovi);
		if (errorcode != OBS_VIDEO_SUCCESS) {
			obs_free_graphics();
			return errorcode;
		}
	}

	blog(LOG_INFO, "video settings reset:\n"
	               "\tbase resolution:   %dx%d\n"
	               "\toutput resolution: %dx%d\n"
	               "\tfps:               %d/%d",
	               ovi->base_width, ovi->base_height,
	               ovi->output_width, ovi->output_height,
	               ovi->fps_num, ovi->fps_den);

	return obs_init_video(ovi);
}