static gboolean render(GtkGLArea* self, GdkGLContext* context, gpointer user_data)
{
+ scf_loge("%s(),%d\n", __func__, __LINE__);
simp_avio_t* gl = user_data;
if (gtk_gl_area_get_error (self) != NULL)
return -1;
}
+ gl->view = gl_area;
+
simp_filter_add_input (f, in);
simp_filter_add_output(f, alsa);
simp_filter_add_output(f, gl);
if (!gl)
return -ENOMEM;
- io->priv = gl;
+ io->vopen = 1;
+ io->priv = gl;
return 0;
}
static int _gtk_gl_run(simp_avio_t* io)
{
- simp_gl_t* gl = io->priv;
+ scf_loge("%s(),%d\n", __func__, __LINE__);
+ simp_frame_t* f;
+ scf_list_t* l;
+ simp_gl_t* gl = io->priv;
- float mvp[16];
+ float mvp[16];
- if (!gl->init)
+ if (!gl->init) {
_gl_init(gl);
+ gl->init = 0;
+ }
+
+ pthread_mutex_lock (&io->mutex);
+ if (!scf_list_empty(&io->vout)) {
+
+ l = scf_list_head(&io->vout);
+ f = scf_list_data(l, simp_frame_t, list);
+ scf_list_del(&f->list);
+ pthread_mutex_unlock(&io->mutex);
+
+ int i;
+ for (i = 0; i < SIMP_GL_HEIGHT; i++)
+ memcpy(gl->y + i * SIMP_GL_WIDTH, f->frame->data[0] + i * f->frame->linesize[0], SIMP_GL_WIDTH);
+
+ for (i = 0; i < SIMP_GL_HEIGHT / 2; i++)
+ memcpy(gl->u + i * SIMP_GL_WIDTH / 2, f->frame->data[1] + i * f->frame->linesize[1], SIMP_GL_WIDTH / 2);
+
+ 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);
+ } else
+ pthread_mutex_unlock(&io->mutex);
compute_mvp(mvp, 0, 0, 0);