gl: use GLMemory for accessing textures everywhere

This simplifies and consolidates a lot of duplicated code creating
and modifying textures.
This commit is contained in:
Matthew Waters 2016-07-12 00:30:22 +10:00
parent 9b7d248982
commit c8c016ed17
5 changed files with 11 additions and 9 deletions

View File

@ -631,7 +631,7 @@ _upload_frames (GstAggregator * agg, GstAggregatorPad * agg_pad,
gboolean gboolean
gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf) gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf)
{ {
guint out_tex; GstGLMemory *out_tex;
gboolean res = TRUE; gboolean res = TRUE;
GstVideoFrame out_frame; GstVideoFrame out_frame;
GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (mix); GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (mix);
@ -645,7 +645,7 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf)
return FALSE; 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), if (!gst_aggregator_iterate_sinkpads (GST_AGGREGATOR (mix),
(GstAggregatorPadForeachFunc) _upload_frames, NULL)) (GstAggregatorPadForeachFunc) _upload_frames, NULL))

View File

@ -78,7 +78,7 @@ typedef gboolean (*GstGLMixerSetCaps) (GstGLMixer* mixer,
GstCaps* outcaps); GstCaps* outcaps);
typedef void (*GstGLMixerReset) (GstGLMixer *mixer); typedef void (*GstGLMixerReset) (GstGLMixer *mixer);
typedef gboolean (*GstGLMixerProcessFunc) (GstGLMixer *mix, GstBuffer *outbuf); 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 struct _GstGLMixer
{ {

View File

@ -70,7 +70,7 @@ static gboolean gst_gl_mosaic_init_shader (GstGLMixer * mixer,
GstCaps * outcaps); GstCaps * outcaps);
static gboolean gst_gl_mosaic_process_textures (GstGLMixer * mixer, static gboolean gst_gl_mosaic_process_textures (GstGLMixer * mixer,
guint out_tex); GstGLMemory * out_tex);
static void gst_gl_mosaic_callback (gpointer stuff); static void gst_gl_mosaic_callback (gpointer stuff);
//vertex source //vertex source
@ -194,7 +194,7 @@ gst_gl_mosaic_init_shader (GstGLMixer * mixer, GstCaps * outcaps)
} }
static gboolean 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); 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_gl_context_use_fbo_v2 (GST_GL_BASE_MIXER (mix)->context,
GST_VIDEO_INFO_WIDTH (&GST_VIDEO_AGGREGATOR (mix)->info), GST_VIDEO_INFO_WIDTH (&GST_VIDEO_AGGREGATOR (mix)->info),
GST_VIDEO_INFO_HEIGHT (&GST_VIDEO_AGGREGATOR (mix)->info), mix->fbo, 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; return TRUE;
} }

View File

@ -40,6 +40,7 @@ struct _GstGLMosaic
GstGLMixer mixer; GstGLMixer mixer;
GstGLShader *shader; GstGLShader *shader;
GstGLMemory *out_tex;
}; };
struct _GstGLMosaicClass struct _GstGLMosaicClass

View File

@ -474,7 +474,7 @@ static gboolean gst_gl_video_mixer_init_shader (GstGLMixer * mixer,
GstCaps * outcaps); GstCaps * outcaps);
static gboolean gst_gl_video_mixer_process_textures (GstGLMixer * mixer, 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); static void gst_gl_video_mixer_callback (gpointer stuff);
/* *INDENT-OFF* */ /* *INDENT-OFF* */
@ -1156,7 +1156,7 @@ gst_gl_video_mixer_init_shader (GstGLMixer * mixer, GstCaps * outcaps)
} }
static gboolean 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); 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_WIDTH (&GST_VIDEO_AGGREGATOR (mix)->info),
GST_VIDEO_INFO_HEIGHT (&GST_VIDEO_AGGREGATOR (mix)->info), GST_VIDEO_INFO_HEIGHT (&GST_VIDEO_AGGREGATOR (mix)->info),
mix->fbo, mix->depthbuffer, 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; return TRUE;
} }