eglglessink: Factor display region reset to its own func

This commit is contained in:
Reynaldo H. Verdejo Pinochet 2012-10-18 02:26:17 -03:00 committed by Sebastian Dröge
parent c3a12d737e
commit 5bdf1ec099

View file

@ -406,6 +406,8 @@ static inline gboolean egl_init (GstEglGlesSink * eglglessink);
static gboolean gst_eglglessink_context_make_current (GstEglGlesSink * static gboolean gst_eglglessink_context_make_current (GstEglGlesSink *
eglglessink, gboolean bind); eglglessink, gboolean bind);
static void gst_eglglessink_wipe_eglglesctx (GstEglGlesSink * eglglessink); static void gst_eglglessink_wipe_eglglesctx (GstEglGlesSink * eglglessink);
static inline void gst_eglglessink_reset_display_region (GstEglGlesSink *
eglglessink);
GST_BOILERPLATE_FULL (GstEglGlesSink, gst_eglglessink, GstVideoSink, GST_BOILERPLATE_FULL (GstEglGlesSink, gst_eglglessink, GstVideoSink,
GST_TYPE_VIDEO_SINK, gst_eglglessink_init_interfaces); GST_TYPE_VIDEO_SINK, gst_eglglessink_init_interfaces);
@ -688,11 +690,17 @@ gst_eglglessink_wipe_eglglesctx (GstEglGlesSink * eglglessink)
eglglessink->eglglesctx.eglcontext = NULL; eglglessink->eglglesctx.eglcontext = NULL;
} }
gst_eglglessink_reset_display_region (eglglessink);
}
/* Reset display region
* XXX: Should probably keep old ones if set_render_rect()
* has been called.
*/
static inline void
gst_eglglessink_reset_display_region (GstEglGlesSink * eglglessink)
{
GST_OBJECT_LOCK (eglglessink); GST_OBJECT_LOCK (eglglessink);
/* Reset display region
* XXX: Should probably keep old ones if set_render_rect()
* has been called.
*/
eglglessink->display_region.w = 0; eglglessink->display_region.w = 0;
eglglessink->display_region.h = 0; eglglessink->display_region.h = 0;
GST_OBJECT_UNLOCK (eglglessink); GST_OBJECT_UNLOCK (eglglessink);
@ -720,15 +728,7 @@ gst_eglglessink_start (GstEglGlesSink * eglglessink)
goto HANDLE_ERROR; goto HANDLE_ERROR;
} }
GST_OBJECT_LOCK (eglglessink); gst_eglglessink_reset_display_region (eglglessink);
/* Reset display region
* XXX: Should probably keep old ones if set_render_rect()
* has been called.
*/
eglglessink->display_region.w = 0;
eglglessink->display_region.h = 0;
GST_OBJECT_UNLOCK (eglglessink);
eglglessink->last_flow = GST_FLOW_OK; eglglessink->last_flow = GST_FLOW_OK;
gst_data_queue_set_flushing (eglglessink->queue, FALSE); gst_data_queue_set_flushing (eglglessink->queue, FALSE);
@ -1628,15 +1628,15 @@ gst_eglglessink_set_render_rectangle (GstXOverlay * overlay, gint x, gint y,
/* This is the set-defaults condition according to /* This is the set-defaults condition according to
* the xOverlay interface docs * the xOverlay interface docs
*/ */
eglglessink->display_region.w = 0; gst_eglglessink_reset_display_region (eglglessink);
eglglessink->display_region.h = 0;
} else { } else {
GST_OBJECT_LOCK (eglglessink);
eglglessink->display_region.x = x; eglglessink->display_region.x = x;
eglglessink->display_region.y = y; eglglessink->display_region.y = y;
eglglessink->display_region.w = width; eglglessink->display_region.w = width;
eglglessink->display_region.h = height; eglglessink->display_region.h = height;
GST_OBJECT_UNLOCK (eglglessink);
} }
GST_OBJECT_UNLOCK (eglglessink);
return; return;
} }