if (gtk_gl_area_get_error (self) != NULL)
return FALSE;
- glViewport(0, 0, 1920, 1080);
+// glViewport(0, 0, 1920, 1080);
glClearColor (1.0, 0.0, 0.0, 1.0);
glClear (GL_COLOR_BUFFER_BIT);
return 0;
}
-int _gtk_gl_open(simp_avio_t* io, const char* in, const char* out)
+static int _gtk_gl_open(simp_avio_t* io, const char* in, const char* out)
{
simp_gl_t* gl = calloc(1, sizeof(simp_gl_t));
if (!gl)
return 0;
}
+static int _gtk_gl_close(simp_avio_t* io)
+{
+ simp_gl_t* gl;
+
+ if (io && io->priv) {
+ gl = io->priv;
+
+ glDeleteTextures(1, &gl->texture_y);
+ glDeleteTextures(1, &gl->texture_u);
+ glDeleteTextures(1, &gl->texture_v);
+
+ glDeleteBuffers (2, gl->buffers);
+
+ glDeleteVertexArrays(1, &gl->vao);
+
+ free(gl);
+ io->priv = NULL;
+ }
+
+ return 0;
+}
+
static int _gl_init(simp_gl_t* gl)
{
init_buffers(gl);
static int _gtk_gl_run(simp_avio_t* io)
{
- scf_loge("%s(),%d\n", __func__, __LINE__);
simp_frame_t* f;
scf_list_t* l;
simp_gl_t* gl = io->priv;
for (i = 0; i < SIMP_GL_HEIGHT / 2; i++)
memcpy(gl->v + i * SIMP_GL_WIDTH / 2, f->frame->data[2] + i * f->frame->linesize[2], SIMP_GL_WIDTH / 2);
+
+ simp_frame_free(f);
+ f = NULL;
} else
pthread_mutex_unlock(&io->mutex);
{
.type = "gtk_gl",
.open = _gtk_gl_open,
+ .close = _gtk_gl_close,
.run = _gtk_gl_run,
};