3 int main(int argc, char *argv[]) {
\r
4 GstElement *pipeline, *bin, *equalizer, *convert, *sink;
\r
5 GstPad *pad, *ghost_pad;
\r
9 /* Initialize GStreamer */
\r
10 gst_init (&argc, &argv);
\r
12 /* Build the pipeline */
\r
13 pipeline = gst_parse_launch ("playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm", NULL);
\r
15 /* Create the elements inside the sink bin */
\r
16 equalizer = gst_element_factory_make ("equalizer-3bands", "equalizer");
\r
17 convert = gst_element_factory_make ("audioconvert", "convert");
\r
18 sink = gst_element_factory_make ("autoaudiosink", "audio_sink");
\r
19 if (!equalizer || !convert || !sink) {
\r
20 g_printerr ("Not all elements could be created.\n");
\r
24 /* Create the sink bin, add the elements and link them */
\r
25 bin = gst_bin_new ("audio_sink_bin");
\r
26 gst_bin_add_many (GST_BIN (bin), equalizer, convert, sink, NULL);
\r
27 gst_element_link_many (equalizer, convert, sink, NULL);
\r
28 pad = gst_element_get_static_pad (equalizer, "sink");
\r
29 ghost_pad = gst_ghost_pad_new ("sink", pad);
\r
30 gst_pad_set_active (ghost_pad, TRUE);
\r
31 gst_element_add_pad (bin, ghost_pad);
\r
32 gst_object_unref (pad);
\r
34 /* Configure the equalizer */
\r
35 g_object_set (G_OBJECT (equalizer), "band1", (gdouble)-24.0, NULL);
\r
36 g_object_set (G_OBJECT (equalizer), "band2", (gdouble)-24.0, NULL);
\r
38 /* Set playbin2's audio sink to be our sink bin */
\r
39 g_object_set (GST_OBJECT (pipeline), "audio-sink", bin, NULL);
\r
42 gst_element_set_state (pipeline, GST_STATE_PLAYING);
\r
44 /* Wait until error or EOS */
\r
45 bus = gst_element_get_bus (pipeline);
\r
46 msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, GST_MESSAGE_ERROR | GST_MESSAGE_EOS);
\r
48 /* Free resources */
\r
50 gst_message_unref (msg);
\r
51 gst_object_unref (bus);
\r
52 gst_element_set_state (pipeline, GST_STATE_NULL);
\r
53 gst_object_unref (pipeline);
\r