This is a megapatch with the following changes:
[platform/upstream/gstreamer.git] / test / record.c
1 #include <sys/types.h>
2 #include <sys/stat.h>
3 #include <fcntl.h>
4 #include <glib.h>
5 #include <gst/gst.h>
6
7 int main(int argc,char *argv[]) {
8   int fd;
9   GstElement *pipeline, *audiosrc, *fdsink;
10   GstElementFactory *audiosrcfactory, *fdsinkfactory;
11   GList *padlist;
12
13   gst_init(&argc,&argv);
14
15   pipeline = GST_ELEMENT(gst_pipeline_new("pipeline"));
16
17   audiosrcfactory = gst_elementfactory_find("audiosrc");
18   audiosrc = gst_elementfactory_create(audiosrcfactory,"audiosrc");
19
20   fd = open(argv[1],O_CREAT|O_RDWR);
21
22   fdsinkfactory = gst_elementfactory_find("fdsink");
23   fdsink = gst_elementfactory_create(fdsinkfactory,"fdsink");
24   gtk_object_set(GTK_OBJECT(fdsink),"fd",fd,NULL);
25
26   /* add objects to the main pipeline */
27   gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(audiosrc));
28   gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(fdsink));
29
30   /* connect src to sink */
31   gst_pad_connect(gst_element_get_pad(audiosrc,"src"),
32                   gst_element_get_pad(fdsink,"sink"));
33
34   g_print("\nok, runnable, hitting 'play'...\n");
35   gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
36
37   while(1) {
38     gst_bin_iterate(GST_BIN(pipeline));
39   }
40 }
41