Commit 7ade3221 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller
Browse files

Remove a few old example apps from the 0.8 days

Some have been replaced by newer ones, others are demoing elements that
don't exist any longer (not in -good anyway), and others have not been
touched in many years and it seem pointless to keep them around.

Removing these files makes sure we don't have any code in our repository
that uses Gtk+ symbols which are to be removed for GNOME3, and as such
will make some script that greps for this kind of stuff give us a clean
bill of code health. Fixes #585757.
parent 4c782db8
#include <gnome.h>
#include <gst/gst.h>
static gboolean
idle_func (gpointer data)
{
gst_bin_iterate (GST_BIN (data));
return TRUE;
}
int
main (int argc, char *argv[])
{
GstElement *bin;
GstElement *src;
GstElement *dvdec;
/*GstElement *cspace; */
GstElement *deint;
GstElement *videosink;
GtkWidget *appwindow;
GtkWidget *vbox1;
GtkWidget *button;
guint32 draw;
GtkWidget *gtk_socket;
gst_init (&argc, &argv);
gnome_init ("Videotest", "0.0.1", argc, argv);
bin = gst_pipeline_new ("pipeline");
if (argc == 1) {
src = gst_element_factory_make ("dv1394src", "src");
} else {
src = gst_element_factory_make ("filesrc", "src");
g_object_set (G_OBJECT (src), "location", argv[1], "bytesperread", 480,
NULL);
}
dvdec = gst_element_factory_make ("dvdec", "decoder");
if (!dvdec)
fprintf (stderr, "no dvdec\n"), exit (1);
/* cspace = gst_element_factory_make ("colorspace", "cspace"); */
deint = gst_element_factory_make ("deinterlace", "deinterlace");
videosink = gst_element_factory_make (DEFAULT_VIDEOSINK, "videosink");
if (!videosink)
fprintf (stderr, "no dvdec\n"), exit (1);
g_object_set (G_OBJECT (videosink), "width", 720, "height", 576, NULL);
gst_bin_add (GST_BIN (bin), GST_ELEMENT (src));
gst_bin_add (GST_BIN (bin), GST_ELEMENT (dvdec));
/* gst_bin_add(GST_BIN(bin),GST_ELEMENT(cspace)); */
gst_bin_add (GST_BIN (bin), GST_ELEMENT (videosink));
gst_element_link (src, "src", dvdec, "sink");
/* gst_element_link(cspace,"src",videosink,"sink"); */
/* gst_element_link(dvdec,"video",cspace,"sink"); */
gst_element_link (dvdec, "video", deint, "sink");
gst_element_link (deint, "src", videosink, "sink");
appwindow = gnome_app_new ("Videotest", "Videotest");
vbox1 = gtk_vbox_new (FALSE, 0);
gtk_widget_show (vbox1);
button = gtk_button_new_with_label ("test");
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (vbox1), button, FALSE, FALSE, 0);
draw = gst_util_get_int_arg (GTK_OBJECT (videosink), "xid"),
gtk_socket = gtk_socket_new ();
gtk_widget_set_usize (gtk_socket, 720, 576);
gtk_widget_show (gtk_socket);
gnome_app_set_contents (GNOME_APP (appwindow), vbox1);
gtk_box_pack_start (GTK_BOX (vbox1), GTK_WIDGET (gtk_socket), TRUE, TRUE, 0);
gtk_widget_realize (gtk_socket);
gtk_socket_steal (GTK_SOCKET (gtk_socket), draw);
gtk_object_set (GTK_OBJECT (appwindow), "allow_grow", TRUE, NULL);
gtk_object_set (GTK_OBJECT (appwindow), "allow_shrink", TRUE, NULL);
gtk_widget_show_all (appwindow);
#ifndef GST_DISABLE_LOADSAVE
xmlSaveFile ("dvshow.xml", gst_xml_write (GST_ELEMENT (bin)));
#endif
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING);
g_idle_add (idle_func, bin);
gtk_main ();
exit (0);
}
if HAVE_GTK
GTK_SUBDIRS=dynparams level $(FT2_SUBDIRS)
else
GTK_SUBDIRS=
endif
if USE_GCONF
GCONF_SUBDIRS=gstplay
else
GCONF_SUBDIRS=
endif
SUBDIRS=$(GTK_SUBDIRS) $(GCONF_SUBDIRS) switch
DIST_SUBDIRS=capsfilter dynparams indexing gstplay switch level
noinst_PROGRAMS = demo plot
demo_SOURCES = demo.c
demo_CFLAGS = $(GTK_CFLAGS) $(GST_CFLAGS)
demo_LDFLAGS = $(GTK_LIBS) $(GST_LIBS)
plot_SOURCES = plot.c
plot_CFLAGS = $(GTK_CFLAGS) $(GST_CFLAGS)
plot_LDFLAGS = $(GTK_LIBS) $(GST_LIBS)
EXTRA_DIST = README
level plugin by thomas <thomas@apestaart.org>
this plugin signals:
- running time since last EOS/start
- channel
- RMS level
- peak level
- decaying peak level
over the given interval.
This is useful for a VU meter display and for plotting out the signal graph.
The VU meter can either display RMS, or display immediate peak level and
have the falloff decaying peak level displayed as a line.
The interval for signal emission, ttl of decay peak, and falloff of decay peak
can all be set.
The element only takes unsigned data in; it could be extended to signed as
well, if separate fast chain functions are made that displaces the incoming
data to its midpoint (ie, 0,65535 should be mapped to -32768, 32767)
There are two demo apps, apps and plot. apps will create some GTK sliders
to display the volume. plot will output data readable by gnuplot.
Here is a sample plot script to plot output of the plot command that was
stored to plot.dat
set xlabel "Seconds"
set ylabel "dB"
set yrange [-60:0]
plot 'plot.dat' using 1:2 title 'L RMS' with lines, \
'plot.dat' using 1:3 title 'L peak' with lines, \
'plot.dat' using 1:4 title 'L decay' with lines
plot 'plot.dat' using 1:5 title 'R RMS' with lines, \
'plot.dat' using 1:6 title 'R peak' with lines, \
'plot.dat' using 1:7 title 'R decay' with lines
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* demo.c: sample application to display VU meter-like output of level
* Copyright (C) 2003
* Thomas Vander Stichele <thomas at apestaart dot org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
#include <gtk/gtk.h>
/* global array for the scale widgets, we'll assume stereo */
GtkWidget *elapsed;
GtkWidget *scale[2][3];
static void
level_callback (GstElement * element, gdouble time, gint channel,
gdouble rms, gdouble peak, gdouble decay)
{
gchar *label;
label = g_strdup_printf ("%.3f", time);
gtk_label_set (GTK_LABEL (elapsed), label);
g_free (label);
gtk_range_set_value (GTK_RANGE (scale[channel][0]), rms);
gtk_range_set_value (GTK_RANGE (scale[channel][1]), peak);
gtk_range_set_value (GTK_RANGE (scale[channel][2]), decay);
}
static gboolean
idler (gpointer data)
{
GstElement *pipeline = GST_ELEMENT (data);
g_print ("+");
if (gst_bin_iterate (GST_BIN (pipeline)))
return TRUE;
gtk_main_quit ();
return FALSE;
}
static void
setup_gui ()
{
GtkWidget *window;
GtkWidget *vbox;
GtkWidget *label, *hbox;
int c;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "destroy", gtk_main_quit, NULL);
vbox = gtk_vbox_new (TRUE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
/* elapsed widget */
hbox = gtk_hbox_new (TRUE, 0);
label = gtk_label_new ("Elapsed");
elapsed = gtk_label_new ("0.000");
gtk_container_add (GTK_CONTAINER (hbox), label);
gtk_container_add (GTK_CONTAINER (hbox), elapsed);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
for (c = 0; c < 2; ++c) {
/* RMS */
hbox = gtk_hbox_new (TRUE, 0);
label = gtk_label_new ("RMS");
gtk_container_add (GTK_CONTAINER (hbox), label);
scale[c][0] = gtk_hscale_new_with_range (-90.0, 0.0, 0.2);
gtk_widget_set_size_request (scale[c][0], 100, -1);
gtk_container_add (GTK_CONTAINER (hbox), scale[c][0]);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
/* peak */
hbox = gtk_hbox_new (TRUE, 0);
label = gtk_label_new ("peak");
gtk_container_add (GTK_CONTAINER (hbox), label);
scale[c][1] = gtk_hscale_new_with_range (-90.0, 0.0, 0.2);
gtk_widget_set_size_request (scale[c][1], 100, -1);
gtk_container_add (GTK_CONTAINER (hbox), scale[c][1]);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
/* decay */
hbox = gtk_hbox_new (TRUE, 0);
label = gtk_label_new ("decaying peek");
gtk_container_add (GTK_CONTAINER (hbox), label);
scale[c][2] = gtk_hscale_new_with_range (-90.0, 0.0, 0.2);
gtk_widget_set_size_request (scale[c][2], 100, -1);
gtk_container_add (GTK_CONTAINER (hbox), scale[c][2]);
gtk_container_add (GTK_CONTAINER (vbox), hbox);
}
gtk_widget_show_all (GTK_WIDGET (window));
}
int
main (int argc, char *argv[])
{
GstElement *pipeline = NULL;
GError *error = NULL;
GstElement *level;
gst_init (&argc, &argv);
gtk_init (&argc, &argv);
pipeline = gst_parse_launchv ((const gchar **) &argv[1], &error);
if (error) {
g_print ("pipeline could not be constructed: %s\n", error->message);
g_print ("Please give a complete pipeline with a 'level' element.\n");
g_print ("Example: audiotestsrc ! level ! %s\n", DEFAULT_AUDIOSINK);
g_error_free (error);
return 1;
}
level = gst_bin_get_by_name (GST_BIN (pipeline), "level0");
if (level == NULL) {
g_print ("Please give a pipeline with a 'level' element in it\n");
return 1;
}
g_object_set (level, "signal", TRUE, NULL);
g_signal_connect (level, "level", G_CALLBACK (level_callback), NULL);
/* setup GUI */
setup_gui ();
/* connect level signal */
/* go to main loop */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_idle_add (idler, pipeline);
gtk_main ();
return 0;
}
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* plot.c: output data points to be graphed with gnuplot
* Copyright (C) 2003
* Thomas Vander Stichele <thomas at apestaart dot org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
#include <gtk/gtk.h>
gboolean got_channel[2] = { FALSE, FALSE }; /* to see if we got the signal for this one yet */
gint channels = 0; /* guess at how many channels there are */
gdouble last_time = 0.0; /* time of last signal */
gdouble values[2][3]; /* array of levels from which to print */
static void
level_callback (GstElement * element, gdouble time, gint channel,
gdouble rms, gdouble peak, gdouble decay)
{
int i = 0, j = 0;
gboolean got_all = FALSE;
if (channel + 1 > channels)
channels = channel + 1;
/* reset got_channel if this is a new time point */
if (time > last_time) {
for (i = 0; i < channels; ++i)
got_channel[i] = FALSE;
last_time = time;
}
/* store values */
got_channel[channel] = TRUE;
values[channel][0] = rms;
values[channel][1] = peak;
values[channel][2] = decay;
/* check if we have all channels, and output if we do */
/* FIXME: this fails on the first, no ? */
got_all = TRUE;
for (i = 0; i < channels; ++i)
if (!got_channel[i])
got_all = FALSE;
if (got_all) {
g_print ("%f ", time);
for (i = 0; i < channels; ++i)
for (j = 0; j < 3; ++j)
g_print ("%f ", values[i][j]);
g_print ("\n");
}
}
static gboolean
idler (gpointer data)
{
GstElement *pipeline = GST_ELEMENT (data);
if (gst_bin_iterate (GST_BIN (pipeline)))
return TRUE;
gtk_main_quit ();
return FALSE;
}
int
main (int argc, char *argv[])
{
GstElement *pipeline = NULL;
GError *error = NULL;
GstElement *level;
gst_init (&argc, &argv);
gtk_init (&argc, &argv);
pipeline = gst_parse_launchv ((const gchar **) &argv[1], &error);
if (error) {
g_print ("pipeline could not be constructed: %s\n", error->message);
g_print ("Please give a complete pipeline with a 'level' element.\n");
g_print ("Example: audiotestsrc ! level ! %s\n", DEFAULT_AUDIOSINK);
g_error_free (error);
return 1;
}
level = gst_bin_get_by_name (GST_BIN (pipeline), "level0");
if (level == NULL) {
g_print ("Please give a pipeline with a 'level' element in it\n");
return 1;
}
g_object_set (level, "signal", TRUE, NULL);
g_signal_connect (level, "level", G_CALLBACK (level_callback), NULL);
/* go to main loop */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_idle_add (idler, pipeline);
gtk_main ();
return 0;
}
noinst_PROGRAMS = switcher
switcher_SOURCES = switcher.c
switcher_CFLAGS = $(GST_CFLAGS)
switcher_LDFLAGS = $(GST_LIBS)
/* GStreamer
* Copyright (C) 2003 Julien Moutte <julien@moutte.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
static GMainLoop *loop = NULL;
static void
got_eos (GstElement * pipeline)
{
g_main_loop_quit (loop);
}
static gboolean
idle_iterate (GstElement * pipeline)
{
gst_bin_iterate (GST_BIN (pipeline));
return (GST_STATE (GST_ELEMENT (pipeline)) == GST_STATE_PLAYING);
}
static gboolean
switch_timer (GstElement * video_switch)
{
gint nb_sources, active_source;
g_object_get (G_OBJECT (video_switch), "nb_sources", &nb_sources, NULL);
g_object_get (G_OBJECT (video_switch), "active_source", &active_source, NULL);
active_source++;
if (active_source > nb_sources - 1)
active_source = 0;
g_object_set (G_OBJECT (video_switch), "active_source", active_source, NULL);
g_message ("current number of sources : %d, active source %d",
nb_sources, active_source);
return (GST_STATE (GST_ELEMENT (video_switch)) == GST_STATE_PLAYING);
}
int
main (int argc, char *argv[])
{
GstElement *pipeline, *src1, *src2, *video_switch, *video_sink;
/* Initing GStreamer library */
gst_init (&argc, &argv);
loop = g_main_loop_new (NULL, FALSE);
pipeline = gst_pipeline_new ("pipeline");
src1 = gst_element_factory_make ("videotestsrc", "src1");
g_object_set (G_OBJECT (src1), "pattern", 0, NULL);
src2 = gst_element_factory_make ("videotestsrc", "src2");
g_object_set (G_OBJECT (src2), "pattern", 1, NULL);
video_switch = gst_element_factory_make ("switch", "video_switch");
video_sink = gst_element_factory_make (DEFAULT_VIDEOSINK, "video_sink");
gst_bin_add_many (GST_BIN (pipeline), src1, src2, video_switch,
video_sink, NULL);
gst_element_link (src1, video_switch);
gst_element_link (src2, video_switch);
gst_element_link (video_switch, video_sink);
g_signal_connect (G_OBJECT (pipeline), "eos", G_CALLBACK (got_eos), NULL);
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
g_idle_add ((GSourceFunc) idle_iterate, pipeline);
g_timeout_add (2000, (GSourceFunc) switch_timer, video_switch);
g_main_loop_run (loop);
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY);
/* unref */
gst_object_unref (GST_OBJECT (pipeline));
exit (0);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment