mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
gst-libs/gst/xoverlay/xoverlay.*: Add optional "desired size" signal and querying.
Original commit message from CVS: 2004-01-04 Benjamin Otte <in7y118@public.uni-hamburg.de> * gst-libs/gst/xoverlay/xoverlay.c: (gst_x_overlay_base_init), (gst_x_overlay_got_xwindow_id), (gst_x_overlay_get_desired_size), (gst_x_overlay_got_desired_size): * gst-libs/gst/xoverlay/xoverlay.h: Add optional "desired size" signal and querying.
This commit is contained in:
parent
7b6726efe6
commit
5e15a670e8
5 changed files with 156 additions and 6 deletions
|
@ -1,3 +1,11 @@
|
|||
2004-01-04 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
||||
|
||||
* gst-libs/gst/xoverlay/xoverlay.c: (gst_x_overlay_base_init),
|
||||
(gst_x_overlay_got_xwindow_id), (gst_x_overlay_get_desired_size),
|
||||
(gst_x_overlay_got_desired_size):
|
||||
* gst-libs/gst/xoverlay/xoverlay.h:
|
||||
Add optional "desired size" signal and querying.
|
||||
|
||||
2004-01-04 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||
|
||||
* gst/matroska/matroska-demux.c:
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
enum {
|
||||
HAVE_XWINDOW_ID,
|
||||
DESIRED_SIZE,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
|
@ -62,6 +63,10 @@ gst_x_overlay_get_type (void)
|
|||
return gst_x_overlay_type;
|
||||
}
|
||||
|
||||
/* FIXME: evil hack, we should figure out our marshal handling in this interfaces some day */
|
||||
extern void gst_marshal_VOID__INT_INT (GClosure *closure, GValue *return_value, guint n_param_values,
|
||||
const GValue *param_values, gpointer invocation_hint, gpointer marshal_data);
|
||||
|
||||
static void
|
||||
gst_x_overlay_base_init (gpointer g_class)
|
||||
{
|
||||
|
@ -75,8 +80,15 @@ gst_x_overlay_base_init (gpointer g_class)
|
|||
GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstXOverlayClass, have_xwindow_id),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1,
|
||||
G_TYPE_POINTER);
|
||||
g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1,
|
||||
G_TYPE_INT);
|
||||
gst_x_overlay_signals[DESIRED_SIZE] =
|
||||
g_signal_new ("desired_size_changed",
|
||||
GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstXOverlayClass, desired_size),
|
||||
NULL, NULL,
|
||||
gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2,
|
||||
G_TYPE_INT, G_TYPE_INT);
|
||||
|
||||
initialized = TRUE;
|
||||
}
|
||||
|
@ -119,5 +131,55 @@ gst_x_overlay_got_xwindow_id (GstXOverlay *overlay, XID xwindow_id)
|
|||
g_return_if_fail (GST_IS_X_OVERLAY (overlay));
|
||||
|
||||
g_signal_emit (G_OBJECT (overlay),
|
||||
gst_x_overlay_signals[HAVE_XWINDOW_ID], 0, xwindow_id);
|
||||
gst_x_overlay_signals[HAVE_XWINDOW_ID], 0, (gint) xwindow_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_x_overlay_get_desired_size:
|
||||
* @overlay: a #GstXOverlay which got a XWindow.
|
||||
* @width: pointer to a gint taking the width or NULL.
|
||||
* @height: pointer to a gint taking the height or NULL.
|
||||
*
|
||||
* Gets the desired size of the overlay. If the overlay doesn't know its desired
|
||||
* size, width and height are set to 0.
|
||||
*/
|
||||
void
|
||||
gst_x_overlay_get_desired_size (GstXOverlay *overlay, guint *width, guint *height)
|
||||
{
|
||||
guint width_tmp, height_tmp;
|
||||
GstXOverlayClass *klass;
|
||||
|
||||
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE ((overlay), GST_TYPE_X_OVERLAY));
|
||||
|
||||
klass = GST_X_OVERLAY_GET_CLASS (overlay);
|
||||
if (klass->get_desired_size && GST_IS_X_OVERLAY (overlay)) {
|
||||
/* this ensures that elements don't need to check width and height for NULL
|
||||
but apps may use NULL */
|
||||
klass->get_desired_size (overlay, width ? width : &width_tmp, height ? height : &height_tmp);
|
||||
} else {
|
||||
if (width)
|
||||
*width = 0;
|
||||
if (height)
|
||||
*height = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_x_overlay_got_desired_size:
|
||||
* @overlay: a #GstXOverlay which changed its desired size.
|
||||
* @width: The new desired width
|
||||
* @height: The new desired height
|
||||
*
|
||||
* This will fire a "desired_size_changed" signal.
|
||||
*
|
||||
* This function should be used by video overlay developpers.
|
||||
*/
|
||||
void
|
||||
gst_x_overlay_got_desired_size (GstXOverlay *overlay, guint width, guint height)
|
||||
{
|
||||
g_return_if_fail (GST_IS_X_OVERLAY (overlay));
|
||||
|
||||
g_signal_emit (G_OBJECT (overlay),
|
||||
gst_x_overlay_signals[DESIRED_SIZE], 0, width, height);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,10 +50,17 @@ typedef struct _GstXOverlayClass {
|
|||
/* virtual functions */
|
||||
void (* set_xwindow_id) (GstXOverlay *overlay,
|
||||
XID xwindow_id);
|
||||
/* optional virtual functions */
|
||||
void (* get_desired_size) (GstXOverlay *overlay,
|
||||
guint *width,
|
||||
guint *height);
|
||||
|
||||
/* signals */
|
||||
void (*have_xwindow_id) (GstXOverlay *overlay,
|
||||
XID xwindow_id);
|
||||
void (* desired_size) (GstXOverlay *overlay,
|
||||
guint width,
|
||||
guint height);
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
} GstXOverlayClass;
|
||||
|
@ -62,9 +69,11 @@ GType gst_x_overlay_get_type (void);
|
|||
|
||||
/* virtual class function wrappers */
|
||||
void gst_x_overlay_set_xwindow_id (GstXOverlay *overlay, XID xwindow_id);
|
||||
void gst_x_overlay_get_desired_size (GstXOverlay *overlay, guint *width, guint *height);
|
||||
|
||||
/* public methods to fire signals */
|
||||
void gst_x_overlay_got_xwindow_id (GstXOverlay *overlay, XID xwindow_id);
|
||||
void gst_x_overlay_got_desired_size (GstXOverlay *overlay, guint width, guint height);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
enum {
|
||||
HAVE_XWINDOW_ID,
|
||||
DESIRED_SIZE,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
|
@ -62,6 +63,10 @@ gst_x_overlay_get_type (void)
|
|||
return gst_x_overlay_type;
|
||||
}
|
||||
|
||||
/* FIXME: evil hack, we should figure out our marshal handling in this interfaces some day */
|
||||
extern void gst_marshal_VOID__INT_INT (GClosure *closure, GValue *return_value, guint n_param_values,
|
||||
const GValue *param_values, gpointer invocation_hint, gpointer marshal_data);
|
||||
|
||||
static void
|
||||
gst_x_overlay_base_init (gpointer g_class)
|
||||
{
|
||||
|
@ -75,8 +80,15 @@ gst_x_overlay_base_init (gpointer g_class)
|
|||
GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstXOverlayClass, have_xwindow_id),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1,
|
||||
G_TYPE_POINTER);
|
||||
g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1,
|
||||
G_TYPE_INT);
|
||||
gst_x_overlay_signals[DESIRED_SIZE] =
|
||||
g_signal_new ("desired_size_changed",
|
||||
GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GstXOverlayClass, desired_size),
|
||||
NULL, NULL,
|
||||
gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2,
|
||||
G_TYPE_INT, G_TYPE_INT);
|
||||
|
||||
initialized = TRUE;
|
||||
}
|
||||
|
@ -119,5 +131,55 @@ gst_x_overlay_got_xwindow_id (GstXOverlay *overlay, XID xwindow_id)
|
|||
g_return_if_fail (GST_IS_X_OVERLAY (overlay));
|
||||
|
||||
g_signal_emit (G_OBJECT (overlay),
|
||||
gst_x_overlay_signals[HAVE_XWINDOW_ID], 0, xwindow_id);
|
||||
gst_x_overlay_signals[HAVE_XWINDOW_ID], 0, (gint) xwindow_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_x_overlay_get_desired_size:
|
||||
* @overlay: a #GstXOverlay which got a XWindow.
|
||||
* @width: pointer to a gint taking the width or NULL.
|
||||
* @height: pointer to a gint taking the height or NULL.
|
||||
*
|
||||
* Gets the desired size of the overlay. If the overlay doesn't know its desired
|
||||
* size, width and height are set to 0.
|
||||
*/
|
||||
void
|
||||
gst_x_overlay_get_desired_size (GstXOverlay *overlay, guint *width, guint *height)
|
||||
{
|
||||
guint width_tmp, height_tmp;
|
||||
GstXOverlayClass *klass;
|
||||
|
||||
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE ((overlay), GST_TYPE_X_OVERLAY));
|
||||
|
||||
klass = GST_X_OVERLAY_GET_CLASS (overlay);
|
||||
if (klass->get_desired_size && GST_IS_X_OVERLAY (overlay)) {
|
||||
/* this ensures that elements don't need to check width and height for NULL
|
||||
but apps may use NULL */
|
||||
klass->get_desired_size (overlay, width ? width : &width_tmp, height ? height : &height_tmp);
|
||||
} else {
|
||||
if (width)
|
||||
*width = 0;
|
||||
if (height)
|
||||
*height = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_x_overlay_got_desired_size:
|
||||
* @overlay: a #GstXOverlay which changed its desired size.
|
||||
* @width: The new desired width
|
||||
* @height: The new desired height
|
||||
*
|
||||
* This will fire a "desired_size_changed" signal.
|
||||
*
|
||||
* This function should be used by video overlay developpers.
|
||||
*/
|
||||
void
|
||||
gst_x_overlay_got_desired_size (GstXOverlay *overlay, guint width, guint height)
|
||||
{
|
||||
g_return_if_fail (GST_IS_X_OVERLAY (overlay));
|
||||
|
||||
g_signal_emit (G_OBJECT (overlay),
|
||||
gst_x_overlay_signals[DESIRED_SIZE], 0, width, height);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,10 +50,17 @@ typedef struct _GstXOverlayClass {
|
|||
/* virtual functions */
|
||||
void (* set_xwindow_id) (GstXOverlay *overlay,
|
||||
XID xwindow_id);
|
||||
/* optional virtual functions */
|
||||
void (* get_desired_size) (GstXOverlay *overlay,
|
||||
guint *width,
|
||||
guint *height);
|
||||
|
||||
/* signals */
|
||||
void (*have_xwindow_id) (GstXOverlay *overlay,
|
||||
XID xwindow_id);
|
||||
void (* desired_size) (GstXOverlay *overlay,
|
||||
guint width,
|
||||
guint height);
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
} GstXOverlayClass;
|
||||
|
@ -62,9 +69,11 @@ GType gst_x_overlay_get_type (void);
|
|||
|
||||
/* virtual class function wrappers */
|
||||
void gst_x_overlay_set_xwindow_id (GstXOverlay *overlay, XID xwindow_id);
|
||||
void gst_x_overlay_get_desired_size (GstXOverlay *overlay, guint *width, guint *height);
|
||||
|
||||
/* public methods to fire signals */
|
||||
void gst_x_overlay_got_xwindow_id (GstXOverlay *overlay, XID xwindow_id);
|
||||
void gst_x_overlay_got_desired_size (GstXOverlay *overlay, guint width, guint height);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
Loading…
Reference in a new issue