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-01-04 21:33:45 +00:00
|
|
|
#include <stdio.h>
|
2002-03-04 18:56:24 +00:00
|
|
|
#include <string.h>
|
2002-01-04 21:33:45 +00:00
|
|
|
#include <math.h>
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <gst/control/control.h>
|
|
|
|
|
2002-03-04 18:56:24 +00:00
|
|
|
#define ZERO(mem) memset(&mem, 0, sizeof(mem))
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static gint
|
|
|
|
quit_live (GtkWidget * window, GdkEventAny * e, gpointer data)
|
gst/sine/demo-dparams.c: Use double dparams, not float.
Original commit message from CVS:
* gst/sine/demo-dparams.c: (quit_live),
(dynparm_log_value_changed), (dynparm_value_changed), (main):
Use double dparams, not float.
* gst/sine/gstsinesrc.c: (gst_sinesrc_class_init),
(gst_sinesrc_init): Change sync default to FALSE, since multiple
sync'd elements don't really work correctly.
* gst/volume/gstvolume.c: (volume_class_init), (volume_init),
(volume_update_volume), (volume_get_property): Change dparam
to double.
2004-02-19 01:45:01 +00:00
|
|
|
{
|
2004-03-14 22:34:34 +00:00
|
|
|
gtk_main_quit ();
|
2002-01-04 21:33:45 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static void
|
|
|
|
dynparm_log_value_changed (GtkAdjustment * adj, GstDParam * dparam)
|
gst/sine/demo-dparams.c: Use double dparams, not float.
Original commit message from CVS:
* gst/sine/demo-dparams.c: (quit_live),
(dynparm_log_value_changed), (dynparm_value_changed), (main):
Use double dparams, not float.
* gst/sine/gstsinesrc.c: (gst_sinesrc_class_init),
(gst_sinesrc_init): Change sync default to FALSE, since multiple
sync'd elements don't really work correctly.
* gst/volume/gstvolume.c: (volume_class_init), (volume_init),
(volume_update_volume), (volume_get_property): Change dparam
to double.
2004-02-19 01:45:01 +00:00
|
|
|
{
|
2004-02-14 02:41:51 +00:00
|
|
|
gdouble value;
|
2002-01-04 21:33:45 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
g_return_if_fail (dparam != NULL);
|
|
|
|
g_return_if_fail (GST_IS_DPARAM (dparam));
|
|
|
|
|
|
|
|
value = exp (adj->value);
|
|
|
|
|
|
|
|
g_print ("setting value to %f\n", value);
|
|
|
|
g_object_set (G_OBJECT (dparam), "value_double", value, NULL);
|
2002-01-04 21:33:45 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static void
|
|
|
|
dynparm_value_changed (GtkAdjustment * adj, GstDParam * dparam)
|
gst/sine/demo-dparams.c: Use double dparams, not float.
Original commit message from CVS:
* gst/sine/demo-dparams.c: (quit_live),
(dynparm_log_value_changed), (dynparm_value_changed), (main):
Use double dparams, not float.
* gst/sine/gstsinesrc.c: (gst_sinesrc_class_init),
(gst_sinesrc_init): Change sync default to FALSE, since multiple
sync'd elements don't really work correctly.
* gst/volume/gstvolume.c: (volume_class_init), (volume_init),
(volume_update_volume), (volume_get_property): Change dparam
to double.
2004-02-19 01:45:01 +00:00
|
|
|
{
|
2004-03-14 22:34:34 +00:00
|
|
|
g_return_if_fail (dparam != NULL);
|
|
|
|
g_return_if_fail (GST_IS_DPARAM (dparam));
|
2002-01-04 21:33:45 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
g_print ("setting value to %f\n", adj->value);
|
|
|
|
g_object_set (G_OBJECT (dparam), "value_double", (gdouble) adj->value, NULL);
|
2002-03-04 18:56:24 +00:00
|
|
|
|
2002-01-04 21:33:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
|
|
|
{
|
2002-01-04 21:33:45 +00:00
|
|
|
GtkWidget *window;
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkAdjustment *volume_adj;
|
|
|
|
GtkAdjustment *freq_adj;
|
|
|
|
GtkWidget *volume_slider;
|
|
|
|
GtkWidget *freq_slider;
|
|
|
|
|
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
|
|
|
GstElement *thread, *sinesrc, *volfilter, *audiosink;
|
2002-01-04 21:33:45 +00:00
|
|
|
GstDParamManager *dpman;
|
|
|
|
GstDParam *volume;
|
|
|
|
GstDParam *freq;
|
gst/sine/demo-dparams.c: Use double dparams, not float.
Original commit message from CVS:
* gst/sine/demo-dparams.c: (quit_live),
(dynparm_log_value_changed), (dynparm_value_changed), (main):
Use double dparams, not float.
* gst/sine/gstsinesrc.c: (gst_sinesrc_class_init),
(gst_sinesrc_init): Change sync default to FALSE, since multiple
sync'd elements don't really work correctly.
* gst/volume/gstvolume.c: (volume_class_init), (volume_init),
(volume_update_volume), (volume_get_property): Change dparam
to double.
2004-02-19 01:45:01 +00:00
|
|
|
GParamSpecDouble *spec;
|
2002-01-04 21:33:45 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
gtk_init (&argc, &argv);
|
|
|
|
gst_init (&argc, &argv);
|
|
|
|
gst_control_init (&argc, &argv);
|
2002-01-04 21:33:45 +00:00
|
|
|
|
|
|
|
/***** construct the pipeline *****/
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
g_print ("creating elements\n");
|
|
|
|
thread = gst_thread_new ("live-example");
|
|
|
|
sinesrc = gst_element_factory_make ("sinesrc", "sine-source");
|
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
|
|
|
audiosink = gst_element_factory_make (DEFAULT_AUDIOSINK, "sound-sink");
|
2004-03-14 22:34:34 +00:00
|
|
|
volfilter = gst_element_factory_make ("volume", "volume-filter");
|
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
|
|
|
gst_bin_add_many (GST_BIN (thread), sinesrc, volfilter, audiosink, NULL);
|
|
|
|
gst_element_link_many (sinesrc, volfilter, audiosink, NULL);
|
2002-05-05 15:46:05 +00:00
|
|
|
/* this breaks with current alsa oss compat lib */
|
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
|
|
|
g_object_set (G_OBJECT (audiosink), "fragment", 0x00180008, NULL);
|
|
|
|
g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
g_object_set (G_OBJECT (sinesrc), "samplesperbuffer", 1024, NULL);
|
2002-01-04 21:33:45 +00:00
|
|
|
|
|
|
|
/***** set up the GUI *****/
|
2004-03-14 22:34:34 +00:00
|
|
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
|
|
|
gtk_window_set_default_size (GTK_WINDOW (window), 80, 400);
|
|
|
|
g_signal_connect (window, "delete_event", GTK_SIGNAL_FUNC (quit_live), NULL);
|
|
|
|
hbox = gtk_hbox_new (TRUE, 0);
|
|
|
|
gtk_container_add (GTK_CONTAINER (window), hbox);
|
2002-01-04 21:33:45 +00:00
|
|
|
|
2002-05-05 15:46:05 +00:00
|
|
|
/***** set up the dparams *****/
|
2002-01-04 21:33:45 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
freq = gst_dpsmooth_new (G_TYPE_DOUBLE);
|
|
|
|
|
|
|
|
g_object_set (G_OBJECT (freq), "update_period", 2000000LL, NULL);
|
|
|
|
|
2002-05-05 15:46:05 +00:00
|
|
|
/* this defines the maximum slope that this *
|
2004-03-14 22:34:34 +00:00
|
|
|
* param can change. This says that in 50ms *
|
|
|
|
* the value can change by a maximum of one semitone *
|
|
|
|
* (the log of one semitone is 0.693) */
|
|
|
|
g_object_set (G_OBJECT (freq), "slope_delta_double", 0.693, NULL);
|
|
|
|
g_object_set (G_OBJECT (freq), "slope_time", 50000000LL, NULL);
|
|
|
|
|
2002-05-05 15:46:05 +00:00
|
|
|
dpman = gst_dpman_get_manager (sinesrc);
|
2004-08-03 14:28:12 +00:00
|
|
|
if (!gst_dpman_attach_dparam (dpman, "freq", freq))
|
|
|
|
g_assert_not_reached ();
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_dpman_set_mode (dpman, "asynchronous");
|
|
|
|
|
|
|
|
spec = (GParamSpecDouble *) gst_dpman_get_param_spec (dpman, "freq");
|
|
|
|
freq_adj = (GtkAdjustment *) gtk_adjustment_new (log (spec->default_value),
|
|
|
|
log (spec->minimum), log (spec->maximum), 0.1, 0.01, 0.01);
|
|
|
|
|
|
|
|
|
|
|
|
freq_slider = gtk_vscale_new (freq_adj);
|
|
|
|
gtk_scale_set_digits (GTK_SCALE (freq_slider), 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), freq_slider, TRUE, TRUE, 0);
|
|
|
|
|
|
|
|
volume = gst_dpsmooth_new (G_TYPE_DOUBLE);
|
|
|
|
|
|
|
|
g_object_set (G_OBJECT (volume), "update_period", 2000000LL, NULL);
|
|
|
|
|
2002-05-05 15:46:05 +00:00
|
|
|
/* this defines the maximum slope that this *
|
2004-03-14 22:34:34 +00:00
|
|
|
* param can change. This says that in 50ms *
|
|
|
|
* the value can change from 0.0 to 1.0 */
|
|
|
|
g_object_set (G_OBJECT (volume), "slope_delta_double", 0.1, NULL);
|
|
|
|
g_object_set (G_OBJECT (volume), "slope_time", 50000000LL, NULL);
|
|
|
|
|
2002-05-05 15:46:05 +00:00
|
|
|
dpman = gst_dpman_get_manager (volfilter);
|
2004-08-03 14:28:12 +00:00
|
|
|
if (!gst_dpman_attach_dparam (dpman, "volume", volume))
|
|
|
|
g_assert_not_reached ();
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_dpman_set_mode (dpman, "asynchronous");
|
|
|
|
|
|
|
|
g_object_set (G_OBJECT (volfilter), "mute", FALSE, NULL);
|
|
|
|
|
|
|
|
spec = (GParamSpecDouble *) gst_dpman_get_param_spec (dpman, "volume");
|
|
|
|
volume_adj =
|
|
|
|
(GtkAdjustment *) gtk_adjustment_new (spec->default_value, 0.0, 1.2, 0.1,
|
|
|
|
0.01, 0.01);
|
|
|
|
volume_slider = gtk_vscale_new (volume_adj);
|
|
|
|
gtk_scale_set_digits (GTK_SCALE (volume_slider), 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), volume_slider, TRUE, TRUE, 0);
|
|
|
|
|
2002-01-04 21:33:45 +00:00
|
|
|
/***** set up the handlers and such *****/
|
2002-03-19 04:10:06 +00:00
|
|
|
/*gtk_signal_connect(volume_adj,"value-changed",GTK_SIGNAL_FUNC(volume_changed),sinesrc); */
|
2004-03-14 22:34:34 +00:00
|
|
|
g_signal_connect (volume_adj, "value-changed",
|
|
|
|
GTK_SIGNAL_FUNC (dynparm_value_changed), volume);
|
|
|
|
|
|
|
|
g_signal_connect (freq_adj, "value-changed",
|
|
|
|
GTK_SIGNAL_FUNC (dynparm_log_value_changed), freq);
|
|
|
|
gtk_adjustment_value_changed (volume_adj);
|
|
|
|
gtk_adjustment_value_changed (freq_adj);
|
|
|
|
|
|
|
|
g_print ("starting pipeline\n");
|
|
|
|
|
2002-01-04 21:33:45 +00:00
|
|
|
/***** start everything up *****/
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_element_set_state (thread, GST_STATE_PLAYING);
|
|
|
|
|
2002-01-04 21:33:45 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
gtk_widget_show_all (window);
|
|
|
|
gtk_main ();
|
2002-01-04 21:33:45 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|