diff options
author | Thiago Santos <thiago.sousa.santos@collabora.com> | 2013-03-22 10:16:58 -0300 |
---|---|---|
committer | Thiago Santos <thiago.sousa.santos@collabora.com> | 2013-04-16 16:08:51 -0300 |
commit | 019204ec938f2492e1f7d75e3624556e9e9ed9bd (patch) | |
tree | 695d59c4bb88f2c8eab384f0f3e73463a858368f | |
parent | 80dbdad4d5983f97ea87bd7e941928911a3b893d (diff) | |
download | gstreamer-plugins-bad-019204ec938f2492e1f7d75e3624556e9e9ed9bd.tar.gz |
eglglessink: use uniform names for egl adaptation functions
And that should be gst_egl_adaptation_*
-rw-r--r-- | ext/eglgles/gstegladaptation.c | 26 | ||||
-rw-r--r-- | ext/eglgles/gstegladaptation.h | 38 | ||||
-rw-r--r-- | ext/eglgles/gstegladaptation_eagl.m | 24 | ||||
-rw-r--r-- | ext/eglgles/gstegladaptation_egl.c | 29 | ||||
-rw-r--r-- | ext/eglgles/gsteglglessink.c | 27 |
5 files changed, 70 insertions, 74 deletions
diff --git a/ext/eglgles/gstegladaptation.c b/ext/eglgles/gstegladaptation.c index 77702798f..a0532a6f7 100644 --- a/ext/eglgles/gstegladaptation.c +++ b/ext/eglgles/gstegladaptation.c @@ -296,19 +296,19 @@ HANDLE_ERROR: GstEglAdaptationContext * -gst_egl_adaptation_context_new (GstElement * element) +gst_egl_adaptation_new (GstElement * element) { GstEglAdaptationContext *ctx = g_new0 (GstEglAdaptationContext, 1); ctx->element = gst_object_ref (element); - gst_egl_adaptation_context_init (ctx); + gst_egl_adaptation_init (ctx); return ctx; } void -gst_egl_adaptation_context_free (GstEglAdaptationContext * ctx) +gst_egl_adaptation_free (GstEglAdaptationContext * ctx) { gst_object_unref (ctx->element); g_free (ctx); @@ -319,7 +319,7 @@ gst_egl_adaptation_choose_config (GstEglAdaptationContext * ctx) { gint egl_configs; - if (!_gst_egl_choose_config (ctx, FALSE, &egl_configs)) { + if (!gst_egl_choose_config (ctx, FALSE, &egl_configs)) { goto HANDLE_ERROR; } @@ -342,7 +342,7 @@ HANDLE_ERROR: return FALSE; } -gint gst_egl_adaptation_context_fill_supported_fbuffer_configs +gint gst_egl_adaptation_fill_supported_fbuffer_configs (GstEglAdaptationContext * ctx, GstCaps ** ret_caps) { gboolean ret = FALSE; @@ -354,7 +354,7 @@ gint gst_egl_adaptation_context_fill_supported_fbuffer_configs /* Init supported format/caps list */ caps = gst_caps_new_empty (); - if (_gst_egl_choose_config (ctx, TRUE, NULL)) { + if (gst_egl_choose_config (ctx, TRUE, NULL)) { gst_caps_append (caps, gst_video_format_new_template_caps (GST_VIDEO_FORMAT_RGBA)); gst_caps_append (caps, @@ -408,7 +408,7 @@ gint gst_egl_adaptation_context_fill_supported_fbuffer_configs } void -gst_egl_adaptation_context_cleanup (GstEglAdaptationContext * ctx) +gst_egl_adaptation_cleanup (GstEglAdaptationContext * ctx) { gint i; @@ -439,7 +439,7 @@ gst_egl_adaptation_context_cleanup (GstEglAdaptationContext * ctx) } } - gst_egl_adaptation_context_make_current (ctx, FALSE); + gst_egl_adaptation_make_current (ctx, FALSE); gst_egl_adaptation_destroy_surface (ctx); gst_egl_adaptation_destroy_context (ctx); @@ -463,13 +463,13 @@ gst_egl_adaptation_init_egl_surface (GstEglAdaptationContext * ctx, gst_egl_adaptation_query_buffer_preserved (ctx); - if (!gst_egl_adaptation_context_make_current (ctx, TRUE)) + if (!gst_egl_adaptation_make_current (ctx, TRUE)) goto HANDLE_ERROR_LOCKED; gst_egl_adaptation_query_par (ctx); /* Save surface dims */ - gst_egl_adaptation_context_update_surface_dimensions (ctx); + gst_egl_adaptation_update_surface_dimensions (ctx); /* We have a surface! */ ctx->have_surface = TRUE; @@ -674,19 +674,19 @@ got_gl_error (const char *wtf) } GLuint -gst_egl_adaptation_context_get_texture (GstEglAdaptationContext * ctx, gint i) +gst_egl_adaptation_get_texture (GstEglAdaptationContext * ctx, gint i) { return ctx->texture[i]; } gint -gst_egl_adaptation_context_get_surface_width (GstEglAdaptationContext * ctx) +gst_egl_adaptation_get_surface_width (GstEglAdaptationContext * ctx) { return ctx->surface_width; } gint -gst_egl_adaptation_context_get_surface_height (GstEglAdaptationContext * ctx) +gst_egl_adaptation_get_surface_height (GstEglAdaptationContext * ctx) { return ctx->surface_height; } diff --git a/ext/eglgles/gstegladaptation.h b/ext/eglgles/gstegladaptation.h index 9b9bff852..e7073bfde 100644 --- a/ext/eglgles/gstegladaptation.h +++ b/ext/eglgles/gstegladaptation.h @@ -134,10 +134,10 @@ struct GstEglAdaptationContext #endif }; -GstEglAdaptationContext * gst_egl_adaptation_context_new (GstElement * element); -void gst_egl_adaptation_context_init (GstEglAdaptationContext * ctx); -void gst_egl_adaptation_context_deinit (GstEglAdaptationContext * ctx); -void gst_egl_adaptation_context_free (GstEglAdaptationContext * ctx); +GstEglAdaptationContext * gst_egl_adaptation_new (GstElement * element); +void gst_egl_adaptation_init (GstEglAdaptationContext * ctx); +void gst_egl_adaptation_deinit (GstEglAdaptationContext * ctx); +void gst_egl_adaptation_free (GstEglAdaptationContext * ctx); /* platform window */ gboolean gst_egl_adaptation_create_native_window (GstEglAdaptationContext * ctx, gint width, gint height, gpointer * own_window_data); @@ -145,36 +145,36 @@ void gst_egl_adaptation_destroy_native_window (GstEglAdaptationContext * ctx, gp /* Initialization */ gboolean gst_egl_adaptation_init_display (GstEglAdaptationContext * ctx); -gint gst_egl_adaptation_context_fill_supported_fbuffer_configs (GstEglAdaptationContext * ctx, GstCaps ** ret_caps); +gint gst_egl_adaptation_fill_supported_fbuffer_configs (GstEglAdaptationContext * ctx, GstCaps ** ret_caps); gboolean gst_egl_adaptation_init_egl_surface (GstEglAdaptationContext * ctx, GstVideoFormat format); -void gst_egl_adaptation_context_init_egl_exts (GstEglAdaptationContext * ctx); +void gst_egl_adaptation_init_egl_exts (GstEglAdaptationContext * ctx); /* cleanup */ -void gst_egl_adaptation_context_cleanup (GstEglAdaptationContext * ctx); -void gst_egl_adaptation_context_terminate_display(GstEglAdaptationContext * ctx); +void gst_egl_adaptation_cleanup (GstEglAdaptationContext * ctx); +void gst_egl_adaptation_terminate_display(GstEglAdaptationContext * ctx); /* configuration */ gboolean gst_egl_adaptation_choose_config (GstEglAdaptationContext * ctx); -gboolean gst_egl_adaptation_context_make_current (GstEglAdaptationContext * ctx, gboolean bind); -gboolean gst_egl_adaptation_context_update_surface_dimensions (GstEglAdaptationContext * ctx); +gboolean gst_egl_adaptation_make_current (GstEglAdaptationContext * ctx, gboolean bind); +gboolean gst_egl_adaptation_update_surface_dimensions (GstEglAdaptationContext * ctx); /* rendering */ -void gst_egl_adaptation_context_bind_API (GstEglAdaptationContext * ctx); -gboolean gst_egl_adaptation_context_swap_buffers (GstEglAdaptationContext * ctx); +void gst_egl_adaptation_bind_API (GstEglAdaptationContext * ctx); +gboolean gst_egl_adaptation_swap_buffers (GstEglAdaptationContext * ctx); /* get/set */ -void gst_egl_adaptation_context_set_window (GstEglAdaptationContext * ctx, guintptr window); -void gst_egl_adaptation_context_update_used_window (GstEglAdaptationContext * ctx); -guintptr gst_egl_adaptation_context_get_window (GstEglAdaptationContext * ctx); -GLuint gst_egl_adaptation_context_get_texture (GstEglAdaptationContext * ctx, gint i); -gint gst_egl_adaptation_context_get_surface_width (GstEglAdaptationContext * ctx); -gint gst_egl_adaptation_context_get_surface_height (GstEglAdaptationContext * ctx); +void gst_egl_adaptation_set_window (GstEglAdaptationContext * ctx, guintptr window); +void gst_egl_adaptation_update_used_window (GstEglAdaptationContext * ctx); +guintptr gst_egl_adaptation_get_window (GstEglAdaptationContext * ctx); +GLuint gst_egl_adaptation_get_texture (GstEglAdaptationContext * ctx, gint i); +gint gst_egl_adaptation_get_surface_width (GstEglAdaptationContext * ctx); +gint gst_egl_adaptation_get_surface_height (GstEglAdaptationContext * ctx); /* error handling */ gboolean got_gl_error (const char *wtf); /* platform specific helpers */ -gboolean _gst_egl_choose_config (GstEglAdaptationContext * ctx, gboolean try_only, gint * num_configs); +gboolean gst_egl_choose_config (GstEglAdaptationContext * ctx, gboolean try_only, gint * num_configs); gboolean gst_egl_adaptation_create_egl_context (GstEglAdaptationContext * ctx); gboolean gst_egl_adaptation_create_surface (GstEglAdaptationContext * ctx); void gst_egl_adaptation_query_buffer_preserved (GstEglAdaptationContext * ctx); diff --git a/ext/eglgles/gstegladaptation_eagl.m b/ext/eglgles/gstegladaptation_eagl.m index 2e8ecd435..91857921c 100644 --- a/ext/eglgles/gstegladaptation_eagl.m +++ b/ext/eglgles/gstegladaptation_eagl.m @@ -60,13 +60,13 @@ struct _GstEaglContext }; void -gst_egl_adaptation_context_init (GstEglAdaptationContext * ctx) +gst_egl_adaptation_init (GstEglAdaptationContext * ctx) { ctx->eaglctx = g_new0 (GstEaglContext, 1); } void -gst_egl_adaptation_context_deinit (GstEglAdaptationContext * ctx) +gst_egl_adaptation_deinit (GstEglAdaptationContext * ctx) { g_free (ctx->eaglctx); } @@ -79,13 +79,13 @@ gst_egl_adaptation_init_display (GstEglAdaptationContext * ctx) } void -gst_egl_adaptation_context_terminate_display (GstEglAdaptationContext * ctx) +gst_egl_adaptation_terminate_display (GstEglAdaptationContext * ctx) { /* NOP */ } void -gst_egl_adaptation_context_bind_API (GstEglAdaptationContext * ctx) +gst_egl_adaptation_bind_API (GstEglAdaptationContext * ctx) { /* NOP */ } @@ -116,7 +116,7 @@ gst_egl_adaptation_create_egl_context (GstEglAdaptationContext * ctx) } gboolean -gst_egl_adaptation_context_make_current (GstEglAdaptationContext * ctx, +gst_egl_adaptation_make_current (GstEglAdaptationContext * ctx, gboolean bind) { if (bind && ctx->eaglctx->eagl_context) { @@ -195,7 +195,7 @@ gst_egl_adaptation_create_surface (GstEglAdaptationContext * ctx) } gboolean -_gst_egl_choose_config (GstEglAdaptationContext * ctx, gboolean try_only, gint * num_configs) +gst_egl_choose_config (GstEglAdaptationContext * ctx, gboolean try_only, gint * num_configs) { CAEAGLLayer *eaglLayer = (CAEAGLLayer *)[ctx->eaglctx->window layer]; NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: @@ -234,7 +234,7 @@ gst_egl_adaptation_query_par (GstEglAdaptationContext * ctx) } gboolean -gst_egl_adaptation_context_update_surface_dimensions (GstEglAdaptationContext * +gst_egl_adaptation_update_surface_dimensions (GstEglAdaptationContext * ctx) { GLint width; @@ -256,7 +256,7 @@ gst_egl_adaptation_context_update_surface_dimensions (GstEglAdaptationContext * } void -gst_egl_adaptation_context_init_egl_exts (GstEglAdaptationContext * ctx) +gst_egl_adaptation_init_egl_exts (GstEglAdaptationContext * ctx) { const gchar *extensions = (const gchar *) glGetString(GL_EXTENSIONS); NSString *extensionsString = [NSString stringWithCString:extensions encoding: NSASCIIStringEncoding]; @@ -285,7 +285,7 @@ gst_egl_adaptation_destroy_context (GstEglAdaptationContext * ctx) } gboolean -gst_egl_adaptation_context_swap_buffers (GstEglAdaptationContext * ctx) +gst_egl_adaptation_swap_buffers (GstEglAdaptationContext * ctx) { glBindRenderbuffer(GL_RENDERBUFFER, ctx->eaglctx->color_renderbuffer); [ctx->eaglctx->eagl_context presentRenderbuffer:GL_RENDERBUFFER]; @@ -294,19 +294,19 @@ gst_egl_adaptation_context_swap_buffers (GstEglAdaptationContext * ctx) } void -gst_egl_adaptation_context_set_window (GstEglAdaptationContext * ctx, guintptr window) +gst_egl_adaptation_set_window (GstEglAdaptationContext * ctx, guintptr window) { ctx->eaglctx->window = (UIView *) window; } void -gst_egl_adaptation_context_update_used_window (GstEglAdaptationContext * ctx) +gst_egl_adaptation_update_used_window (GstEglAdaptationContext * ctx) { ctx->eaglctx->used_window = ctx->eaglctx->window; } guintptr -gst_egl_adaptation_context_get_window (GstEglAdaptationContext * ctx) +gst_egl_adaptation_get_window (GstEglAdaptationContext * ctx) { return (guintptr) ctx->eaglctx->window; } diff --git a/ext/eglgles/gstegladaptation_egl.c b/ext/eglgles/gstegladaptation_egl.c index b9052df4b..2177b87eb 100644 --- a/ext/eglgles/gstegladaptation_egl.c +++ b/ext/eglgles/gstegladaptation_egl.c @@ -182,7 +182,7 @@ HANDLE_ERROR: } void -gst_egl_adaptation_context_terminate_display (GstEglAdaptationContext * ctx) +gst_egl_adaptation_terminate_display (GstEglAdaptationContext * ctx) { if (ctx->eglglesctx->display) { eglTerminate (ctx->eglglesctx->display); @@ -192,7 +192,7 @@ gst_egl_adaptation_context_terminate_display (GstEglAdaptationContext * ctx) gboolean -_gst_egl_choose_config (GstEglAdaptationContext * ctx, gboolean try_only, +gst_egl_choose_config (GstEglAdaptationContext * ctx, gboolean try_only, gint * num_configs) { EGLint cfg_number; @@ -238,8 +238,7 @@ gst_egl_adaptation_create_egl_context (GstEglAdaptationContext * ctx) } gboolean -gst_egl_adaptation_context_make_current (GstEglAdaptationContext * ctx, - gboolean bind) +gst_egl_adaptation_make_current (GstEglAdaptationContext * ctx, gboolean bind) { g_assert (ctx->eglglesctx->display != NULL); @@ -355,8 +354,7 @@ gst_egl_adaptation_query_par (GstEglAdaptationContext * ctx) /* XXX: Lock eglgles context? */ /* TODO refactor only to get the w/h and let common code do the updates */ gboolean -gst_egl_adaptation_context_update_surface_dimensions (GstEglAdaptationContext * - ctx) +gst_egl_adaptation_update_surface_dimensions (GstEglAdaptationContext * ctx) { gint width, height; @@ -383,7 +381,7 @@ gst_egl_adaptation_context_update_surface_dimensions (GstEglAdaptationContext * * EGL/GLES extensions. */ void -gst_egl_adaptation_context_init_egl_exts (GstEglAdaptationContext * ctx) +gst_egl_adaptation_init_egl_exts (GstEglAdaptationContext * ctx) { const char *eglexts; unsigned const char *glexts; @@ -419,13 +417,13 @@ gst_egl_adaptation_destroy_context (GstEglAdaptationContext * ctx) } void -gst_egl_adaptation_context_bind_API (GstEglAdaptationContext * ctx) +gst_egl_adaptation_bind_API (GstEglAdaptationContext * ctx) { eglBindAPI (EGL_OPENGL_ES_API); } gboolean -gst_egl_adaptation_context_swap_buffers (GstEglAdaptationContext * ctx) +gst_egl_adaptation_swap_buffers (GstEglAdaptationContext * ctx) { gboolean ret = eglSwapBuffers (ctx->eglglesctx->display, ctx->eglglesctx->surface); @@ -442,7 +440,7 @@ gst_egl_adaptation_create_native_window (GstEglAdaptationContext * ctx, EGLNativeWindowType window = platform_create_native_window (width, height, own_window_data); if (window) - gst_egl_adaptation_context_set_window (ctx, window); + gst_egl_adaptation_set_window (ctx, window); GST_DEBUG_OBJECT (ctx->element, "Using window handle %p", window); return window != 0; } @@ -457,32 +455,31 @@ gst_egl_adaptation_destroy_native_window (GstEglAdaptationContext * ctx, } void -gst_egl_adaptation_context_init (GstEglAdaptationContext * ctx) +gst_egl_adaptation_init (GstEglAdaptationContext * ctx) { ctx->eglglesctx = g_new0 (GstEglGlesRenderContext, 1); } void -gst_egl_adaptation_context_deinit (GstEglAdaptationContext * ctx) +gst_egl_adaptation_deinit (GstEglAdaptationContext * ctx) { g_free (ctx->eglglesctx); } void -gst_egl_adaptation_context_set_window (GstEglAdaptationContext * ctx, - guintptr window) +gst_egl_adaptation_set_window (GstEglAdaptationContext * ctx, guintptr window) { ctx->eglglesctx->window = (EGLNativeWindowType) window; } void -gst_egl_adaptation_context_update_used_window (GstEglAdaptationContext * ctx) +gst_egl_adaptation_update_used_window (GstEglAdaptationContext * ctx) { ctx->eglglesctx->used_window = ctx->eglglesctx->window; } guintptr -gst_egl_adaptation_context_get_window (GstEglAdaptationContext * ctx) +gst_egl_adaptation_get_window (GstEglAdaptationContext * ctx) { return ctx->eglglesctx->window; } diff --git a/ext/eglgles/gsteglglessink.c b/ext/eglgles/gsteglglessink.c index 7c1b48a4c..42b9d99a2 100644 --- a/ext/eglgles/gsteglglessink.c +++ b/ext/eglgles/gsteglglessink.c @@ -207,9 +207,9 @@ egl_init (GstEglGlesSink * eglglessink) goto HANDLE_ERROR; } - gst_egl_adaptation_context_init_egl_exts (eglglessink->egl_context); + gst_egl_adaptation_init_egl_exts (eglglessink->egl_context); - if (!gst_egl_adaptation_context_fill_supported_fbuffer_configs + if (!gst_egl_adaptation_fill_supported_fbuffer_configs (eglglessink->egl_context, &eglglessink->sinkcaps)) { GST_ERROR_OBJECT (eglglessink, "Display support NONE of our configs"); goto HANDLE_ERROR; @@ -241,7 +241,7 @@ render_thread_func (GstEglGlesSink * eglglessink) gst_element_post_message (GST_ELEMENT_CAST (eglglessink), message); g_value_unset (&val); - gst_egl_adaptation_context_bind_API (eglglessink->egl_context); + gst_egl_adaptation_bind_API (eglglessink->egl_context); while (gst_data_queue_pop (eglglessink->queue, &item)) { GstBuffer *buf = NULL; @@ -306,7 +306,7 @@ render_thread_func (GstEglGlesSink * eglglessink) GST_DEBUG_OBJECT (eglglessink, "Shutting down thread"); /* EGL/GLES cleanup */ - gst_egl_adaptation_context_cleanup (eglglessink->egl_context); + gst_egl_adaptation_cleanup (eglglessink->egl_context); if (eglglessink->configured_caps) { gst_caps_unref (eglglessink->configured_caps); @@ -635,7 +635,7 @@ gst_eglglessink_set_window_handle (GstXOverlay * overlay, guintptr id) /* OK, we have a new window */ GST_OBJECT_LOCK (eglglessink); - gst_egl_adaptation_context_set_window (eglglessink->egl_context, id); + gst_egl_adaptation_set_window (eglglessink->egl_context, id); eglglessink->have_window = ((gpointer) id != NULL); GST_OBJECT_UNLOCK (eglglessink); @@ -866,7 +866,7 @@ gst_eglglessink_render (GstEglGlesSink * eglglessink) * calling party explicitly ask us not to by setting * force_aspect_ratio to FALSE. */ - if (gst_egl_adaptation_context_update_surface_dimensions + if (gst_egl_adaptation_update_surface_dimensions (eglglessink->egl_context) || eglglessink->render_region_changed || !eglglessink->display_region.w || !eglglessink->display_region.h || eglglessink->size_changed) { @@ -996,7 +996,7 @@ gst_eglglessink_render (GstEglGlesSink * eglglessink) if (got_gl_error ("glDrawElements")) goto HANDLE_ERROR; - if (!gst_egl_adaptation_context_swap_buffers (eglglessink->egl_context)) { + if (!gst_egl_adaptation_swap_buffers (eglglessink->egl_context)) { goto HANDLE_ERROR; } @@ -1083,7 +1083,7 @@ gst_eglglessink_configure_caps (GstEglGlesSink * eglglessink, GstCaps * caps) GST_DEBUG_OBJECT (eglglessink, "Caps are not compatible, reconfiguring"); /* EGL/GLES cleanup */ - gst_egl_adaptation_context_cleanup (eglglessink->egl_context); + gst_egl_adaptation_cleanup (eglglessink->egl_context); gst_caps_unref (eglglessink->configured_caps); eglglessink->configured_caps = NULL; @@ -1110,11 +1110,10 @@ gst_eglglessink_configure_caps (GstEglGlesSink * eglglessink, GstCaps * caps) goto HANDLE_ERROR; } eglglessink->using_own_window = TRUE; - gst_egl_adaptation_context_update_used_window (eglglessink->egl_context); + gst_egl_adaptation_update_used_window (eglglessink->egl_context); eglglessink->have_window = TRUE; } - used_window = - gst_egl_adaptation_context_get_window (eglglessink->egl_context); + used_window = gst_egl_adaptation_get_window (eglglessink->egl_context); GST_OBJECT_UNLOCK (eglglessink); gst_x_overlay_got_window_handle (GST_X_OVERLAY (eglglessink), (guintptr) used_window); @@ -1165,7 +1164,7 @@ gst_eglglessink_open (GstEglGlesSink * eglglessink) static gboolean gst_eglglessink_close (GstEglGlesSink * eglglessink) { - gst_egl_adaptation_context_terminate_display (eglglessink->egl_context); + gst_egl_adaptation_terminate_display (eglglessink->egl_context); gst_caps_unref (eglglessink->sinkcaps); eglglessink->sinkcaps = NULL; @@ -1240,7 +1239,7 @@ gst_eglglessink_finalize (GObject * object) g_cond_free (eglglessink->render_cond); g_mutex_free (eglglessink->render_lock); - gst_egl_adaptation_context_free (eglglessink->egl_context); + gst_egl_adaptation_free (eglglessink->egl_context); G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -1386,7 +1385,7 @@ gst_eglglessink_init (GstEglGlesSink * eglglessink, eglglessink->last_flow = GST_FLOW_WRONG_STATE; eglglessink->egl_context = - gst_egl_adaptation_context_new (GST_ELEMENT_CAST (eglglessink)); + gst_egl_adaptation_new (GST_ELEMENT_CAST (eglglessink)); } /* Interface initializations. Used here for initializing the XOverlay |