diff options
| author | Wim Taymans <wim.taymans@gmail.com> | 2002-01-06 19:30:09 +0000 | 
|---|---|---|
| committer | Wim Taymans <wim.taymans@gmail.com> | 2002-01-06 19:30:09 +0000 | 
| commit | 6dd422d76824c65c1f6e55d6b38d187f3dc95065 (patch) | |
| tree | 2e8d9aa936d27598eb91eb02d5ec7b51607bffa6 | |
| parent | 07931530900cd98bbcf6e2c2b4529ae37b435631 (diff) | |
Added a check for sidplay
Original commit message from CVS:
Added a check for sidplay
Added a capsfilter example
| -rw-r--r-- | configure.ac | 5 | ||||
| -rw-r--r-- | examples/capsfilter/Makefile.am | 6 | ||||
| -rw-r--r-- | examples/capsfilter/capsfilter1.c | 90 | 
3 files changed, 100 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 29e0aeeb..f9a0c04d 100644 --- a/configure.ac +++ b/configure.ac @@ -570,8 +570,10 @@ dnl *** sidplay ***  dnl FIXME : make this work  translit(dnm, m, l) AM_CONDITIONAL(USE_SIDPLAY, true)  GST_CHECK_FEATURE(SIDPLAY, [sidplay plugin], sidplay, [ -  GST_CHECK_LIBHEADER(SIDPLAY, sidplay, sidTune(), ,sidplay/sidtune.h,SIDPLAY_LIBS="-lsidplay") +  AC_LANG_PUSH(C++) +  AC_CHECK_HEADER(sidplay/sidtune.h, SIDPLAY_LIBS="-lsidplay", )    AC_SUBST(SIDPLAY_LIBS) +  AC_LANG_POP()  ])  dnl *** smoothwave *** @@ -1011,6 +1013,7 @@ sys/v4l/Makefile  sys/vcd/Makefile  sys/vga/Makefile  sys/xvideo/Makefile +examples/capsfilter/Makefile  ext/Makefile  ext/a52dec/Makefile  ext/aalib/Makefile diff --git a/examples/capsfilter/Makefile.am b/examples/capsfilter/Makefile.am new file mode 100644 index 00000000..f8562fee --- /dev/null +++ b/examples/capsfilter/Makefile.am @@ -0,0 +1,6 @@ +noinst_PROGRAMS = capsfilter1 + +LDADD = $(GST_LIBS) +AM_CFLAGS = $(GST_CFLAGS) + + diff --git a/examples/capsfilter/capsfilter1.c b/examples/capsfilter/capsfilter1.c new file mode 100644 index 00000000..ab6f4a09 --- /dev/null +++ b/examples/capsfilter/capsfilter1.c @@ -0,0 +1,90 @@ +#include <gst/gst.h> + +/* This app uses a filter to connect colorspace and videosink + * so that only RGB data can pass the connection, colorspace will use + * a converter to convert the I420 data to RGB. Without a filter, this + * connection would use the I420 format (assuming Xv is enabled) */ + +static void +new_pad_func (GstElement *element, GstPad *newpad, gpointer data) +{ +  GstElement *pipeline = (GstElement *) data; +  GstElement *queue = gst_bin_get_by_name (GST_BIN (pipeline), "queue"); + +  if (!strcmp (gst_pad_get_name (newpad), "video_00")) { +    gst_element_set_state (pipeline, GST_STATE_PAUSED); +    gst_pad_connect (newpad, gst_element_get_pad (queue, "sink")); +    gst_element_set_state (pipeline, GST_STATE_PLAYING); +  } +} + +gint +main (gint argc, gchar *argv[]) +{ +  GstElement *pipeline; +  GstElement *filesrc; +  GstElement *demux; +  GstElement *thread; +  GstElement *queue; +  GstElement *mpeg2dec; +  GstElement *colorspace; +  GstElement *xvideosink; +  gboolean res; + +  gst_init (&argc, &argv); + +  if (argc < 2) { +    g_print ("usage: %s <mpeg1 system stream>\n", argv[0]); +    return (-1); +  } + +  pipeline = gst_pipeline_new ("main_pipeline"); +  filesrc = gst_elementfactory_make ("filesrc", "filesrc"); +  g_return_val_if_fail (filesrc, -1); +  g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); +  demux = gst_elementfactory_make ("mpegdemux", "demux"); +  g_return_val_if_fail (demux, -1); +  g_signal_connect (G_OBJECT (demux), "new_pad", G_CALLBACK (new_pad_func), pipeline); + +  thread = gst_thread_new ("thread"); +  queue = gst_elementfactory_make ("queue", "queue"); +  mpeg2dec = gst_elementfactory_make ("mpeg2dec", "mpeg2dec"); +  g_return_val_if_fail (mpeg2dec, -1); +  colorspace = gst_elementfactory_make ("colorspace", "colorspace"); +  g_return_val_if_fail (colorspace, -1); +  xvideosink = gst_elementfactory_make ("xvideosink", "xvideosink"); +  g_return_val_if_fail (xvideosink, -1); +  g_object_set (G_OBJECT (xvideosink), "toplevel", TRUE, NULL); + +  gst_bin_add (GST_BIN (pipeline), filesrc); +  gst_bin_add (GST_BIN (pipeline), demux); +   +  gst_bin_add (GST_BIN (thread), queue); +  gst_bin_add (GST_BIN (thread), mpeg2dec); +  gst_bin_add (GST_BIN (thread), colorspace); +  gst_bin_add (GST_BIN (thread), xvideosink); +  gst_bin_add (GST_BIN (pipeline), thread); + +  gst_element_connect (filesrc, "src", demux, "sink"); +  gst_element_connect (queue, "src", mpeg2dec, "sink"); +  gst_element_connect (mpeg2dec, "src", colorspace, "sink"); +  /* force RGB data passing between colorspace and xvideosink */ +  res = gst_element_connect_filtered (colorspace, "src", xvideosink, "sink", +		        GST_CAPS_NEW ( +			  "filtercaps", +			  "video/raw", +			    "format",  GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB ")) +			)); +  if (!res) { +    g_print ("could not connect colorspace and xvideosink\n"); +    return -1; +  } + +  gst_element_set_state (pipeline, GST_STATE_PLAYING); + +  while (gst_bin_iterate (GST_BIN (pipeline))); +   +  gst_element_set_state (pipeline, GST_STATE_NULL); + +  return 0; +}  | 
