mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 06:16:36 +00:00
59e2b0fcd5
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):
107 lines
2.8 KiB
C
107 lines
2.8 KiB
C
#ifdef HAVE_CONFIG_H
|
|
#include "config.h"
|
|
#endif
|
|
#include <stdlib.h>
|
|
#include <gst/gst.h>
|
|
#include <string.h>
|
|
|
|
static GstElement *bin;
|
|
|
|
static void
|
|
unlinked (GstPad * pad, GstPad * peerpad, GstElement * pipeline)
|
|
{
|
|
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
|
gst_bin_remove (GST_BIN (pipeline), bin);
|
|
gst_element_set_state (bin, GST_STATE_READY);
|
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
}
|
|
|
|
static void
|
|
new_pad (GstElement * elem, GstPad * newpad, GstElement * pipeline)
|
|
{
|
|
GstScheduler *sched;
|
|
GstClock *clock;
|
|
|
|
g_print ("new pad %s\n", gst_pad_get_name (newpad));
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
|
gst_bin_add (GST_BIN (pipeline), bin);
|
|
|
|
sched = gst_element_get_scheduler (GST_ELEMENT (pipeline));
|
|
clock = gst_scheduler_get_clock (sched);
|
|
gst_scheduler_set_clock (sched, clock);
|
|
|
|
gst_pad_link (newpad, gst_element_get_pad (bin, "sink"));
|
|
|
|
g_signal_connect (G_OBJECT (newpad), "unlinked", G_CALLBACK (unlinked),
|
|
pipeline);
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
}
|
|
|
|
int
|
|
main (int argc, char **argv)
|
|
{
|
|
GstElement *pipeline;
|
|
GstElement *filesrc;
|
|
GstElement *oggdemux;
|
|
GstElement *vorbisdec;
|
|
GstElement *audioconvert;
|
|
GstElement *audiosink;
|
|
|
|
gst_init (&argc, &argv);
|
|
|
|
if (argc < 2) {
|
|
g_print ("usage: %s <oggfile>\n", argv[0]);
|
|
return (-1);
|
|
}
|
|
|
|
pipeline = gst_pipeline_new ("pipeline");
|
|
|
|
filesrc = gst_element_factory_make ("filesrc", "filesrc");
|
|
g_assert (filesrc);
|
|
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
|
|
|
|
oggdemux = gst_element_factory_make ("oggdemux", "oggdemux");
|
|
g_assert (oggdemux);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), filesrc);
|
|
gst_bin_add (GST_BIN (pipeline), oggdemux);
|
|
|
|
gst_element_link_pads (filesrc, "src", oggdemux, "sink");
|
|
|
|
g_signal_connect (G_OBJECT (oggdemux), "new_pad", G_CALLBACK (new_pad),
|
|
pipeline);
|
|
|
|
bin = gst_bin_new ("bin");
|
|
vorbisdec = gst_element_factory_make ("vorbisdec", "vorbisdec");
|
|
g_assert (vorbisdec);
|
|
audioconvert = gst_element_factory_make ("audioconvert", "audioconvert");
|
|
g_assert (audioconvert);
|
|
audiosink = gst_element_factory_make (DEFAULT_AUDIOSINK, DEFAULT_AUDIOSINK);
|
|
g_assert (audiosink);
|
|
gst_bin_add (GST_BIN (bin), vorbisdec);
|
|
gst_bin_add (GST_BIN (bin), audioconvert);
|
|
gst_bin_add (GST_BIN (bin), audiosink);
|
|
|
|
gst_element_link_pads (vorbisdec, "src", audioconvert, "sink");
|
|
gst_element_link_pads (audioconvert, "src", audiosink, "sink");
|
|
|
|
gst_element_add_ghost_pad (bin, gst_element_get_pad (vorbisdec, "sink"),
|
|
"sink");
|
|
|
|
g_object_ref (G_OBJECT (bin));
|
|
|
|
g_signal_connect (pipeline, "deep_notify",
|
|
G_CALLBACK (gst_element_default_deep_notify), NULL);
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
|
|
while (gst_bin_iterate (GST_BIN (pipeline)))
|
|
/* nop */ ;
|
|
|
|
/* stop probe */
|
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
|
|
return 0;
|
|
}
|