rtpsession: Always keep at least one NACK on early RTCP
[platform/upstream/gst-plugins-good.git] / ext / gtk / gtkgstbasewidget.h
1 /*
2  * GStreamer
3  * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
4  *
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.
9  *
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.
14  *
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.
19  */
20
21 #ifndef __GTK_GST_BASE_WIDGET_H__
22 #define __GTK_GST_BASE_WIDGET_H__
23
24 #include <gtk/gtk.h>
25 #include <gst/gst.h>
26 #include <gst/video/video.h>
27
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)
32
33 G_BEGIN_DECLS
34
35 typedef struct _GtkGstBaseWidget GtkGstBaseWidget;
36 typedef struct _GtkGstBaseWidgetClass GtkGstBaseWidgetClass;
37
38 struct _GtkGstBaseWidget
39 {
40   union {
41     GtkDrawingArea drawing_area;
42 #if GTK_CHECK_VERSION(3, 15, 0)
43     GtkGLArea gl_area;
44 #endif
45   } parent;
46
47   /* properties */
48   gboolean force_aspect_ratio;
49   gint par_n, par_d;
50   gboolean ignore_alpha;
51
52   gint display_width;
53   gint display_height;
54
55   gboolean negotiated;
56   GstBuffer *pending_buffer;
57   GstBuffer *buffer;
58   GstVideoInfo v_info;
59
60   /* resize */
61   gboolean pending_resize;
62   GstVideoInfo pending_v_info;
63   guint display_ratio_num;
64   guint display_ratio_den;
65
66   /*< private >*/
67   GMutex lock;
68   GWeakRef element;
69
70   /* Pending draw idles callback */
71   guint draw_id;
72 };
73
74 struct _GtkGstBaseWidgetClass
75 {
76   union {
77     GtkDrawingAreaClass drawing_area_class;
78 #if GTK_CHECK_VERSION(3, 15, 0)
79     GtkGLAreaClass gl_area_class;
80 #endif
81   } parent_class;
82 };
83
84 /* For implementer */
85 void            gtk_gst_base_widget_class_init           (GtkGstBaseWidgetClass * klass);
86 void            gtk_gst_base_widget_init                 (GtkGstBaseWidget * widget);
87
88 void            gtk_gst_base_widget_finalize             (GObject * object);
89
90 /* API */
91 gboolean        gtk_gst_base_widget_set_format           (GtkGstBaseWidget * widget, GstVideoInfo * v_info);
92 void            gtk_gst_base_widget_set_buffer           (GtkGstBaseWidget * widget, GstBuffer * buffer);
93 void            gtk_gst_base_widget_set_element          (GtkGstBaseWidget * widget, GstElement * element);
94
95 G_END_DECLS
96
97 #endif /* __GTK_GST_BASE_WIDGET_H__ */