2 * gstvaapisink.c - VA-API video sink
4 * Copyright (C) 2010-2011 Splitted-Desktop Systems
5 * Copyright (C) 2011-2012 Intel Corporation
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * as published by the Free Software Foundation; either version 2.1
10 * of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301 USA
24 * SECTION:gstvaapisink
25 * @short_description: A VA-API based videosink
27 * vaapisink renders video frames to a drawable (X #Window) on a local
28 * display using the Video Acceleration (VA) API. The element will
29 * create its own internal window and render into it.
34 #include <gst/video/video.h>
35 #include <gst/video/videocontext.h>
36 #include <gst/vaapi/gstvaapivideobuffer.h>
37 #include <gst/vaapi/gstvaapivideosink.h>
38 #include <gst/vaapi/gstvaapidisplay_x11.h>
39 #include <gst/vaapi/gstvaapiwindow_x11.h>
41 # include <gst/vaapi/gstvaapidisplay_glx.h>
42 # include <gst/vaapi/gstvaapiwindow_glx.h>
45 /* Supported interfaces */
46 #include <gst/interfaces/xoverlay.h>
48 #include "gstvaapisink.h"
49 #include "gstvaapipluginutil.h"
51 #define GST_PLUGIN_NAME "vaapisink"
52 #define GST_PLUGIN_DESC "A VA-API based videosink"
54 GST_DEBUG_CATEGORY_STATIC(gst_debug_vaapisink);
55 #define GST_CAT_DEFAULT gst_debug_vaapisink
57 /* ElementFactory information */
58 static const GstElementDetails gst_vaapisink_details =
63 "Gwenole Beauchesne <gwenole.beauchesne@intel.com>");
65 /* Default template */
66 static GstStaticPadTemplate gst_vaapisink_sink_factory =
67 GST_STATIC_PAD_TEMPLATE(
71 GST_STATIC_CAPS(GST_VAAPI_SURFACE_CAPS));
74 gst_vaapisink_implements_iface_init(GstImplementsInterfaceClass *iface);
77 gst_vaapisink_video_context_iface_init(GstVideoContextInterface *iface);
80 gst_vaapisink_xoverlay_iface_init(GstXOverlayClass *iface);
82 G_DEFINE_TYPE_WITH_CODE(
86 G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE,
87 gst_vaapisink_implements_iface_init);
88 G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
89 gst_vaapisink_video_context_iface_init);
90 G_IMPLEMENT_INTERFACE(GST_TYPE_X_OVERLAY,
91 gst_vaapisink_xoverlay_iface_init));
102 #define DEFAULT_DISPLAY_TYPE GST_VAAPI_DISPLAY_TYPE_ANY
104 /* GstImplementsInterface interface */
107 gst_vaapisink_implements_interface_supported(
108 GstImplementsInterface *iface,
112 return (type == GST_TYPE_VIDEO_CONTEXT ||
113 type == GST_TYPE_X_OVERLAY);
117 gst_vaapisink_implements_iface_init(GstImplementsInterfaceClass *iface)
119 iface->supported = gst_vaapisink_implements_interface_supported;
122 /* GstVaapiVideoSink interface */
125 gst_vaapisink_set_video_context(GstVideoContext *context, const gchar *type,
128 GstVaapiSink *sink = GST_VAAPISINK (context);
129 gst_vaapi_set_display (type, value, &sink->display);
133 gst_vaapisink_video_context_iface_init(GstVideoContextInterface *iface)
135 iface->set_context = gst_vaapisink_set_video_context;
138 /* GstXOverlay interface */
141 gst_vaapisink_ensure_window_xid(GstVaapiSink *sink, guintptr window_id);
144 gst_vaapisink_show_frame(GstBaseSink *base_sink, GstBuffer *buffer);
147 gst_vaapisink_xoverlay_set_window_handle(GstXOverlay *overlay, guintptr window)
149 GstVaapiSink * const sink = GST_VAAPISINK(overlay);
151 /* Disable GLX rendering when vaapisink is using a foreign X
152 window. It's pretty much useless */
153 if (sink->display_type == GST_VAAPI_DISPLAY_TYPE_GLX)
154 sink->display_type = GST_VAAPI_DISPLAY_TYPE_X11;
156 sink->foreign_window = TRUE;
157 gst_vaapisink_ensure_window_xid(sink, window);
161 gst_vaapisink_xoverlay_set_render_rectangle(
162 GstXOverlay *overlay,
169 GstVaapiSink * const sink = GST_VAAPISINK(overlay);
170 GstVaapiRectangle * const display_rect = &sink->display_rect;
174 display_rect->width = width;
175 display_rect->height = height;
177 GST_DEBUG("render rect (%d,%d):%ux%u",
178 display_rect->x, display_rect->y,
179 display_rect->width, display_rect->height);
183 gst_vaapisink_xoverlay_expose(GstXOverlay *overlay)
185 GstBaseSink * const base_sink = GST_BASE_SINK(overlay);
188 buffer = gst_base_sink_get_last_buffer(base_sink);
190 gst_vaapisink_show_frame(base_sink, buffer);
191 gst_buffer_unref(buffer);
196 gst_vaapisink_xoverlay_iface_init(GstXOverlayClass *iface)
198 iface->set_window_handle = gst_vaapisink_xoverlay_set_window_handle;
199 iface->set_render_rectangle = gst_vaapisink_xoverlay_set_render_rectangle;
200 iface->expose = gst_vaapisink_xoverlay_expose;
204 gst_vaapisink_destroy(GstVaapiSink *sink)
206 g_clear_object(&sink->texture);
207 g_clear_object(&sink->display);
209 gst_caps_replace(&sink->caps, NULL);
212 /* Checks whether a ConfigureNotify event is in the queue */
213 typedef struct _ConfigureNotifyEventPendingArgs ConfigureNotifyEventPendingArgs;
214 struct _ConfigureNotifyEventPendingArgs {
222 configure_notify_event_pending_cb(Display *dpy, XEvent *xev, XPointer arg)
224 ConfigureNotifyEventPendingArgs * const args =
225 (ConfigureNotifyEventPendingArgs *)arg;
227 if (xev->type == ConfigureNotify &&
228 xev->xconfigure.window == args->window &&
229 xev->xconfigure.width == args->width &&
230 xev->xconfigure.height == args->height)
233 /* XXX: this is a hack to traverse the whole queue because we
234 can't use XPeekIfEvent() since it could block */
239 configure_notify_event_pending(
246 ConfigureNotifyEventPendingArgs args;
249 args.window = window;
251 args.height = height;
254 /* XXX: don't use XPeekIfEvent() because it might block */
256 gst_vaapi_display_x11_get_display(GST_VAAPI_DISPLAY_X11(sink->display)),
258 configure_notify_event_pending_cb, (XPointer)&args
264 get_display_type_name(GstVaapiDisplayType display_type)
266 gpointer const klass = g_type_class_peek(GST_VAAPI_TYPE_DISPLAY_TYPE);
267 GEnumValue * const e = g_enum_get_value(klass, display_type);
270 return e->value_name;
271 return "<unknown-type>";
274 static inline gboolean
275 gst_vaapisink_ensure_display(GstVaapiSink *sink)
277 GstVaapiDisplayType display_type;
279 if (!gst_vaapi_ensure_display(sink, sink->display_type, &sink->display))
282 display_type = gst_vaapi_display_get_display_type(sink->display);
283 if (display_type != sink->display_type) {
284 GST_INFO("created %s %p", get_display_type_name(display_type),
286 sink->display_type = display_type;
292 gst_vaapisink_ensure_render_rect(GstVaapiSink *sink, guint width, guint height)
294 GstVaapiRectangle * const display_rect = &sink->display_rect;
295 guint num, den, display_par_n, display_par_d;
298 /* Return success if caps are not set yet */
302 GST_DEBUG("ensure render rect within %ux%u bounds", width, height);
304 gst_vaapi_display_get_pixel_aspect_ratio(
306 &display_par_n, &display_par_d
308 GST_DEBUG("display pixel-aspect-ratio %d/%d",
309 display_par_n, display_par_d);
311 success = gst_video_calculate_display_ratio(
313 sink->video_width, sink->video_height,
314 sink->video_par_n, sink->video_par_d,
315 display_par_n, display_par_d
319 GST_DEBUG("video size %dx%d, calculated ratio %d/%d",
320 sink->video_width, sink->video_height, num, den);
322 display_rect->width = gst_util_uint64_scale_int(height, num, den);
323 if (display_rect->width <= width) {
324 GST_DEBUG("keeping window height");
325 display_rect->height = height;
328 GST_DEBUG("keeping window width");
329 display_rect->width = width;
330 display_rect->height =
331 gst_util_uint64_scale_int(width, den, num);
333 GST_DEBUG("scaling video to %ux%u", display_rect->width, display_rect->height);
335 g_assert(display_rect->width <= width);
336 g_assert(display_rect->height <= height);
338 display_rect->x = (width - display_rect->width) / 2;
339 display_rect->y = (height - display_rect->height) / 2;
341 GST_DEBUG("render rect (%d,%d):%ux%u",
342 display_rect->x, display_rect->y,
343 display_rect->width, display_rect->height);
347 static inline gboolean
348 gst_vaapisink_ensure_window(GstVaapiSink *sink, guint width, guint height)
350 GstVaapiDisplay * const display = sink->display;
353 switch (sink->display_type) {
355 case GST_VAAPI_DISPLAY_TYPE_GLX:
356 sink->window = gst_vaapi_window_glx_new(display, width, height);
359 case GST_VAAPI_DISPLAY_TYPE_X11:
360 sink->window = gst_vaapi_window_x11_new(display, width, height);
363 GST_ERROR("unsupported display type %d", sink->display_type);
367 gst_x_overlay_got_window_handle(
369 gst_vaapi_window_x11_get_xid(GST_VAAPI_WINDOW_X11(sink->window))
372 return sink->window != NULL;
376 gst_vaapisink_ensure_window_xid(GstVaapiSink *sink, guintptr window_id)
379 unsigned int width, height, border_width, depth;
383 if (!gst_vaapisink_ensure_display(sink))
386 gst_vaapi_display_lock(sink->display);
388 gst_vaapi_display_x11_get_display(GST_VAAPI_DISPLAY_X11(sink->display)),
391 &x, &y, &width, &height, &border_width, &depth
393 gst_vaapi_display_unlock(sink->display);
395 if ((width != sink->window_width || height != sink->window_height) &&
396 !configure_notify_event_pending(sink, xid, width, height)) {
397 if (!gst_vaapisink_ensure_render_rect(sink, width, height))
399 sink->window_width = width;
400 sink->window_height = height;
404 gst_vaapi_window_x11_get_xid(GST_VAAPI_WINDOW_X11(sink->window)) == xid)
407 g_clear_object(&sink->window);
409 switch (sink->display_type) {
411 case GST_VAAPI_DISPLAY_TYPE_GLX:
412 sink->window = gst_vaapi_window_glx_new_with_xid(sink->display, xid);
415 case GST_VAAPI_DISPLAY_TYPE_X11:
416 sink->window = gst_vaapi_window_x11_new_with_xid(sink->display, xid);
419 GST_ERROR("unsupported display type %d", sink->display_type);
422 return sink->window != NULL;
426 gst_vaapisink_start(GstBaseSink *base_sink)
428 GstVaapiSink * const sink = GST_VAAPISINK(base_sink);
430 return gst_vaapisink_ensure_display(sink);
434 gst_vaapisink_stop(GstBaseSink *base_sink)
436 GstVaapiSink * const sink = GST_VAAPISINK(base_sink);
438 g_clear_object(&sink->window);
439 g_clear_object(&sink->display);
445 gst_vaapisink_set_caps(GstBaseSink *base_sink, GstCaps *caps)
447 GstVaapiSink * const sink = GST_VAAPISINK(base_sink);
448 GstStructure * const structure = gst_caps_get_structure(caps, 0);
449 guint win_width, win_height, display_width, display_height;
450 gint video_width, video_height, video_par_n = 1, video_par_d = 1;
454 if (!gst_structure_get_int(structure, "width", &video_width))
456 if (!gst_structure_get_int(structure, "height", &video_height))
458 sink->video_width = video_width;
459 sink->video_height = video_height;
461 gst_video_parse_caps_pixel_aspect_ratio(caps, &video_par_n, &video_par_d);
462 sink->video_par_n = video_par_n;
463 sink->video_par_d = video_par_d;
464 GST_DEBUG("video pixel-aspect-ratio %d/%d", video_par_n, video_par_d);
466 gst_caps_replace(&sink->caps, caps);
468 if (!gst_vaapisink_ensure_display(sink))
471 gst_vaapi_display_get_size(sink->display, &display_width, &display_height);
472 if (sink->foreign_window) {
473 win_width = sink->window_width;
474 win_height = sink->window_height;
476 else if (sink->fullscreen ||
477 video_width > display_width || video_height > display_height) {
478 win_width = display_width;
479 win_height = display_height;
482 win_width = video_width;
483 win_height = video_height;
487 if (!sink->foreign_window || sink->fullscreen)
488 gst_vaapi_window_set_size(sink->window, win_width, win_height);
491 gst_vaapi_display_lock(sink->display);
492 gst_x_overlay_prepare_xwindow_id(GST_X_OVERLAY(sink));
493 gst_vaapi_display_unlock(sink->display);
496 if (!gst_vaapisink_ensure_window(sink, win_width, win_height))
498 gst_vaapi_window_set_fullscreen(sink->window, sink->fullscreen);
499 gst_vaapi_window_show(sink->window);
500 gst_vaapi_window_get_size(sink->window, &win_width, &win_height);
502 sink->window_width = win_width;
503 sink->window_height = win_height;
504 GST_DEBUG("window size %ux%u", win_width, win_height);
506 return gst_vaapisink_ensure_render_rect(sink, win_width, win_height);
511 render_background(GstVaapiSink *sink)
513 /* Original code from Mirco Muller (MacSlow):
514 <http://cgit.freedesktop.org/~macslow/gl-gst-player/> */
515 GLfloat fStartX = 0.0f;
516 GLfloat fStartY = 0.0f;
517 GLfloat fWidth = (GLfloat)sink->window_width;
518 GLfloat fHeight = (GLfloat)sink->window_height;
520 glClear(GL_COLOR_BUFFER_BIT);
523 /* top third, darker grey to white */
524 glColor3f(0.85f, 0.85f, 0.85f);
525 glVertex3f(fStartX, fStartY, 0.0f);
526 glColor3f(0.85f, 0.85f, 0.85f);
527 glVertex3f(fStartX + fWidth, fStartY, 0.0f);
528 glColor3f(1.0f, 1.0f, 1.0f);
529 glVertex3f(fStartX + fWidth, fStartY + fHeight / 3.0f, 0.0f);
530 glColor3f(1.0f, 1.0f, 1.0f);
531 glVertex3f(fStartX, fStartY + fHeight / 3.0f, 0.0f);
533 /* middle third, just plain white */
534 glColor3f(1.0f, 1.0f, 1.0f);
535 glVertex3f(fStartX, fStartY + fHeight / 3.0f, 0.0f);
536 glVertex3f(fStartX + fWidth, fStartY + fHeight / 3.0f, 0.0f);
537 glVertex3f(fStartX + fWidth, fStartY + 2.0f * fHeight / 3.0f, 0.0f);
538 glVertex3f(fStartX, fStartY + 2.0f * fHeight / 3.0f, 0.0f);
540 /* bottom third, white to lighter grey */
541 glColor3f(1.0f, 1.0f, 1.0f);
542 glVertex3f(fStartX, fStartY + 2.0f * fHeight / 3.0f, 0.0f);
543 glColor3f(1.0f, 1.0f, 1.0f);
544 glVertex3f(fStartX + fWidth, fStartY + 2.0f * fHeight / 3.0f, 0.0f);
545 glColor3f(0.62f, 0.66f, 0.69f);
546 glVertex3f(fStartX + fWidth, fStartY + fHeight, 0.0f);
547 glColor3f(0.62f, 0.66f, 0.69f);
548 glVertex3f(fStartX, fStartY + fHeight, 0.0f);
554 render_frame(GstVaapiSink *sink)
556 const guint x1 = sink->display_rect.x;
557 const guint x2 = sink->display_rect.x + sink->display_rect.width;
558 const guint y1 = sink->display_rect.y;
559 const guint y2 = sink->display_rect.y + sink->display_rect.height;
561 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
564 glTexCoord2f(0.0f, 0.0f); glVertex2i(x1, y1);
565 glTexCoord2f(0.0f, 1.0f); glVertex2i(x1, y2);
566 glTexCoord2f(1.0f, 1.0f); glVertex2i(x2, y2);
567 glTexCoord2f(1.0f, 0.0f); glVertex2i(x2, y1);
573 render_reflection(GstVaapiSink *sink)
575 const guint x1 = sink->display_rect.x;
576 const guint x2 = sink->display_rect.x + sink->display_rect.width;
577 const guint y1 = sink->display_rect.y;
578 const guint rh = sink->display_rect.height / 5;
579 GLfloat ry = 1.0f - (GLfloat)rh / (GLfloat)sink->display_rect.height;
583 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
584 glTexCoord2f(0.0f, 1.0f); glVertex2i(x1, y1);
585 glTexCoord2f(1.0f, 1.0f); glVertex2i(x2, y1);
587 glColor4f(1.0f, 1.0f, 1.0f, 0.0f);
588 glTexCoord2f(1.0f, ry); glVertex2i(x2, y1 + rh);
589 glTexCoord2f(0.0f, ry); glVertex2i(x1, y1 + rh);
595 gst_vaapisink_show_frame_glx(
597 GstVaapiSurface *surface,
601 GstVaapiWindowGLX * const window = GST_VAAPI_WINDOW_GLX(sink->window);
605 gst_vaapi_window_glx_make_current(window);
606 if (!sink->texture) {
607 sink->texture = gst_vaapi_texture_new(
615 goto error_create_texture;
617 if (!gst_vaapi_texture_put_surface(sink->texture, surface, flags))
618 goto error_transfer_surface;
620 target = gst_vaapi_texture_get_target(sink->texture);
621 texture = gst_vaapi_texture_get_id(sink->texture);
622 if (target != GL_TEXTURE_2D || !texture)
625 if (sink->use_reflection)
626 render_background(sink);
629 glBindTexture(target, texture);
631 if (sink->use_reflection) {
633 glRotatef(20.0f, 0.0f, 1.0f, 0.0f);
634 glTranslatef(50.0f, 0.0f, 0.0f);
637 if (sink->use_reflection) {
639 glTranslatef(0.0, (GLfloat)sink->display_rect.height + 5.0f, 0.0f);
640 render_reflection(sink);
645 glBindTexture(target, 0);
647 gst_vaapi_window_glx_swap_buffers(window);
651 error_create_texture:
653 GST_DEBUG("could not create VA/GLX texture");
656 error_transfer_surface:
658 GST_DEBUG("could not transfer VA surface to texture");
664 static inline gboolean
665 gst_vaapisink_show_frame_x11(
667 GstVaapiSurface *surface,
671 if (!gst_vaapi_window_put_surface(sink->window, surface,
672 NULL, &sink->display_rect, flags)) {
673 GST_DEBUG("could not render VA surface");
680 gst_vaapisink_show_frame(GstBaseSink *base_sink, GstBuffer *buffer)
682 GstVaapiSink * const sink = GST_VAAPISINK(base_sink);
683 GstVaapiVideoBuffer * const vbuffer = GST_VAAPI_VIDEO_BUFFER(buffer);
684 GstVaapiSurface *surface;
687 GstVideoOverlayComposition * const composition =
688 gst_video_buffer_get_overlay_composition(buffer);
690 if (sink->display != gst_vaapi_video_buffer_get_display (vbuffer)) {
691 g_clear_object(&sink->display);
692 sink->display = g_object_ref (gst_vaapi_video_buffer_get_display (vbuffer));
696 return GST_FLOW_UNEXPECTED;
698 surface = gst_vaapi_video_buffer_get_surface(vbuffer);
700 return GST_FLOW_UNEXPECTED;
702 GST_DEBUG("render surface %" GST_VAAPI_ID_FORMAT,
703 GST_VAAPI_ID_ARGS(gst_vaapi_surface_get_id(surface)));
705 flags = gst_vaapi_video_buffer_get_render_flags(vbuffer);
707 if (!gst_vaapi_surface_set_subpictures_from_composition(surface,
709 GST_WARNING("could not update subtitles");
711 switch (sink->display_type) {
713 case GST_VAAPI_DISPLAY_TYPE_GLX:
714 success = gst_vaapisink_show_frame_glx(sink, surface, flags);
717 case GST_VAAPI_DISPLAY_TYPE_X11:
718 success = gst_vaapisink_show_frame_x11(sink, surface, flags);
721 GST_ERROR("unsupported display type %d", sink->display_type);
725 return success ? GST_FLOW_OK : GST_FLOW_UNEXPECTED;
729 gst_vaapisink_query(GstBaseSink *base_sink, GstQuery *query)
731 GstVaapiSink *sink = GST_VAAPISINK(base_sink);
732 GST_DEBUG ("sharing display %p", sink->display);
733 return gst_vaapi_reply_to_query (query, sink->display);
737 gst_vaapisink_finalize(GObject *object)
739 gst_vaapisink_destroy(GST_VAAPISINK(object));
741 G_OBJECT_CLASS(gst_vaapisink_parent_class)->finalize(object);
745 gst_vaapisink_set_property(
752 GstVaapiSink * const sink = GST_VAAPISINK(object);
755 case PROP_DISPLAY_TYPE:
756 sink->display_type = g_value_get_enum(value);
758 case PROP_FULLSCREEN:
759 sink->fullscreen = g_value_get_boolean(value);
761 case PROP_SYNCHRONOUS:
762 sink->synchronous = g_value_get_boolean(value);
764 case PROP_USE_REFLECTION:
765 sink->use_reflection = g_value_get_boolean(value);
768 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
774 gst_vaapisink_get_property(
781 GstVaapiSink * const sink = GST_VAAPISINK(object);
784 case PROP_DISPLAY_TYPE:
785 g_value_set_enum(value, sink->display_type);
787 case PROP_FULLSCREEN:
788 g_value_set_boolean(value, sink->fullscreen);
790 case PROP_SYNCHRONOUS:
791 g_value_set_boolean(value, sink->synchronous);
793 case PROP_USE_REFLECTION:
794 g_value_set_boolean(value, sink->use_reflection);
797 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
803 gst_vaapisink_class_init(GstVaapiSinkClass *klass)
805 GObjectClass * const object_class = G_OBJECT_CLASS(klass);
806 GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
807 GstBaseSinkClass * const basesink_class = GST_BASE_SINK_CLASS(klass);
808 GstPadTemplate *pad_template;
810 GST_DEBUG_CATEGORY_INIT(gst_debug_vaapisink,
811 GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC);
813 object_class->finalize = gst_vaapisink_finalize;
814 object_class->set_property = gst_vaapisink_set_property;
815 object_class->get_property = gst_vaapisink_get_property;
817 basesink_class->start = gst_vaapisink_start;
818 basesink_class->stop = gst_vaapisink_stop;
819 basesink_class->set_caps = gst_vaapisink_set_caps;
820 basesink_class->preroll = gst_vaapisink_show_frame;
821 basesink_class->render = gst_vaapisink_show_frame;
822 basesink_class->query = gst_vaapisink_query;
824 gst_element_class_set_details_simple(
826 gst_vaapisink_details.longname,
827 gst_vaapisink_details.klass,
828 gst_vaapisink_details.description,
829 gst_vaapisink_details.author
832 pad_template = gst_static_pad_template_get(&gst_vaapisink_sink_factory);
833 gst_element_class_add_pad_template(element_class, pad_template);
834 gst_object_unref(pad_template);
836 g_object_class_install_property
839 g_param_spec_enum("display",
841 "display type to use",
842 GST_VAAPI_TYPE_DISPLAY_TYPE,
843 GST_VAAPI_DISPLAY_TYPE_ANY,
844 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
847 g_object_class_install_property
850 g_param_spec_boolean("use-reflection",
852 "Enables OpenGL reflection effect",
857 g_object_class_install_property
860 g_param_spec_boolean("fullscreen",
862 "Requests window in fullscreen state",
867 * GstVaapiSink:synchronous:
869 * When enabled, runs the X display in synchronous mode. Note that
870 * this is used only for debugging.
872 g_object_class_install_property
875 g_param_spec_boolean("synchronous",
877 "Toggles X display synchronous mode",
883 gst_vaapisink_init(GstVaapiSink *sink)
886 sink->display = NULL;
888 sink->window_width = 0;
889 sink->window_height = 0;
890 sink->texture = NULL;
891 sink->video_width = 0;
892 sink->video_height = 0;
893 sink->video_par_n = 1;
894 sink->video_par_d = 1;
895 sink->foreign_window = FALSE;
896 sink->fullscreen = FALSE;
897 sink->synchronous = FALSE;
898 sink->display_type = DEFAULT_DISPLAY_TYPE;
899 sink->use_reflection = FALSE;