コード例 #1
0
ファイル: obs-video.c プロジェクト: BraginWoW/obs-studio
static bool swap_frame(uint64_t timestamp)
{
	struct obs_video *video = &obs->video;
	stagesurf_t last_surface = video->copy_surfaces[video->cur_texture];
	stagesurf_t surface;
	struct video_frame frame;

	/* the last frame stays mapped until rendering starts with the next */
	if (video->copy_mapped) {
		stagesurface_unmap(last_surface);
		video->copy_mapped = false;
	}

	video->textures_copied[video->cur_texture] = true;
	/* TODO: texture staging */
	//gs_stage_texture(last_surface, );

	if (++video->cur_texture == NUM_TEXTURES)
		video->cur_texture = 0;

	if (video->textures_copied[video->cur_texture]) {
		surface = video->copy_surfaces[video->cur_texture];
		video->copy_mapped = stagesurface_map(surface, &frame.data,
				&frame.row_size);

		if (video->copy_mapped) {
			frame.timestamp = timestamp;
			video_output_frame(video->video, &frame);
		}
	}

	return video->copy_mapped;
}
コード例 #2
0
ファイル: obs-video.c プロジェクト: GamingAtheist/obs-studio
static inline bool download_frame(struct obs_core_video *video,
		int prev_texture, struct video_data *frame)
{
	stagesurf_t surface = video->copy_surfaces[prev_texture];

	if (!video->textures_copied[prev_texture])
		return false;

	if (!stagesurface_map(surface, &frame->data[0], &frame->linesize[0]))
		return false;

	video->mapped_surface = surface;
	return true;
}