Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/GStreamer/gst-plugins-good.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2020-07-10 02:42:13 +0300
committerTim-Philipp Müller <tim@centricular.com>2020-07-10 19:37:28 +0300
commitc22b71e1816eea70fbc20f2cbc9be845ee2da507 (patch)
tree59a1ea3e556a84b8c5d033349e1bd553d0feaf67 /tests
parentfbcc43d822c7e9f5915952d479ce111efd22af23 (diff)
examples: fix indentation of rpicamsrc examples
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/667>
Diffstat (limited to 'tests')
-rw-r--r--tests/examples/rpicamsrc/test_color_balance.c126
-rw-r--r--tests/examples/rpicamsrc/test_orientation.c86
-rw-r--r--tests/examples/rpicamsrc/webrtc-unidirectional-h264.c4
3 files changed, 111 insertions, 105 deletions
diff --git a/tests/examples/rpicamsrc/test_color_balance.c b/tests/examples/rpicamsrc/test_color_balance.c
index b5bac083d..6974fab6a 100644
--- a/tests/examples/rpicamsrc/test_color_balance.c
+++ b/tests/examples/rpicamsrc/test_color_balance.c
@@ -19,13 +19,13 @@
static gboolean incrementing_##name = TRUE;
#if CONTROL_SATURATION
-declare_value(SATURATION, 50);
+declare_value (SATURATION, 50);
#endif
#if CONTROL_BRIGHTNESS
-declare_value(BRIGHTNESS, 50);
+declare_value (BRIGHTNESS, 50);
#endif
#if CONTROL_CONTRAST
-declare_value(CONTRAST, 0);
+declare_value (CONTRAST, 0);
#endif
#define update(name, channel, current_value) \
@@ -39,76 +39,78 @@ declare_value(CONTRAST, 0);
return current_##name; \
}
-gint compute_value(GstColorBalanceChannel* channel, gint current_value)
+gint
+compute_value (GstColorBalanceChannel * channel, gint current_value)
{
#if CONTROL_SATURATION
- update(SATURATION, channel, current_value);
+ update (SATURATION, channel, current_value);
#endif
#if CONTROL_BRIGHTNESS
- update(BRIGHTNESS, channel, current_value);
+ update (BRIGHTNESS, channel, current_value);
#endif
#if CONTROL_CONTRAST
- update(CONTRAST, channel, current_value);
+ update (CONTRAST, channel, current_value);
#endif
- return current_value;
+ return current_value;
}
-static gboolean process(gpointer data)
+static gboolean
+process (gpointer data)
{
- GstColorBalance* balance = (GstColorBalance*) data;
- const GList* controls;
- GstColorBalanceChannel* channel;
- const GList* item;
- gint index, new_value, current_value;
-
- controls = gst_color_balance_list_channels(balance);
-
- if (controls == NULL) {
- g_printerr("There is no list of colorbalance controls\n");
- return G_SOURCE_REMOVE;
- }
-
- for (item = controls, index = 0; item != NULL;
- item = item->next, ++index) {
- channel = item->data;
- current_value = gst_color_balance_get_value(balance, channel);
- new_value = compute_value(channel, current_value);
- gst_color_balance_set_value(balance, channel, new_value);
- }
-
- return G_SOURCE_CONTINUE;
+ GstColorBalance *balance = (GstColorBalance *) data;
+ const GList *controls;
+ GstColorBalanceChannel *channel;
+ const GList *item;
+ gint index, new_value, current_value;
+
+ controls = gst_color_balance_list_channels (balance);
+
+ if (controls == NULL) {
+ g_printerr ("There is no list of colorbalance controls\n");
+ return G_SOURCE_REMOVE;
+ }
+
+ for (item = controls, index = 0; item != NULL; item = item->next, ++index) {
+ channel = item->data;
+ current_value = gst_color_balance_get_value (balance, channel);
+ new_value = compute_value (channel, current_value);
+ gst_color_balance_set_value (balance, channel, new_value);
+ }
+
+ return G_SOURCE_CONTINUE;
}
-int main(int argc, char** argv)
+int
+main (int argc, char **argv)
{
- GMainLoop* loop;
- GstElement* pipeline;
- GError* error = NULL;
- GstElement* src;
- GstColorBalance* balance;
-
- gst_init(&argc, &argv);
- loop = g_main_loop_new(NULL, FALSE);
-
- pipeline = gst_parse_launch(PIPELINE, &error);
- if (error != NULL) {
- g_printerr("Error parsing '%s': %s", PIPELINE, error->message);
- g_error_free(error);
- return -1;
- }
-
- gst_element_set_state(pipeline, GST_STATE_PLAYING);
- src = gst_bin_get_by_name(GST_BIN(pipeline), "src");
- if (!src) {
- g_printerr("Source element not found\n");
- return -2;
- }
-
- balance = GST_COLOR_BALANCE(src);
- g_timeout_add_seconds(1, process, balance);
- g_main_loop_run(loop);
-
- gst_object_unref(src);
- gst_element_set_state(pipeline, GST_STATE_NULL);
- return 0;
+ GMainLoop *loop;
+ GstElement *pipeline;
+ GError *error = NULL;
+ GstElement *src;
+ GstColorBalance *balance;
+
+ gst_init (&argc, &argv);
+ loop = g_main_loop_new (NULL, FALSE);
+
+ pipeline = gst_parse_launch (PIPELINE, &error);
+ if (error != NULL) {
+ g_printerr ("Error parsing '%s': %s", PIPELINE, error->message);
+ g_error_free (error);
+ return -1;
+ }
+
+ gst_element_set_state (pipeline, GST_STATE_PLAYING);
+ src = gst_bin_get_by_name (GST_BIN (pipeline), "src");
+ if (!src) {
+ g_printerr ("Source element not found\n");
+ return -2;
+ }
+
+ balance = GST_COLOR_BALANCE (src);
+ g_timeout_add_seconds (1, process, balance);
+ g_main_loop_run (loop);
+
+ gst_object_unref (src);
+ gst_element_set_state (pipeline, GST_STATE_NULL);
+ return 0;
}
diff --git a/tests/examples/rpicamsrc/test_orientation.c b/tests/examples/rpicamsrc/test_orientation.c
index 7702537d3..989f4620f 100644
--- a/tests/examples/rpicamsrc/test_orientation.c
+++ b/tests/examples/rpicamsrc/test_orientation.c
@@ -10,61 +10,63 @@
#define PIPELINE "rpicamsrc name=src preview=0 fullscreen=0 ! h264parse ! omxh264dec ! glimagesink sync=0"
-void configure_orientation(GstVideoOrientation* orientation)
+void
+configure_orientation (GstVideoOrientation * orientation)
{
- gboolean flip;
+ gboolean flip;
- if (gst_video_orientation_get_hflip(orientation, &flip)) {
- g_print("current hflip: %s\n", flip ? "enabled" : "disabled");
+ if (gst_video_orientation_get_hflip (orientation, &flip)) {
+ g_print ("current hflip: %s\n", flip ? "enabled" : "disabled");
- if (g_getenv("HFLIP"))
- gst_video_orientation_set_hflip(orientation, TRUE);
+ if (g_getenv ("HFLIP"))
+ gst_video_orientation_set_hflip (orientation, TRUE);
- gst_video_orientation_get_hflip(orientation, &flip);
- g_print("new hflip: %s\n", flip ? "enabled" : "disabled");
- }
+ gst_video_orientation_get_hflip (orientation, &flip);
+ g_print ("new hflip: %s\n", flip ? "enabled" : "disabled");
+ }
- if (gst_video_orientation_get_vflip(orientation, &flip)) {
- g_print("current vflip: %s\n", flip ? "enabled" : "disabled");
+ if (gst_video_orientation_get_vflip (orientation, &flip)) {
+ g_print ("current vflip: %s\n", flip ? "enabled" : "disabled");
- if (g_getenv("VFLIP"))
- gst_video_orientation_set_vflip(orientation, TRUE);
+ if (g_getenv ("VFLIP"))
+ gst_video_orientation_set_vflip (orientation, TRUE);
- gst_video_orientation_get_vflip(orientation, &flip);
- g_print("new vflip: %s\n", flip ? "enabled" : "disabled");
- }
+ gst_video_orientation_get_vflip (orientation, &flip);
+ g_print ("new vflip: %s\n", flip ? "enabled" : "disabled");
+ }
}
-int main(int argc, char** argv)
+int
+main (int argc, char **argv)
{
- GMainLoop* loop;
- GstElement* pipeline;
- GError* error = NULL;
- GstElement* src;
- GstVideoOrientation* orientation;
+ GMainLoop *loop;
+ GstElement *pipeline;
+ GError *error = NULL;
+ GstElement *src;
+ GstVideoOrientation *orientation;
- gst_init(&argc, &argv);
- loop = g_main_loop_new(NULL, FALSE);
+ gst_init (&argc, &argv);
+ loop = g_main_loop_new (NULL, FALSE);
- pipeline = gst_parse_launch(PIPELINE, &error);
- if (error != NULL) {
- g_printerr("Error parsing '%s': %s", PIPELINE, error->message);
- g_error_free(error);
- return -1;
- }
+ pipeline = gst_parse_launch (PIPELINE, &error);
+ if (error != NULL) {
+ g_printerr ("Error parsing '%s': %s", PIPELINE, error->message);
+ g_error_free (error);
+ return -1;
+ }
- gst_element_set_state(pipeline, GST_STATE_PLAYING);
- src = gst_bin_get_by_name(GST_BIN(pipeline), "src");
- if (!src) {
- g_printerr("Source element not found\n");
- return -2;
- }
+ gst_element_set_state (pipeline, GST_STATE_PLAYING);
+ src = gst_bin_get_by_name (GST_BIN (pipeline), "src");
+ if (!src) {
+ g_printerr ("Source element not found\n");
+ return -2;
+ }
- orientation = GST_VIDEO_ORIENTATION(src);
- configure_orientation(orientation);
- g_main_loop_run(loop);
+ orientation = GST_VIDEO_ORIENTATION (src);
+ configure_orientation (orientation);
+ g_main_loop_run (loop);
- gst_object_unref(src);
- gst_element_set_state(pipeline, GST_STATE_NULL);
- return 0;
+ gst_object_unref (src);
+ gst_element_set_state (pipeline, GST_STATE_NULL);
+ return 0;
}
diff --git a/tests/examples/rpicamsrc/webrtc-unidirectional-h264.c b/tests/examples/rpicamsrc/webrtc-unidirectional-h264.c
index b8a716d1d..6944ece07 100644
--- a/tests/examples/rpicamsrc/webrtc-unidirectional-h264.c
+++ b/tests/examples/rpicamsrc/webrtc-unidirectional-h264.c
@@ -184,7 +184,9 @@ create_receiver_entry (SoupWebsocketConnection * connection)
G_CALLBACK (soup_websocket_message_cb), (gpointer) receiver_entry);
error = NULL;
- receiver_entry->pipeline = gst_parse_launch ("webrtcbin name=webrtcbin stun-server=stun://" STUN_SERVER " "
+ receiver_entry->pipeline =
+ gst_parse_launch ("webrtcbin name=webrtcbin stun-server=stun://"
+ STUN_SERVER " "
"rpicamsrc bitrate=600000 annotation-mode=12 preview=false ! video/x-h264,profile=constrained-baseline,width=640,height=360,level=3.0 ! queue max-size-time=100000000 ! h264parse ! "
"rtph264pay config-interval=-1 name=payloader ! "
"application/x-rtp,media=video,encoding-name=H264,payload="