Added a check for sidplay

Original commit message from CVS:
Added a check for sidplay
Added a capsfilter example
This commit is contained in:
Wim Taymans 2002-01-06 19:30:09 +00:00
parent dea4419a80
commit d13417cfa2
3 changed files with 100 additions and 1 deletions

View file

@ -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

View file

@ -0,0 +1,6 @@
noinst_PROGRAMS = capsfilter1
LDADD = $(GST_LIBS)
AM_CFLAGS = $(GST_CFLAGS)

View file

@ -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;
}