mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-05-03 06:54:47 +00:00
added threadlock test
Original commit message from CVS: added threadlock test
This commit is contained in:
parent
8fc64053fc
commit
4f74cacc80
2 changed files with 36 additions and 2 deletions
|
@ -1,8 +1,8 @@
|
|||
SUBDIRS = sched eos
|
||||
SUBDIRS = sched eos
|
||||
|
||||
noinst_PROGRAMS = init loadall simplefake states caps queue registry \
|
||||
paranoia rip mp3encode autoplug props case4 markup load tee incsched \
|
||||
reaping
|
||||
reaping threadlock
|
||||
|
||||
# we have nothing but apps here, we can do this safely
|
||||
LIBS += $(GST_LIBS)
|
||||
|
|
34
tests/threadlock.c
Normal file
34
tests/threadlock.c
Normal file
|
@ -0,0 +1,34 @@
|
|||
#include <stdio.h>
|
||||
#include <gst/gst.h>
|
||||
|
||||
int main(int argc,char *argv[]) {
|
||||
GstBin *pipeline, *thread;
|
||||
GstElement *src, *queue1, *sink;
|
||||
|
||||
gst_init(&argc,&argv);
|
||||
gst_info_set_categories(-1);
|
||||
gst_debug_set_categories(-1);
|
||||
|
||||
pipeline = gst_pipeline_new("pipeline");
|
||||
thread = gst_thread_new("thread");
|
||||
src = gst_elementfactory_make("fakesrc","src");
|
||||
queue1 = gst_elementfactory_make("queue","queue");
|
||||
sink = gst_elementfactory_make("fakesink","sink");
|
||||
|
||||
gst_bin_add(pipeline,src);
|
||||
gst_bin_add(pipeline,queue1);
|
||||
gst_bin_add(pipeline,GST_ELEMENT(thread));
|
||||
gst_bin_add(thread,sink);
|
||||
|
||||
gst_element_add_ghost_pad(GST_ELEMENT(thread),gst_element_get_pad(sink,"sink"),"sink");
|
||||
|
||||
gst_element_connect (src,"src",queue1,"sink");
|
||||
gst_element_connect (queue1, "src", thread, "sink");
|
||||
|
||||
while (1) {
|
||||
fprintf(stderr,"SWITCHING TO READY:\n");
|
||||
gst_element_set_state (pipeline, GST_STATE_READY);
|
||||
fprintf(stderr,"SWITCHING TO NULL:\n");
|
||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue