summaryrefslogtreecommitdiffstats
path: root/binding
diff options
context:
space:
mode:
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2019-02-21 16:45:48 +0200
committerGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2019-06-04 18:48:19 +0300
commitd1f8f301ad225cad8d6dba320c97914cbd64c40e (patch)
treec9281f84b9ae3b226e3b6e069e6c366d5c1d51fe /binding
parent32dfec3cdb14ddc916248c183d7176c977b04d10 (diff)
binding: make 4A truly optional
The non-4A codepaths were totally broken here Bug-AGL: SPEC-2473 Change-Id: I1c3c49688566684455bf9522f68f506eaf6aa6c3 Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com>
Diffstat (limited to 'binding')
-rw-r--r--binding/radio-binding.c4
-rw-r--r--binding/radio_impl_kingfisher.c32
2 files changed, 11 insertions, 25 deletions
diff --git a/binding/radio-binding.c b/binding/radio-binding.c
index 02135fc..19cea20 100644
--- a/binding/radio-binding.c
+++ b/binding/radio-binding.c
@@ -57,6 +57,7 @@ static void scan_callback(uint32_t frequency, void *data)
static int set_role_state(bool state, char **output)
{
+#ifdef HAVE_4A_FRAMEWORK
int rc;
json_object *response = NULL;
json_object *jsonData = json_object_new_object();
@@ -114,6 +115,9 @@ failed_malformed:
failed:
return rc;
+#else
+ return 0;
+#endif
}
/*
diff --git a/binding/radio_impl_kingfisher.c b/binding/radio_impl_kingfisher.c
index 8bfc6ff..5600ff6 100644
--- a/binding/radio_impl_kingfisher.c
+++ b/binding/radio_impl_kingfisher.c
@@ -23,9 +23,6 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <json-c/json.h>
-#ifndef HAVE_4A_FRAMEWORK
-#include <gst/gst.h>
-#endif /* !HAVE_4A_FRAMEWORK */
#include <afb/afb-binding.h>
@@ -37,13 +34,6 @@
#define SI_CTL_CMDLINE_MAXLEN 128
#define SI_CTL_OUTPUT_MAXLEN 128
-#ifndef HAVE_4A_FRAMEWORK
-#define GST_SINK_OPT_LEN 128
-#define GST_PIPELINE_LEN 256
-// GStreamer state
-static GstElement *pipeline;
-#endif /* !HAVE_4A_FRAMEWORK */
-
// Structure to describe FM band plans, all values in Hz.
typedef struct {
char *name;
@@ -86,6 +76,11 @@ static int kf_init(void)
char cmd[SI_CTL_CMDLINE_MAXLEN];
int rc;
+#ifndef HAVE_4A_FRAMEWORK
+ /* this code will only work with 4A */
+ return -1;
+#endif
+
if(present)
return 0;
@@ -327,10 +322,7 @@ static void kf_start(void)
else {
AFB_ERROR("afb_service_call_sync failed\n");
}
-#else /* !HAVE_4A_FRAMEWORK */
- // Start pipeline
- gst_element_set_state(pipeline, GST_STATE_PLAYING);
-#endif /* !HAVE_4A_FRAMEWORK */
+#endif /* HAVE_4A_FRAMEWORK */
running = true;
}
@@ -356,17 +348,7 @@ static void kf_stop(void)
else {
AFB_ERROR("afb_service_call_sync failed\n");
}
-#else /* !HAVE_4A_FRAMEWORK */
- gst_element_set_state(pipeline, GST_STATE_PAUSED);
- GstEvent *event;
-
- // Flush pipeline
- // This seems required to avoid stutters on starts after a stop
- event = gst_event_new_flush_start();
- gst_element_send_event(GST_ELEMENT(pipeline), event);
- event = gst_event_new_flush_stop(TRUE);
- gst_element_send_event(GST_ELEMENT(pipeline), event);
-#endif /* !HAVE_4A_FRAMEWORK */
+#endif /* HAVE_4A_FRAMEWORK */
running = false;
}