summaryrefslogtreecommitdiff
path: root/test/xmmstest.c
blob: 3402d2832cee4c2194da872b3ad1ae019b8f4556 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <gnome.h>
#include <gst/gst.h>

extern gboolean _gst_plugin_spew;

gboolean idle_func(gpointer data);

GstElement *src;

int 
main (int argc,char *argv[]) 
{
  GstElement *bin;
  GstElement *effect;
  GstElement *audiosink;

  gst_init(&argc,&argv);

  bin = gst_bin_new("bin");

  //src = gst_elementfactory_make("XMMS_INPUT_mpeg_layer_1/2/3_player_1.2.4", "xmms_plugin");
  //src = gst_elementfactory_make("XMMS_INPUT_oggvorbis_player_0.1", "xmms_plugin");
  src = gst_elementfactory_make("XMMS_INPUT_mikmod_player_1.2.4", "xmms_plugin");
  //src = gst_elementfactory_make("XMMS_INPUT_tone_generator_1.2.4", "xmms_plugin");
  g_return_val_if_fail(src != NULL, -1);

  //effect = gst_elementfactory_make("XMMS_EFFECT_voice_removal_plugin_1.2.4", "xmms_effect");
  effect = gst_elementfactory_make("XMMS_EFFECT_extra_stereo_plugin_1.2.4", "xmms_effect");
  //effect = gst_elementfactory_make("XMMS_EFFECT_echo_plugin_1.2.4", "xmms_effect");
  g_return_val_if_fail(effect != NULL, -1);

  gtk_object_set (GTK_OBJECT (src), "location", argv[1], NULL);
  //gtk_object_set (GTK_OBJECT (src), "filename", "tone://1000", NULL);

  g_print ("Song Info (text:length): %s\n",gst_util_get_string_arg (GTK_OBJECT (src), "song_info"));
  //gtk_object_set (GTK_OBJECT (src), "show_about", TRUE, NULL);
  //gtk_object_set (GTK_OBJECT (src), "configure", TRUE, NULL);
  //gtk_object_set (GTK_OBJECT (src), "show_file_info", TRUE, NULL);

  audiosink = gst_elementfactory_make("audiosink", "audiosink");
  g_return_val_if_fail(audiosink != NULL, -1);

  gst_bin_add(GST_BIN(bin),GST_ELEMENT(src));
  gst_bin_add(GST_BIN(bin),GST_ELEMENT(effect));
  gst_bin_add(GST_BIN(bin),GST_ELEMENT(audiosink));

  gst_pad_connect(gst_element_get_pad(src,"src"),
                  gst_element_get_pad(effect,"sink"));
  gst_pad_connect(gst_element_get_pad(effect,"src"),
                  gst_element_get_pad(audiosink,"sink"));

  gst_element_set_state(GST_ELEMENT(bin),GST_STATE_PLAYING);

  g_idle_add(idle_func, bin);

  gtk_main();

  return 0;
}

gboolean 
idle_func (gpointer data) 
{
  gst_bin_iterate(GST_BIN(data));

  return TRUE;
}