don't fake screen edge with erosion (debug trick)
[sparrow.git] / app.h
blob174d09178b0c1b77431827fdeab8bea4d882412b
2 #define PIPELINE_TEST 0
4 #ifndef UNUSED
5 #define UNUSED __attribute__ ((unused))
6 #else
7 #warning UNUSED is set
8 #endif
10 #define WIDTH 800
11 #define HEIGHT 600
12 #define FPS 20
14 #define COMMON_CAPS \
15 "framerate", GST_TYPE_FRACTION, FPS, 1, \
16 "width", G_TYPE_INT, WIDTH, \
17 "height", G_TYPE_INT, HEIGHT, \
18 NULL
20 const gchar *PLUGIN_DIR = "/home/douglas/sparrow";
22 static inline GstPipeline *
23 make_pipeline(GstElement *sink){
24 GstPipeline *pipeline = GST_PIPELINE(gst_pipeline_new("sparow_pipeline"));
25 GstElement *src = gst_element_factory_make("v4l2src", NULL);
26 //GstElement *src = gst_element_factory_make("videotestsrc", NULL);
27 GstElement *caps1 = gst_element_factory_make("capsfilter", "caps1");
28 GstElement *cs = gst_element_factory_make("ffmpegcolorspace", NULL);
29 GstElement *sparrow = gst_element_factory_make("sparrow", NULL);
30 GstElement *caps2 = gst_element_factory_make("capsfilter", "caps1");
31 GstElement *cs2 = gst_element_factory_make("ffmpegcolorspace", NULL);
33 g_object_set(G_OBJECT(caps1), "caps",
34 gst_caps_new_simple ("video/x-raw-yuv",
35 "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'),
36 COMMON_CAPS), NULL);
38 g_object_set(G_OBJECT(caps2), "caps",
39 gst_caps_new_simple ("video/x-raw-rgb",
40 COMMON_CAPS), NULL);
43 g_object_set(G_OBJECT(sparrow),
44 "timer", TRUE,
45 "debug", FALSE,
46 "rngseed", 1,
47 "colour", 1,
48 //"reload", "dumpfiles/gtk.dump",
49 //"save", "dumpfiles/gtk.dump",
50 NULL);
52 gst_bin_add_many (GST_BIN(pipeline), src,
53 caps1,
54 cs,
55 sparrow,
56 caps2,
57 cs2,
58 sink,
59 NULL);
60 gst_element_link_many(src,
61 caps1,
62 cs,
63 sparrow,
64 caps2,
65 cs2,
66 sink,
67 NULL);
68 return pipeline;
73 static inline void
74 post_tee_pipeline(GstPipeline *pipeline, GstElement *tee, GstElement *sink,
75 int rngseed, int colour, int timer, int debug){
76 GstElement *queue = gst_element_factory_make ("queue", NULL);
77 GstElement *sparrow = gst_element_factory_make("sparrow", NULL);
78 GstElement *caps_posteriori = gst_element_factory_make("capsfilter", NULL);
79 GstElement *cs_posteriori = gst_element_factory_make("ffmpegcolorspace", NULL);
81 g_object_set(G_OBJECT(caps_posteriori), "caps",
82 gst_caps_new_simple ("video/x-raw-rgb",
83 COMMON_CAPS), NULL);
85 g_object_set(G_OBJECT(sparrow),
86 "timer", timer,
87 "debug", debug,
88 "rngseed", rngseed,
89 "colour", colour,
90 //"reload", "dumpfiles/gtk.dump",
91 //"save", "dumpfiles/gtk.dump",
92 NULL);
94 gst_bin_add_many (GST_BIN(pipeline),
95 queue,
96 sparrow,
97 caps_posteriori,
98 cs_posteriori,
99 sink,
100 NULL);
102 gst_element_link_many(tee,
103 queue,
104 sparrow,
105 caps_posteriori,
106 cs_posteriori,
107 sink,
108 NULL);
112 gst-launch-0.10 --gst-plugin-path=. --gst-debug=sparrow:5 v4l2src ! ffmpegcolorspace ! tee name=vid2 \
113 ! queue ! sparrow ! 'video/x-raw-rgb,width=320,height=240,framerate=25/1' ! ximagesink \
114 vid2. ! queue ! sparrow ! 'video/x-raw-rgb,width=320,height=240,framerate=25/1' ! ximagesink
117 static inline GstPipeline *
118 make_dual_pipeline(GstElement *sink1, GstElement *sink2)
120 GstPipeline *pipeline = GST_PIPELINE(gst_pipeline_new("sparrow_pipeline"));
121 //GstElement *src = gst_element_factory_make("v4l2src", NULL);
122 GstElement *src = gst_element_factory_make("videotestsrc", NULL);
123 GstElement *caps_priori = gst_element_factory_make("capsfilter", NULL);
124 GstElement *cs_priori = gst_element_factory_make("ffmpegcolorspace", NULL);
125 GstElement *caps_interiori = gst_element_factory_make("capsfilter", NULL);
126 GstElement *tee = gst_element_factory_make ("tee", NULL);
128 g_object_set(G_OBJECT(caps_priori), "caps",
129 gst_caps_new_simple ("video/x-raw-yuv",
130 "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'),
131 COMMON_CAPS), NULL);
133 g_object_set(G_OBJECT(caps_interiori), "caps",
134 gst_caps_new_simple ("video/x-raw-rgb",
135 COMMON_CAPS), NULL);
137 gst_bin_add_many(GST_BIN(pipeline),
138 src,
139 caps_priori,
140 cs_priori,
141 caps_interiori,
142 tee,
143 NULL);
145 gst_element_link_many(src,
146 caps_priori,
147 cs_priori,
148 //caps_interiori,
149 tee,
150 NULL);
152 post_tee_pipeline(pipeline, tee, sink1,
153 1, 1, 1, 0);
154 post_tee_pipeline(pipeline, tee, sink2,
155 2, 2, 0, 0);
158 return pipeline;
177 #endif