hc
2023-02-14 0cc9b7c44253c93447ddf73e206fbdbb3d9f16b1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From e2deefa112cddff70b6237ccf27fb1943d91ba2b Mon Sep 17 00:00:00 2001
From: Jeffy Chen <jeffy.chen@rock-chips.com>
Date: Thu, 24 Dec 2020 10:16:44 +0800
Subject: [PATCH 15/31] camerabin2: Support setting default filters
 
Use env "CAMERABIN2_PREVIEW_FILTER", "CAMERABIN2_IMAGE_FILTER",
"CAMERABIN2_VIDEO_FILTER", "CAMERABIN2_VIEWFINDER_FILTER" to set default
filters.
 
Tested with:
export CAMERABIN2_VIEWFINDER_FILTER="videoflip method=clockwise"
gst-launch-1.0 camerabin
 
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
 gst/camerabin2/gstcamerabin2.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
 
diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c
index 6ac5ce4..1d3784f 100644
--- a/gst/camerabin2/gstcamerabin2.c
+++ b/gst/camerabin2/gstcamerabin2.c
@@ -1507,6 +1507,19 @@ gst_camera_bin_create_elements (GstCameraBin2 * camera)
   gboolean profile_switched = FALSE;
   const gchar *missing_element_name;
   gint encbin_flags = 0;
+  const char *env;
+
+  if ((env = g_getenv ("CAMERABIN2_PREVIEW_FILTER")))
+    camera->preview_filter = gst_parse_launch (env, NULL);
+
+  if ((env = g_getenv ("CAMERABIN2_IMAGE_FILTER")))
+    camera->user_image_filter = gst_parse_launch (env, NULL);
+
+  if ((env = g_getenv ("CAMERABIN2_VIDEO_FILTER")))
+    camera->user_video_filter = gst_parse_launch (env, NULL);
+
+  if ((env = g_getenv ("CAMERABIN2_VIEWFINDER_FILTER")))
+    camera->user_viewfinder_filter = gst_parse_launch (env, NULL);
 
   if (!camera->elements_created) {
     /* Check that elements created in _init were really created */
@@ -1885,7 +1898,6 @@ gst_camera_bin_change_state (GstElement * element, GstStateChange trans)
   GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
   GstCameraBin2 *camera = GST_CAMERA_BIN2_CAST (element);
 
-
   switch (trans) {
     case GST_STATE_CHANGE_NULL_TO_READY:
       if (!gst_camera_bin_create_elements (camera)) {
-- 
2.20.1