From a92336c6720121d9acbb1f1f083e9d24f3a6096b Mon Sep 17 00:00:00 2001 From: Erik Walthinsen Date: Wed, 23 May 2001 19:48:42 +0000 Subject: [PATCH] added have_size handler so the window matches the video size Original commit message from CVS: added have_size handler so the window matches the video size --- examples/autoplug/autoplug.c | 13 ++++++++++++- tests/old/examples/autoplug/autoplug.c | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/examples/autoplug/autoplug.c b/examples/autoplug/autoplug.c index c65d0a5d37..dff37becf6 100644 --- a/examples/autoplug/autoplug.c +++ b/examples/autoplug/autoplug.c @@ -1,6 +1,13 @@ #include #include +static void +autoplug_have_size (GstElement *element, guint width, guint height, + GtkWidget *socket) +{ + gtk_widget_set_usize(socket,width,height); +} + static void gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline) { @@ -26,7 +33,7 @@ gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline) gst_bin_remove (GST_BIN (autobin), typefind); /* and an audio sink */ - osssink = gst_elementfactory_make("osssink", "play_audio"); + osssink = gst_elementfactory_make("esdsink", "play_audio"); g_assert(osssink != NULL); /* and an video sink */ @@ -66,9 +73,13 @@ gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline) gtk_widget_realize (socket); gtk_socket_steal (GTK_SOCKET (socket), gst_util_get_int_arg (GTK_OBJECT (videosink), "xid")); + gtk_widget_set_usize(socket,320,240); gtk_widget_show_all (appwindow); + gtk_signal_connect (GTK_OBJECT (videosink), "have_size", + GTK_SIGNAL_FUNC (autoplug_have_size), socket); + gst_element_set_state (pipeline, GST_STATE_PLAYING); xmlSaveFile("xmlTest.gst", gst_xml_write (GST_ELEMENT (pipeline))); diff --git a/tests/old/examples/autoplug/autoplug.c b/tests/old/examples/autoplug/autoplug.c index c65d0a5d37..dff37becf6 100644 --- a/tests/old/examples/autoplug/autoplug.c +++ b/tests/old/examples/autoplug/autoplug.c @@ -1,6 +1,13 @@ #include #include +static void +autoplug_have_size (GstElement *element, guint width, guint height, + GtkWidget *socket) +{ + gtk_widget_set_usize(socket,width,height); +} + static void gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline) { @@ -26,7 +33,7 @@ gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline) gst_bin_remove (GST_BIN (autobin), typefind); /* and an audio sink */ - osssink = gst_elementfactory_make("osssink", "play_audio"); + osssink = gst_elementfactory_make("esdsink", "play_audio"); g_assert(osssink != NULL); /* and an video sink */ @@ -66,9 +73,13 @@ gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline) gtk_widget_realize (socket); gtk_socket_steal (GTK_SOCKET (socket), gst_util_get_int_arg (GTK_OBJECT (videosink), "xid")); + gtk_widget_set_usize(socket,320,240); gtk_widget_show_all (appwindow); + gtk_signal_connect (GTK_OBJECT (videosink), "have_size", + GTK_SIGNAL_FUNC (autoplug_have_size), socket); + gst_element_set_state (pipeline, GST_STATE_PLAYING); xmlSaveFile("xmlTest.gst", gst_xml_write (GST_ELEMENT (pipeline)));