summaryrefslogtreecommitdiff
path: root/patches/xineliboutput-atmolight-switch.patch
blob: b37d7e95511dd8170a49514586a1433e107956f3 (plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
diff --git a/xine_frontend.c b/xine_frontend.c
index 27d1af1..9a95ebf 100644
--- a/xine_frontend.c
+++ b/xine_frontend.c
@@ -1424,6 +1424,41 @@ static int fe_send_event(frontend_t *this_gen, const char *data)
   } else if (!strcmp(data, "POWER_OFF")) {
     shutdown_system(this->shutdown_cmd, 1);
 
+  } else if (!strncasecmp(data, "ATMOLIGHT", 9)) {
+    if (this->postplugins) {
+      int i;
+      for (i = 0; i < this->postplugins->post_video_elements_num; ++i) {
+        post_element_t *pve = this->postplugins->post_video_elements[i];
+        if (pve->enable && !strcmp(pve->name, "atmo")) {
+          xine_post_in_t *input_api = (xine_post_in_t *) xine_post_input(pve->post, "parameters");
+          if (input_api) {
+            xine_post_api_t *post_api = (xine_post_api_t *) input_api->data;
+            xine_post_api_descr_t *api_descr = post_api->get_param_descr();
+            xine_post_api_parameter_t *parm = api_descr->parameter;
+            while(parm->type != POST_PARAM_TYPE_LAST) {
+              if (!strcmp(parm->name, "enabled")) {
+                uint8_t *param_data = malloc(api_descr->struct_size);
+                if (param_data) {
+                  post_api->get_parameters(pve->post, param_data);
+                  int *enabled = (int *)(param_data + parm->offset);
+                  char *p = strpbrk(data + 9, "01");
+                  if (p)
+                    *enabled = (atoi(p)) ? 1: 0;
+                  else
+                    *enabled = (*enabled) ? 0: 1;
+                  post_api->set_parameters(pve->post, param_data);
+                  free(param_data);
+                }
+                break;
+              }
+              parm++;
+            }
+          }
+          break;
+        }
+      }
+    }
+
   } else {
 
     LOGDBG("Event: %s", data);
diff --git a/xine_frontend_kbd.c b/xine_frontend_kbd.c
index c750d08..1f5646d 100644
--- a/xine_frontend_kbd.c
+++ b/xine_frontend_kbd.c
@@ -209,6 +209,10 @@ static void *kbd_receiver_thread(void *fe_gen)
         fe->send_event(fe, "TOGGLE_DEINTERLACE");
         continue;
       }
+      if (code == 'a' || code == 'A') {
+        fe->send_event(fe, "ATMOLIGHT");
+        continue;
+      }
     }
 
     snprintf(str, sizeof(str), "%016" PRIX64, code);
@@ -282,6 +286,10 @@ static void *slave_receiver_thread(void *fe_gen)
       fe->send_input_event(fe, NULL, str+5, 0, 0);
       continue;
     }
+    if (!strncasecmp(str, "ATMOLIGHT", 9)) {
+      fe->send_event(fe, str);
+      continue;
+    }
 
     LOGMSG("Unknown slave mode command: %s", str);
 
diff --git a/xine_frontend_lirc.c b/xine_frontend_lirc.c
index abf9b62..0bf73bb 100644
--- a/xine_frontend_lirc.c
+++ b/xine_frontend_lirc.c
@@ -229,6 +229,11 @@ static void *lirc_receiver_thread(void *fe_gen)
               fe->send_event(fe, "TOGGLE_DEINTERLACE");
             continue;
           }
+          if (!strcmp(KeyName, "Atmolight")) {
+            if (!repeat)
+              fe->send_event(fe, "ATMOLIGHT");
+            continue;
+          }
         }
 
         alarm(3);
diff --git a/xine_frontend_main.c b/xine_frontend_main.c
index 48cc0e3..d20009a 100644
--- a/xine_frontend_main.c
+++ b/xine_frontend_main.c
@@ -379,9 +379,11 @@ int main(int argc, char *argv[])
                      "  mapping keyboard f,F     -> fullscreen toggle\n"
                      "          keyboard d,D     -> deinterlace toggle\n"
                      "          keyboard p,P     -> power off\n"
+                     "          keyboard a,A     -> atmolight toggle\n"
                      "          LIRC Deinterlace -> deinterlace toggle\n"
                      "          LIRC Fullscreen  -> fullscreen toggle\n"
                      "          LIRC PowerOff    -> power off\n"
+                     "          LIRC Atmolight   -> atmolight toggle\n"
                      "          LIRC Quit        -> exit\n");
               break;
     case 'b': nokbd = daemon_mode = 1;