gl/upload: small code cleanup and gst-indent

This commit is contained in:
Matthew Waters 2014-05-29 16:29:09 +10:00 committed by Tim-Philipp Müller
parent 82910401c8
commit 8b50888179

View file

@ -48,42 +48,19 @@
#define USING_GLES3(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES3)
static gboolean _upload_memory (GstGLUpload * upload);
//static gboolean _do_upload_fill (GstGLContext * context, GstGLUpload * upload);
//static gboolean _do_upload_make (GstGLContext * context, GstGLUpload * upload);
static gboolean _init_upload (GstGLUpload * upload);
//static gboolean _init_upload_fbo (GstGLContext * context, GstGLUpload * upload);
static gboolean _gst_gl_upload_perform_with_data_unlocked (GstGLUpload * upload,
GLuint * texture_id, gpointer data[GST_VIDEO_MAX_PLANES]);
static void _do_upload_with_meta (GstGLContext * context, GstGLUpload * upload);
static void gst_gl_upload_reset (GstGLUpload * upload);
/* *INDENT-OFF* */
#define YUV_TO_RGB_COEFFICIENTS \
"uniform vec3 offset;\n" \
"uniform vec3 rcoeff;\n" \
"uniform vec3 gcoeff;\n" \
"uniform vec3 bcoeff;\n"
/* FIXME: use the colormatrix support from videoconvert */
struct TexData
{
guint format, type, width, height;
gfloat tex_scaling[2];
guint unpack_length;
};
struct _GstGLUploadPrivate
{
gboolean result;
struct TexData texture_info[GST_VIDEO_MAX_PLANES];
GstBuffer *buffer;
GstVideoFrame frame;
GstVideoGLTextureUploadMeta *meta;
guint tex_id;
gboolean mapped;
GstVideoFrame frame;
GstBuffer *outbuf;
};
@ -94,10 +71,10 @@ GST_DEBUG_CATEGORY_STATIC (gst_gl_upload_debug);
#define DEBUG_INIT \
GST_DEBUG_CATEGORY_INIT (gst_gl_upload_debug, "glupload", 0, "upload");
G_DEFINE_TYPE_WITH_CODE (GstGLUpload, gst_gl_upload, GST_TYPE_OBJECT, DEBUG_INIT);
G_DEFINE_TYPE_WITH_CODE (GstGLUpload, gst_gl_upload, GST_TYPE_OBJECT,
DEBUG_INIT);
static void gst_gl_upload_finalize (GObject * object);
#define GST_GL_UPLOAD_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
GST_TYPE_GL_UPLOAD, GstGLUploadPrivate))
@ -203,7 +180,6 @@ _gst_gl_upload_set_format_unlocked (GstGLUpload * upload,
upload->initted = FALSE;
}
/**
* gst_gl_upload_set_format:
* @upload: a #GstGLUpload
@ -290,7 +266,6 @@ gst_gl_upload_perform_with_buffer (GstGLUpload * upload, GstBuffer * buffer,
}
return ret;
}
#if GST_GL_HAVE_PLATFORM_EGL
if (!upload->priv->tex_id && gst_is_egl_image_memory (mem))
gst_gl_context_gen_texture (upload->context, &upload->priv->tex_id,
@ -467,7 +442,8 @@ _gst_gl_upload_perform_with_data_unlocked (GstGLUpload * upload,
for (i = 0; i < GST_VIDEO_MAX_PLANES; i++) {
if (upload->in_tex[i] && upload->in_tex[i]->data != data[i]) {
upload->in_tex[i]->data = data[i];
GST_GL_MEMORY_FLAG_SET (upload->in_tex[i], GST_GL_MEMORY_FLAG_NEED_UPLOAD);
GST_GL_MEMORY_FLAG_SET (upload->in_tex[i],
GST_GL_MEMORY_FLAG_NEED_UPLOAD);
}
}
@ -502,7 +478,8 @@ _init_upload (GstGLUpload * upload)
GST_VIDEO_INFO_WIDTH (&upload->in_info),
GST_VIDEO_INFO_HEIGHT (&upload->in_info));
gst_gl_color_convert_set_format (upload->convert, &upload->in_info, &out_info);
gst_gl_color_convert_set_format (upload->convert, &upload->in_info,
&out_info);
upload->out_tex = gst_gl_memory_wrapped_texture (upload->context, 0,
GST_VIDEO_GL_TEXTURE_TYPE_RGBA, GST_VIDEO_INFO_WIDTH (&upload->in_info),
@ -538,7 +515,8 @@ _upload_memory (GstGLUpload * upload)
inbuf = gst_buffer_new ();
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&upload->in_info); i++) {
in_texture[i] = upload->in_tex[i]->tex_id;
gst_buffer_append_memory (inbuf, gst_memory_ref ((GstMemory *) upload->in_tex[i]));
gst_buffer_append_memory (inbuf,
gst_memory_ref ((GstMemory *) upload->in_tex[i]));
}
GST_TRACE ("uploading with textures:%u,%u,%u dimensions:%ux%u",
@ -547,7 +525,8 @@ _upload_memory (GstGLUpload * upload)
upload->priv->outbuf = gst_gl_color_convert_perform (upload->convert, inbuf);
gst_buffer_unref (inbuf);
gst_video_info_set_format (&out_info, GST_VIDEO_FORMAT_RGBA, in_width, in_height);
gst_video_info_set_format (&out_info, GST_VIDEO_FORMAT_RGBA, in_width,
in_height);
if (!gst_video_frame_map (&out_frame, &out_info, upload->priv->outbuf,
GST_MAP_READ | GST_MAP_GL)) {
gst_buffer_unref (upload->priv->outbuf);