2015-07-16 16:51:34 +00:00
|
|
|
/*
|
|
|
|
* GStreamer
|
|
|
|
* Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GTK_GST_BASE_WIDGET_H__
|
|
|
|
#define __GTK_GST_BASE_WIDGET_H__
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <gst/video/video.h>
|
|
|
|
|
|
|
|
#define GTK_GST_BASE_WIDGET(w) ((GtkGstBaseWidget *)(w))
|
|
|
|
#define GTK_GST_BASE_WIDGET_CLASS(k) ((GtkGstBaseWidgetClass *)(k))
|
|
|
|
#define GTK_GST_BASE_WIDGET_LOCK(w) g_mutex_lock(&((GtkGstBaseWidget*)(w))->lock)
|
|
|
|
#define GTK_GST_BASE_WIDGET_UNLOCK(w) g_mutex_unlock(&((GtkGstBaseWidget*)(w))->lock)
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
typedef struct _GtkGstBaseWidget GtkGstBaseWidget;
|
|
|
|
typedef struct _GtkGstBaseWidgetClass GtkGstBaseWidgetClass;
|
|
|
|
|
|
|
|
struct _GtkGstBaseWidget
|
|
|
|
{
|
|
|
|
union {
|
|
|
|
GtkDrawingArea drawing_area;
|
|
|
|
#if GTK_CHECK_VERSION(3, 15, 0)
|
|
|
|
GtkGLArea gl_area;
|
|
|
|
#endif
|
|
|
|
} parent;
|
|
|
|
|
|
|
|
/* properties */
|
|
|
|
gboolean force_aspect_ratio;
|
|
|
|
gint par_n, par_d;
|
2021-05-07 16:22:06 +00:00
|
|
|
gint video_par_n, video_par_d;
|
2015-07-16 16:51:34 +00:00
|
|
|
gboolean ignore_alpha;
|
|
|
|
|
|
|
|
gint display_width;
|
|
|
|
gint display_height;
|
|
|
|
|
|
|
|
gboolean negotiated;
|
2015-08-15 13:08:11 +00:00
|
|
|
GstBuffer *pending_buffer;
|
2015-07-16 16:51:34 +00:00
|
|
|
GstBuffer *buffer;
|
|
|
|
GstVideoInfo v_info;
|
|
|
|
|
2015-07-17 18:36:56 +00:00
|
|
|
/* resize */
|
|
|
|
gboolean pending_resize;
|
|
|
|
GstVideoInfo pending_v_info;
|
|
|
|
guint display_ratio_num;
|
|
|
|
guint display_ratio_den;
|
|
|
|
|
2015-07-16 16:51:34 +00:00
|
|
|
/*< private >*/
|
|
|
|
GMutex lock;
|
2015-08-11 11:34:59 +00:00
|
|
|
GWeakRef element;
|
2015-07-16 16:51:34 +00:00
|
|
|
|
2015-07-17 18:36:56 +00:00
|
|
|
/* Pending draw idles callback */
|
2015-07-16 16:51:34 +00:00
|
|
|
guint draw_id;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GtkGstBaseWidgetClass
|
|
|
|
{
|
|
|
|
union {
|
|
|
|
GtkDrawingAreaClass drawing_area_class;
|
|
|
|
#if GTK_CHECK_VERSION(3, 15, 0)
|
|
|
|
GtkGLAreaClass gl_area_class;
|
|
|
|
#endif
|
|
|
|
} parent_class;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* For implementer */
|
|
|
|
void gtk_gst_base_widget_class_init (GtkGstBaseWidgetClass * klass);
|
|
|
|
void gtk_gst_base_widget_init (GtkGstBaseWidget * widget);
|
|
|
|
|
|
|
|
void gtk_gst_base_widget_finalize (GObject * object);
|
|
|
|
|
|
|
|
/* API */
|
2015-07-17 18:36:56 +00:00
|
|
|
gboolean gtk_gst_base_widget_set_format (GtkGstBaseWidget * widget, GstVideoInfo * v_info);
|
|
|
|
void gtk_gst_base_widget_set_buffer (GtkGstBaseWidget * widget, GstBuffer * buffer);
|
2022-02-01 13:26:02 +00:00
|
|
|
void gtk_gst_base_widget_queue_draw (GtkGstBaseWidget * widget);
|
2015-08-11 11:34:59 +00:00
|
|
|
void gtk_gst_base_widget_set_element (GtkGstBaseWidget * widget, GstElement * element);
|
2021-05-05 12:24:31 +00:00
|
|
|
void gtk_gst_base_widget_display_size_to_stream_size (GtkGstBaseWidget * base_widget,
|
|
|
|
gdouble x, gdouble y,
|
|
|
|
gdouble * stream_x, gdouble * stream_y);
|
2015-07-16 16:51:34 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GTK_GST_BASE_WIDGET_H__ */
|