2 * gstvaapisink.c - VA-API video sink
4 * gstreamer-vaapi (C) 2010-2011 Splitted-Desktop Systems
5 * Copyright (C) 2011 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/gstutils_version.h>
35 #include <gst/video/video.h>
36 #include <gst/video/videocontext.h>
37 #include <gst/vaapi/gstvaapivideobuffer.h>
38 #include <gst/vaapi/gstvaapivideosink.h>
39 #include <gst/vaapi/gstvaapidisplay_x11.h>
40 #include <gst/vaapi/gstvaapiwindow_x11.h>
42 #include <gst/vaapi/gstvaapidisplay_glx.h>
43 #include <gst/vaapi/gstvaapiwindow_glx.h>
46 /* Supported interfaces */
47 #include <gst/interfaces/xoverlay.h>
49 #include "gstvaapisink.h"
50 #include "gstvaapipluginutil.h"
52 #define HAVE_GST_XOVERLAY_SET_WINDOW_HANDLE \
53 GST_PLUGINS_BASE_CHECK_VERSION(0,10,31)
55 #define HAVE_GST_XOVERLAY_SET_RENDER_RECTANGLE \
56 GST_PLUGINS_BASE_CHECK_VERSION(0,10,29)
58 #define GST_PLUGIN_NAME "vaapisink"
59 #define GST_PLUGIN_DESC "A VA-API based videosink"
61 GST_DEBUG_CATEGORY_STATIC(gst_debug_vaapisink);
62 #define GST_CAT_DEFAULT gst_debug_vaapisink
64 /* ElementFactory information */
65 static const GstElementDetails gst_vaapisink_details =
70 "Gwenole Beauchesne <gwenole.beauchesne@intel.com>");
72 /* Default template */
73 static GstStaticPadTemplate gst_vaapisink_sink_factory =
74 GST_STATIC_PAD_TEMPLATE(
78 GST_STATIC_CAPS(GST_VAAPI_SURFACE_CAPS));
80 static void gst_vaapisink_iface_init(GType type);
87 gst_vaapisink_iface_init);
98 /* GstImplementsInterface interface */
101 gst_vaapisink_implements_interface_supported(
102 GstImplementsInterface *iface,
106 return (type == GST_TYPE_VIDEO_CONTEXT ||
107 type == GST_TYPE_X_OVERLAY);
111 gst_vaapisink_implements_iface_init(GstImplementsInterfaceClass *iface)
113 iface->supported = gst_vaapisink_implements_interface_supported;
116 /* GstVaapiVideoSink interface */
119 gst_vaapisink_set_video_context(GstVideoContext *context, const gchar *type,
122 GstVaapiSink *sink = GST_VAAPISINK (context);
123 gst_vaapi_set_display (type, value, &sink->display);
127 gst_vaapisink_video_context_iface_init(GstVideoContextInterface *iface)
129 iface->set_context = gst_vaapisink_set_video_context;
132 /* GstXOverlay interface */
135 gst_vaapisink_ensure_window_xid(GstVaapiSink *sink, guintptr window_id);
138 gst_vaapisink_show_frame(GstBaseSink *base_sink, GstBuffer *buffer);
141 _gst_vaapisink_xoverlay_set_xid(GstXOverlay *overlay, guintptr window_id)
143 GstVaapiSink * const sink = GST_VAAPISINK(overlay);
145 /* Disable GLX rendering when vaapisink is using a foreign X
146 window. It's pretty much useless */
147 sink->use_glx = FALSE;
149 sink->foreign_window = TRUE;
150 gst_vaapisink_ensure_window_xid(sink, window_id);
153 #if HAVE_GST_XOVERLAY_SET_WINDOW_HANDLE
155 gst_vaapisink_xoverlay_set_window_handle(GstXOverlay *overlay, guintptr window_id)
157 _gst_vaapisink_xoverlay_set_xid(overlay, window_id);
161 gst_vaapisink_xoverlay_set_xid(GstXOverlay *overlay, XID xid)
163 _gst_vaapisink_xoverlay_set_xid(overlay, xid);
167 #if HAVE_GST_XOVERLAY_SET_RENDER_RECTANGLE
169 gst_vaapisink_xoverlay_set_render_rectangle(
170 GstXOverlay *overlay,
177 GstVaapiSink * const sink = GST_VAAPISINK(overlay);
178 GstVaapiRectangle * const display_rect = &sink->display_rect;
182 display_rect->width = width;
183 display_rect->height = height;
185 GST_DEBUG("render rect (%d,%d):%ux%u",
186 display_rect->x, display_rect->y,
187 display_rect->width, display_rect->height);
192 gst_vaapisink_xoverlay_expose(GstXOverlay *overlay)
194 GstBaseSink * const base_sink = GST_BASE_SINK(overlay);
197 buffer = gst_base_sink_get_last_buffer(base_sink);
199 gst_vaapisink_show_frame(base_sink, buffer);
200 gst_buffer_unref(buffer);
205 gst_vaapisink_xoverlay_iface_init(GstXOverlayClass *iface)
207 #if HAVE_GST_XOVERLAY_SET_WINDOW_HANDLE
208 iface->set_window_handle = gst_vaapisink_xoverlay_set_window_handle;
210 iface->set_xwindow_id = gst_vaapisink_xoverlay_set_xid;
212 #if HAVE_GST_XOVERLAY_SET_RENDER_RECTANGLE
213 iface->set_render_rectangle = gst_vaapisink_xoverlay_set_render_rectangle;
215 iface->expose = gst_vaapisink_xoverlay_expose;
219 gst_vaapisink_iface_init(GType type)
221 const GType g_define_type_id = type;
223 G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE,
224 gst_vaapisink_implements_iface_init);
225 G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
226 gst_vaapisink_video_context_iface_init);
227 G_IMPLEMENT_INTERFACE(GST_TYPE_X_OVERLAY,
228 gst_vaapisink_xoverlay_iface_init);
232 gst_vaapisink_destroy(GstVaapiSink *sink)
235 g_object_unref(sink->display);
236 sink->display = NULL;
240 /* Checks whether a ConfigureNotify event is in the queue */
241 typedef struct _ConfigureNotifyEventPendingArgs ConfigureNotifyEventPendingArgs;
242 struct _ConfigureNotifyEventPendingArgs {
250 configure_notify_event_pending_cb(Display *dpy, XEvent *xev, XPointer arg)
252 ConfigureNotifyEventPendingArgs * const args =
253 (ConfigureNotifyEventPendingArgs *)arg;
255 if (xev->type == ConfigureNotify &&
256 xev->xconfigure.window == args->window &&
257 xev->xconfigure.width == args->width &&
258 xev->xconfigure.height == args->height)
261 /* XXX: this is a hack to traverse the whole queue because we
262 can't use XPeekIfEvent() since it could block */
267 configure_notify_event_pending(
274 ConfigureNotifyEventPendingArgs args;
277 args.window = window;
279 args.height = height;
282 /* XXX: don't use XPeekIfEvent() because it might block */
284 gst_vaapi_display_x11_get_display(GST_VAAPI_DISPLAY_X11(sink->display)),
286 configure_notify_event_pending_cb, (XPointer)&args
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;
296 double display_ratio;
299 GST_DEBUG("ensure render rect within %ux%u bounds", width, height);
301 gst_vaapi_display_get_pixel_aspect_ratio(
303 &display_par_n, &display_par_d
305 GST_DEBUG("display pixel-aspect-ratio %d/%d",
306 display_par_n, display_par_d);
308 success = gst_video_calculate_display_ratio(
310 sink->video_width, sink->video_height,
311 sink->video_par_n, sink->video_par_d,
312 display_par_n, display_par_d
316 GST_DEBUG("video size %dx%d, calculated ratio %d/%d",
317 sink->video_width, sink->video_height, num, den);
319 if ((sink->video_height % den) == 0) {
320 GST_DEBUG("keeping video height");
321 display_rect->width =
322 gst_util_uint64_scale_int(sink->video_height, num, den);
323 display_rect->height = sink->video_height;
325 else if ((sink->video_width % num) == 0) {
326 GST_DEBUG("keeping video width");
327 display_rect->width = sink->video_width;
328 display_rect->height =
329 gst_util_uint64_scale_int(sink->video_width, den, num);
332 GST_DEBUG("approximating while keeping video height");
333 display_rect->width =
334 gst_util_uint64_scale_int(sink->video_height, num, den);
335 display_rect->height = sink->video_height;
337 display_ratio = (gdouble)display_rect->width / display_rect->height;
338 GST_DEBUG("scaling to %ux%u", display_rect->width, display_rect->height);
340 if (sink->fullscreen || sink->foreign_window ||
341 display_rect->width > width || display_rect->height > height) {
342 if (sink->video_width > sink->video_height) {
343 display_rect->width = width;
344 display_rect->height = width / display_ratio;
347 display_rect->width = height * display_ratio;
348 display_rect->height = height;
352 if (sink->fullscreen) {
353 display_rect->x = (width - display_rect->width) / 2;
354 display_rect->y = (height - display_rect->height) / 2;
361 GST_DEBUG("render rect (%d,%d):%ux%u",
362 display_rect->x, display_rect->y,
363 display_rect->width, display_rect->height);
367 static inline gboolean
368 gst_vaapisink_ensure_window(GstVaapiSink *sink, guint width, guint height)
370 GstVaapiDisplay * const display = sink->display;
373 #if USE_VAAPISINK_GLX
375 sink->window = gst_vaapi_window_glx_new(display, width, height);
378 sink->window = gst_vaapi_window_x11_new(display, width, height);
380 gst_x_overlay_got_xwindow_id(
382 gst_vaapi_window_x11_get_xid(GST_VAAPI_WINDOW_X11(sink->window))
385 return sink->window != NULL;
389 gst_vaapisink_ensure_window_xid(GstVaapiSink *sink, guintptr window_id)
392 unsigned int width, height, border_width, depth;
396 if (!gst_vaapi_ensure_display(sink, &sink->display))
399 gst_vaapi_display_lock(sink->display);
401 gst_vaapi_display_x11_get_display(GST_VAAPI_DISPLAY_X11(sink->display)),
404 &x, &y, &width, &height, &border_width, &depth
406 gst_vaapi_display_unlock(sink->display);
408 if ((width != sink->window_width || height != sink->window_height) &&
409 !configure_notify_event_pending(sink, xid, width, height)) {
410 if (!gst_vaapisink_ensure_render_rect(sink, width, height))
412 sink->window_width = width;
413 sink->window_height = height;
417 gst_vaapi_window_x11_get_xid(GST_VAAPI_WINDOW_X11(sink->window)) == xid)
421 g_object_unref(sink->window);
425 #if USE_VAAPISINK_GLX
427 sink->window = gst_vaapi_window_glx_new_with_xid(sink->display, xid);
430 sink->window = gst_vaapi_window_x11_new_with_xid(sink->display, xid);
431 return sink->window != NULL;
435 gst_vaapisink_start(GstBaseSink *base_sink)
441 gst_vaapisink_stop(GstBaseSink *base_sink)
443 GstVaapiSink * const sink = GST_VAAPISINK(base_sink);
446 g_object_unref(sink->window);
451 g_object_unref(sink->display);
452 sink->display = NULL;
458 gst_vaapisink_set_caps(GstBaseSink *base_sink, GstCaps *caps)
460 GstVaapiSink * const sink = GST_VAAPISINK(base_sink);
461 GstStructure * const structure = gst_caps_get_structure(caps, 0);
462 guint display_width, display_height, win_width, win_height;
463 gint video_width, video_height, video_par_n = 1, video_par_d = 1;
467 if (!gst_structure_get_int(structure, "width", &video_width))
469 if (!gst_structure_get_int(structure, "height", &video_height))
471 sink->video_width = video_width;
472 sink->video_height = video_height;
474 gst_video_parse_caps_pixel_aspect_ratio(caps, &video_par_n, &video_par_d);
475 sink->video_par_n = video_par_n;
476 sink->video_par_d = video_par_d;
477 GST_DEBUG("video pixel-aspect-ratio %d/%d", video_par_n, video_par_d);
479 if (!gst_vaapi_ensure_display(sink, &sink->display))
482 gst_vaapi_display_get_size(sink->display, &display_width, &display_height);
483 if (!gst_vaapisink_ensure_render_rect(sink, display_width, display_height))
486 if (sink->fullscreen) {
487 win_width = display_width;
488 win_height = display_height;
491 win_width = sink->display_rect.width;
492 win_height = sink->display_rect.height;
496 gst_vaapi_window_set_size(sink->window, win_width, win_height);
498 gst_vaapi_display_lock(sink->display);
499 gst_x_overlay_prepare_xwindow_id(GST_X_OVERLAY(sink));
500 gst_vaapi_display_unlock(sink->display);
503 if (!gst_vaapisink_ensure_window(sink, win_width, win_height))
505 gst_vaapi_window_set_fullscreen(sink->window, sink->fullscreen);
506 gst_vaapi_window_show(sink->window);
508 sink->window_width = win_width;
509 sink->window_height = win_height;
513 #if USE_VAAPISINK_GLX
515 render_background(GstVaapiSink *sink)
517 /* Original code from Mirco Muller (MacSlow):
518 <http://cgit.freedesktop.org/~macslow/gl-gst-player/> */
519 GLfloat fStartX = 0.0f;
520 GLfloat fStartY = 0.0f;
521 GLfloat fWidth = (GLfloat)sink->window_width;
522 GLfloat fHeight = (GLfloat)sink->window_height;
524 glClear(GL_COLOR_BUFFER_BIT);
527 /* top third, darker grey to white */
528 glColor3f(0.85f, 0.85f, 0.85f);
529 glVertex3f(fStartX, fStartY, 0.0f);
530 glColor3f(0.85f, 0.85f, 0.85f);
531 glVertex3f(fStartX + fWidth, fStartY, 0.0f);
532 glColor3f(1.0f, 1.0f, 1.0f);
533 glVertex3f(fStartX + fWidth, fStartY + fHeight / 3.0f, 0.0f);
534 glColor3f(1.0f, 1.0f, 1.0f);
535 glVertex3f(fStartX, fStartY + fHeight / 3.0f, 0.0f);
537 /* middle third, just plain white */
538 glColor3f(1.0f, 1.0f, 1.0f);
539 glVertex3f(fStartX, fStartY + fHeight / 3.0f, 0.0f);
540 glVertex3f(fStartX + fWidth, fStartY + fHeight / 3.0f, 0.0f);
541 glVertex3f(fStartX + fWidth, fStartY + 2.0f * fHeight / 3.0f, 0.0f);
542 glVertex3f(fStartX, fStartY + 2.0f * fHeight / 3.0f, 0.0f);
544 /* bottom third, white to lighter grey */
545 glColor3f(1.0f, 1.0f, 1.0f);
546 glVertex3f(fStartX, fStartY + 2.0f * fHeight / 3.0f, 0.0f);
547 glColor3f(1.0f, 1.0f, 1.0f);
548 glVertex3f(fStartX + fWidth, fStartY + 2.0f * fHeight / 3.0f, 0.0f);
549 glColor3f(0.62f, 0.66f, 0.69f);
550 glVertex3f(fStartX + fWidth, fStartY + fHeight, 0.0f);
551 glColor3f(0.62f, 0.66f, 0.69f);
552 glVertex3f(fStartX, fStartY + fHeight, 0.0f);
558 render_frame(GstVaapiSink *sink)
560 const guint x1 = sink->display_rect.x;
561 const guint x2 = sink->display_rect.x + sink->display_rect.width;
562 const guint y1 = sink->display_rect.y;
563 const guint y2 = sink->display_rect.y + sink->display_rect.height;
565 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
568 glTexCoord2f(0.0f, 0.0f); glVertex2i(x1, y1);
569 glTexCoord2f(0.0f, 1.0f); glVertex2i(x1, y2);
570 glTexCoord2f(1.0f, 1.0f); glVertex2i(x2, y2);
571 glTexCoord2f(1.0f, 0.0f); glVertex2i(x2, y1);
577 render_reflection(GstVaapiSink *sink)
579 const guint x1 = sink->display_rect.x;
580 const guint x2 = sink->display_rect.x + sink->display_rect.width;
581 const guint y1 = sink->display_rect.y;
582 const guint rh = sink->display_rect.height / 5;
583 GLfloat ry = 1.0f - (GLfloat)rh / (GLfloat)sink->display_rect.height;
587 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
588 glTexCoord2f(0.0f, 1.0f); glVertex2i(x1, y1);
589 glTexCoord2f(1.0f, 1.0f); glVertex2i(x2, y1);
591 glColor4f(1.0f, 1.0f, 1.0f, 0.0f);
592 glTexCoord2f(1.0f, ry); glVertex2i(x2, y1 + rh);
593 glTexCoord2f(0.0f, ry); glVertex2i(x1, y1 + rh);
599 gst_vaapisink_show_frame_glx(
601 GstVaapiSurface *surface,
605 GstVaapiWindowGLX * const window = GST_VAAPI_WINDOW_GLX(sink->window);
609 gst_vaapi_window_glx_make_current(window);
610 if (!sink->texture) {
611 sink->texture = gst_vaapi_texture_new(
619 goto error_create_texture;
621 if (!gst_vaapi_texture_put_surface(sink->texture, surface, flags))
622 goto error_transfer_surface;
624 target = gst_vaapi_texture_get_target(sink->texture);
625 texture = gst_vaapi_texture_get_id(sink->texture);
626 if (target != GL_TEXTURE_2D || !texture)
629 if (sink->use_reflection)
630 render_background(sink);
633 glBindTexture(target, texture);
635 if (sink->use_reflection) {
637 glRotatef(20.0f, 0.0f, 1.0f, 0.0f);
638 glTranslatef(50.0f, 0.0f, 0.0f);
641 if (sink->use_reflection) {
643 glTranslatef(0.0, (GLfloat)sink->display_rect.height + 5.0f, 0.0f);
644 render_reflection(sink);
649 glBindTexture(target, 0);
651 gst_vaapi_window_glx_swap_buffers(window);
655 error_create_texture:
657 GST_DEBUG("could not create VA/GLX texture");
660 error_transfer_surface:
662 GST_DEBUG("could not transfer VA surface to texture");
668 static inline gboolean
669 gst_vaapisink_show_frame_x11(
671 GstVaapiSurface *surface,
675 if (!gst_vaapi_window_put_surface(sink->window, surface,
676 NULL, &sink->display_rect, flags)) {
677 GST_DEBUG("could not render VA surface");
684 gst_vaapisink_show_frame(GstBaseSink *base_sink, GstBuffer *buffer)
686 GstVaapiSink * const sink = GST_VAAPISINK(base_sink);
687 GstVaapiVideoBuffer * const vbuffer = GST_VAAPI_VIDEO_BUFFER(buffer);
688 GstVaapiSurface *surface;
691 GstVideoOverlayComposition * const composition =
692 gst_video_buffer_get_overlay_composition(buffer);
694 if (sink->display != gst_vaapi_video_buffer_get_display (vbuffer)) {
696 g_object_unref (sink->display);
697 sink->display = g_object_ref (gst_vaapi_video_buffer_get_display (vbuffer));
701 return GST_FLOW_UNEXPECTED;
703 surface = gst_vaapi_video_buffer_get_surface(vbuffer);
705 return GST_FLOW_UNEXPECTED;
707 GST_DEBUG("render surface %" GST_VAAPI_ID_FORMAT,
708 GST_VAAPI_ID_ARGS(gst_vaapi_surface_get_id(surface)));
710 flags = GST_VAAPI_PICTURE_STRUCTURE_FRAME;
712 if (!gst_vaapi_surface_set_subpictures_from_composition(surface,
714 GST_WARNING("could not update subtitles");
716 #if USE_VAAPISINK_GLX
718 success = gst_vaapisink_show_frame_glx(sink, surface, flags);
721 success = gst_vaapisink_show_frame_x11(sink, surface, flags);
722 return success ? GST_FLOW_OK : GST_FLOW_UNEXPECTED;
726 gst_vaapisink_query(GstBaseSink *base_sink, GstQuery *query)
728 GstVaapiSink *sink = GST_VAAPISINK(base_sink);
729 GST_DEBUG ("sharing display %p", sink->display);
730 return gst_vaapi_reply_to_query (query, sink->display);
734 gst_vaapisink_finalize(GObject *object)
736 gst_vaapisink_destroy(GST_VAAPISINK(object));
738 G_OBJECT_CLASS(parent_class)->finalize(object);
742 gst_vaapisink_set_property(
749 GstVaapiSink * const sink = GST_VAAPISINK(object);
753 sink->use_glx = g_value_get_boolean(value);
755 case PROP_FULLSCREEN:
756 sink->fullscreen = g_value_get_boolean(value);
758 case PROP_SYNCHRONOUS:
759 sink->synchronous = g_value_get_boolean(value);
761 case PROP_USE_REFLECTION:
762 sink->use_reflection = g_value_get_boolean(value);
765 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
771 gst_vaapisink_get_property(
778 GstVaapiSink * const sink = GST_VAAPISINK(object);
782 g_value_set_boolean(value, sink->use_glx);
784 case PROP_FULLSCREEN:
785 g_value_set_boolean(value, sink->fullscreen);
787 case PROP_SYNCHRONOUS:
788 g_value_set_boolean(value, sink->synchronous);
790 case PROP_USE_REFLECTION:
791 g_value_set_boolean(value, sink->use_reflection);
794 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
800 gst_vaapisink_base_init(gpointer klass)
802 GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
804 gst_element_class_set_details(element_class, &gst_vaapisink_details);
806 gst_element_class_add_pad_template(
808 gst_static_pad_template_get(&gst_vaapisink_sink_factory)
813 gst_vaapisink_class_init(GstVaapiSinkClass *klass)
815 GObjectClass * const object_class = G_OBJECT_CLASS(klass);
816 GstBaseSinkClass * const basesink_class = GST_BASE_SINK_CLASS(klass);
818 GST_DEBUG_CATEGORY_INIT(gst_debug_vaapisink,
819 GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC);
821 object_class->finalize = gst_vaapisink_finalize;
822 object_class->set_property = gst_vaapisink_set_property;
823 object_class->get_property = gst_vaapisink_get_property;
825 basesink_class->start = gst_vaapisink_start;
826 basesink_class->stop = gst_vaapisink_stop;
827 basesink_class->set_caps = gst_vaapisink_set_caps;
828 basesink_class->preroll = gst_vaapisink_show_frame;
829 basesink_class->render = gst_vaapisink_show_frame;
830 basesink_class->query = gst_vaapisink_query;
832 #if USE_VAAPISINK_GLX
833 g_object_class_install_property
836 g_param_spec_boolean("use-glx",
838 "Enables GLX rendering",
842 g_object_class_install_property
845 g_param_spec_boolean("use-reflection",
847 "Enables OpenGL reflection effect",
852 g_object_class_install_property
855 g_param_spec_boolean("fullscreen",
857 "Requests window in fullscreen state",
862 * GstVaapiSink:synchronous:
864 * When enabled, runs the X display in synchronous mode. Note that
865 * this is used only for debugging.
867 g_object_class_install_property
870 g_param_spec_boolean("synchronous",
872 "Toggles X display synchronous mode",
878 gst_vaapisink_init(GstVaapiSink *sink, GstVaapiSinkClass *klass)
880 sink->display = NULL;
882 sink->window_width = 0;
883 sink->window_height = 0;
884 sink->texture = NULL;
885 sink->video_width = 0;
886 sink->video_height = 0;
887 sink->video_par_n = 1;
888 sink->video_par_d = 1;
889 sink->foreign_window = FALSE;
890 sink->fullscreen = FALSE;
891 sink->synchronous = FALSE;
892 sink->use_glx = USE_VAAPISINK_GLX;
893 sink->use_reflection = FALSE;