2005-01-09 14:53:59 +00:00
|
|
|
/*
|
|
|
|
* Sample app for element embedding.
|
|
|
|
*/
|
|
|
|
|
configure.ac: Put DEFAULT_AUDIOSINK in config.h and use whereever possible. (Fixes #165997)
Original commit message from CVS:
* configure.ac: Put DEFAULT_AUDIOSINK in config.h and use
whereever possible. (Fixes #165997)
* examples/capsfilter/capsfilter1.c: (main):
* examples/dynparams/filter.c: (create_ui):
* examples/seeking/cdparanoia.c: (get_track_info), (main):
* examples/seeking/chained.c: (main):
* examples/seeking/seek.c: (make_mod_pipeline), (make_dv_pipeline),
(make_wav_pipeline), (make_flac_pipeline), (make_sid_pipeline),
(make_vorbis_pipeline), (make_mp3_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline):
* examples/seeking/spider_seek.c: (make_spider_pipeline):
* examples/switch/switcher.c: (main):
* ext/dv/demo-play.c: (main):
* ext/faad/gstfaad.c: (gst_faad_change_state):
* ext/mad/gstmad.c: (gst_mad_chain):
* ext/smoothwave/demo-osssrc.c: (main):
* gst-libs/gst/gconf/gconf.c: (gst_gconf_set_string),
(gst_gconf_render_bin_from_description),
(gst_gconf_get_default_audio_sink),
(gst_gconf_get_default_video_sink),
(gst_gconf_get_default_audio_src),
(gst_gconf_get_default_video_src),
(gst_gconf_get_default_visualization_element):
* gst/level/demo.c: (main):
* gst/level/plot.c: (main):
* gst/playback/gstplaybin.c: (gen_video_element),
(gen_audio_element):
* gst/playback/test.c: (gen_video_element), (gen_audio_element):
* gst/playondemand/demo-mp3.c: (setup_pipeline):
* gst/sine/demo-dparams.c: (main):
* gst/spectrum/demo-osssrc.c: (main):
* gst/speed/demo-mp3.c: (main):
* gst/volume/demo.c: (main):
* testsuite/embed/embed.c: (main):
2005-02-02 08:14:01 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2002-11-20 09:04:43 +00:00
|
|
|
#include <gst/gst.h>
|
2005-01-09 14:53:59 +00:00
|
|
|
#include <gst/xoverlay/xoverlay.h>
|
2002-11-20 09:04:43 +00:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include <gdk/gdkx.h>
|
|
|
|
|
2005-01-09 14:53:59 +00:00
|
|
|
static void
|
|
|
|
cb_expose (GtkWidget * w, GdkEventExpose * ev, GstElement * e)
|
2002-11-20 09:04:43 +00:00
|
|
|
{
|
2005-01-09 14:53:59 +00:00
|
|
|
if (GST_IS_X_OVERLAY (e) &&
|
|
|
|
!GTK_WIDGET_NO_WINDOW (w) && GTK_WIDGET_REALIZED (w)) {
|
|
|
|
gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (e),
|
|
|
|
GDK_WINDOW_XWINDOW (w->window));
|
2004-03-14 22:34:34 +00:00
|
|
|
}
|
2002-11-20 09:04:43 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
2002-11-20 09:04:43 +00:00
|
|
|
{
|
2005-01-09 14:53:59 +00:00
|
|
|
GtkWidget *window, *content;
|
|
|
|
GstElement *testsrc, *csp, *videosink, *pipeline;
|
2002-11-20 09:04:43 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
gtk_init (&argc, &argv);
|
|
|
|
gst_init (&argc, &argv);
|
2002-11-20 09:04:43 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
pipeline = gst_element_factory_make ("pipeline", NULL);
|
|
|
|
testsrc = gst_element_factory_make ("videotestsrc", NULL);
|
2005-01-09 14:53:59 +00:00
|
|
|
csp = gst_element_factory_make ("ffmpegcolorspace", NULL);
|
configure.ac: Put DEFAULT_AUDIOSINK in config.h and use whereever possible. (Fixes #165997)
Original commit message from CVS:
* configure.ac: Put DEFAULT_AUDIOSINK in config.h and use
whereever possible. (Fixes #165997)
* examples/capsfilter/capsfilter1.c: (main):
* examples/dynparams/filter.c: (create_ui):
* examples/seeking/cdparanoia.c: (get_track_info), (main):
* examples/seeking/chained.c: (main):
* examples/seeking/seek.c: (make_mod_pipeline), (make_dv_pipeline),
(make_wav_pipeline), (make_flac_pipeline), (make_sid_pipeline),
(make_vorbis_pipeline), (make_mp3_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline):
* examples/seeking/spider_seek.c: (make_spider_pipeline):
* examples/switch/switcher.c: (main):
* ext/dv/demo-play.c: (main):
* ext/faad/gstfaad.c: (gst_faad_change_state):
* ext/mad/gstmad.c: (gst_mad_chain):
* ext/smoothwave/demo-osssrc.c: (main):
* gst-libs/gst/gconf/gconf.c: (gst_gconf_set_string),
(gst_gconf_render_bin_from_description),
(gst_gconf_get_default_audio_sink),
(gst_gconf_get_default_video_sink),
(gst_gconf_get_default_audio_src),
(gst_gconf_get_default_video_src),
(gst_gconf_get_default_visualization_element):
* gst/level/demo.c: (main):
* gst/level/plot.c: (main):
* gst/playback/gstplaybin.c: (gen_video_element),
(gen_audio_element):
* gst/playback/test.c: (gen_video_element), (gen_audio_element):
* gst/playondemand/demo-mp3.c: (setup_pipeline):
* gst/sine/demo-dparams.c: (main):
* gst/spectrum/demo-osssrc.c: (main):
* gst/speed/demo-mp3.c: (main):
* gst/volume/demo.c: (main):
* testsuite/embed/embed.c: (main):
2005-02-02 08:14:01 +00:00
|
|
|
videosink = gst_element_factory_make (DEFAULT_VIDEOSINK, NULL);
|
2002-11-20 09:04:43 +00:00
|
|
|
|
2005-01-09 14:53:59 +00:00
|
|
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
|
|
|
gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);
|
|
|
|
gtk_window_set_title (GTK_WINDOW (window), "My application");
|
|
|
|
content = gtk_event_box_new ();
|
|
|
|
gtk_container_add (GTK_CONTAINER (window), content);
|
|
|
|
g_signal_connect (content, "expose-event", G_CALLBACK (cb_expose), videosink);
|
|
|
|
gtk_widget_show_all (window);
|
2002-11-20 09:04:43 +00:00
|
|
|
|
2005-01-09 14:53:59 +00:00
|
|
|
gst_bin_add_many (GST_BIN (pipeline), testsrc, csp, videosink, NULL);
|
|
|
|
gst_element_link_many (testsrc, csp, videosink, NULL);
|
2002-11-20 09:04:43 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
g_idle_add ((GSourceFunc) gst_bin_iterate, pipeline);
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
2002-11-20 09:04:43 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
gtk_main ();
|
2002-11-20 09:04:43 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
return 0;
|
2002-11-20 09:04:43 +00:00
|
|
|
}
|