2001-05-25 21:00:07 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
int main(int argc,char *argv[]) {
|
|
|
|
GstBin *pipeline, *thread;
|
2001-06-01 18:24:41 +00:00
|
|
|
GstElement *src, *sink;
|
2001-05-25 21:00:07 +00:00
|
|
|
|
|
|
|
gst_info_set_categories(-1);
|
|
|
|
gst_debug_set_categories(-1);
|
2001-05-26 05:26:47 +00:00
|
|
|
gst_init(&argc,&argv);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2001-06-01 18:24:41 +00:00
|
|
|
pipeline = GST_BIN (gst_pipeline_new("pipeline"));
|
|
|
|
thread = GST_BIN (gst_thread_new("thread"));
|
2001-05-25 21:00:07 +00:00
|
|
|
src = gst_elementfactory_make("fakesrc","src");
|
2001-06-25 01:20:11 +00:00
|
|
|
g_object_set(G_OBJECT(src),"silent",TRUE,NULL);
|
2001-05-25 21:00:07 +00:00
|
|
|
sink = gst_elementfactory_make("fakesink","sink");
|
2001-06-25 01:20:11 +00:00
|
|
|
g_object_set(G_OBJECT(sink),"silent",TRUE,NULL);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
|
|
|
fprintf(stderr,"ADDING src\n");
|
|
|
|
gst_bin_add(thread,src);
|
|
|
|
fprintf(stderr,"ADDING sink\n");
|
|
|
|
gst_bin_add(thread,sink);
|
|
|
|
fprintf(stderr,"CONNECTING src to sink\n");
|
|
|
|
gst_element_connect (src, "src", sink, "sink");
|
|
|
|
|
2001-05-26 05:19:33 +00:00
|
|
|
fprintf(stderr,"ADDING thread\n");
|
|
|
|
gst_bin_add(pipeline,GST_ELEMENT(thread));
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2001-05-26 05:19:33 +00:00
|
|
|
while (1) {
|
|
|
|
fprintf(stderr,"\nSWITCHING to PLAYING:\n");
|
2001-06-01 18:24:41 +00:00
|
|
|
gst_element_set_state (GST_ELEMENT (thread), GST_STATE_PLAYING);
|
2001-05-26 05:26:47 +00:00
|
|
|
sleep(1);
|
2001-05-26 05:19:33 +00:00
|
|
|
fprintf(stderr,"\nSWITCHING to PAUSED:\n");
|
2001-06-01 18:24:41 +00:00
|
|
|
gst_element_set_state (GST_ELEMENT (thread), GST_STATE_PAUSED);
|
2001-05-26 05:36:26 +00:00
|
|
|
// sleep(1);
|
2001-05-26 05:19:33 +00:00
|
|
|
}
|
2001-05-25 21:00:07 +00:00
|
|
|
}
|