From c8c016ed177353721a43cc45885828953471908e Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Tue, 12 Jul 2016 00:30:22 +1000 Subject: [PATCH] gl: use GLMemory for accessing textures everywhere This simplifies and consolidates a lot of duplicated code creating and modifying textures. --- ext/gl/gstglmixer.c | 4 ++-- ext/gl/gstglmixer.h | 2 +- ext/gl/gstglmosaic.c | 7 ++++--- ext/gl/gstglmosaic.h | 1 + ext/gl/gstglvideomixer.c | 6 +++--- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/ext/gl/gstglmixer.c b/ext/gl/gstglmixer.c index 764a53c..f9c22a1 100644 --- a/ext/gl/gstglmixer.c +++ b/ext/gl/gstglmixer.c @@ -631,7 +631,7 @@ _upload_frames (GstAggregator * agg, GstAggregatorPad * agg_pad, gboolean gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf) { - guint out_tex; + GstGLMemory *out_tex; gboolean res = TRUE; GstVideoFrame out_frame; GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (mix); @@ -645,7 +645,7 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf) return FALSE; } - out_tex = *(guint *) out_frame.data[0]; + out_tex = (GstGLMemory *) out_frame.map[0].memory; if (!gst_aggregator_iterate_sinkpads (GST_AGGREGATOR (mix), (GstAggregatorPadForeachFunc) _upload_frames, NULL)) diff --git a/ext/gl/gstglmixer.h b/ext/gl/gstglmixer.h index 81976a7..de5a3dc 100644 --- a/ext/gl/gstglmixer.h +++ b/ext/gl/gstglmixer.h @@ -78,7 +78,7 @@ typedef gboolean (*GstGLMixerSetCaps) (GstGLMixer* mixer, GstCaps* outcaps); typedef void (*GstGLMixerReset) (GstGLMixer *mixer); typedef gboolean (*GstGLMixerProcessFunc) (GstGLMixer *mix, GstBuffer *outbuf); -typedef gboolean (*GstGLMixerProcessTextures) (GstGLMixer *mix, guint out_tex); +typedef gboolean (*GstGLMixerProcessTextures) (GstGLMixer *mix, GstGLMemory *out_tex); struct _GstGLMixer { diff --git a/ext/gl/gstglmosaic.c b/ext/gl/gstglmosaic.c index bcf3833..701435f 100644 --- a/ext/gl/gstglmosaic.c +++ b/ext/gl/gstglmosaic.c @@ -70,7 +70,7 @@ static gboolean gst_gl_mosaic_init_shader (GstGLMixer * mixer, GstCaps * outcaps); static gboolean gst_gl_mosaic_process_textures (GstGLMixer * mixer, - guint out_tex); + GstGLMemory * out_tex); static void gst_gl_mosaic_callback (gpointer stuff); //vertex source @@ -194,7 +194,7 @@ gst_gl_mosaic_init_shader (GstGLMixer * mixer, GstCaps * outcaps) } static gboolean -gst_gl_mosaic_process_textures (GstGLMixer * mix, guint out_tex) +gst_gl_mosaic_process_textures (GstGLMixer * mix, GstGLMemory * out_tex) { GstGLMosaic *mosaic = GST_GL_MOSAIC (mix); @@ -202,7 +202,8 @@ gst_gl_mosaic_process_textures (GstGLMixer * mix, guint out_tex) gst_gl_context_use_fbo_v2 (GST_GL_BASE_MIXER (mix)->context, GST_VIDEO_INFO_WIDTH (&GST_VIDEO_AGGREGATOR (mix)->info), GST_VIDEO_INFO_HEIGHT (&GST_VIDEO_AGGREGATOR (mix)->info), mix->fbo, - mix->depthbuffer, out_tex, gst_gl_mosaic_callback, (gpointer) mosaic); + mix->depthbuffer, out_tex->tex_id, gst_gl_mosaic_callback, + (gpointer) mosaic); return TRUE; } diff --git a/ext/gl/gstglmosaic.h b/ext/gl/gstglmosaic.h index e0b340c..40f5d6c 100644 --- a/ext/gl/gstglmosaic.h +++ b/ext/gl/gstglmosaic.h @@ -40,6 +40,7 @@ struct _GstGLMosaic GstGLMixer mixer; GstGLShader *shader; + GstGLMemory *out_tex; }; struct _GstGLMosaicClass diff --git a/ext/gl/gstglvideomixer.c b/ext/gl/gstglvideomixer.c index 83905d0..176d27e 100644 --- a/ext/gl/gstglvideomixer.c +++ b/ext/gl/gstglvideomixer.c @@ -474,7 +474,7 @@ static gboolean gst_gl_video_mixer_init_shader (GstGLMixer * mixer, GstCaps * outcaps); static gboolean gst_gl_video_mixer_process_textures (GstGLMixer * mixer, - guint out_tex); + GstGLMemory * out_tex); static void gst_gl_video_mixer_callback (gpointer stuff); /* *INDENT-OFF* */ @@ -1156,7 +1156,7 @@ gst_gl_video_mixer_init_shader (GstGLMixer * mixer, GstCaps * outcaps) } static gboolean -gst_gl_video_mixer_process_textures (GstGLMixer * mix, guint out_tex) +gst_gl_video_mixer_process_textures (GstGLMixer * mix, GstGLMemory * out_tex) { GstGLVideoMixer *video_mixer = GST_GL_VIDEO_MIXER (mix); @@ -1164,7 +1164,7 @@ gst_gl_video_mixer_process_textures (GstGLMixer * mix, guint out_tex) GST_VIDEO_INFO_WIDTH (&GST_VIDEO_AGGREGATOR (mix)->info), GST_VIDEO_INFO_HEIGHT (&GST_VIDEO_AGGREGATOR (mix)->info), mix->fbo, mix->depthbuffer, - out_tex, gst_gl_video_mixer_callback, (gpointer) video_mixer); + out_tex->tex_id, gst_gl_video_mixer_callback, (gpointer) video_mixer); return TRUE; } -- 2.7.4