2 #define PIPELINE_TEST 0
5 #define UNUSED __attribute__ ((unused))
14 "framerate", GST_TYPE_FRACTION, 30, 1, \
15 "width", G_TYPE_INT, WIDTH, \
16 "height", G_TYPE_INT, HEIGHT, \
19 const gchar
*PLUGIN_DIR
= "/home/douglas/sparrow";
21 const guchar
*SPARROW_XML
= (guchar
*)"/home/douglas/sparrow/sparrow.xml";
25 static inline GstPipeline
*
26 make_pipeline(GstElement
*sink
){
27 GstPipeline
*pipeline
= GST_PIPELINE(gst_pipeline_new (NULL
));
28 GstElement
*src
= gst_element_factory_make ("videotestsrc", NULL
);
29 //GstElement *warp = gst_element_factory_make ("warptv", NULL);
30 //GstElement *colorspace = gst_element_factory_make ("ffmpegcolorspace", NULL);
32 gst_bin_add_many(GST_BIN (pipeline
),
37 gst_element_link_many(src
,
46 static inline GstPipeline
*
47 make_pipeline(GstElement
*sink
){
48 GstPipeline
*pipeline
= GST_PIPELINE(gst_pipeline_new("sparow_pipeline"));
49 GstElement
*src
= gst_element_factory_make("v4l2src", NULL
);
50 //GstElement *src = gst_element_factory_make("videotestsrc", NULL);
51 GstElement
*caps1
= gst_element_factory_make("capsfilter", "caps1");
52 GstElement
*cs
= gst_element_factory_make("ffmpegcolorspace", NULL
);
53 GstElement
*sparrow
= gst_element_factory_make("sparrow", NULL
);
54 GstElement
*caps2
= gst_element_factory_make("capsfilter", "caps1");
55 GstElement
*cs2
= gst_element_factory_make("ffmpegcolorspace", NULL
);
57 g_object_set(G_OBJECT(caps1
), "caps",
58 gst_caps_new_simple ("video/x-raw-yuv",
59 "format", GST_TYPE_FOURCC
, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'),
62 g_object_set(G_OBJECT(caps2
), "caps",
63 gst_caps_new_simple ("video/x-raw-rgb",
67 g_object_set(G_OBJECT(sparrow
),
72 //"reload", "dumpfiles/gtk.dump",
73 //"save", "dumpfiles/gtk.dump",
76 gst_bin_add_many (GST_BIN(pipeline
), src
,
84 gst_element_link_many(src
,
98 post_tee_pipeline(GstPipeline
*pipeline
, GstElement
*tee
, GstPad
*pad
, GstElement
*sink
,
99 int rngseed
, int colour
, int timer
, int debug
){
100 GstElement
*queue
= gst_element_factory_make ("queue", NULL
);
101 GstElement
*sparrow
= gst_element_factory_make("sparrow", NULL
);
102 GstElement
*caps_posteriori
= gst_element_factory_make("capsfilter", NULL
);
103 GstElement
*cs_posteriori
= gst_element_factory_make("ffmpegcolorspace", NULL
);
104 //GstPad *qpad = gst_element_get_compatible_pad(queue, pad, NULL);
106 g_object_set(G_OBJECT(caps_posteriori
), "caps",
107 gst_caps_new_simple ("video/x-raw-rgb",
110 g_object_set(G_OBJECT(sparrow
),
115 //"reload", "dumpfiles/gtk.dump",
116 //"save", "dumpfiles/gtk.dump",
119 gst_bin_add_many (GST_BIN(pipeline
),
127 //gst_pad_link(pad, qpad);
129 gst_element_link_many(tee
,
139 gst-launch-0.10 --gst-plugin-path=. --gst-debug=sparrow:5 v4l2src ! ffmpegcolorspace ! tee name=vid2 \
140 ! queue ! sparrow ! 'video/x-raw-rgb,width=320,height=240,framerate=25/1' ! ximagesink \
141 vid2. ! queue ! sparrow ! 'video/x-raw-rgb,width=320,height=240,framerate=25/1' ! ximagesink
144 static inline GstPipeline
*
145 make_dual_pipeline(GstElement
*sink1
, GstElement
*sink2
)
147 GstPipeline
*pipeline
= GST_PIPELINE(gst_pipeline_new("sparow_pipeline"));
148 //GstElement *src = gst_element_factory_make("v4l2src", NULL);
149 GstElement
*src
= gst_element_factory_make("videotestsrc", NULL
);
150 GstElement
*caps_priori
= gst_element_factory_make("capsfilter", NULL
);
151 GstElement
*cs_priori
= gst_element_factory_make("ffmpegcolorspace", NULL
);
152 GstElement
*caps_interiori
= gst_element_factory_make("capsfilter", NULL
);
153 GstElement
*tee
= gst_element_factory_make ("tee", NULL
);
155 g_object_set(G_OBJECT(caps_priori
), "caps",
156 gst_caps_new_simple ("video/x-raw-yuv",
157 "format", GST_TYPE_FOURCC
, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'),
160 g_object_set(G_OBJECT(caps_interiori
), "caps",
161 gst_caps_new_simple ("video/x-raw-rgb",
164 gst_bin_add_many(GST_BIN(pipeline
),
172 gst_element_link_many(src
,
179 GstPad
*pad1
; //= gst_element_get_request_pad (tee, "src%d");
180 GstPad
*pad2
; //= gst_element_get_request_pad (tee, "src%d");
182 post_tee_pipeline(pipeline
, tee
, pad1
, sink1
,
184 post_tee_pipeline(pipeline
, tee
, pad2
, sink2
,
191 pad = gst_element_get_static_pad (aqueue, "sink");
192 rpad = gst_element_get_request_pad (tee, "src%d");
193 gst_pad_link (rpad, pad);
194 gst_object_unref (rpad);
195 gst_object_unref (pad);
196 gst_element_link_pads (aqueue, "src", asink, "sink");
198 pad = gst_element_get_static_pad (vqueue, "sink");
199 rpad = gst_element_get_request_pad (tee, "src%d");
200 gst_pad_link (rpad, pad);
201 gst_object_unref (rpad);
202 gst_object_unref (pad);
204 pad = gst_element_get_static_pad (tee, "sink");
205 gst_element_add_pad (element, gst_ghost_pad_new ("sink", pad));
206 gst_object_unref (pad);