mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
[388/906] just fix builds and indent
This commit is contained in:
parent
b85ffef956
commit
525701cfca
7 changed files with 199 additions and 93 deletions
|
@ -23,6 +23,7 @@ add_library (gstgl STATIC
|
|||
gstgldisplay.c
|
||||
gstglbuffer.c
|
||||
gstglfilter.c
|
||||
gstglmixer.c
|
||||
gstglshader.c)
|
||||
|
||||
target_link_libraries(gstgl
|
||||
|
@ -36,17 +37,18 @@ target_link_libraries(gstgl
|
|||
else (WIN32)
|
||||
|
||||
if (APPLE)
|
||||
|
||||
|
||||
include_directories(AFTER
|
||||
../../..)
|
||||
|
||||
|
||||
add_library (gstgl STATIC
|
||||
gstglwindow_cocoa.m
|
||||
gstgldisplay.c
|
||||
gstglbuffer.c
|
||||
gstglfilter.c
|
||||
gstglmixer.c
|
||||
gstglshader.c)
|
||||
|
||||
|
||||
target_link_libraries(gstgl
|
||||
general ${OPENGL_LIBRARIES}
|
||||
general ${GLEW_LIBRARY}
|
||||
|
@ -58,23 +60,24 @@ else (WIN32)
|
|||
"-framework Cocoa")
|
||||
|
||||
else (APPLE)
|
||||
|
||||
|
||||
include_directories(AFTER
|
||||
../../..)
|
||||
|
||||
|
||||
add_library (gstgl STATIC
|
||||
gstglwindow_x11.c
|
||||
gstgldisplay.c
|
||||
gstglbuffer.c
|
||||
gstglfilter.c
|
||||
gstglmixer.c
|
||||
gstglshader.c)
|
||||
|
||||
|
||||
target_link_libraries(gstgl
|
||||
general ${OPENGL_LIBRARIES}
|
||||
general ${GLEW_LIBRARY}
|
||||
general ${GLIB2_LIBRARIES}
|
||||
general ${GSTREAMER_LIBRARIES})
|
||||
|
||||
|
||||
endif (APPLE)
|
||||
|
||||
|
||||
endif (WIN32)
|
||||
|
|
|
@ -12,6 +12,7 @@ libgstgl_@GST_MAJORMINOR@_la_SOURCES = \
|
|||
gstgldisplay.c \
|
||||
gstglbuffer.c \
|
||||
gstglfilter.c \
|
||||
gstglmixer.c \
|
||||
gstglshader.c
|
||||
|
||||
if GL_BACKEND_WIN32
|
||||
|
@ -33,10 +34,11 @@ libgstgl_@GST_MAJORMINOR@include_HEADERS = \
|
|||
gstgldisplay.h \
|
||||
gstglbuffer.h \
|
||||
gstglfilter.h \
|
||||
gstglmixer.h \
|
||||
gstglshader.h
|
||||
|
||||
libgstgl_@GST_MAJORMINOR@_la_LIBADD = \
|
||||
$(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) \
|
||||
$(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) -lgstcontroller-$(GST_MAJORMINOR) \
|
||||
$(GST_BASE_LIBS) $(GST_LIBS) \
|
||||
$(GL_LIBS)
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ static void gst_gl_filter_set_property (GObject * object, guint prop_id,
|
|||
static void gst_gl_filter_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec);
|
||||
|
||||
static gboolean gst_gl_filter_src_query (GstPad *pad, GstQuery * query);
|
||||
static gboolean gst_gl_filter_src_query (GstPad * pad, GstQuery * query);
|
||||
|
||||
static GstCaps *gst_gl_filter_transform_caps (GstBaseTransform * bt,
|
||||
GstPadDirection direction, GstCaps * caps);
|
||||
|
@ -121,7 +121,7 @@ static void
|
|||
gst_gl_filter_init (GstGLFilter * filter, GstGLFilterClass * klass)
|
||||
{
|
||||
GstBaseTransform *base_trans = GST_BASE_TRANSFORM (filter);
|
||||
|
||||
|
||||
gst_pad_set_query_function (base_trans->srcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_gl_filter_src_query));
|
||||
|
||||
|
@ -167,10 +167,13 @@ gst_gl_filter_src_query (GstPad * pad, GstQuery * query)
|
|||
GstStructure *structure = gst_query_get_structure (query);
|
||||
if (filter->display) {
|
||||
/* this gl filter is a sink in terms of the gl chain */
|
||||
gst_structure_set (structure, "gstgldisplay", G_TYPE_POINTER, filter->display, NULL);
|
||||
gst_structure_set (structure, "gstgldisplay", G_TYPE_POINTER,
|
||||
filter->display, NULL);
|
||||
} else {
|
||||
/* at least one gl element is after in our gl chain */
|
||||
res = g_strcmp0 (gst_element_get_name (parent), gst_structure_get_name (structure)) == 0;
|
||||
res =
|
||||
g_strcmp0 (gst_element_get_name (parent),
|
||||
gst_structure_get_name (structure)) == 0;
|
||||
}
|
||||
if (!res)
|
||||
res = gst_pad_query_default (pad, query);
|
||||
|
@ -214,16 +217,19 @@ gst_gl_filter_start (GstBaseTransform * bt)
|
|||
GstGLFilter *filter = GST_GL_FILTER (bt);
|
||||
GstGLFilterClass *filter_class = GST_GL_FILTER_GET_CLASS (filter);
|
||||
GstElement *parent = GST_ELEMENT (gst_element_get_parent (filter));
|
||||
GstStructure *structure = gst_structure_new (gst_element_get_name (filter), NULL);
|
||||
GstStructure *structure =
|
||||
gst_structure_new (gst_element_get_name (filter), NULL);
|
||||
GstQuery *query = gst_query_new_application (GST_QUERY_CUSTOM, structure);
|
||||
|
||||
gboolean isPerformed = gst_element_query (parent, query);
|
||||
|
||||
if (isPerformed) {
|
||||
const GValue *id_value = gst_structure_get_value (structure, "gstgldisplay");
|
||||
const GValue *id_value =
|
||||
gst_structure_get_value (structure, "gstgldisplay");
|
||||
if (G_VALUE_HOLDS_POINTER (id_value))
|
||||
/* at least one gl element is after in our gl chain */
|
||||
filter->display = g_object_ref (GST_GL_DISPLAY (g_value_get_pointer (id_value)));
|
||||
filter->display =
|
||||
g_object_ref (GST_GL_DISPLAY (g_value_get_pointer (id_value)));
|
||||
else {
|
||||
/* this gl filter is a sink in terms of the gl chain */
|
||||
filter->display = gst_gl_display_new ();
|
||||
|
@ -325,7 +331,6 @@ gst_gl_filter_prepare_output_buffer (GstBaseTransform * trans,
|
|||
GstBuffer * inbuf, gint size, GstCaps * caps, GstBuffer ** buf)
|
||||
{
|
||||
GstGLFilter *filter = NULL;
|
||||
GstGLBuffer *gl_inbuf = GST_GL_BUFFER (inbuf);
|
||||
GstGLBuffer *gl_outbuf = NULL;
|
||||
|
||||
filter = GST_GL_FILTER (trans);
|
||||
|
@ -360,8 +365,7 @@ gst_gl_filter_set_caps (GstBaseTransform * bt, GstCaps * incaps,
|
|||
&filter->fbo, &filter->depthbuffer);
|
||||
|
||||
if (filter_class->display_init_cb != NULL) {
|
||||
gst_gl_display_thread_add (filter->display, gst_gl_filter_start_gl,
|
||||
filter);
|
||||
gst_gl_display_thread_add (filter->display, gst_gl_filter_start_gl, filter);
|
||||
}
|
||||
|
||||
if (filter_class->onInitFBO)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Generic video mixer plugin
|
||||
/*
|
||||
*
|
||||
* GStreamer
|
||||
* Copyright (C) 2009 Julien Isorce <julien.isorce@gmail.com>
|
||||
*
|
||||
|
@ -58,8 +58,6 @@ static void gst_gl_mixer_pad_set_property (GObject * object, guint prop_id,
|
|||
static gboolean gst_gl_mixer_src_event (GstPad * pad, GstEvent * event);
|
||||
static gboolean gst_gl_mixer_sink_event (GstPad * pad, GstEvent * event);
|
||||
|
||||
static void gst_gl_mixer_sort_pads (GstGLMixer * mix);
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -110,7 +108,7 @@ gst_gl_mixer_set_master_geometry (GstGLMixer * mix)
|
|||
gint fps_n = 0;
|
||||
gint fps_d = 0;
|
||||
GstGLMixerPad *master = NULL;
|
||||
|
||||
|
||||
while (walk) {
|
||||
GstGLMixerPad *mixpad = GST_GL_MIXER_PAD (walk->data);
|
||||
|
||||
|
@ -129,9 +127,7 @@ gst_gl_mixer_set_master_geometry (GstGLMixer * mix)
|
|||
}
|
||||
|
||||
/* set results */
|
||||
if (mix->master != master ||
|
||||
mix->fps_n != fps_n ||
|
||||
mix->fps_d != fps_d) {
|
||||
if (mix->master != master || mix->fps_n != fps_n || mix->fps_d != fps_d) {
|
||||
mix->setcaps = TRUE;
|
||||
mix->sendseg = TRUE;
|
||||
mix->master = master;
|
||||
|
@ -146,7 +142,7 @@ gst_gl_mixer_pad_sink_setcaps (GstPad * pad, GstCaps * vscaps)
|
|||
GstGLMixer *mix = GST_GL_MIXER (gst_pad_get_parent (pad));
|
||||
GstGLMixerPad *mixpad = GST_GL_MIXER_PAD (pad);
|
||||
GstStructure *structure = gst_caps_get_structure (vscaps, 0);
|
||||
gint width = 0;
|
||||
gint width = 0;
|
||||
gint height = 0;
|
||||
gboolean ret = FALSE;
|
||||
const GValue *framerate = gst_structure_get_value (structure, "framerate");
|
||||
|
@ -154,8 +150,7 @@ gst_gl_mixer_pad_sink_setcaps (GstPad * pad, GstCaps * vscaps)
|
|||
GST_INFO_OBJECT (mix, "Setting caps %" GST_PTR_FORMAT, vscaps);
|
||||
|
||||
if (!gst_structure_get_int (structure, "width", &width) ||
|
||||
!gst_structure_get_int (structure, "height", &height) ||
|
||||
! framerate)
|
||||
!gst_structure_get_int (structure, "height", &height) || !framerate)
|
||||
goto beach;
|
||||
|
||||
GST_GL_MIXER_STATE_LOCK (mix);
|
||||
|
@ -310,8 +305,7 @@ gst_gl_mixer_class_init (GstGLMixerClass * klass)
|
|||
|
||||
gstelement_class->request_new_pad =
|
||||
GST_DEBUG_FUNCPTR (gst_gl_mixer_request_new_pad);
|
||||
gstelement_class->release_pad =
|
||||
GST_DEBUG_FUNCPTR (gst_gl_mixer_release_pad);
|
||||
gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_gl_mixer_release_pad);
|
||||
gstelement_class->change_state =
|
||||
GST_DEBUG_FUNCPTR (gst_gl_mixer_change_state);
|
||||
|
||||
|
@ -379,8 +373,7 @@ gst_gl_mixer_init (GstGLMixer * mix, GstGLMixerClass * g_class)
|
|||
mix->collect = gst_collect_pads_new ();
|
||||
|
||||
gst_collect_pads_set_function (mix->collect,
|
||||
(GstCollectPadsFunction) GST_DEBUG_FUNCPTR (gst_gl_mixer_collected),
|
||||
mix);
|
||||
(GstCollectPadsFunction) GST_DEBUG_FUNCPTR (gst_gl_mixer_collected), mix);
|
||||
|
||||
mix->state_lock = g_mutex_new ();
|
||||
|
||||
|
@ -599,14 +592,18 @@ gst_gl_mixer_query (GstPad * pad, GstQuery * query)
|
|||
GSList *walk = mix->sinkpads;
|
||||
GstStructure *structure = gst_query_get_structure (query);
|
||||
|
||||
const gchar* name = gst_structure_get_name (structure);
|
||||
res = g_strcmp0 (gst_element_get_name (mix), gst_structure_get_name (structure)) == 0;
|
||||
res =
|
||||
g_strcmp0 (gst_element_get_name (mix),
|
||||
gst_structure_get_name (structure)) == 0;
|
||||
|
||||
if (!res) {
|
||||
/* id_value is set by upstream element of itself when going to paused state */
|
||||
const GValue *id_value = gst_structure_get_value (structure, "gstgldisplay");
|
||||
GstGLDisplay *foreign_display = GST_GL_DISPLAY (g_value_get_pointer (id_value));
|
||||
gulong foreign_gl_context = gst_gl_display_get_internal_gl_context (foreign_display);
|
||||
const GValue *id_value =
|
||||
gst_structure_get_value (structure, "gstgldisplay");
|
||||
GstGLDisplay *foreign_display =
|
||||
GST_GL_DISPLAY (g_value_get_pointer (id_value));
|
||||
gulong foreign_gl_context =
|
||||
gst_gl_display_get_internal_gl_context (foreign_display);
|
||||
|
||||
/* iterate on each sink pad until reaching the gl element
|
||||
* that requested the query */
|
||||
|
@ -623,8 +620,9 @@ gst_gl_mixer_query (GstPad * pad, GstQuery * query)
|
|||
|
||||
gst_gl_display_activate_gl_context (foreign_display, TRUE);
|
||||
|
||||
gst_structure_set (structure, "gstgldisplay", G_TYPE_POINTER, sink_pad->display, NULL);
|
||||
|
||||
gst_structure_set (structure, "gstgldisplay", G_TYPE_POINTER,
|
||||
sink_pad->display, NULL);
|
||||
|
||||
/* does not work:
|
||||
* res = gst_pad_query_default (GST_PAD_CAST (sink_pad), query);*/
|
||||
res = gst_pad_query (peer, query);
|
||||
|
@ -652,9 +650,10 @@ gst_gl_mixer_getcaps (GstPad * pad)
|
|||
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
||||
|
||||
gst_structure_set (structure, "width", G_TYPE_INT, 8000, NULL);
|
||||
gst_structure_set (structure, "height", G_TYPE_INT, /*G_MAXINT*/6000, NULL);
|
||||
gst_structure_set (structure, "height", G_TYPE_INT, /*G_MAXINT */ 6000, NULL);
|
||||
if (mix->fps_d != 0)
|
||||
gst_structure_set (structure, "framerate", GST_TYPE_FRACTION, mix->fps_n, mix->fps_d, NULL);
|
||||
gst_structure_set (structure, "framerate", GST_TYPE_FRACTION, mix->fps_n,
|
||||
mix->fps_d, NULL);
|
||||
|
||||
gst_object_unref (mix);
|
||||
|
||||
|
@ -667,7 +666,7 @@ gst_gl_mixer_setcaps (GstPad * pad, GstCaps * caps)
|
|||
GstGLMixer *mix = GST_GL_MIXER (gst_pad_get_parent_element (pad));
|
||||
GstGLMixerClass *mixer_class = GST_GL_MIXER_GET_CLASS (mix);
|
||||
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
||||
gint width = 0;
|
||||
gint width = 0;
|
||||
gint height = 0;
|
||||
|
||||
GST_INFO_OBJECT (mix, "set src caps: %" GST_PTR_FORMAT, caps);
|
||||
|
@ -1010,9 +1009,8 @@ gst_gl_mixer_collected (GstCollectPads * pads, GstGLMixer * mix)
|
|||
|
||||
if (!ret)
|
||||
goto error;
|
||||
|
||||
gl_outbuf = gst_gl_buffer_new (mix->display,
|
||||
mix->width, mix->height);
|
||||
|
||||
gl_outbuf = gst_gl_buffer_new (mix->display, mix->width, mix->height);
|
||||
|
||||
outbuf = GST_BUFFER (gl_outbuf);
|
||||
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (mix->srcpad));
|
||||
|
@ -1217,21 +1215,24 @@ gst_gl_mixer_change_state (GstElement * element, GstStateChange transition)
|
|||
GSList *walk = mix->sinkpads;
|
||||
|
||||
GstElement *parent = GST_ELEMENT (gst_element_get_parent (mix));
|
||||
GstStructure *structure = gst_structure_new (gst_element_get_name (mix), NULL);
|
||||
GstStructure *structure =
|
||||
gst_structure_new (gst_element_get_name (mix), NULL);
|
||||
GstQuery *query = gst_query_new_application (GST_QUERY_CUSTOM, structure);
|
||||
|
||||
/* retrieve the gldisplay that is owned by gl elements after the gl mixer */
|
||||
gboolean isPerformed = gst_element_query (parent, query);
|
||||
|
||||
if (isPerformed) {
|
||||
const GValue *id_value = gst_structure_get_value (structure, "gstgldisplay");
|
||||
const GValue *id_value =
|
||||
gst_structure_get_value (structure, "gstgldisplay");
|
||||
if (G_VALUE_HOLDS_POINTER (id_value))
|
||||
/* at least one gl element is after in our gl chain */
|
||||
mix->display = g_object_ref (GST_GL_DISPLAY (g_value_get_pointer (id_value)));
|
||||
mix->display =
|
||||
g_object_ref (GST_GL_DISPLAY (g_value_get_pointer (id_value)));
|
||||
else
|
||||
/* this gl filter is a sink in terms of the gl chain */
|
||||
mix->display = gst_gl_display_new ();
|
||||
gst_gl_display_create_context (mix->display, 0);
|
||||
gst_gl_display_create_context (mix->display, 0);
|
||||
}
|
||||
|
||||
gst_query_unref (query);
|
||||
|
@ -1244,12 +1245,13 @@ gst_gl_mixer_change_state (GstElement * element, GstStateChange transition)
|
|||
sink_pad->display = gst_gl_display_new ();
|
||||
}
|
||||
mix->array_buffers =
|
||||
g_array_sized_new (FALSE, TRUE, sizeof (GstBuffer *), mix->next_sinkpad);
|
||||
g_array_sized_new (FALSE, TRUE, sizeof (GstBuffer *),
|
||||
mix->next_sinkpad);
|
||||
GST_LOG_OBJECT (mix, "starting collectpads");
|
||||
gst_collect_pads_start (mix->collect);
|
||||
break;
|
||||
}
|
||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||
{
|
||||
GSList *walk = mix->sinkpads;
|
||||
GST_LOG_OBJECT (mix, "stopping collectpads");
|
||||
|
|
|
@ -197,29 +197,30 @@ gst_gl_window_error_quark (void)
|
|||
}
|
||||
|
||||
gulong
|
||||
gst_gl_window_get_internal_gl_context (GstGLWindow *window)
|
||||
gst_gl_window_get_internal_gl_context (GstGLWindow * window)
|
||||
{
|
||||
GstGLWindowPrivate *priv = window->priv;
|
||||
return (gulong) priv->gl_context;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
callback_activate_gl_context (GstGLWindowPrivate *priv)
|
||||
callback_activate_gl_context (GstGLWindowPrivate * priv)
|
||||
{
|
||||
/*if (!wglMakeCurrent (priv->device, priv->gl_context))
|
||||
g_debug ("failed to activate opengl context %lud\n", GetLastError ());*/
|
||||
if (!eglMakeCurrent (priv->gl_display, priv->gl_surface, priv->gl_surface,
|
||||
priv->gl_context))
|
||||
g_debug ("failed to activate opengl context %lud\n", GetLastError ());
|
||||
}
|
||||
|
||||
void
|
||||
callback_inactivate_gl_context (GstGLWindowPrivate *priv)
|
||||
callback_inactivate_gl_context (GstGLWindowPrivate * priv)
|
||||
{
|
||||
/*if (!wglMakeCurrent (NULL, NULL))
|
||||
g_debug ("failed to inactivate opengl context %lud\n", GetLastError ());*/
|
||||
if (!eglMakeCurrent (priv->device, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||
EGL_NO_CONTEXT))
|
||||
g_debug ("failed to inactivate opengl context %lud\n", GetLastError ());
|
||||
}
|
||||
|
||||
void
|
||||
gst_gl_window_activate_gl_context (GstGLWindow *window, gboolean activate)
|
||||
gst_gl_window_activate_gl_context (GstGLWindow * window, gboolean activate)
|
||||
{
|
||||
GstGLWindowPrivate *priv = window->priv;
|
||||
if (activate)
|
||||
|
@ -237,10 +238,10 @@ gst_gl_window_set_external_window_id (GstGLWindow * window, gulong id)
|
|||
HWND parent_id = GetProp (priv->internal_win_id, "gl_window_parent_id");
|
||||
|
||||
if (priv->visible) {
|
||||
ShowWindow (priv->internal_win_id, SW_HIDE);
|
||||
priv->visible = FALSE;
|
||||
}
|
||||
|
||||
ShowWindow (priv->internal_win_id, SW_HIDE);
|
||||
priv->visible = FALSE;
|
||||
}
|
||||
|
||||
if (parent_id) {
|
||||
WNDPROC parent_proc = GetProp (parent_id, "gl_window_parent_proc");
|
||||
|
||||
|
@ -254,7 +255,6 @@ gst_gl_window_set_external_window_id (GstGLWindow * window, gulong id)
|
|||
RemoveProp (parent_id, "gl_window_parent_proc");
|
||||
RemoveProp (priv->internal_win_id, "gl_window_parent_id");
|
||||
}
|
||||
|
||||
//not 0
|
||||
if (id) {
|
||||
WNDPROC window_parent_proc =
|
||||
|
@ -282,7 +282,7 @@ gst_gl_window_set_external_window_id (GstGLWindow * window, gulong id)
|
|||
} else {
|
||||
//no parent so the internal window needs borders and system menu
|
||||
SetWindowLongPtr (priv->internal_win_id, GWL_STYLE,
|
||||
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW);
|
||||
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -339,8 +339,11 @@ gst_gl_window_draw (GstGLWindow * window, gint width, gint height)
|
|||
RECT rect;
|
||||
GetClientRect (priv->internal_win_id, &rect);
|
||||
width += 2 * GetSystemMetrics (SM_CXSIZEFRAME);
|
||||
height += 2 * GetSystemMetrics (SM_CYSIZEFRAME) + GetSystemMetrics (SM_CYCAPTION);
|
||||
MoveWindow (priv->internal_win_id, rect.left, rect.top, width, height, FALSE);
|
||||
height +=
|
||||
2 * GetSystemMetrics (SM_CYSIZEFRAME) +
|
||||
GetSystemMetrics (SM_CYCAPTION);
|
||||
MoveWindow (priv->internal_win_id, rect.left, rect.top, width, height,
|
||||
FALSE);
|
||||
}
|
||||
ShowWindowAsync (priv->internal_win_id, SW_SHOW);
|
||||
priv->visible = TRUE;
|
||||
|
@ -471,11 +474,12 @@ window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
eglCreateContext (priv->display, config, priv->external_gl_context,
|
||||
contextAttribs);
|
||||
if (priv->gl_context != EGL_NO_CONTEXT)
|
||||
g_debug ("gl context created: %lud, external: %lud\n", (gulong) priv->gl_context,
|
||||
(gulong) priv->external_gl_context);
|
||||
g_debug ("gl context created: %lud, external: %lud\n",
|
||||
(gulong) priv->gl_context, (gulong) priv->external_gl_context);
|
||||
else
|
||||
g_debug ("failed to create glcontext %lud, extenal: %lud, win: %lud, %s\n",
|
||||
(gulong) priv->gl_context, (gulong) priv->external_gl_context,
|
||||
g_debug
|
||||
("failed to create glcontext %lud, extenal: %lud, win: %lud, %s\n",
|
||||
(gulong) priv->gl_context, (gulong) priv->external_gl_context,
|
||||
(gulong) hWnd, EGLErrorString ());
|
||||
|
||||
ReleaseDC (hWnd, priv->display);
|
||||
|
|
|
@ -239,7 +239,7 @@ gst_gl_window_init (GstGLWindow * window)
|
|||
|
||||
/* Must be called in the gl thread */
|
||||
GstGLWindow *
|
||||
gst_gl_window_new (gint width, gint height, gulong external_gl_context)
|
||||
gst_gl_window_new (gulong external_gl_context)
|
||||
{
|
||||
GstGLWindow *window = g_object_new (GST_GL_TYPE_WINDOW, NULL);
|
||||
GstGLWindowPrivate *priv = window->priv;
|
||||
|
@ -348,20 +348,20 @@ gst_gl_window_new (gint width, gint height, gulong external_gl_context)
|
|||
|
||||
mask = CWBackPixmap | CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
priv->internal_win_id = XCreateWindow (priv->device, priv->root, x, y,
|
||||
width, height, 0, priv->visual_info->depth, InputOutput,
|
||||
priv->visual_info->visual, mask, &win_attr);
|
||||
|
||||
x += 20;
|
||||
y += 20;
|
||||
|
||||
priv->internal_win_id = XCreateWindow (priv->device, priv->root, x, y,
|
||||
1, 1, 0, priv->visual_info->depth, InputOutput,
|
||||
priv->visual_info->visual, mask, &win_attr);
|
||||
|
||||
XSync (priv->device, FALSE);
|
||||
|
||||
XSetWindowBackgroundPixmap (priv->device, priv->internal_win_id, None);
|
||||
|
||||
g_debug ("gl window id: %lud\n", (gulong) priv->internal_win_id);
|
||||
|
||||
g_debug ("gl window props: x:%d y:%d w:%d h:%d\n", x, y, width, height);
|
||||
g_debug ("gl window props: x:%d y:%d\n", x, y);
|
||||
|
||||
wm_atoms[0] = XInternAtom (priv->device, "WM_DELETE_WINDOW", True);
|
||||
if (wm_atoms[0] == None)
|
||||
|
@ -410,6 +410,7 @@ gst_gl_window_new (gint width, gint height, gulong external_gl_context)
|
|||
g_mutex_unlock (priv->x_lock);
|
||||
|
||||
return window;
|
||||
|
||||
no_display:
|
||||
g_mutex_unlock (priv->x_lock);
|
||||
g_object_unref (window);
|
||||
|
@ -422,6 +423,41 @@ gst_gl_window_error_quark (void)
|
|||
return g_quark_from_static_string ("gst-gl-window-error");
|
||||
}
|
||||
|
||||
gulong
|
||||
gst_gl_window_get_internal_gl_context (GstGLWindow * window)
|
||||
{
|
||||
GstGLWindowPrivate *priv = window->priv;
|
||||
return (gulong) priv->gl_context;
|
||||
}
|
||||
|
||||
void
|
||||
callback_activate_gl_context (GstGLWindowPrivate * priv)
|
||||
{
|
||||
if (!glXMakeCurrent (priv->device, priv->internal_win_id, priv->gl_context))
|
||||
g_debug ("failed to activate opengl context %lud\n",
|
||||
(gulong) priv->gl_context);
|
||||
}
|
||||
|
||||
void
|
||||
callback_inactivate_gl_context (GstGLWindowPrivate * priv)
|
||||
{
|
||||
if (!glXMakeCurrent (priv->device, None, NULL))
|
||||
g_debug ("failed to inactivate opengl context %lud\n",
|
||||
(gulong) priv->gl_context);
|
||||
}
|
||||
|
||||
void
|
||||
gst_gl_window_activate_gl_context (GstGLWindow * window, gboolean activate)
|
||||
{
|
||||
GstGLWindowPrivate *priv = window->priv;
|
||||
if (activate)
|
||||
gst_gl_window_send_message (window,
|
||||
GST_GL_WINDOW_CB (callback_activate_gl_context), priv);
|
||||
else
|
||||
gst_gl_window_send_message (window,
|
||||
GST_GL_WINDOW_CB (callback_inactivate_gl_context), priv);
|
||||
}
|
||||
|
||||
/* Not called by the gl thread */
|
||||
void
|
||||
gst_gl_window_set_external_window_id (GstGLWindow * window, gulong id)
|
||||
|
@ -494,7 +530,7 @@ gst_gl_window_set_close_callback (GstGLWindow * window, GstGLWindowCB callback,
|
|||
|
||||
/* Called in the gl thread */
|
||||
void
|
||||
gst_gl_window_draw_unlocked (GstGLWindow * window)
|
||||
gst_gl_window_draw_unlocked (GstGLWindow * window, gint width, gint height)
|
||||
{
|
||||
GstGLWindowPrivate *priv = window->priv;
|
||||
|
||||
|
@ -522,7 +558,7 @@ gst_gl_window_draw_unlocked (GstGLWindow * window)
|
|||
|
||||
/* Not called by the gl thread */
|
||||
void
|
||||
gst_gl_window_draw (GstGLWindow * window)
|
||||
gst_gl_window_draw (GstGLWindow * window, gint width, gint height)
|
||||
{
|
||||
if (window) {
|
||||
GstGLWindowPrivate *priv = window->priv;
|
||||
|
@ -533,13 +569,22 @@ gst_gl_window_draw (GstGLWindow * window)
|
|||
XEvent event;
|
||||
XWindowAttributes attr;
|
||||
|
||||
XGetWindowAttributes (priv->disp_send, priv->internal_win_id, &attr);
|
||||
|
||||
if (!priv->visible) {
|
||||
|
||||
if (!priv->parent) {
|
||||
attr.width = width;
|
||||
attr.height = height;
|
||||
XResizeWindow (priv->disp_send, priv->internal_win_id,
|
||||
attr.width, attr.height);
|
||||
XSync (priv->disp_send, FALSE);
|
||||
}
|
||||
|
||||
XMapWindow (priv->disp_send, priv->internal_win_id);
|
||||
priv->visible = TRUE;
|
||||
}
|
||||
|
||||
XGetWindowAttributes (priv->disp_send, priv->internal_win_id, &attr);
|
||||
|
||||
if (priv->parent) {
|
||||
XWindowAttributes attr_parent;
|
||||
XGetWindowAttributes (priv->disp_send, priv->parent, &attr_parent);
|
||||
|
|
|
@ -247,7 +247,7 @@ gst_gl_window_init (GstGLWindow * window)
|
|||
|
||||
/* Must be called in the gl thread */
|
||||
GstGLWindow *
|
||||
gst_gl_window_new (gint width, gint height, gulong external_gl_context)
|
||||
gst_gl_window_new (gulong external_gl_context)
|
||||
{
|
||||
GstGLWindow *window = g_object_new (GST_GL_TYPE_WINDOW, NULL);
|
||||
GstGLWindowPrivate *priv = window->priv;
|
||||
|
@ -329,20 +329,20 @@ gst_gl_window_new (gint width, gint height, gulong external_gl_context)
|
|||
|
||||
mask = CWBackPixmap | CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
priv->internal_win_id = XCreateWindow (priv->device, priv->root, x, y,
|
||||
width, height, 0, priv->visual_info->depth, InputOutput,
|
||||
priv->visual_info->visual, mask, &win_attr);
|
||||
|
||||
x += 20;
|
||||
y += 20;
|
||||
|
||||
priv->internal_win_id = XCreateWindow (priv->device, priv->root, x, y,
|
||||
1, 1, 0, priv->visual_info->depth, InputOutput,
|
||||
priv->visual_info->visual, mask, &win_attr);
|
||||
|
||||
XSync (priv->device, FALSE);
|
||||
|
||||
XSetWindowBackgroundPixmap (priv->device, priv->internal_win_id, None);
|
||||
|
||||
g_debug ("gl window id: %lud\n", (gulong) priv->internal_win_id);
|
||||
|
||||
g_debug ("gl window props: x:%d y:%d w:%d h:%d\n", x, y, width, height);
|
||||
g_debug ("gl window props: x:%d y:%d\n", x, y);
|
||||
|
||||
wm_atoms[0] = XInternAtom (priv->device, "WM_DELETE_WINDOW", True);
|
||||
if (wm_atoms[0] == None)
|
||||
|
@ -420,6 +420,43 @@ gst_gl_window_error_quark (void)
|
|||
return g_quark_from_static_string ("gst-gl-window-error");
|
||||
}
|
||||
|
||||
gulong
|
||||
gst_gl_window_get_internal_gl_context (GstGLWindow * window)
|
||||
{
|
||||
GstGLWindowPrivate *priv = window->priv;
|
||||
return (gulong) priv->gl_context;
|
||||
}
|
||||
|
||||
void
|
||||
callback_activate_gl_context (GstGLWindowPrivate * priv)
|
||||
{
|
||||
if (!eglMakeCurrent (priv->gl_display, priv->gl_surface, priv->gl_surface,
|
||||
priv->gl_context))
|
||||
g_debug ("failed to activate opengl context %lud\n",
|
||||
(gulong) priv->gl_context);
|
||||
}
|
||||
|
||||
void
|
||||
callback_inactivate_gl_context (GstGLWindowPrivate * priv)
|
||||
{
|
||||
if (!eglMakeCurrent (priv->device, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||
EGL_NO_CONTEXT))
|
||||
g_debug ("failed to inactivate opengl context %lud\n",
|
||||
(gulong) priv->gl_context);
|
||||
}
|
||||
|
||||
void
|
||||
gst_gl_window_activate_gl_context (GstGLWindow * window, gboolean activate)
|
||||
{
|
||||
GstGLWindowPrivate *priv = window->priv;
|
||||
if (activate)
|
||||
gst_gl_window_send_message (window,
|
||||
GST_GL_WINDOW_CB (callback_activate_gl_context), priv);
|
||||
else
|
||||
gst_gl_window_send_message (window,
|
||||
GST_GL_WINDOW_CB (callback_inactivate_gl_context), priv);
|
||||
}
|
||||
|
||||
/* Not called by the gl thread */
|
||||
void
|
||||
gst_gl_window_set_external_window_id (GstGLWindow * window, gulong id)
|
||||
|
@ -492,7 +529,7 @@ gst_gl_window_set_close_callback (GstGLWindow * window, GstGLWindowCB callback,
|
|||
|
||||
/* Called in the gl thread */
|
||||
void
|
||||
gst_gl_window_draw_unlocked (GstGLWindow * window)
|
||||
gst_gl_window_draw_unlocked (GstGLWindow * window, gint width, gint height)
|
||||
{
|
||||
GstGLWindowPrivate *priv = window->priv;
|
||||
|
||||
|
@ -520,7 +557,7 @@ gst_gl_window_draw_unlocked (GstGLWindow * window)
|
|||
|
||||
/* Not called by the gl thread */
|
||||
void
|
||||
gst_gl_window_draw (GstGLWindow * window)
|
||||
gst_gl_window_draw (GstGLWindow * window, gint width, gint height)
|
||||
{
|
||||
if (window) {
|
||||
GstGLWindowPrivate *priv = window->priv;
|
||||
|
@ -531,13 +568,22 @@ gst_gl_window_draw (GstGLWindow * window)
|
|||
XEvent event;
|
||||
XWindowAttributes attr;
|
||||
|
||||
XGetWindowAttributes (priv->disp_send, priv->internal_win_id, &attr);
|
||||
|
||||
if (!priv->visible) {
|
||||
|
||||
if (!priv->parent) {
|
||||
attr.width = width;
|
||||
attr.height = height;
|
||||
XResizeWindow (priv->disp_send, priv->internal_win_id,
|
||||
attr.width, attr.height);
|
||||
XSync (priv->disp_send, FALSE);
|
||||
}
|
||||
|
||||
XMapWindow (priv->disp_send, priv->internal_win_id);
|
||||
priv->visible = TRUE;
|
||||
}
|
||||
|
||||
XGetWindowAttributes (priv->disp_send, priv->internal_win_id, &attr);
|
||||
|
||||
if (priv->parent) {
|
||||
XWindowAttributes attr_parent;
|
||||
XGetWindowAttributes (priv->disp_send, priv->parent, &attr_parent);
|
||||
|
|
Loading…
Reference in a new issue