From d1f8f301ad225cad8d6dba320c97914cbd64c40e Mon Sep 17 00:00:00 2001 From: George Kiagiadakis Date: Thu, 21 Feb 2019 16:45:48 +0200 Subject: 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 --- binding/radio-binding.c | 4 ++++ binding/radio_impl_kingfisher.c | 32 +++++++------------------------- 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 #include #include -#ifndef HAVE_4A_FRAMEWORK -#include -#endif /* !HAVE_4A_FRAMEWORK */ #include @@ -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; } -- cgit