Пример #1
0
Файл: opengl.c Проект: 7max/glc
int opengl_capture_stop()
{
	int ret;
	if (!opengl.capturing)
		return 0;

	if (!(ret = gl_capture_stop(opengl.gl_capture)))
		opengl.capturing = 0;

	return ret;
}
Пример #2
0
void gl_capture_error(gl_capture_t gl_capture, int err)
{
	glc_log(gl_capture->glc, GLC_ERROR, "gl_capture",
		"%s (%d)", strerror(err), err);

	/* stop capturing */
	if (gl_capture->flags & GL_CAPTURE_CAPTURING)
		gl_capture_stop(gl_capture);

	/* cancel glc */
	glc_state_set(gl_capture->glc, GLC_STATE_CANCEL);
	if (gl_capture->to)
		ps_buffer_cancel(gl_capture->to);
}
Пример #3
0
Файл: opengl.c Проект: 7max/glc
int opengl_close()
{
	int ret;
	if (!opengl.started)
		return 0;

	glc_log(opengl.glc, GLC_DEBUG, "opengl", "closing");

	if (opengl.capturing)
		gl_capture_stop(opengl.gl_capture);
	gl_capture_destroy(opengl.gl_capture);

	if (opengl.unscaled) {
		if (lib.running) {
			if ((ret = glc_util_write_end_of_stream(opengl.glc, opengl.unscaled))) {
				glc_log(opengl.glc, GLC_ERROR, "opengl",
					 "can't write end of stream: %s (%d)", strerror(ret), ret);
				return ret;
			}
		} else
			ps_buffer_cancel(opengl.unscaled);

		if (opengl.convert_ycbcr_420jpeg) {
			ycbcr_process_wait(opengl.ycbcr);
			ycbcr_destroy(opengl.ycbcr);
		} else {
			scale_process_wait(opengl.scale);
			scale_destroy(opengl.scale);
		}
	} else if (lib.running) {
		if ((ret = glc_util_write_end_of_stream(opengl.glc, opengl.buffer))) {
			glc_log(opengl.glc, GLC_ERROR, "opengl",
				 "can't write end of stream: %s (%d)", strerror(ret), ret);
			return ret;
		}
	} else
		ps_buffer_cancel(opengl.buffer);

	if (opengl.unscaled) {
		ps_buffer_destroy(opengl.unscaled);
		free(opengl.unscaled);
	}

	return 0;
}