3 * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #ifndef __GTK_GST_BASE_WIDGET_H__
22 #define __GTK_GST_BASE_WIDGET_H__
26 #include <gst/video/video.h>
28 #define GTK_GST_BASE_WIDGET(w) ((GtkGstBaseWidget *)(w))
29 #define GTK_GST_BASE_WIDGET_CLASS(k) ((GtkGstBaseWidgetClass *)(k))
30 #define GTK_GST_BASE_WIDGET_LOCK(w) g_mutex_lock(&((GtkGstBaseWidget*)(w))->lock)
31 #define GTK_GST_BASE_WIDGET_UNLOCK(w) g_mutex_unlock(&((GtkGstBaseWidget*)(w))->lock)
35 typedef struct _GtkGstBaseWidget GtkGstBaseWidget;
36 typedef struct _GtkGstBaseWidgetClass GtkGstBaseWidgetClass;
38 struct _GtkGstBaseWidget
41 GtkDrawingArea drawing_area;
42 #if GTK_CHECK_VERSION(3, 15, 0)
48 gboolean force_aspect_ratio;
50 gboolean ignore_alpha;
61 gboolean pending_resize;
62 GstVideoInfo pending_v_info;
63 guint display_ratio_num;
64 guint display_ratio_den;
66 /* Poor-man virtual */
67 void (*reset) (GtkGstBaseWidget * widget);
73 /* Pending draw idles callback */
77 struct _GtkGstBaseWidgetClass
80 GtkDrawingAreaClass drawing_area_class;
81 #if GTK_CHECK_VERSION(3, 15, 0)
82 GtkGLAreaClass gl_area_class;
88 void gtk_gst_base_widget_class_init (GtkGstBaseWidgetClass * klass);
89 void gtk_gst_base_widget_init (GtkGstBaseWidget * widget);
91 void gtk_gst_base_widget_finalize (GObject * object);
94 gboolean gtk_gst_base_widget_set_format (GtkGstBaseWidget * widget, GstVideoInfo * v_info);
95 void gtk_gst_base_widget_set_buffer (GtkGstBaseWidget * widget, GstBuffer * buffer);
96 void gtk_gst_base_widget_set_element (GtkGstBaseWidget * widget, GstElement * element);
100 #endif /* __GTK_GST_BASE_WIDGET_H__ */