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/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->texture);
236 sink->texture = NULL;
240 g_object_unref(sink->display);
241 sink->display = NULL;
244 gst_caps_replace(&sink->caps, NULL);
247 /* Checks whether a ConfigureNotify event is in the queue */
248 typedef struct _ConfigureNotifyEventPendingArgs ConfigureNotifyEventPendingArgs;
249 struct _ConfigureNotifyEventPendingArgs {
257 configure_notify_event_pending_cb(Display *dpy, XEvent *xev, XPointer arg)
259 ConfigureNotifyEventPendingArgs * const args =
260 (ConfigureNotifyEventPendingArgs *)arg;
262 if (xev->type == ConfigureNotify &&
263 xev->xconfigure.window == args->window &&
264 xev->xconfigure.width == args->width &&
265 xev->xconfigure.height == args->height)
268 /* XXX: this is a hack to traverse the whole queue because we
269 can't use XPeekIfEvent() since it could block */
274 configure_notify_event_pending(
281 ConfigureNotifyEventPendingArgs args;
284 args.window = window;
286 args.height = height;
289 /* XXX: don't use XPeekIfEvent() because it might block */
291 gst_vaapi_display_x11_get_display(GST_VAAPI_DISPLAY_X11(sink->display)),
293 configure_notify_event_pending_cb, (XPointer)&args
299 gst_vaapisink_ensure_render_rect(GstVaapiSink *sink, guint width, guint height)
301 GstVaapiRectangle * const display_rect = &sink->display_rect;
302 guint num, den, display_par_n, display_par_d;
305 /* Return success if caps are not set yet */
309 GST_DEBUG("ensure render rect within %ux%u bounds", width, height);
311 gst_vaapi_display_get_pixel_aspect_ratio(
313 &display_par_n, &display_par_d
315 GST_DEBUG("display pixel-aspect-ratio %d/%d",
316 display_par_n, display_par_d);
318 success = gst_video_calculate_display_ratio(
320 sink->video_width, sink->video_height,
321 sink->video_par_n, sink->video_par_d,
322 display_par_n, display_par_d
326 GST_DEBUG("video size %dx%d, calculated ratio %d/%d",
327 sink->video_width, sink->video_height, num, den);
329 display_rect->width = gst_util_uint64_scale_int(height, num, den);
330 if (display_rect->width <= width) {
331 GST_DEBUG("keeping window height");
332 display_rect->height = height;
335 GST_DEBUG("keeping window width");
336 display_rect->width = width;
337 display_rect->height =
338 gst_util_uint64_scale_int(width, den, num);
340 GST_DEBUG("scaling video to %ux%u", display_rect->width, display_rect->height);
342 g_assert(display_rect->width <= width);
343 g_assert(display_rect->height <= height);
345 display_rect->x = (width - display_rect->width) / 2;
346 display_rect->y = (height - display_rect->height) / 2;
348 GST_DEBUG("render rect (%d,%d):%ux%u",
349 display_rect->x, display_rect->y,
350 display_rect->width, display_rect->height);
354 static inline gboolean
355 gst_vaapisink_ensure_window(GstVaapiSink *sink, guint width, guint height)
357 GstVaapiDisplay * const display = sink->display;
360 #if USE_VAAPISINK_GLX
362 sink->window = gst_vaapi_window_glx_new(display, width, height);
365 sink->window = gst_vaapi_window_x11_new(display, width, height);
367 gst_x_overlay_got_xwindow_id(
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_vaapi_ensure_display(sink, &sink->display))
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)
408 g_object_unref(sink->window);
412 #if USE_VAAPISINK_GLX
414 sink->window = gst_vaapi_window_glx_new_with_xid(sink->display, xid);
417 sink->window = gst_vaapi_window_x11_new_with_xid(sink->display, xid);
418 return sink->window != NULL;
422 gst_vaapisink_start(GstBaseSink *base_sink)
424 GstVaapiSink * const sink = GST_VAAPISINK(base_sink);
426 return gst_vaapi_ensure_display(sink, &sink->display);
430 gst_vaapisink_stop(GstBaseSink *base_sink)
432 GstVaapiSink * const sink = GST_VAAPISINK(base_sink);
435 g_object_unref(sink->window);
440 g_object_unref(sink->display);
441 sink->display = NULL;
447 gst_vaapisink_set_caps(GstBaseSink *base_sink, GstCaps *caps)
449 GstVaapiSink * const sink = GST_VAAPISINK(base_sink);
450 GstStructure * const structure = gst_caps_get_structure(caps, 0);
451 guint win_width, win_height, display_width, display_height;
452 gint video_width, video_height, video_par_n = 1, video_par_d = 1;
456 if (!gst_structure_get_int(structure, "width", &video_width))
458 if (!gst_structure_get_int(structure, "height", &video_height))
460 sink->video_width = video_width;
461 sink->video_height = video_height;
463 gst_video_parse_caps_pixel_aspect_ratio(caps, &video_par_n, &video_par_d);
464 sink->video_par_n = video_par_n;
465 sink->video_par_d = video_par_d;
466 GST_DEBUG("video pixel-aspect-ratio %d/%d", video_par_n, video_par_d);
468 gst_caps_replace(&sink->caps, caps);
470 if (!gst_vaapi_ensure_display(sink, &sink->display))
473 gst_vaapi_display_get_size(sink->display, &display_width, &display_height);
474 if (sink->fullscreen ||
475 video_width > display_width || video_height > display_height) {
476 win_width = display_width;
477 win_height = display_height;
480 win_width = video_width;
481 win_height = video_height;
485 gst_vaapi_window_set_size(sink->window, win_width, win_height);
487 gst_vaapi_display_lock(sink->display);
488 gst_x_overlay_prepare_xwindow_id(GST_X_OVERLAY(sink));
489 gst_vaapi_display_unlock(sink->display);
492 if (!gst_vaapisink_ensure_window(sink, win_width, win_height))
494 gst_vaapi_window_set_fullscreen(sink->window, sink->fullscreen);
495 gst_vaapi_window_show(sink->window);
496 gst_vaapi_window_get_size(sink->window, &win_width, &win_height);
498 sink->window_width = win_width;
499 sink->window_height = win_height;
500 GST_DEBUG("window size %ux%u", win_width, win_height);
502 return gst_vaapisink_ensure_render_rect(sink, win_width, win_height);
505 #if USE_VAAPISINK_GLX
507 render_background(GstVaapiSink *sink)
509 /* Original code from Mirco Muller (MacSlow):
510 <http://cgit.freedesktop.org/~macslow/gl-gst-player/> */
511 GLfloat fStartX = 0.0f;
512 GLfloat fStartY = 0.0f;
513 GLfloat fWidth = (GLfloat)sink->window_width;
514 GLfloat fHeight = (GLfloat)sink->window_height;
516 glClear(GL_COLOR_BUFFER_BIT);
519 /* top third, darker grey to white */
520 glColor3f(0.85f, 0.85f, 0.85f);
521 glVertex3f(fStartX, fStartY, 0.0f);
522 glColor3f(0.85f, 0.85f, 0.85f);
523 glVertex3f(fStartX + fWidth, fStartY, 0.0f);
524 glColor3f(1.0f, 1.0f, 1.0f);
525 glVertex3f(fStartX + fWidth, fStartY + fHeight / 3.0f, 0.0f);
526 glColor3f(1.0f, 1.0f, 1.0f);
527 glVertex3f(fStartX, fStartY + fHeight / 3.0f, 0.0f);
529 /* middle third, just plain white */
530 glColor3f(1.0f, 1.0f, 1.0f);
531 glVertex3f(fStartX, fStartY + fHeight / 3.0f, 0.0f);
532 glVertex3f(fStartX + fWidth, fStartY + fHeight / 3.0f, 0.0f);
533 glVertex3f(fStartX + fWidth, fStartY + 2.0f * fHeight / 3.0f, 0.0f);
534 glVertex3f(fStartX, fStartY + 2.0f * fHeight / 3.0f, 0.0f);
536 /* bottom third, white to lighter grey */
537 glColor3f(1.0f, 1.0f, 1.0f);
538 glVertex3f(fStartX, fStartY + 2.0f * fHeight / 3.0f, 0.0f);
539 glColor3f(1.0f, 1.0f, 1.0f);
540 glVertex3f(fStartX + fWidth, fStartY + 2.0f * fHeight / 3.0f, 0.0f);
541 glColor3f(0.62f, 0.66f, 0.69f);
542 glVertex3f(fStartX + fWidth, fStartY + fHeight, 0.0f);
543 glColor3f(0.62f, 0.66f, 0.69f);
544 glVertex3f(fStartX, fStartY + fHeight, 0.0f);
550 render_frame(GstVaapiSink *sink)
552 const guint x1 = sink->display_rect.x;
553 const guint x2 = sink->display_rect.x + sink->display_rect.width;
554 const guint y1 = sink->display_rect.y;
555 const guint y2 = sink->display_rect.y + sink->display_rect.height;
557 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
560 glTexCoord2f(0.0f, 0.0f); glVertex2i(x1, y1);
561 glTexCoord2f(0.0f, 1.0f); glVertex2i(x1, y2);
562 glTexCoord2f(1.0f, 1.0f); glVertex2i(x2, y2);
563 glTexCoord2f(1.0f, 0.0f); glVertex2i(x2, y1);
569 render_reflection(GstVaapiSink *sink)
571 const guint x1 = sink->display_rect.x;
572 const guint x2 = sink->display_rect.x + sink->display_rect.width;
573 const guint y1 = sink->display_rect.y;
574 const guint rh = sink->display_rect.height / 5;
575 GLfloat ry = 1.0f - (GLfloat)rh / (GLfloat)sink->display_rect.height;
579 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
580 glTexCoord2f(0.0f, 1.0f); glVertex2i(x1, y1);
581 glTexCoord2f(1.0f, 1.0f); glVertex2i(x2, y1);
583 glColor4f(1.0f, 1.0f, 1.0f, 0.0f);
584 glTexCoord2f(1.0f, ry); glVertex2i(x2, y1 + rh);
585 glTexCoord2f(0.0f, ry); glVertex2i(x1, y1 + rh);
591 gst_vaapisink_show_frame_glx(
593 GstVaapiSurface *surface,
597 GstVaapiWindowGLX * const window = GST_VAAPI_WINDOW_GLX(sink->window);
601 gst_vaapi_window_glx_make_current(window);
602 if (!sink->texture) {
603 sink->texture = gst_vaapi_texture_new(
611 goto error_create_texture;
613 if (!gst_vaapi_texture_put_surface(sink->texture, surface, flags))
614 goto error_transfer_surface;
616 target = gst_vaapi_texture_get_target(sink->texture);
617 texture = gst_vaapi_texture_get_id(sink->texture);
618 if (target != GL_TEXTURE_2D || !texture)
621 if (sink->use_reflection)
622 render_background(sink);
625 glBindTexture(target, texture);
627 if (sink->use_reflection) {
629 glRotatef(20.0f, 0.0f, 1.0f, 0.0f);
630 glTranslatef(50.0f, 0.0f, 0.0f);
633 if (sink->use_reflection) {
635 glTranslatef(0.0, (GLfloat)sink->display_rect.height + 5.0f, 0.0f);
636 render_reflection(sink);
641 glBindTexture(target, 0);
643 gst_vaapi_window_glx_swap_buffers(window);
647 error_create_texture:
649 GST_DEBUG("could not create VA/GLX texture");
652 error_transfer_surface:
654 GST_DEBUG("could not transfer VA surface to texture");
660 static inline gboolean
661 gst_vaapisink_show_frame_x11(
663 GstVaapiSurface *surface,
667 if (!gst_vaapi_window_put_surface(sink->window, surface,
668 NULL, &sink->display_rect, flags)) {
669 GST_DEBUG("could not render VA surface");
676 gst_vaapisink_show_frame(GstBaseSink *base_sink, GstBuffer *buffer)
678 GstVaapiSink * const sink = GST_VAAPISINK(base_sink);
679 GstVaapiVideoBuffer * const vbuffer = GST_VAAPI_VIDEO_BUFFER(buffer);
680 GstVaapiSurface *surface;
683 GstVideoOverlayComposition * const composition =
684 gst_video_buffer_get_overlay_composition(buffer);
686 if (sink->display != gst_vaapi_video_buffer_get_display (vbuffer)) {
688 g_object_unref (sink->display);
689 sink->display = g_object_ref (gst_vaapi_video_buffer_get_display (vbuffer));
693 return GST_FLOW_UNEXPECTED;
695 surface = gst_vaapi_video_buffer_get_surface(vbuffer);
697 return GST_FLOW_UNEXPECTED;
699 GST_DEBUG("render surface %" GST_VAAPI_ID_FORMAT,
700 GST_VAAPI_ID_ARGS(gst_vaapi_surface_get_id(surface)));
702 flags = gst_vaapi_video_buffer_get_render_flags(vbuffer);
704 if (!gst_vaapi_surface_set_subpictures_from_composition(surface,
706 GST_WARNING("could not update subtitles");
708 #if USE_VAAPISINK_GLX
710 success = gst_vaapisink_show_frame_glx(sink, surface, flags);
713 success = gst_vaapisink_show_frame_x11(sink, surface, flags);
714 return success ? GST_FLOW_OK : GST_FLOW_UNEXPECTED;
718 gst_vaapisink_query(GstBaseSink *base_sink, GstQuery *query)
720 GstVaapiSink *sink = GST_VAAPISINK(base_sink);
721 GST_DEBUG ("sharing display %p", sink->display);
722 return gst_vaapi_reply_to_query (query, sink->display);
726 gst_vaapisink_finalize(GObject *object)
728 gst_vaapisink_destroy(GST_VAAPISINK(object));
730 G_OBJECT_CLASS(parent_class)->finalize(object);
734 gst_vaapisink_set_property(
741 GstVaapiSink * const sink = GST_VAAPISINK(object);
745 sink->use_glx = g_value_get_boolean(value);
747 case PROP_FULLSCREEN:
748 sink->fullscreen = g_value_get_boolean(value);
750 case PROP_SYNCHRONOUS:
751 sink->synchronous = g_value_get_boolean(value);
753 case PROP_USE_REFLECTION:
754 sink->use_reflection = g_value_get_boolean(value);
757 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
763 gst_vaapisink_get_property(
770 GstVaapiSink * const sink = GST_VAAPISINK(object);
774 g_value_set_boolean(value, sink->use_glx);
776 case PROP_FULLSCREEN:
777 g_value_set_boolean(value, sink->fullscreen);
779 case PROP_SYNCHRONOUS:
780 g_value_set_boolean(value, sink->synchronous);
782 case PROP_USE_REFLECTION:
783 g_value_set_boolean(value, sink->use_reflection);
786 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
792 gst_vaapisink_base_init(gpointer klass)
794 GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
795 GstPadTemplate *pad_template;
797 gst_element_class_set_details(element_class, &gst_vaapisink_details);
799 pad_template = gst_static_pad_template_get(&gst_vaapisink_sink_factory);
800 gst_element_class_add_pad_template(element_class, pad_template);
801 gst_object_unref(pad_template);
805 gst_vaapisink_class_init(GstVaapiSinkClass *klass)
807 GObjectClass * const object_class = G_OBJECT_CLASS(klass);
808 GstBaseSinkClass * const basesink_class = GST_BASE_SINK_CLASS(klass);
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 #if USE_VAAPISINK_GLX
825 g_object_class_install_property
828 g_param_spec_boolean("use-glx",
830 "Enables GLX rendering",
834 g_object_class_install_property
837 g_param_spec_boolean("use-reflection",
839 "Enables OpenGL reflection effect",
844 g_object_class_install_property
847 g_param_spec_boolean("fullscreen",
849 "Requests window in fullscreen state",
854 * GstVaapiSink:synchronous:
856 * When enabled, runs the X display in synchronous mode. Note that
857 * this is used only for debugging.
859 g_object_class_install_property
862 g_param_spec_boolean("synchronous",
864 "Toggles X display synchronous mode",
870 gst_vaapisink_init(GstVaapiSink *sink, GstVaapiSinkClass *klass)
873 sink->display = NULL;
875 sink->window_width = 0;
876 sink->window_height = 0;
877 sink->texture = NULL;
878 sink->video_width = 0;
879 sink->video_height = 0;
880 sink->video_par_n = 1;
881 sink->video_par_d = 1;
882 sink->foreign_window = FALSE;
883 sink->fullscreen = FALSE;
884 sink->synchronous = FALSE;
885 sink->use_glx = USE_VAAPISINK_GLX;
886 sink->use_reflection = FALSE;