mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-12 03:16:33 +00:00
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
This commit is contained in:
parent
d7e533b5ea
commit
a92336c672
2 changed files with 24 additions and 2 deletions
|
@ -1,6 +1,13 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gnome.h>
|
#include <gnome.h>
|
||||||
|
|
||||||
|
static void
|
||||||
|
autoplug_have_size (GstElement *element, guint width, guint height,
|
||||||
|
GtkWidget *socket)
|
||||||
|
{
|
||||||
|
gtk_widget_set_usize(socket,width,height);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline)
|
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);
|
gst_bin_remove (GST_BIN (autobin), typefind);
|
||||||
|
|
||||||
/* and an audio sink */
|
/* and an audio sink */
|
||||||
osssink = gst_elementfactory_make("osssink", "play_audio");
|
osssink = gst_elementfactory_make("esdsink", "play_audio");
|
||||||
g_assert(osssink != NULL);
|
g_assert(osssink != NULL);
|
||||||
|
|
||||||
/* and an video sink */
|
/* and an video sink */
|
||||||
|
@ -66,9 +73,13 @@ gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline)
|
||||||
gtk_widget_realize (socket);
|
gtk_widget_realize (socket);
|
||||||
gtk_socket_steal (GTK_SOCKET (socket),
|
gtk_socket_steal (GTK_SOCKET (socket),
|
||||||
gst_util_get_int_arg (GTK_OBJECT (videosink), "xid"));
|
gst_util_get_int_arg (GTK_OBJECT (videosink), "xid"));
|
||||||
|
gtk_widget_set_usize(socket,320,240);
|
||||||
|
|
||||||
gtk_widget_show_all (appwindow);
|
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);
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
|
|
||||||
xmlSaveFile("xmlTest.gst", gst_xml_write (GST_ELEMENT (pipeline)));
|
xmlSaveFile("xmlTest.gst", gst_xml_write (GST_ELEMENT (pipeline)));
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gnome.h>
|
#include <gnome.h>
|
||||||
|
|
||||||
|
static void
|
||||||
|
autoplug_have_size (GstElement *element, guint width, guint height,
|
||||||
|
GtkWidget *socket)
|
||||||
|
{
|
||||||
|
gtk_widget_set_usize(socket,width,height);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline)
|
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);
|
gst_bin_remove (GST_BIN (autobin), typefind);
|
||||||
|
|
||||||
/* and an audio sink */
|
/* and an audio sink */
|
||||||
osssink = gst_elementfactory_make("osssink", "play_audio");
|
osssink = gst_elementfactory_make("esdsink", "play_audio");
|
||||||
g_assert(osssink != NULL);
|
g_assert(osssink != NULL);
|
||||||
|
|
||||||
/* and an video sink */
|
/* and an video sink */
|
||||||
|
@ -66,9 +73,13 @@ gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline)
|
||||||
gtk_widget_realize (socket);
|
gtk_widget_realize (socket);
|
||||||
gtk_socket_steal (GTK_SOCKET (socket),
|
gtk_socket_steal (GTK_SOCKET (socket),
|
||||||
gst_util_get_int_arg (GTK_OBJECT (videosink), "xid"));
|
gst_util_get_int_arg (GTK_OBJECT (videosink), "xid"));
|
||||||
|
gtk_widget_set_usize(socket,320,240);
|
||||||
|
|
||||||
gtk_widget_show_all (appwindow);
|
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);
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
|
|
||||||
xmlSaveFile("xmlTest.gst", gst_xml_write (GST_ELEMENT (pipeline)));
|
xmlSaveFile("xmlTest.gst", gst_xml_write (GST_ELEMENT (pipeline)));
|
||||||
|
|
Loading…
Reference in a new issue